@@ -27,12 +27,6 @@ using namespace o2::aod::hf_cand;
2727using namespace o2 ::aod::hf_cand_prong2;
2828using namespace o2 ::analysis::hf_cuts_d0_topik;
2929
30- void customize (std::vector<o2::framework::ConfigParamSpec>& workflowOptions)
31- {
32- ConfigParamSpec optionDoMC{" doMC" , VariantType::Bool, true , {" Fill MC histograms." }};
33- workflowOptions.push_back (optionDoMC);
34- }
35-
3630#include " Framework/runDataProcessing.h"
3731
3832// / D0 analysis task
@@ -41,77 +35,8 @@ struct TaskD0 {
4135 " registry" ,
4236 {{" hptcand" , " 2-prong candidates;candidate #it{p}_{T} (GeV/#it{c});entries" , {HistType::kTH1F , {{100 , 0 ., 10 .}}}},
4337 {" hptprong0" , " 2-prong candidates;prong 0 #it{p}_{T} (GeV/#it{c});entries" , {HistType::kTH1F , {{100 , 0 ., 10 .}}}},
44- {" hptprong1" , " 2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries" , {HistType::kTH1F , {{100 , 0 ., 10 .}}}}}};
45-
46- Configurable<int > d_selectionFlagD0{" d_selectionFlagD0" , 1 , " Selection Flag for D0" };
47- Configurable<int > d_selectionFlagD0bar{" d_selectionFlagD0bar" , 1 , " Selection Flag for D0bar" };
48- Configurable<double > cutYCandMax{" cutYCandMax" , -1 ., " max. cand. rapidity" };
49- Configurable<std::vector<double >> bins{" pTBins" , std::vector<double >{hf_cuts_d0_topik::pTBins_v}, " pT bin limits" };
50-
51- void init (o2::framework::InitContext&)
52- {
53- auto vbins = (std::vector<double >)bins;
54- registry.add (" hmass" , " 2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries" , {HistType::kTH2F , {{500 , 0 ., 5 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
55- registry.add (" hdeclength" , " 2-prong candidates;decay length (cm);entries" , {HistType::kTH2F , {{200 , 0 ., 2 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
56- registry.add (" hdeclengthxy" , " 2-prong candidates;decay length xy (cm);entries" , {HistType::kTH2F , {{200 , 0 ., 2 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
57- registry.add (" hd0Prong0" , " 2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries" , {HistType::kTH2F , {{100 , -1 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
58- registry.add (" hd0Prong1" , " 2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries" , {HistType::kTH2F , {{100 , -1 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
59- registry.add (" hd0d0" , " 2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries" , {HistType::kTH2F , {{500 , -1 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
60- registry.add (" hCTS" , " 2-prong candidates;cos #it{#theta}* (D^{0});entries" , {HistType::kTH2F , {{110 , -1.1 , 1.1 }, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
61- registry.add (" hCt" , " 2-prong candidates;proper lifetime (D^{0}) * #it{c} (cm);entries" , {HistType::kTH2F , {{120 , -20 ., 100 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
62- registry.add (" hCPA" , " 2-prong candidates;cosine of pointing angle;entries" , {HistType::kTH2F , {{110 , -1.1 , 1.1 }, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
63- registry.add (" hEta" , " 2-prong candidates;candidate #it{#eta};entries" , {HistType::kTH2F , {{100 , -2 ., 2 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
64- registry.add (" hselectionstatus" , " 2-prong candidates;selection status;entries" , {HistType::kTH2F , {{5 , -0.5 , 4.5 }, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
65- registry.add (" hImpParErr" , " 2-prong candidates;impact parameter error (cm);entries" , {HistType::kTH2F , {{100 , -1 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
66- registry.add (" hDecLenErr" , " 2-prong candidates;decay length error (cm);entries" , {HistType::kTH2F , {{100 , 0 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
67- registry.add (" hDecLenXYErr" , " 2-prong candidates;decay length xy error (cm);entries" , {HistType::kTH2F , {{100 , 0 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
68- }
69-
70- Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= d_selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= d_selectionFlagD0bar);
71-
72- void process (soa::Filtered<soa::Join<aod::HfCandProng2, aod::HFSelD0Candidate>> const & candidates)
73- {
74- for (auto & candidate : candidates) {
75- if (!(candidate.hfflag () & 1 << DecayType::D0ToPiK)) {
76- continue ;
77- }
78- if (cutYCandMax >= 0 . && std::abs (YD0 (candidate)) > cutYCandMax) {
79- continue ;
80- }
81-
82- if (candidate.isSelD0 () >= d_selectionFlagD0) {
83- registry.fill (HIST (" hmass" ), InvMassD0 (candidate), candidate.pt ());
84- }
85- if (candidate.isSelD0bar () >= d_selectionFlagD0bar) {
86- registry.fill (HIST (" hmass" ), InvMassD0bar (candidate), candidate.pt ());
87- }
88-
89- registry.fill (HIST (" hptcand" ), candidate.pt ());
90- registry.fill (HIST (" hptprong0" ), candidate.ptProng0 ());
91- registry.fill (HIST (" hptprong1" ), candidate.ptProng1 ());
92- registry.fill (HIST (" hdeclength" ), candidate.decayLength (), candidate.pt ());
93- registry.fill (HIST (" hdeclengthxy" ), candidate.decayLengthXY (), candidate.pt ());
94- registry.fill (HIST (" hd0Prong0" ), candidate.impactParameter0 (), candidate.pt ());
95- registry.fill (HIST (" hd0Prong1" ), candidate.impactParameter1 (), candidate.pt ());
96- registry.fill (HIST (" hd0d0" ), candidate.impactParameterProduct (), candidate.pt ());
97- registry.fill (HIST (" hCTS" ), CosThetaStarD0 (candidate), candidate.pt ());
98- registry.fill (HIST (" hCt" ), CtD0 (candidate), candidate.pt ());
99- registry.fill (HIST (" hCPA" ), candidate.cpa (), candidate.pt ());
100- registry.fill (HIST (" hEta" ), candidate.eta (), candidate.pt ());
101- registry.fill (HIST (" hselectionstatus" ), candidate.isSelD0 () + (candidate.isSelD0bar () * 2 ), candidate.pt ());
102- registry.fill (HIST (" hImpParErr" ), candidate.errorImpactParameter0 (), candidate.pt ());
103- registry.fill (HIST (" hImpParErr" ), candidate.errorImpactParameter1 (), candidate.pt ());
104- registry.fill (HIST (" hDecLenErr" ), candidate.errorDecayLength (), candidate.pt ());
105- registry.fill (HIST (" hDecLenXYErr" ), candidate.errorDecayLengthXY (), candidate.pt ());
106- }
107- }
108- };
109-
110- // / Fills MC histograms.
111- struct TaskD0MC {
112- HistogramRegistry registry{
113- " registry" ,
114- {{" hPtRecSig" , " 2-prong candidates (matched);#it{p}_{T}^{rec.} (GeV/#it{c});entries" , {HistType::kTH1F , {{360 , 0 ., 36 .}}}},
38+ {" hptprong1" , " 2-prong candidates;prong 1 #it{p}_{T} (GeV/#it{c});entries" , {HistType::kTH1F , {{100 , 0 ., 10 .}}}},
39+ {" hPtRecSig" , " 2-prong candidates (matched);#it{p}_{T}^{rec.} (GeV/#it{c});entries" , {HistType::kTH1F , {{360 , 0 ., 36 .}}}},
11540 {" hPtRecSigPrompt" , " 2-prong candidates (matched, prompt);#it{p}_{T}^{rec.} (GeV/#it{c});entries" , {HistType::kTH1F , {{360 , 0 ., 36 .}}}},
11641 {" hPtRecSigNonPrompt" , " 2-prong candidates (matched, non-prompt);#it{p}_{T}^{rec.} (GeV/#it{c});entries" , {HistType::kTH1F , {{360 , 0 ., 36 .}}}},
11742 {" hPtRecBg" , " 2-prong candidates (unmatched);#it{p}_{T}^{rec.} (GeV/#it{c});entries" , {HistType::kTH1F , {{360 , 0 ., 36 .}}}},
@@ -176,21 +101,79 @@ struct TaskD0MC {
176101
177102 Configurable<int > d_selectionFlagD0{" d_selectionFlagD0" , 1 , " Selection Flag for D0" };
178103 Configurable<int > d_selectionFlagD0bar{" d_selectionFlagD0bar" , 1 , " Selection Flag for D0bar" };
104+ Configurable<double > cutYCandMax{" cutYCandMax" , -1 ., " max. cand. rapidity" };
179105 Configurable<int > d_selectionHFFlag{" d_selectionHFFlag" , 1 , " Selection Flag for HF flagged candidates" };
180106 Configurable<int > d_selectionTopol{" d_selectionTopol" , 1 , " Selection Flag for topologically selected candidates" };
181107 Configurable<int > d_selectionCand{" d_selectionCand" , 1 , " Selection Flag for conj. topol. selected candidates" };
182108 Configurable<int > d_selectionPID{" d_selectionPID" , 1 , " Selection Flag for reco PID candidates" };
183- Configurable<double > cutYCandMax{" cutYCandMax" , -1 ., " max. cand. rapidity" };
109+ Configurable<std::vector<double >> bins{" pTBins" , std::vector<double >{hf_cuts_d0_topik::pTBins_v}, " pT bin limits" };
110+
111+ void init (o2::framework::InitContext&)
112+ {
113+ auto vbins = (std::vector<double >)bins;
114+ registry.add (" hmass" , " 2-prong candidates;inv. mass (#pi K) (GeV/#it{c}^{2});entries" , {HistType::kTH2F , {{500 , 0 ., 5 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
115+ registry.add (" hdeclength" , " 2-prong candidates;decay length (cm);entries" , {HistType::kTH2F , {{200 , 0 ., 2 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
116+ registry.add (" hdeclengthxy" , " 2-prong candidates;decay length xy (cm);entries" , {HistType::kTH2F , {{200 , 0 ., 2 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
117+ registry.add (" hd0Prong0" , " 2-prong candidates;prong 0 DCAxy to prim. vertex (cm);entries" , {HistType::kTH2F , {{100 , -1 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
118+ registry.add (" hd0Prong1" , " 2-prong candidates;prong 1 DCAxy to prim. vertex (cm);entries" , {HistType::kTH2F , {{100 , -1 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
119+ registry.add (" hd0d0" , " 2-prong candidates;product of DCAxy to prim. vertex (cm^{2});entries" , {HistType::kTH2F , {{500 , -1 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
120+ registry.add (" hCTS" , " 2-prong candidates;cos #it{#theta}* (D^{0});entries" , {HistType::kTH2F , {{110 , -1.1 , 1.1 }, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
121+ registry.add (" hCt" , " 2-prong candidates;proper lifetime (D^{0}) * #it{c} (cm);entries" , {HistType::kTH2F , {{120 , -20 ., 100 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
122+ registry.add (" hCPA" , " 2-prong candidates;cosine of pointing angle;entries" , {HistType::kTH2F , {{110 , -1.1 , 1.1 }, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
123+ registry.add (" hEta" , " 2-prong candidates;candidate #it{#eta};entries" , {HistType::kTH2F , {{100 , -2 ., 2 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
124+ registry.add (" hselectionstatus" , " 2-prong candidates;selection status;entries" , {HistType::kTH2F , {{5 , -0.5 , 4.5 }, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
125+ registry.add (" hImpParErr" , " 2-prong candidates;impact parameter error (cm);entries" , {HistType::kTH2F , {{100 , -1 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
126+ registry.add (" hDecLenErr" , " 2-prong candidates;decay length error (cm);entries" , {HistType::kTH2F , {{100 , 0 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
127+ registry.add (" hDecLenXYErr" , " 2-prong candidates;decay length xy error (cm);entries" , {HistType::kTH2F , {{100 , 0 ., 1 .}, {vbins, " #it{p}_{T} (GeV/#it{c})" }}});
128+ }
184129
185- Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isRecoHFFlag >= d_selectionHFFlag);
186- // Filter filterSelectCandidates = (aod::hf_selcandidate_d0::isSelD0 >= d_selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= d_selectionFlagD0bar);
130+ Partition<soa::Join<aod::HfCandProng2, aod::HFSelD0Candidate>> selectedD0Candidates = aod::hf_selcandidate_d0::isSelD0 >= d_selectionFlagD0 || aod::hf_selcandidate_d0::isSelD0bar >= d_selectionFlagD0bar;
187131
188- void process (soa::Filtered<soa::Join<aod::HfCandProng2, aod::HFSelD0Candidate, aod::HfCandProng2MCRec>> const & candidates,
189- soa::Join<aod::McParticles, aod::HfCandProng2MCGen> const & particlesMC, aod::BigTracksMC const & tracks)
132+ void process (soa::Join<aod::HfCandProng2, aod::HFSelD0Candidate>& candidates)
133+ {
134+ for (auto & candidate : selectedD0Candidates) {
135+ if (!(candidate.hfflag () & 1 << DecayType::D0ToPiK)) {
136+ continue ;
137+ }
138+ if (cutYCandMax >= 0 . && std::abs (YD0 (candidate)) > cutYCandMax) {
139+ continue ;
140+ }
141+
142+ if (candidate.isSelD0 () >= d_selectionFlagD0) {
143+ registry.fill (HIST (" hmass" ), InvMassD0 (candidate), candidate.pt ());
144+ }
145+ if (candidate.isSelD0bar () >= d_selectionFlagD0bar) {
146+ registry.fill (HIST (" hmass" ), InvMassD0bar (candidate), candidate.pt ());
147+ }
148+
149+ registry.fill (HIST (" hptcand" ), candidate.pt ());
150+ registry.fill (HIST (" hptprong0" ), candidate.ptProng0 ());
151+ registry.fill (HIST (" hptprong1" ), candidate.ptProng1 ());
152+ registry.fill (HIST (" hdeclength" ), candidate.decayLength (), candidate.pt ());
153+ registry.fill (HIST (" hdeclengthxy" ), candidate.decayLengthXY (), candidate.pt ());
154+ registry.fill (HIST (" hd0Prong0" ), candidate.impactParameter0 (), candidate.pt ());
155+ registry.fill (HIST (" hd0Prong1" ), candidate.impactParameter1 (), candidate.pt ());
156+ registry.fill (HIST (" hd0d0" ), candidate.impactParameterProduct (), candidate.pt ());
157+ registry.fill (HIST (" hCTS" ), CosThetaStarD0 (candidate), candidate.pt ());
158+ registry.fill (HIST (" hCt" ), CtD0 (candidate), candidate.pt ());
159+ registry.fill (HIST (" hCPA" ), candidate.cpa (), candidate.pt ());
160+ registry.fill (HIST (" hEta" ), candidate.eta (), candidate.pt ());
161+ registry.fill (HIST (" hselectionstatus" ), candidate.isSelD0 () + (candidate.isSelD0bar () * 2 ), candidate.pt ());
162+ registry.fill (HIST (" hImpParErr" ), candidate.errorImpactParameter0 (), candidate.pt ());
163+ registry.fill (HIST (" hImpParErr" ), candidate.errorImpactParameter1 (), candidate.pt ());
164+ registry.fill (HIST (" hDecLenErr" ), candidate.errorDecayLength (), candidate.pt ());
165+ registry.fill (HIST (" hDecLenXYErr" ), candidate.errorDecayLengthXY (), candidate.pt ());
166+ }
167+ }
168+
169+ Partition<soa::Join<aod::HfCandProng2, aod::HFSelD0Candidate, aod::HfCandProng2MCRec>> recoFlag2Prong = aod::hf_selcandidate_d0::isRecoHFFlag >= d_selectionHFFlag;
170+
171+ void processMC (soa::Join<aod::HfCandProng2, aod::HFSelD0Candidate, aod::HfCandProng2MCRec>& candidates,
172+ soa::Join<aod::McParticles, aod::HfCandProng2MCGen> const & particlesMC, aod::BigTracksMC const & tracks)
190173 {
191174 // MC rec.
192175 // Printf("MC Candidates: %d", candidates.size());
193- for (auto & candidate : candidates ) {
176+ for (auto & candidate : recoFlag2Prong ) {
194177 if (!(candidate.hfflag () & 1 << DecayType::D0ToPiK)) {
195178 continue ;
196179 }
@@ -342,15 +325,11 @@ struct TaskD0MC {
342325 }
343326 }
344327 }
328+
329+ PROCESS_SWITCH (TaskD0, processMC, " Process MC" , false );
345330};
346331
347332WorkflowSpec defineDataProcessing (ConfigContext const & cfgc)
348333{
349- WorkflowSpec workflow{
350- adaptAnalysisTask<TaskD0>(cfgc, TaskName{" hf-task-d0" })};
351- const bool doMC = cfgc.options ().get <bool >(" doMC" );
352- if (doMC) {
353- workflow.push_back (adaptAnalysisTask<TaskD0MC>(cfgc, TaskName{" hf-task-d0-mc" }));
354- }
355- return workflow;
334+ return WorkflowSpec{adaptAnalysisTask<TaskD0>(cfgc, TaskName{" hf-task-d0" })};
356335}
0 commit comments