1414//
1515// Author: Giorgio Alberto Lucia
1616
17+ #include " PWGEM/Dilepton/Utils/PairUtilities.h"
1718#include " PWGEM/PhotonMeson/DataModel/gammaTables.h"
1819#include " PWGLF/DataModel/LFClusterStudiesTable.h"
1920#include " PWGLF/DataModel/LFStrangenessTables.h"
@@ -216,6 +217,7 @@ struct LfTreeCreatorClusterStudies {
216217 Configurable<float > cascsetting_massWindowXi{" cascsetting_massWindowXi" , 0 .01f , " Mass window for the Xi" };
217218 Configurable<float > cascsetting_nsigmatpc{" cascsetting_nsigmaTPC" , 3 .f , " Number of sigmas for the TPC PID" };
218219
220+ Configurable<bool > electronsetting_fromPhotonConversion{" electronsetting_fromPhotonConversion" , false , " Flag to indicate if the electron is from photon conversion" };
219221 Configurable<float > electronsetting_conversion_rmin{" electron_conversion_rmin" , 1 .76f , " Minimum radius for the photon conversion (cm)" };
220222 Configurable<float > electronsetting_conversion_rmax{" electron_conversion_rmax" , 19 .77f , " Maximum radius for the photon conversion (cm)" };
221223 Configurable<float > electronsetting_maxDcaxy{" electronsetting_maxDcaxy" , 0 .1f , " Maximum value for the DCAxy" };
@@ -227,6 +229,16 @@ struct LfTreeCreatorClusterStudies {
227229 Configurable<float > electronsetting_maxNsigmatpcPr{" electronsetting_maxNsigmaTPCPr" , 2 .f , " Maximum number for the number of sigmas for p rejection for the TPC PID for electrons" };
228230 Configurable<float > electronsetting_maxNsigmatofEl{" electronsetting_maxNsigmaTOFEl" , 4 .f , " Minimum value for the number of sigmas for the TPC PID for electrons" };
229231 Configurable<float > electronsetting_minPt{" electronsetting_minPt" , 0 .f , " Minimum pT accepted for electrons" };
232+ Configurable<float > electronsetting_dcaV0daughters{" electronsetting_dcaV0daughters" , 1 .f , " DCA between the V0 daughters" };
233+ Configurable<float > electronsetting_dcaMinV0DaughterToPv{" electronsetting_dcaMinV0DaughterToPv" , 0 .06f , " DCA of the daughters to the primary vertex" };
234+ Configurable<float > electronsetting_radiusV0{" electronsetting_radiusV0" , 0 .5f , " Maximum radius of the V0 accepted" };
235+ Configurable<float > electronsetting_cosPA{" electronsetting_cosPA" , 0 .98f , " Cosine of the pointing angle of the V0" };
236+ Configurable<float > electronsetting_maxMassPi0{" electronsetting_maxMassPi0" , o2::constants::physics::MassPi0, " Maximum mass for the Pi0" };
237+ Configurable<float > electronsetting_minMassPi0{" electronsetting_minMassPi0" , 0 .08f , " Minimum mass for the Pi0" };
238+ Configurable<float > electronsetting_maxPhiv{" electronsetting_maxPhiv" , 1 .5708f , " Maximum value for the Phiv" };
239+ Configurable<float > electronsetting_minPhiv{" electronsetting_minPhiv" , 0 .f , " Minimum value for the Phiv" };
240+ Configurable<float > electronsetting_maxMassPhoton{" electronsetting_maxMassPhoton" , 0 .f , " Maximum mass for the Photon" };
241+ Configurable<float > electronsetting_minMassPhoton{" electronsetting_minMassPhoton" , 0 .005f , " Minimum mass for the Photon" };
230242
231243 Configurable<int > desetting_nClsIts{" desetting_nClsIts" , 6 , " Minimum number of ITS clusters" };
232244 Configurable<float > desetting_nsigmatpc{" desetting_nsigmaCutTPC" , 2 .f , " Number of sigmas for the TPC PID" };
@@ -343,6 +355,24 @@ struct LfTreeCreatorClusterStudies {
343355 return true ;
344356 }
345357
358+ bool qualitySelectionPhotons (aod::V0Datas::iterator const & v0)
359+ {
360+ if (std::abs (v0.dcapostopv ()) < electronsetting_dcaMinV0DaughterToPv)
361+ return false ;
362+ if (std::abs (v0.dcanegtopv ()) < electronsetting_dcaMinV0DaughterToPv)
363+ return false ;
364+ if (std::abs (v0.dcaV0daughters ()) > electronsetting_dcaV0daughters)
365+ return false ;
366+ if (v0.v0radius () < electronsetting_radiusV0)
367+ return false ;
368+ if (std::abs (v0.v0cosPA ()) < electronsetting_cosPA)
369+ return false ;
370+ if (v0.qtarm () > lambdasetting_qtAPcut)
371+ return false ;
372+
373+ return true ;
374+ }
375+
346376 bool qualitySelectionCascade (aod::CascDatas::iterator const & cascade, const std::array<float , 3 >& pv)
347377 {
348378 if (std::abs (cascade.dcapostopv ()) < cascsetting_dcaMinV0DaughterToPv)
@@ -673,7 +703,7 @@ struct LfTreeCreatorClusterStudies {
673703 std::abs (track.tpcNSigmaPr ()) < electronsetting_maxNsigmatpcPr)
674704 return false ;
675705
676- if (electronsetting_maxNsigmatofEl != 0 &&
706+ if (electronsetting_maxNsigmatofEl > 1e-7 &&
677707 std::abs (track.tofNSigmaEl ()) < electronsetting_maxNsigmatofEl)
678708 return false ;
679709
@@ -817,9 +847,6 @@ struct LfTreeCreatorClusterStudies {
817847 candidatePos.massMother = massV0;
818848 candidateNeg.massMother = massV0;
819849
820- if (!setting_fillV0)
821- return ;
822-
823850 if constexpr (isMC) { // MC
824851 if (!posTrack.has_mcParticle () || !negTrack.has_mcParticle ())
825852 return ;
@@ -1011,7 +1038,7 @@ struct LfTreeCreatorClusterStudies {
10111038 }
10121039
10131040 template <const bool isMC = false , typename Track>
1014- void fillElectronTable (const Track& posTrack, const Track& negTrack)
1041+ void fillElectronTableFromPi0Dalitz (const Track& posTrack, const Track& negTrack)
10151042 {
10161043 m_hAnalysis.fill (HIST (" e_selections" ), ESelections::kENoCut );
10171044 if (!qualityTrackSelection (posTrack) || !qualityTrackSelection (negTrack)) {
@@ -1033,17 +1060,20 @@ struct LfTreeCreatorClusterStudies {
10331060 std::array<float , 3 >{posTrack.px (), posTrack.py (), posTrack.pz ()},
10341061 std::array<float , 3 >{negTrack.px (), negTrack.py (), negTrack.pz ()}},
10351062 std::array<float , 2 >{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}));
1063+ float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair (posTrack.px (), posTrack.py (), posTrack.pz (), negTrack.px (), negTrack.py (), negTrack.pz (), posTrack.sign (), negTrack.sign (), m_d_bz);
10361064
10371065 m_hAnalysis.fill (HIST (" massPi0WithBkg" ), invariantMass);
1038- if (invariantMass > o2::constants::physics::MassPi0) {
1066+ if (invariantMass > electronsetting_maxMassPi0 || invariantMass < electronsetting_minMassPi0) {
1067+ return ;
1068+ }
1069+ if (phiv > electronsetting_maxPhiv || phiv < electronsetting_minPhiv) {
10391070 return ;
10401071 }
10411072 m_hAnalysis.fill (HIST (" e_selections" ), ESelections::kEPi0 );
10421073 m_hAnalysis.fill (HIST (" massPi0" ), invariantMass);
10431074 fillHistogramsParticle<PartID::el, isMC>(posTrack);
10441075 fillHistogramsParticle<PartID::el, isMC>(negTrack);
10451076
1046- // float phiv = o2::aod::pwgem::dilepton::utils::pairutil::getPhivPair(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz(), t1.sign(), t2.sign(), m_d_bz);
10471077 // float opangle = o2::aod::pwgem::dilepton::utils::pairutil::getOpeningAngle(t1.px(), t1.py(), t1.pz(), t2.px(), t2.py(), t2.pz());
10481078
10491079 m_ClusterStudiesTable (
@@ -1091,13 +1121,90 @@ struct LfTreeCreatorClusterStudies {
10911121 if (posMother.globalIndex () != negMother.globalIndex () || std::abs (posMother.pdgCode ()) != PDG_t::kPi0 )
10921122 return ;
10931123 m_hAnalysis.fill (HIST (" massPi0Mc" ), std::sqrt ((posMcParticle.e () + negMcParticle.e ()) * (posMcParticle.e () + negMcParticle.e ()) -
1094- (posMcParticle.p () + negMcParticle.p ()) * (posMcParticle.p () + posMcParticle.p ())));
1124+ (posMcParticle.px () + negMcParticle.px ()) * (posMcParticle.px () + posMcParticle.px ()) -
1125+ (posMcParticle.py () + negMcParticle.py ()) * (posMcParticle.py () + posMcParticle.py ()) -
1126+ (posMcParticle.pz () + negMcParticle.pz ()) * (posMcParticle.pz () + posMcParticle.pz ())));
10951127 break ;
10961128 }
10971129 }
10981130 }
10991131 }
11001132
1133+ template <const bool isMC = false , typename Tracks>
1134+ void fillElectronTableFromPhotonConversion (const std::array<float , 3 >& /* pv*/ , const aod::V0Datas::iterator& v0, const Tracks&)
1135+ {
1136+
1137+ m_hAnalysis.fill (HIST (" v0_selections" ), V0Selections::kV0NoCut );
1138+
1139+ const auto & posTrack = v0.template posTrack_as <Tracks>();
1140+ const auto & negTrack = v0.template negTrack_as <Tracks>();
1141+
1142+ if (!qualityTrackSelection (posTrack) || !qualityTrackSelection (negTrack))
1143+ return ;
1144+ m_hAnalysis.fill (HIST (" v0_selections" ), V0Selections::kV0DaughterQuality );
1145+
1146+ if (!qualitySelectionPhotons (v0))
1147+ return ;
1148+ m_hAnalysis.fill (HIST (" v0_selections" ), V0Selections::kV0Topology );
1149+
1150+ std::array<float , 3 > momPos{v0.pxpos (), v0.pypos (), v0.pzpos ()},
1151+ momNeg{v0.pxneg (), v0.pyneg (), v0.pzneg ()};
1152+
1153+ m_hAnalysis.fill (HIST (" armenteros_plot_before_selections" ), v0.alpha (), v0.qtarm ());
1154+
1155+ Candidate candidatePos (std::hypot (momPos[0 ], momPos[1 ], momPos[2 ]) * posTrack.sign (),
1156+ RecoDecay::eta (momPos), RecoDecay::phi (momPos), posTrack.itsClusterSizes (),
1157+ 0 , posTrack.tpcInnerParam () * posTrack.sign (), posTrack.pidForTracking (),
1158+ -999 .f , -999 .f , -999 .f , v0.v0cosPA (), -999 .f , 0 );
1159+ Candidate candidateNeg (std::hypot (momNeg[0 ], momNeg[1 ], momNeg[2 ]) * negTrack.sign (),
1160+ RecoDecay::eta (momNeg), RecoDecay::phi (momNeg), negTrack.itsClusterSizes (),
1161+ 0 , negTrack.tpcInnerParam () * negTrack.sign (), negTrack.pidForTracking (),
1162+ -999 .f , -999 .f , -999 .f , v0.v0cosPA (), -999 .f , 0 );
1163+
1164+ float invariantMass = std::sqrt (RecoDecay::m2<2 >(std::array<std::array<float , 3 >, 2 >{
1165+ std::array<float , 3 >{posTrack.px (), posTrack.py (), posTrack.pz ()},
1166+ std::array<float , 3 >{negTrack.px (), negTrack.py (), negTrack.pz ()}},
1167+ std::array<float , 2 >{o2::constants::physics::MassElectron, o2::constants::physics::MassElectron}));
1168+
1169+ if (invariantMass > electronsetting_maxMassPhoton || invariantMass < electronsetting_minMassPhoton) {
1170+ return ;
1171+ }
1172+
1173+ if (!electronPidSelection (posTrack) || !electronPidSelection (negTrack))
1174+ return ;
1175+ m_hAnalysis.fill (HIST (" v0_selections" ), V0Selections::kV0PID );
1176+
1177+ m_hAnalysis.fill (HIST (" armenteros_plot_gamma" ), v0.alpha (), v0.qtarm ());
1178+ m_hAnalysis.fill (HIST (" photon_radiusV0" ), v0.v0radius ());
1179+ candidatePos.massMother = invariantMass;
1180+ candidateNeg.massMother = invariantMass;
1181+
1182+ if constexpr (isMC) { // MC
1183+ if (!posTrack.has_mcParticle () || !negTrack.has_mcParticle ())
1184+ return ;
1185+
1186+ const auto & posMcParticle = posTrack.mcParticle ();
1187+ const auto & negMcParticle = negTrack.mcParticle ();
1188+
1189+ candidatePos.pdgCode = posMcParticle.pdgCode ();
1190+ candidateNeg.pdgCode = negMcParticle.pdgCode ();
1191+
1192+ if (candidatePos.pdgCode != PDG_t::kElectron || candidateNeg.pdgCode != PDG_t::kElectron )
1193+ return ;
1194+ if (!posMcParticle.has_mothers () || !negMcParticle.has_mothers ())
1195+ return ;
1196+ }
1197+
1198+ fillHistogramsParticle<PartID::el, isMC>(posTrack);
1199+ fillHistogramsParticle<PartID::el, isMC>(negTrack);
1200+
1201+ fillTable<isMC>(candidatePos);
1202+ fillTable<isMC>(candidateNeg);
1203+
1204+ m_hAnalysis.fill (HIST (" isPositive" ), true );
1205+ m_hAnalysis.fill (HIST (" isPositive" ), false );
1206+ }
1207+
11011208 // =========================================================================================================
11021209
11031210 void processDataV0Casc (CollisionsCustom::iterator const & collision /* s*/ , TracksFullIU const & tracks, aod::V0Datas const & v0s, aod::CascDatas const & cascades, aod::BCsWithTimestamps const &)
@@ -1122,9 +1229,27 @@ struct LfTreeCreatorClusterStudies {
11221229 }
11231230 PROCESS_SWITCH (LfTreeCreatorClusterStudies, processDataV0Casc, " process Data V0 and cascade" , false );
11241231
1232+ void processDataElectronsFromPhotonConversion (CollisionsCustom::iterator const & collision /* s*/ , TracksFullIU const & tracks, aod::V0Datas const & v0s, aod::BCsWithTimestamps const &)
1233+ {
1234+ if (!collisionSelection (collision)) {
1235+ return ;
1236+ }
1237+
1238+ const auto & bc = collision.bc_as <aod::BCsWithTimestamps>();
1239+ initCCDB (bc);
1240+
1241+ m_hAnalysis.fill (HIST (" zVtx" ), collision.posZ ());
1242+ std::array<float , 3 > PV = {collision.posX (), collision.posY (), collision.posZ ()};
1243+
1244+ for (const auto & v0 : v0s) {
1245+ fillElectronTableFromPhotonConversion</* isMC*/ false >(PV , v0, tracks);
1246+ }
1247+ }
1248+ PROCESS_SWITCH (LfTreeCreatorClusterStudies, processDataElectronsFromPhotonConversion, " process Data Electrons from Photon Conversion" , false );
1249+
11251250 Partition<TracksFullIU> posTracks = o2::aod::track::signed1Pt > 0 .f;
11261251 Partition<TracksFullIU> negTracks = o2::aod::track::signed1Pt < 0 .f;
1127- void processDataElectrons (CollisionsCustom::iterator const & collision, TracksFullIU const & /* tracks*/ , aod::BCsWithTimestamps const &)
1252+ void processDataElectronsFromDalitz (CollisionsCustom::iterator const & collision, TracksFullIU const & /* tracks*/ , aod::BCsWithTimestamps const &)
11281253 {
11291254 if (!collisionSelection (collision)) {
11301255 return ;
@@ -1139,10 +1264,10 @@ struct LfTreeCreatorClusterStudies {
11391264 const auto & negTracks_thisCollision = negTracks.sliceByCached (o2::aod::track::collisionId, collision.globalIndex (), m_cache);
11401265
11411266 for (const auto & [posTrack, negTrack] : o2::soa::combinations (o2::soa::CombinationsFullIndexPolicy (posTracks_thisCollision, negTracks_thisCollision))) {
1142- fillElectronTable (posTrack, negTrack);
1267+ fillElectronTableFromPi0Dalitz (posTrack, negTrack);
11431268 }
11441269 }
1145- PROCESS_SWITCH (LfTreeCreatorClusterStudies, processDataElectrons , " process Data Electrons" , false );
1270+ PROCESS_SWITCH (LfTreeCreatorClusterStudies, processDataElectronsFromDalitz , " process Data Electrons from Dalitz " , false );
11461271
11471272 void processDataNuclei (CollisionsCustom::iterator const & collision, TracksFullIU const & tracks, aod::BCsWithTimestamps const &)
11481273 {
@@ -1212,9 +1337,30 @@ struct LfTreeCreatorClusterStudies {
12121337 }
12131338 PROCESS_SWITCH (LfTreeCreatorClusterStudies, processMcV0Casc, " process Mc V0 and cascade" , false );
12141339
1340+ void processMcElectronsFromPhotonConversion (CollisionsCustomMc::iterator const & collision /* s*/ , TracksFullIUMc const & tracks, aod::V0Datas const & v0s, aod::BCsWithTimestamps const &, aod::McParticles const &, aod::McCollisions const &)
1341+ {
1342+ if (!collision.has_mcCollision ()) {
1343+ return ;
1344+ }
1345+ if (!collisionSelection (collision)) {
1346+ return ;
1347+ }
1348+
1349+ const auto & bc = collision.bc_as <aod::BCsWithTimestamps>();
1350+ initCCDB (bc);
1351+
1352+ m_hAnalysis.fill (HIST (" zVtx" ), collision.posZ ());
1353+ std::array<float , 3 > PV = {collision.posX (), collision.posY (), collision.posZ ()};
1354+
1355+ for (const auto & v0 : v0s) {
1356+ fillElectronTableFromPhotonConversion</* isMC*/ true >(PV , v0, tracks);
1357+ }
1358+ }
1359+ PROCESS_SWITCH (LfTreeCreatorClusterStudies, processMcElectronsFromPhotonConversion, " process Mc Electrons from Photon Conversion" , false );
1360+
12151361 Partition<TracksFullIUMc> posTracksMc = o2::aod::track::signed1Pt > 0 .f;
12161362 Partition<TracksFullIUMc> negTracksMc = o2::aod::track::signed1Pt < 0 .f;
1217- void processMcElectrons (CollisionsCustomMc::iterator const & collision, TracksFullIUMc const & /* tracks*/ , aod::BCsWithTimestamps const &, aod::McParticles const &, aod::McCollisions const &)
1363+ void processMcElectronsFromDalitz (CollisionsCustomMc::iterator const & collision, TracksFullIUMc const & /* tracks*/ , aod::BCsWithTimestamps const &, aod::McParticles const &, aod::McCollisions const &)
12181364 {
12191365 if (!collision.has_mcCollision ()) {
12201366 return ;
@@ -1234,10 +1380,10 @@ struct LfTreeCreatorClusterStudies {
12341380 if (!posTrack.has_mcParticle () || !negTrack.has_mcParticle ())
12351381 continue ;
12361382
1237- fillElectronTable </* isMC*/ true >(posTrack, negTrack);
1383+ fillElectronTableFromPi0Dalitz </* isMC*/ true >(posTrack, negTrack);
12381384 }
12391385 }
1240- PROCESS_SWITCH (LfTreeCreatorClusterStudies, processMcElectrons , " process Mc Electrons" , false );
1386+ PROCESS_SWITCH (LfTreeCreatorClusterStudies, processMcElectronsFromDalitz , " process Mc Electrons from Dalitz " , false );
12411387
12421388 void processMcNuclei (CollisionsCustomMc::iterator const & collision, TracksFullIUMc const & tracks, aod::BCsWithTimestamps const &, aod::McParticles const &, aod::McCollisions const &)
12431389 {
0 commit comments