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
256251struct DeuteronInTriggeredEvents {
@@ -280,7 +275,6 @@ struct DeuteronInTriggeredEvents {
280275 Configurable<bool > cfgCompensatePIDinTracking{" cfgCompensatePIDinTracking" , false , " If true, divide tpcInnerParam by the electric charge" };
281276
282277 struct : o2::framework::ConfigurableGroup {
283- std::string prefix{" cfgTrackCut" };
284278 Configurable<LabeledArray<double >> dcaMax{" dcaMax" , {nuclei::DCAcutDefault[0 ], 5 , 2 , nuclei::names, nuclei::nDCAConfigName}, " Max DCAxy and DCAz for light nuclei" };
285279 Configurable<float > etaMax{" etaMax" , 0 .8f , " Max Eta for tracks" };
286280 Configurable<int > itsNClusMin{" itsNClusMin" , 5 , " Minimum number of ITS clusters" };
@@ -312,6 +306,7 @@ struct DeuteronInTriggeredEvents {
312306
313307 Configurable<double > cfgNsigmaTPCcutDCAhists{" cfgNsigmaTPCcutDCAhists" , 3 ., " TPC nsigma cut for DCA hists" };
314308 Configurable<double > cfgDeltaTOFmassCutDCAhists{" cfgDeltaTOFmassCutDCAhists" , 0.2 , " Delta TOF mass cut for DCA hists" };
309+ Configurable<double > cfgNsigmaTPCcutTOFhists{" cfgNsigmaTPCcutTOFhists" , 3 ., " TPC nsigma cut for TOF analysis" };
315310 ConfigurableAxis cfgDCAxyBinsProtons{" cfgDCAxyBinsProtons" , {1500 , -1 .5f , 1 .5f }, " DCAxy binning for Protons" };
316311 ConfigurableAxis cfgDCAxyBinsDeuterons{" cfgDCAxyBinsDeuterons" , {1500 , -1 .5f , 1 .5f }, " DCAxy binning for Deuterons" };
317312 ConfigurableAxis cfgDCAxyBinsTritons{" cfgDCAxyBinsTritons" , {1500 , -1 .5f , 1 .5f }, " DCAxy binning for Tritons" };
@@ -335,7 +330,8 @@ struct DeuteronInTriggeredEvents {
335330 // Configurable for working with skimmed data
336331 Configurable<bool > cfgApplyMCEvSel{" cfgApplyMCEvSel" , false , " If true, apply jet-trigger selection on gen events" };
337332 Configurable<bool > cfgSkimmedProcessing{" cfgSkimmedProcessing" , false , " Skimmed dataset processing" };
338- Configurable<int > cfgTriggerList{" cfgTriggerList" , 0 , " 0 : Low jet-pT thr, 1 : High jet-pT thr" };
333+ Configurable<std::string> cfgTriggerList{" cfgTriggerList" , " fH2" , " Trigger List" };
334+ Configurable<bool > cfgSelectTrgEv{" cfgSelectTrgEv" , false , " If true, select events with active trigger list" };
339335
340336 // Configurable for jet identification
341337 Configurable<double > cfgRJet{" cfgRJet" , 0.6 , " R_jet" };
@@ -365,7 +361,7 @@ struct DeuteronInTriggeredEvents {
365361 if (!particle.has_daughters ())
366362 return -1 .f ;
367363
368- float mothVtx[3 ]{particle.vx (), particle.vy (), particle.vz ()};
364+ const float mothVtx[3 ]{particle.vx (), particle.vy (), particle.vz ()};
369365 float dauVtx[3 ]{0 .f , 0 .f , 0 .f };
370366 auto daughters = particle.daughters_as <aod::McParticles>();
371367 for (const auto & dau : daughters) {
@@ -441,7 +437,7 @@ struct DeuteronInTriggeredEvents {
441437
442438 if (cfgSkimmedProcessing) {
443439 bool isTriggered = zorro.isSelected (bc.globalBC ()); // / Just let Zorro do the accounting
444- if (!isTriggered)
440+ if (!isTriggered && cfgSelectTrgEv )
445441 return false ;
446442 }
447443
@@ -456,8 +452,7 @@ struct DeuteronInTriggeredEvents {
456452 return ;
457453 }
458454 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" ));
455+ zorro.initCCDB (ccdb.service , bc.runNumber (), bc.timestamp (), cfgTriggerList);
461456 zorro.populateHistRegistry (spectra, bc.runNumber ());
462457 }
463458 auto timestamp = bc.timestamp ();
@@ -576,20 +571,17 @@ struct DeuteronInTriggeredEvents {
576571 }
577572
578573 template <typename Ttrks>
579- bool isJetTriggered (Ttrks const & tracks, nuclei::triggerListName triggerCondition )
574+ bool isJetTriggered (Ttrks const & tracks)
580575 {
581576 // Defining trigger condition
582577 double jetPtThreshold (0.0 );
583578
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
579+ if (cfgTriggerList.value == " fChJetLowPt" ) {
580+ jetPtThreshold = 30.0 ;
581+ } else if (cfgTriggerList.value == " fChJetHighPt" ) {
582+ jetPtThreshold = 55.0 ;
583+ } else {
584+ return false ;
593585 }
594586
595587 // Loop over tracks
@@ -635,20 +627,17 @@ struct DeuteronInTriggeredEvents {
635627 }
636628
637629 template <typename McParts>
638- bool isMCJetTriggered (McParts const & McParticles, aod::McParticles const & particlesMC, nuclei::triggerListName triggerCondition )
630+ bool isMCJetTriggered (McParts const & McParticles, aod::McParticles const & particlesMC)
639631 {
640632 // Defining trigger condition
641633 double jetPtThreshold (0.0 );
642634
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
635+ if (cfgTriggerList.value == " fChJetLowPt" ) {
636+ jetPtThreshold = 30.0 ;
637+ } else if (cfgTriggerList.value == " fChJetHighPt" ) {
638+ jetPtThreshold = 55.0 ;
639+ } else {
640+ return false ;
652641 }
653642
654643 std::vector<fastjet::PseudoJet> fjParticles;
@@ -883,7 +872,7 @@ struct DeuteronInTriggeredEvents {
883872 nuclei::hNsigma[iPID][iS][iC]->Fill (fvector.pt (), nSigma[iPID][iS]);
884873 nuclei::hNsigmaEta[iPID][iS][iC]->Fill (fvector.eta (), fvector.pt (), nSigma[iPID][iS]);
885874 }
886- if (iPID) {
875+ if (iPID && std::abs (nSigma[iPID][iS]) < cfgNsigmaTPCcutTOFhists ) {
887876 nuclei::hTOFmass[iS][iC]->Fill (fvector.pt (), tofMasses[iS]);
888877 nuclei::hTOFmassEta[iS][iC]->Fill (fvector.eta (), fvector.pt (), tofMasses[iS]);
889878 }
@@ -959,9 +948,6 @@ struct DeuteronInTriggeredEvents {
959948 std::vector<bool > goodCollisions (mcCollisions.size (), false );
960949 std::vector<uint8_t > eventMask (mcCollisions.size (), 0 );
961950
962- // Jet trigger condition
963- auto trigger = static_cast <nuclei::triggerListName>(cfgTriggerList.value );
964-
965951 for (const auto & c : mcCollisions) {
966952
967953 spectra.fill (HIST (" hGenVtxZ" ), c.posZ ());
@@ -972,7 +958,7 @@ struct DeuteronInTriggeredEvents {
972958 if (o2::pwglf::isINELgt0mc (mcParticlesPerColl, pdgDB))
973959 mask |= nuclei::kGenIsINELgt0 ;
974960
975- if (isMCJetTriggered (mcParticlesPerColl, particlesMC, trigger ))
961+ if (isMCJetTriggered (mcParticlesPerColl, particlesMC))
976962 mask |= nuclei::kGenIsJetTriggered ;
977963 }
978964
@@ -992,7 +978,7 @@ struct DeuteronInTriggeredEvents {
992978 const auto & slicedTracks = tracks.sliceBy (tracksPerCollisions, collision.globalIndex ());
993979
994980 if (cfgApplyMCEvSel) {
995- if (!isJetTriggered (slicedTracks, trigger ))
981+ if (!isJetTriggered (slicedTracks))
996982 continue ;
997983 }
998984
@@ -1056,7 +1042,7 @@ struct DeuteronInTriggeredEvents {
10561042 }
10571043 }
10581044 }
1059- } else if (particle.has_mothers () ) {
1045+ } else if (particle.getProcess () == TMCProcess:: kPDecay ) {
10601046 c.flags |= kIsSecondaryFromWeakDecay ;
10611047 for (const auto & motherparticle : particle.mothers_as <aod::McParticles>()) {
10621048 motherPdgCode = motherparticle.pdgCode ();
0 commit comments