1616// / \brief Task to analyze the fraction of the true and fake hits depending on where the fake hits are picked
1717// /
1818
19- // O2 includes
20- #include " Framework/AnalysisTask.h"
21- #include " Framework/runDataProcessing.h"
22- #include " Framework/HistogramRegistry.h"
23- #include " Framework/StaticFor.h"
24- #include " ReconstructionDataFormats/DCA.h"
25- #include " ReconstructionDataFormats/Track.h"
19+ #include " PWGLF/DataModel/LFParticleIdentification.h"
20+
2621#include " Common/Core/TrackSelection.h"
27- #include " Common/DataModel/EventSelection.h"
2822#include " Common/Core/TrackSelectionDefaults.h"
23+ #include " Common/DataModel/EventSelection.h"
2924#include " Common/DataModel/TrackSelectionTables.h"
30- #include " PWGLF/DataModel/LFParticleIdentification.h"
25+
26+ #include < Framework/AnalysisTask.h>
27+ #include < Framework/HistogramRegistry.h>
28+ #include < Framework/StaticFor.h>
29+ #include < Framework/runDataProcessing.h>
30+ #include < ReconstructionDataFormats/DCA.h>
31+ #include < ReconstructionDataFormats/Track.h>
3132
3233using namespace o2 ::framework;
3334// Particle information
@@ -38,12 +39,16 @@ static constexpr const char* particleTitle[nParticles] = {"e", "#mu", "#pi", "K"
3839 " e" , " #mu" , " #pi" , " K" , " p" , " d" , " t" , " ^{3}He" , " #alpha" };
3940static constexpr int PDGs[nParticles] = {11 , 13 , 211 , 321 , 2212 , 1000010020 , 1000010030 , 1000020030 , 1000020040 ,
4041 -11 , -13 , -211 , -321 , -2212 , -1000010020 , -1000010030 , -1000020030 , -1000020040 };
41- std::array<std::shared_ptr<TH1>, nParticles> hPtAll;
42- std::array<std::shared_ptr<TH1>, nParticles> hPtITS;
43- std::array<std::shared_ptr<TH1>, nParticles> hPtTPC;
44- std::array<std::shared_ptr<TH1>, nParticles> hPtTRD;
45- std::array<std::shared_ptr<TH1>, nParticles> hPtTOF;
46- std::array<std::shared_ptr<TH1>, nParticles> hPtOverall;
42+ std::array<std::shared_ptr<TH2>, nParticles> hPtAll;
43+ std::array<std::shared_ptr<TH2>, nParticles> hPtITS;
44+ std::array<std::shared_ptr<TH2>, nParticles> hPtITSAB;
45+ std::array<std::shared_ptr<TH2>, nParticles> hPtITSTPC;
46+ std::array<std::shared_ptr<TH2>, nParticles> hPtTPC;
47+ std::array<std::shared_ptr<TH2>, nParticles> hPtTRD;
48+ std::array<std::shared_ptr<TH2>, nParticles> hPtTOF;
49+ std::array<std::shared_ptr<TH2>, nParticles> hPtOverall;
50+ std::array<std::shared_ptr<TH2>, nParticles> hPtNoise;
51+ std::array<std::shared_ptr<TH2>, nParticles> hPtNoMismatch;
4752
4853struct QaFakeHits {
4954 // Charge selection
@@ -103,23 +108,24 @@ struct QaFakeHits {
103108 LOG (fatal) << " Can't interpret pdgSign " << pdgSign;
104109 }
105110
106- const AxisSpec axisPt{ptBins, " #it{p}_{T} (GeV/#it{c})" };
107- // const AxisSpec axisP{ptBins, "#it{p} (GeV/#it{c})"};
108- // const AxisSpec axisEta{etaBins, "#it{#eta}"};
109- // const AxisSpec axisY{yBins, "#it{y}"};
110- // const AxisSpec axisPhi{phiBins, "#it{#varphi} (rad)"};
111+ const AxisSpec axisPt{ptBins, " #it{p}_{T}^{gen} (GeV/#it{c})" };
112+ const AxisSpec axisPtDiff{100 , -1 , 1 , " #it{p}_{T}^{gen} - #it{p}_{T}^{rec} (GeV/#it{c})" };
111113
112114 const char * partName = particleName (pdgSign, id);
113115 LOG (info) << " Preparing histograms for particle: " << partName << " pdgSign " << pdgSign;
114116 const int histogramIndex = id + pdgSign * nSpecies;
115117
116118 const TString tagPt = Form (" %s " , partName);
117- hPtAll[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/all" , PDGs[histogramIndex]), " All tracks " + tagPt, kTH1D , {axisPt});
118- hPtITS[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/mismatched/its" , PDGs[histogramIndex]), " ITS mismatch " + tagPt, kTH1D , {axisPt});
119- hPtTPC[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/mismatched/tpc" , PDGs[histogramIndex]), " TPC mismatch " + tagPt, kTH1D , {axisPt});
120- hPtTRD[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/mismatched/trd" , PDGs[histogramIndex]), " TRD mismatch " + tagPt, kTH1D , {axisPt});
121- hPtTOF[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/mismatched/tof" , PDGs[histogramIndex]), " TOF mismatch " + tagPt, kTH1D , {axisPt});
122- hPtOverall[histogramIndex] = histos.add <TH1>(Form (" MC/pdg%i/pt/mismatched/overall" , PDGs[histogramIndex]), " Overall mismatch " + tagPt, kTH1D , {axisPt});
119+ hPtAll[histogramIndex] = histos.add <TH2>(Form (" MC/pdg%i/pt/all" , PDGs[histogramIndex]), " All tracks " + tagPt, kTH2D , {axisPt, axisPtDiff});
120+ hPtITS[histogramIndex] = histos.add <TH2>(Form (" MC/pdg%i/pt/mismatched/its" , PDGs[histogramIndex]), " ITS mismatch " + tagPt, kTH2D , {axisPt, axisPtDiff});
121+ hPtITSAB[histogramIndex] = histos.add <TH2>(Form (" MC/pdg%i/pt/mismatched/itsab" , PDGs[histogramIndex]), " ITSAB mismatch " + tagPt, kTH2D , {axisPt, axisPtDiff});
122+ hPtTPC[histogramIndex] = histos.add <TH2>(Form (" MC/pdg%i/pt/mismatched/tpc" , PDGs[histogramIndex]), " TPC mismatch " + tagPt, kTH2D , {axisPt, axisPtDiff});
123+ hPtITSTPC[histogramIndex] = histos.add <TH2>(Form (" MC/pdg%i/pt/mismatched/itstpc" , PDGs[histogramIndex]), " ITSTPC mismatch " + tagPt, kTH2D , {axisPt, axisPtDiff});
124+ hPtTRD[histogramIndex] = histos.add <TH2>(Form (" MC/pdg%i/pt/mismatched/trd" , PDGs[histogramIndex]), " TRD mismatch " + tagPt, kTH2D , {axisPt, axisPtDiff});
125+ hPtTOF[histogramIndex] = histos.add <TH2>(Form (" MC/pdg%i/pt/mismatched/tof" , PDGs[histogramIndex]), " TOF mismatch " + tagPt, kTH2D , {axisPt, axisPtDiff});
126+ hPtOverall[histogramIndex] = histos.add <TH2>(Form (" MC/pdg%i/pt/mismatched/overall" , PDGs[histogramIndex]), " Overall mismatch " + tagPt, kTH2D , {axisPt, axisPtDiff});
127+ hPtNoise[histogramIndex] = histos.add <TH2>(Form (" MC/pdg%i/pt/mismatched/noise" , PDGs[histogramIndex]), " Noise " + tagPt, kTH2D , {axisPt, axisPtDiff});
128+ hPtNoMismatch[histogramIndex] = histos.add <TH2>(Form (" MC/pdg%i/pt/mismatched/no" , PDGs[histogramIndex]), " No mismatch " + tagPt, kTH2D , {axisPt, axisPtDiff});
123129
124130 LOG (info) << " Done with particle: " << partName;
125131 }
@@ -185,14 +191,18 @@ struct QaFakeHits {
185191 if (!track.isGlobalTrack ()) {
186192 return ;
187193 }
188- hPtAll[histogramIndex]->Fill (mcParticle.pt ());
194+ const float ptDiff = mcParticle.pt () - track.pt ();
195+ hPtAll[histogramIndex]->Fill (mcParticle.pt (), ptDiff);
189196 bool mismatchInITS = false ;
190197 for (int i = 0 ; i < 7 ; i++) {
191198 if (isMismatched (track, i)) {
192199 mismatchInITS = true ;
193200 break ;
194201 }
195202 }
203+ if (mismatchInITS) {
204+ hPtITS[histogramIndex]->Fill (mcParticle.pt (), ptDiff);
205+ }
196206
197207 bool mismatchInTPC = false ;
198208 for (int i = 7 ; i < 10 ; i++) {
@@ -201,24 +211,36 @@ struct QaFakeHits {
201211 break ;
202212 }
203213 }
204- const bool mismatchInTRD = isMismatched (track, 10 );
205- const bool mismatchInTOF = isMismatched (track, 11 );
206- const bool overallMismatch = isMismatched (track, 15 );
207-
208- if (mismatchInITS) {
209- hPtITS[histogramIndex]->Fill (mcParticle.pt ());
210- }
211214 if (mismatchInTPC) {
212- hPtTPC[histogramIndex]->Fill (mcParticle.pt ());
215+ hPtTPC[histogramIndex]->Fill (mcParticle.pt (), ptDiff );
213216 }
217+
218+ if (track.mcMask () == 0 ) {
219+ hPtNoMismatch[histogramIndex]->Fill (mcParticle.pt (), ptDiff);
220+ }
221+ const bool mismatchInTRD = isMismatched (track, 10 ); // Not set
214222 if (mismatchInTRD) {
215- hPtTRD[histogramIndex]->Fill (mcParticle.pt ());
223+ hPtTRD[histogramIndex]->Fill (mcParticle.pt (), ptDiff );
216224 }
225+ const bool mismatchInTOF = isMismatched (track, 15 ) && track.hasTOF ();
217226 if (mismatchInTOF) {
218- hPtTOF[histogramIndex]->Fill (mcParticle.pt ());
227+ hPtTOF[histogramIndex]->Fill (mcParticle.pt (), ptDiff);
228+ }
229+ const bool itsAfterBurnerMismatch = isMismatched (track, 12 );
230+ if (itsAfterBurnerMismatch) {
231+ hPtITSAB[histogramIndex]->Fill (mcParticle.pt (), ptDiff);
219232 }
233+ const bool itstpcMismatch = isMismatched (track, 13 );
234+ if (itstpcMismatch) {
235+ hPtITSTPC[histogramIndex]->Fill (mcParticle.pt (), ptDiff);
236+ }
237+ const bool isNoise = isMismatched (track, 14 );
238+ if (isNoise) {
239+ hPtNoise[histogramIndex]->Fill (mcParticle.pt (), ptDiff);
240+ }
241+ const bool overallMismatch = isMismatched (track, 15 );
220242 if (overallMismatch) {
221- hPtOverall[histogramIndex]->Fill (mcParticle.pt ());
243+ hPtOverall[histogramIndex]->Fill (mcParticle.pt (), ptDiff );
222244 }
223245 }
224246
@@ -227,12 +249,16 @@ struct QaFakeHits {
227249
228250 // MC process
229251 void process (o2::aod::Collision const & /* collision*/ ,
230- o2::soa::Join<TrackCandidates, o2::aod::McTrackLabels> const & tracks,
252+ TrackCandidatesMC const & tracks,
231253 o2::aod::McCollisions const &,
232254 o2::aod::McParticles const &)
233255 {
234256 // Track loop
235257 for (const auto & track : tracks) {
258+
259+ LOG (debug) << " Processing track with global index " << track.globalIndex () << " and mask " << track.mcMask ();
260+ LOG (debug) << " mcMask bits: " << std::bitset<16 >(track.mcMask ());
261+
236262 static_for<0 , 1 >([&](auto pdgSign) {
237263 fillMCTrackHistograms<pdgSign, o2::track::PID::Electron>(track, doEl);
238264 fillMCTrackHistograms<pdgSign, o2::track::PID::Muon>(track, doMu);
0 commit comments