Skip to content

Commit 86bbcf9

Browse files
author
Nima Zardoshti
committed
PWGJE: refactory of jet QA task
1 parent c780ad6 commit 86bbcf9

4 files changed

Lines changed: 420 additions & 532 deletions

File tree

PWGJE/TableProducer/jetfinder.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
using JetTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TrackSelection>>;
4444
using JetClusters = o2::soa::Filtered<o2::aod::EMCALClusters>;
4545

46-
using JetParticles2Prong = soa::Filtered<soa::Join<aod::McParticles, aod::HfCand2ProngMcGen>>;
47-
using JetParticles3Prong = soa::Filtered<soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>>;
46+
using JetParticlesD0 = soa::Filtered<soa::Join<aod::McParticles, aod::HfCand2ProngMcGen>>;
47+
using JetParticlesLc = soa::Filtered<soa::Join<aod::McParticles, aod::HfCand3ProngMcGen>>;
4848
using JetParticlesBplus = soa::Filtered<soa::Join<aod::McParticles, aod::HfCandBplusMcGen>>;
4949

5050
using CandidateD0Data = soa::Filtered<soa::Join<aod::HfCand2Prong, aod::HfSelD0>>;

PWGJE/TableProducer/jetfinderhf.cxx

Lines changed: 27 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ struct JetFinderHFTask {
6565
Configurable<float> clusterPhiMax{"clusterPhiMax", 999, "maximum cluster phi"};
6666

6767
// HF candidate level configurables
68-
Configurable<std::string> candSpecie_s{"candSpecie_s", "D0", "options are D0, Lc, Bplus"};
69-
Configurable<std::string> candDecayChannel_s{"candDecayChannel_s", "default", "look up in task"};
7068
Configurable<float> candPtMin{"candPtMin", 0.0, "minimum candidate pT"};
7169
Configurable<float> candPtMax{"candPtMax", 100.0, "maximum candidate pT"};
7270
Configurable<float> candYMin{"candYMin", -0.8, "minimum candidate eta"};
@@ -126,29 +124,18 @@ struct JetFinderHFTask {
126124
jetFinder.ghostArea = jetGhostArea;
127125
jetFinder.ghostRepeatN = ghostRepeat;
128126

129-
auto candSpecie = static_cast<std::string>(candSpecie_s);
130-
auto candDecayChannel = static_cast<std::string>(candDecayChannel_s);
131-
if (candSpecie == "D0") {
127+
if (doprocessD0ChargedJetsData || doprocessD0ChargedJetsMCD || doprocessD0ChargedJetsMCP) { // Note : need to be careful if configurable workflow options are added later
132128
candPDG = static_cast<int>(pdg::Code::kD0);
133129
candDecay = static_cast<int>(aod::hf_cand_2prong::DecayType::D0ToPiK);
134130
}
135-
if (candSpecie == "Bplus") {
131+
if (doprocessBplusChargedJetsData || doprocessBplusChargedJetsMCD || doprocessBplusChargedJetsMCP) {
136132
candPDG = static_cast<int>(pdg::Code::kBPlus);
137133
candDecay = static_cast<int>(aod::hf_cand_bplus::DecayType::BplusToD0Pi);
138134
}
139-
if (candSpecie == "Lc") {
135+
if (doprocessLcChargedJetsData || doprocessLcChargedJetsMCD || doprocessLcChargedJetsMCP) {
140136
candPDG = static_cast<int>(pdg::Code::kLambdaCPlus);
141137
candDecay = static_cast<int>(aod::hf_cand_3prong::DecayType::LcToPKPi);
142138
}
143-
if (candSpecie == "JPsi") {
144-
candPDG = static_cast<int>(pdg::Code::kJPsi);
145-
if (candDecayChannel == "default" || candDecayChannel == "ee") {
146-
candDecay = static_cast<int>(aod::hf_cand_2prong::DecayType::JpsiToEE);
147-
}
148-
if (candDecayChannel == "mumu") {
149-
candDecay = static_cast<int>(aod::hf_cand_2prong::DecayType::JpsiToMuMu);
150-
}
151-
}
152139
}
153140

154141
o2::aod::EMCALClusterDefinition clusterDefinition = o2::aod::emcalcluster::getClusterDefinitionFromString(clusterDefinitionS.value);
@@ -198,9 +185,13 @@ struct JetFinderHFTask {
198185
}
199186

200187
// function that generalically processes gen level events
201-
template <typename T, typename U, typename M>
202-
void analyseMCGenParticles(T const& collision, U const& particles, M& candidates)
188+
template <typename T, typename U>
189+
void analyseMCP(T const& collision, U const& particles)
203190
{
191+
inputParticles.clear();
192+
std::vector<typename U::iterator> candidates;
193+
candidates.clear();
194+
204195
for (auto const& particle : particles) {
205196
if (std::abs(particle.flagMcMatchGen()) & (1 << candDecay)) {
206197
auto particleY = RecoDecay::y(array{particle.px(), particle.py(), particle.pz()}, RecoDecay::getMassPDG(particle.pdgCode()));
@@ -220,34 +211,6 @@ struct JetFinderHFTask {
220211
}
221212
}
222213

223-
// check if type JetParticles2Prong can be templated. then you can just use one function everywhere
224-
// function that is called for gen level events with 2 prong candidates
225-
template <typename T, typename U>
226-
void analyseMCGen2Prong(T const& collision, U const& particles)
227-
{
228-
inputParticles.clear();
229-
std::vector<JetParticles2Prong::iterator> candidates;
230-
candidates.clear();
231-
analyseMCGenParticles(collision, particles, candidates);
232-
}
233-
// function that is called for gen level events with 3 prong candidates
234-
template <typename T, typename U>
235-
void analyseMCGen3Prong(T const& collision, U const& particles)
236-
{
237-
inputParticles.clear();
238-
std::vector<JetParticles3Prong::iterator> candidates;
239-
analyseMCGenParticles(collision, particles, candidates);
240-
}
241-
// function that is called for gen level events with B+ candidates
242-
template <typename T, typename U>
243-
void analyseMCGenBplus(T const& collision, U const& particles)
244-
{
245-
inputParticles.clear();
246-
std::vector<JetParticlesBplus::iterator> candidates;
247-
candidates.clear();
248-
analyseMCGenParticles(collision, particles, candidates);
249-
}
250-
251214
void processDummy(aod::Collisions const& collision)
252215
{
253216
}
@@ -259,38 +222,38 @@ struct JetFinderHFTask {
259222
void processD0ChargedJetsMCD(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision, JetTracks const& tracks, CandidateD0MC const& candidates) { analyseMCD(collision, tracks, candidates); }
260223
PROCESS_SWITCH(JetFinderHFTask, processD0ChargedJetsMCD, "D0 finding on MC detector level", false);
261224

225+
void processD0ChargedJetsMCP(aod::McCollision const& collision,
226+
JetParticlesD0 const& particles)
227+
{
228+
analyseMCP(collision, particles);
229+
}
230+
PROCESS_SWITCH(JetFinderHFTask, processD0ChargedJetsMCP, "D0 jet finding on MC particle level", false);
231+
262232
void processBplusChargedJetsData(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels>>::iterator const& collision, JetTracks const& tracks, CandidateBplusData const& candidates, aod::HfCand2Prong const& HFdaughters) { analyseData(collision, tracks, candidates); }
263233
PROCESS_SWITCH(JetFinderHFTask, processBplusChargedJetsData, "B+ jet finding on data", false);
264234

265235
void processBplusChargedJetsMCD(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision, JetTracks const& tracks, CandidateBplusMC const& candidates, aod::HfCand2Prong const& HFdaughters) { analyseMCD(collision, tracks, candidates); }
266236
PROCESS_SWITCH(JetFinderHFTask, processBplusChargedJetsMCD, "B+ finding on MC detector level", false);
267237

238+
void processBplusChargedJetsMCP(aod::McCollision const& collision,
239+
JetParticlesBplus const& particles)
240+
{
241+
analyseMCP(collision, particles);
242+
}
243+
PROCESS_SWITCH(JetFinderHFTask, processBplusChargedJetsMCP, "B+ jet finding on MC particle level", false);
244+
268245
void processLcChargedJetsData(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels>>::iterator const& collision, JetTracks const& tracks, CandidateLcData const& candidates) { analyseData(collision, tracks, candidates); }
269246
PROCESS_SWITCH(JetFinderHFTask, processLcChargedJetsData, "Lc jet finding on data", false);
270247

271248
void processLcChargedJetsMCD(soa::Join<aod::Collisions, aod::EvSels>::iterator const& collision, JetTracks const& tracks, CandidateLcMC const& candidates) { analyseMCD(collision, tracks, candidates); }
272249
PROCESS_SWITCH(JetFinderHFTask, processLcChargedJetsMCD, "Lc finding on MC detector level", false);
273250

274-
void process2ProngJetsMCP(aod::McCollision const& collision,
275-
JetParticles2Prong const& particles)
276-
{
277-
analyseMCGen2Prong(collision, particles);
278-
}
279-
PROCESS_SWITCH(JetFinderHFTask, process2ProngJetsMCP, "2-prong HF jet finding on MC particle level", false);
280-
281-
void process3ProngJetsMCP(aod::McCollision const& collision,
282-
JetParticles3Prong const& particles)
283-
{
284-
analyseMCGen3Prong(collision, particles);
285-
}
286-
PROCESS_SWITCH(JetFinderHFTask, process3ProngJetsMCP, "3-prong HF jet finding on MC particle level", false);
287-
288-
void processBplusJetsMCP(aod::McCollision const& collision,
289-
JetParticlesBplus const& particles)
251+
void processLcChargedJetsMCP(aod::McCollision const& collision,
252+
JetParticlesLc const& particles)
290253
{
291-
analyseMCGenBplus(collision, particles);
254+
analyseMCP(collision, particles);
292255
}
293-
PROCESS_SWITCH(JetFinderHFTask, processBplusJetsMCP, "B+ HF jet finding on MC particle level", false);
256+
PROCESS_SWITCH(JetFinderHFTask, processLcChargedJetsMCP, "Lc jet finding on MC particle level", false);
294257
};
295258
/*
296259
using JetFinderD0DataCharged = JetFinderHFTask<o2::aod::D0ChargedJets, o2::aod::D0ChargedJetConstituents, o2::aod::D0ChargedJetConstituentsSub>;

0 commit comments

Comments
 (0)