Skip to content

Commit 11f397e

Browse files
author
Cristian Moscatelli
committed
Minor code revision
1 parent 9b9fa30 commit 11f397e

1 file changed

Lines changed: 24 additions & 37 deletions

File tree

PWGLF/TableProducer/Nuspex/deuteronInTriggeredEvents.cxx

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
///
1212
/// \file deuteronInTriggeredEvents.cxx
1313
///
14-
/// \brief (Anti-)nuclei spectra analysis task in jet-triggered events
14+
/// \brief (Anti-)nuclei spectra analysis task in MB and triggered events
1515
/// \author Cristian Moscatelli (cristian.moscatelli@cern.ch)
1616
///
1717
/// Based on PWGLF/TableProducer/Nuspex/nucleiSpectra.cxx
@@ -246,11 +246,6 @@ enum evGenSel : uint8_t {
246246
kGenIsJetTriggered = 1 << 1,
247247
kGenHasRecoEv = 1 << 2
248248
};
249-
250-
enum triggerListName {
251-
fChJetLowPt = 0,
252-
fChJetHighPt = 1
253-
};
254249
} // namespace nuclei
255250

256251
struct DeuteronInTriggeredEvents {
@@ -312,6 +307,7 @@ struct DeuteronInTriggeredEvents {
312307

313308
Configurable<double> cfgNsigmaTPCcutDCAhists{"cfgNsigmaTPCcutDCAhists", 3., "TPC nsigma cut for DCA hists"};
314309
Configurable<double> cfgDeltaTOFmassCutDCAhists{"cfgDeltaTOFmassCutDCAhists", 0.2, "Delta TOF mass cut for DCA hists"};
310+
Configurable<double> cfgNsigmaTPCcutTOFhists{"cfgNsigmaTPCcutTOFhists", 3., "TPC nsigma cut for TOF analysis"};
315311
ConfigurableAxis cfgDCAxyBinsProtons{"cfgDCAxyBinsProtons", {1500, -1.5f, 1.5f}, "DCAxy binning for Protons"};
316312
ConfigurableAxis cfgDCAxyBinsDeuterons{"cfgDCAxyBinsDeuterons", {1500, -1.5f, 1.5f}, "DCAxy binning for Deuterons"};
317313
ConfigurableAxis cfgDCAxyBinsTritons{"cfgDCAxyBinsTritons", {1500, -1.5f, 1.5f}, "DCAxy binning for Tritons"};
@@ -335,7 +331,8 @@ struct DeuteronInTriggeredEvents {
335331
// Configurable for working with skimmed data
336332
Configurable<bool> cfgApplyMCEvSel{"cfgApplyMCEvSel", false, "If true, apply jet-trigger selection on gen events"};
337333
Configurable<bool> cfgSkimmedProcessing{"cfgSkimmedProcessing", false, "Skimmed dataset processing"};
338-
Configurable<int> cfgTriggerList{"cfgTriggerList", 0, "0 : Low jet-pT thr, 1 : High jet-pT thr"};
334+
Configurable<std::string> cfgTriggerList{"cfgTriggerList", "fH2", "Trigger List"};
335+
Configurable<bool> cfgSelectTrgEv{"cfgSelectTrgEv", false, "If true, select events with active trigger list"};
339336

340337
// Configurable for jet identification
341338
Configurable<double> cfgRJet{"cfgRJet", 0.6, "R_jet"};
@@ -441,7 +438,7 @@ struct DeuteronInTriggeredEvents {
441438

442439
if (cfgSkimmedProcessing) {
443440
bool isTriggered = zorro.isSelected(bc.globalBC()); /// Just let Zorro do the accounting
444-
if (!isTriggered)
441+
if (!isTriggered && cfgSelectTrgEv)
445442
return false;
446443
}
447444

@@ -456,8 +453,7 @@ struct DeuteronInTriggeredEvents {
456453
return;
457454
}
458455
if (cfgSkimmedProcessing) {
459-
zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), (cfgTriggerList.value == nuclei::fChJetLowPt) ? "fJetChLowPt" : (cfgTriggerList.value == nuclei::fChJetHighPt) ? "fJetChHighPt"
460-
: throw std::runtime_error("Invalid TriggerList value"));
456+
zorro.initCCDB(ccdb.service, bc.runNumber(), bc.timestamp(), cfgTriggerList);
461457
zorro.populateHistRegistry(spectra, bc.runNumber());
462458
}
463459
auto timestamp = bc.timestamp();
@@ -576,20 +572,17 @@ struct DeuteronInTriggeredEvents {
576572
}
577573

578574
template <typename Ttrks>
579-
bool isJetTriggered(Ttrks const& tracks, nuclei::triggerListName triggerCondition)
575+
bool isJetTriggered(Ttrks const& tracks)
580576
{
581577
// Defining trigger condition
582578
double jetPtThreshold(0.0);
583579

584-
switch (triggerCondition) {
585-
case nuclei::fChJetLowPt:
586-
jetPtThreshold = 30.0;
587-
break;
588-
case nuclei::fChJetHighPt:
589-
jetPtThreshold = 55.0;
590-
break;
591-
default:
592-
return false; // Non-valid trigger
580+
if (cfgTriggerList.value == "fChJetLowPt") {
581+
jetPtThreshold = 30.0;
582+
} else if (cfgTriggerList.value == "fChJetHighPt") {
583+
jetPtThreshold = 55.0;
584+
} else {
585+
return false;
593586
}
594587

595588
// Loop over tracks
@@ -635,20 +628,17 @@ struct DeuteronInTriggeredEvents {
635628
}
636629

637630
template <typename McParts>
638-
bool isMCJetTriggered(McParts const& McParticles, aod::McParticles const& particlesMC, nuclei::triggerListName triggerCondition)
631+
bool isMCJetTriggered(McParts const& McParticles, aod::McParticles const& particlesMC)
639632
{
640633
// Defining trigger condition
641634
double jetPtThreshold(0.0);
642635

643-
switch (triggerCondition) {
644-
case nuclei::fChJetLowPt:
645-
jetPtThreshold = 30.0;
646-
break;
647-
case nuclei::fChJetHighPt:
648-
jetPtThreshold = 55.0;
649-
break;
650-
default:
651-
return false; // Non-valid trigger
636+
if (cfgTriggerList.value == "fChJetLowPt") {
637+
jetPtThreshold = 30.0;
638+
} else if (cfgTriggerList.value == "fChJetHighPt") {
639+
jetPtThreshold = 55.0;
640+
} else {
641+
return false;
652642
}
653643

654644
std::vector<fastjet::PseudoJet> fjParticles;
@@ -883,7 +873,7 @@ struct DeuteronInTriggeredEvents {
883873
nuclei::hNsigma[iPID][iS][iC]->Fill(fvector.pt(), nSigma[iPID][iS]);
884874
nuclei::hNsigmaEta[iPID][iS][iC]->Fill(fvector.eta(), fvector.pt(), nSigma[iPID][iS]);
885875
}
886-
if (iPID) {
876+
if (iPID && std::abs(nSigma[iPID][iS]) < cfgNsigmaTPCcutTOFhists) {
887877
nuclei::hTOFmass[iS][iC]->Fill(fvector.pt(), tofMasses[iS]);
888878
nuclei::hTOFmassEta[iS][iC]->Fill(fvector.eta(), fvector.pt(), tofMasses[iS]);
889879
}
@@ -959,9 +949,6 @@ struct DeuteronInTriggeredEvents {
959949
std::vector<bool> goodCollisions(mcCollisions.size(), false);
960950
std::vector<uint8_t> eventMask(mcCollisions.size(), 0);
961951

962-
// Jet trigger condition
963-
auto trigger = static_cast<nuclei::triggerListName>(cfgTriggerList.value);
964-
965952
for (const auto& c : mcCollisions) {
966953

967954
spectra.fill(HIST("hGenVtxZ"), c.posZ());
@@ -972,7 +959,7 @@ struct DeuteronInTriggeredEvents {
972959
if (o2::pwglf::isINELgt0mc(mcParticlesPerColl, pdgDB))
973960
mask |= nuclei::kGenIsINELgt0;
974961

975-
if (isMCJetTriggered(mcParticlesPerColl, particlesMC, trigger))
962+
if (isMCJetTriggered(mcParticlesPerColl, particlesMC))
976963
mask |= nuclei::kGenIsJetTriggered;
977964
}
978965

@@ -992,7 +979,7 @@ struct DeuteronInTriggeredEvents {
992979
const auto& slicedTracks = tracks.sliceBy(tracksPerCollisions, collision.globalIndex());
993980

994981
if (cfgApplyMCEvSel) {
995-
if (!isJetTriggered(slicedTracks, trigger))
982+
if (!isJetTriggered(slicedTracks))
996983
continue;
997984
}
998985

@@ -1056,7 +1043,7 @@ struct DeuteronInTriggeredEvents {
10561043
}
10571044
}
10581045
}
1059-
} else if (particle.has_mothers()) {
1046+
} else if (particle.getProcess() == TMCProcess::kPDecay) {
10601047
c.flags |= kIsSecondaryFromWeakDecay;
10611048
for (const auto& motherparticle : particle.mothers_as<aod::McParticles>()) {
10621049
motherPdgCode = motherparticle.pdgCode();

0 commit comments

Comments
 (0)