@@ -96,6 +96,8 @@ struct PhiMesonCandProducer {
9696 Configurable<float > cfgYAcceptance{" cfgYAcceptance" , 0 .5f , " Rapidity acceptance" };
9797 } phiConfigs;
9898
99+ Configurable<bool > trueGenPhi{" trueGenPhi" , false , " Phi trigger in MC Collisions: false - gen K+K- pair, true - gen phi meson" };
100+
99101 // Configurables on phi pT bins
100102 Configurable<std::vector<double >> binspTPhi{" binspTPhi" , {0.4 , 0.8 , 1.4 , 2.0 , 2.8 , 4.0 , 6.0 , 10.0 }, " pT bin limits for Phi" };
101103
@@ -315,28 +317,41 @@ struct PhiMesonCandProducer {
315317
316318 void processMCGen (aod::McCollisions::iterator const & mcCollision, aod::McParticles const & mcParticles)
317319 {
318- for (const auto & mcParticle1 : mcParticles) {
319- if (!mcParticle1.isPhysicalPrimary () || std::abs (mcParticle1.eta ()) > trackConfigs.etaMax )
320- continue ;
321-
322- for (const auto & mcParticle2 : mcParticles) {
323- if (!mcParticle2.isPhysicalPrimary () || std::abs (mcParticle2.eta ()) > trackConfigs.etaMax )
320+ if (trueGenPhi) {
321+ for (const auto & mcParticle : mcParticles) {
322+ if (std::abs (mcParticle.pdgCode ()) != o2::constants::physics::Pdg::kPhi )
323+ continue ;
324+ if (mcParticle.pt () < phiConfigs.minPhiPt )
325+ continue ;
326+ if (std::abs (mcParticle.y ()) > phiConfigs.cfgYAcceptance )
324327 continue ;
325328
326- if (!(mcParticle1.pdgCode () == PDG_t::kKPlus && mcParticle2.pdgCode () == PDG_t::kKMinus ) &&
327- !(mcParticle1.pdgCode () == PDG_t::kKMinus && mcParticle2.pdgCode () == PDG_t::kKPlus ))
329+ phimesonCandidatesMcGen (mcCollision.globalIndex (), 0 , mcParticle.pt (), mcParticle.y (), mcParticle.phi ());
330+ }
331+ } else {
332+ for (const auto & mcParticle1 : mcParticles) {
333+ if (!mcParticle1.isPhysicalPrimary () || std::abs (mcParticle1.eta ()) > trackConfigs.etaMax )
328334 continue ;
329335
330- ROOT::Math::PxPyPzMVector genKPair = recMother (mcParticle1, mcParticle2, massKa, massKa);
336+ for (const auto & mcParticle2 : mcParticles) {
337+ if (!mcParticle2.isPhysicalPrimary () || std::abs (mcParticle2.eta ()) > trackConfigs.etaMax )
338+ continue ;
331339
332- if (genKPair.Pt () < phiConfigs.minPhiPt )
333- continue ;
334- if (genKPair.M () > phiConfigs.maxMPhi )
335- continue ;
336- if (std::abs (genKPair.Rapidity ()) > phiConfigs.cfgYAcceptance )
337- continue ;
340+ if (!(mcParticle1.pdgCode () == PDG_t::kKPlus && mcParticle2.pdgCode () == PDG_t::kKMinus ) &&
341+ !(mcParticle1.pdgCode () == PDG_t::kKMinus && mcParticle2.pdgCode () == PDG_t::kKPlus ))
342+ continue ;
343+
344+ ROOT::Math::PxPyPzMVector genKPair = recMother (mcParticle1, mcParticle2, massKa, massKa);
345+
346+ if (genKPair.Pt () < phiConfigs.minPhiPt )
347+ continue ;
348+ if (genKPair.M () > phiConfigs.maxMPhi )
349+ continue ;
350+ if (std::abs (genKPair.Rapidity ()) > phiConfigs.cfgYAcceptance )
351+ continue ;
338352
339- phimesonCandidatesMcGen (mcCollision.globalIndex (), genKPair.M (), genKPair.Pt (), genKPair.Rapidity (), genKPair.Phi ());
353+ phimesonCandidatesMcGen (mcCollision.globalIndex (), genKPair.M (), genKPair.Pt (), genKPair.Rapidity (), genKPair.Phi ());
354+ }
340355 }
341356 }
342357 }
@@ -546,6 +561,7 @@ struct PionTrackProducer {
546561 // Configurable<bool> forceTOF{"forceTOF", false, "force the TOF signal for the PID"};
547562 Configurable<float > tofPIDThreshold{" tofPIDThreshold" , 0.5 , " minimum pT after which TOF PID is applicable" };
548563 Configurable<std::vector<int >> trkPIDspecies{" trkPIDspecies" , std::vector<int >{o2::track::PID::Kaon, o2::track::PID::Proton}, " Trk sel: Particles species for PID rejection, kaon, proton" };
564+ Configurable<bool > applyElRejection{" applyElRejection" , false , " Apply or not the electron rejection" };
549565 Configurable<std::pair<float , float >> pidRangeTPCEl{" pidRangeTPCEl" , {-3 .0f , 5 .0f }, " nSigma TPC range for electrons" };
550566 Configurable<float > pidTPCMaxHadrons{" pidTPCMaxHadrons" , 3 .0f , " maximum nSigma TPC for hadrons" };
551567 Configurable<float > pidTOFMaxHadrons{" pidTOFMaxHadrons" , 3 .0f , " maximum nSigma TOF for hadrons" };
@@ -632,18 +648,20 @@ struct PionTrackProducer {
632648 template <typename T>
633649 bool pidHypothesesRejection (const T& track)
634650 {
635- // Electron rejection
636- auto nSigmaTPCEl = aod::pidutils::tpcNSigma (o2::track::PID::Electron, track);
637-
638- if (nSigmaTPCEl > trackConfigs.pidRangeTPCEl ->first && nSigmaTPCEl < trackConfigs.pidRangeTPCEl ->second ) {
639- auto nSigmaTPCPi = aod::pidutils::tpcNSigma (o2::track::PID::Pion, track);
640- auto nSigmaTPCKa = aod::pidutils::tpcNSigma (o2::track::PID::Kaon, track);
641- auto nSigmaTPCPr = aod::pidutils::tpcNSigma (o2::track::PID::Proton, track);
642-
643- if (std::abs (nSigmaTPCPi) > trackConfigs.pidTPCMaxHadrons &&
644- std::abs (nSigmaTPCKa) > trackConfigs.pidTPCMaxHadrons &&
645- std::abs (nSigmaTPCPr) > trackConfigs.pidTPCMaxHadrons ) {
646- return false ;
651+ // Electron rejection (if enabled)
652+ if (trackConfigs.applyElRejection ) {
653+ auto nSigmaTPCEl = aod::pidutils::tpcNSigma (o2::track::PID::Electron, track);
654+
655+ if (nSigmaTPCEl > trackConfigs.pidRangeTPCEl ->first && nSigmaTPCEl < trackConfigs.pidRangeTPCEl ->second ) {
656+ auto nSigmaTPCPi = aod::pidutils::tpcNSigma (o2::track::PID::Pion, track);
657+ auto nSigmaTPCKa = aod::pidutils::tpcNSigma (o2::track::PID::Kaon, track);
658+ auto nSigmaTPCPr = aod::pidutils::tpcNSigma (o2::track::PID::Proton, track);
659+
660+ if (std::abs (nSigmaTPCPi) > trackConfigs.pidTPCMaxHadrons &&
661+ std::abs (nSigmaTPCKa) > trackConfigs.pidTPCMaxHadrons &&
662+ std::abs (nSigmaTPCPr) > trackConfigs.pidTPCMaxHadrons ) {
663+ return false ;
664+ }
647665 }
648666 }
649667
@@ -806,6 +824,8 @@ struct EventSelectionProducer {
806824 Configurable<float > maxMPhiSignal{" maxMPhiSignal" , 1 .029f , " Upper limits on Phi mass for signal extraction" };
807825 } phiConfigs;
808826
827+ Configurable<bool > withTrueGenPhi{" withTrueGenPhi" , false , " Require the presence of a true generated phi meson in the event" };
828+
809829 // Defining the type of the collisions for data and MC
810830 using SelCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms, aod::PVMults>;
811831 using SimCollisions = soa::Join<SelCollisions, aod::McCollisionLabels>;
@@ -911,23 +931,27 @@ struct EventSelectionProducer {
911931 template <bool isMC, typename MC_T = void , typename T1, typename T2>
912932 bool eventHasPhi (const T1& collision, const T2& phiCandidates)
913933 {
914- uint16_t nPhi{0 };
934+ if (withTrueGenPhi) {
935+ if (phiCandidates.empty ())
936+ return false ;
937+ } else {
938+ uint16_t nPhi{0 };
915939
916- for (const auto & phiCand : phiCandidates) {
940+ for (const auto & phiCand : phiCandidates) {
941+ if (phiCand.inMassRegion (phiConfigs.minMPhiSignal , phiConfigs.maxMPhiSignal ))
942+ nPhi++;
917943
918- if (phiCand.inMassRegion (phiConfigs.minMPhiSignal , phiConfigs.maxMPhiSignal ))
919- nPhi++;
944+ // histos.fill(HIST("hEta"), track1.eta());
945+ // histos.fill(HIST("hNsigmaKaonTPC"), track1.tpcInnerParam(), track1.tpcNSigmaKa());
946+ // histos.fill(HIST("hNsigmaKaonTOF"), track1.tpcInnerParam(), track1.tofNSigmaKa());
947+ // histos.fill(HIST("h2DauTracksPhiDCAxy"), track1.pt(), track1.dcaXY());
948+ // histos.fill(HIST("h2DauTracksPhiDCAz"), track1.pt(), track1.dcaZ());
949+ }
920950
921- // histos.fill(HIST("hEta"), track1.eta());
922- // histos.fill(HIST("hNsigmaKaonTPC"), track1.tpcInnerParam(), track1.tpcNSigmaKa());
923- // histos.fill(HIST("hNsigmaKaonTOF"), track1.tpcInnerParam(), track1.tofNSigmaKa());
924- // histos.fill(HIST("h2DauTracksPhiDCAxy"), track1.pt(), track1.dcaXY());
925- // histos.fill(HIST("h2DauTracksPhiDCAz"), track1.pt(), track1.dcaZ());
951+ if (nPhi == 0 )
952+ return false ;
926953 }
927954
928- if (nPhi == 0 )
929- return false ;
930-
931955 float multPercentile{0 .0f };
932956
933957 if constexpr (!isMC) {
0 commit comments