1414// This code creates parameters used in track tuner.
1515// Please write to: daiki.sekihata@cern.ch
1616
17+ #include " PWGEM/Dilepton/Utils/MCUtilities.h"
1718#include " PWGEM/Dilepton/Utils/PairUtilities.h"
1819
1920#include " Common/CCDB/EventSelectionParams.h"
@@ -246,6 +247,8 @@ struct createTTP {
246247 const AxisSpec axis_eta{cfgNbinsEta, -1 , +1 , " #eta" };
247248 const AxisSpec axis_phi{cfgNbinsPhi, 0.0 , 2 * M_PI , " #varphi (rad.)" };
248249 const AxisSpec axis_sign{3 , -1.5 , +1.5 , " sign" };
250+ const AxisSpec axis_mass{400 , 0 , 4 , " m_{ee} (GeV/c^{2})" };
251+ const AxisSpec axis_ptee{100 , 0 , 10 , " p_{T,ee} (GeV/c)" };
249252
250253 const AxisSpec axis_mean_dcaXY{ConfDCABins, " DCA_{xy} (#mum)" };
251254 const AxisSpec axis_mean_dcaZ{ConfDCABins, " DCA_{z} (#mum)" };
@@ -255,6 +258,12 @@ struct createTTP {
255258 fRegistry .add (" Track/hs" , " electron" , kTHnSparseD , {axis_pt, axis_eta, axis_phi, axis_sign, axis_mean_dcaXY, axis_mean_dcaZ, axis_pull_dcaXY, axis_pull_dcaZ}, false );
256259 fRegistry .add (" Track/hTPCNsigmaEl" , " TPC n sigma el;p_{in} (GeV/c);n #sigma_{e}^{TPC}" , kTH2F , {{1000 , 0 , 10 }, {100 , -5 .f , +5 .f }}, false );
257260 fRegistry .add (" Pair/hMvsPhiV" , " m_{ee} vs. #varphi_{V} ULS;#varphi_{V} (rad.);m_{ee} (GeV/c^{2})" , kTH2F , {{90 , 0 .f , M_PI }, {100 , 0 , 0.1 }});
261+
262+ if (doprocessMC) {
263+ fRegistry .add (" Pair/hMvsPt_omega" , " #omega->ee" , kTH2D , {axis_mass, axis_ptee}, false );
264+ fRegistry .add (" Pair/hMvsPt_phi" , " #phi->ee" , kTH2D , {axis_mass, axis_ptee}, false );
265+ fRegistry .add (" Pair/hMvsPt_jpsi" , " J/#psi->ee" , kTH2D , {axis_mass, axis_ptee}, false );
266+ }
258267 }
259268
260269 template <typename TTrack>
@@ -593,13 +602,20 @@ struct createTTP {
593602 }
594603 PROCESS_SWITCH (createTTP, processData, " process data" , true );
595604
605+ struct lepton {
606+ float pt{0 };
607+ float eta{0 };
608+ float phi{0 };
609+ int mcParticleId{-1 };
610+ };
611+
596612 using MyCollisionsMC = soa::Join<MyCollisions, aod::McCollisionLabels>;
597613 using MyTracksMC = soa::Join<MyTracks, aod::McTrackLabels>;
598614
599615 using FilteredMyCollisionsMC = soa::Filtered<MyCollisionsMC>;
600616 using FilteredMyTracksMC = soa::Filtered<MyTracksMC>;
601617
602- void processMC (MyBCs const &, FilteredMyCollisionsMC const & collisions, FilteredMyTracksMC const & tracks, aod::McCollisions const &, aod::McParticles const &)
618+ void processMC (MyBCs const &, FilteredMyCollisionsMC const & collisions, FilteredMyTracksMC const & tracks, aod::McCollisions const &, aod::McParticles const & mcParticles )
603619 {
604620 for (const auto & collision : collisions) {
605621 if (!collision.has_mcCollision ()) {
@@ -623,6 +639,9 @@ struct createTTP {
623639 mVtx .setPos ({collision.posX (), collision.posY (), collision.posZ ()});
624640 mVtx .setCov (collision.covXX (), collision.covXY (), collision.covYY (), collision.covXZ (), collision.covYZ (), collision.covZZ ());
625641
642+ std::vector<lepton> posLeptons;
643+ std::vector<lepton> negLeptons;
644+
626645 o2::dataformats::DCA mDcaInfoCov ;
627646 auto tracks_per_coll = tracks.sliceBy (perCol, collision.globalIndex ());
628647 for (const auto & track : tracks_per_coll) {
@@ -637,6 +656,9 @@ struct createTTP {
637656 if (!(mcParticle.isPhysicalPrimary () || mcParticle.producedByGenerator ())) {
638657 continue ;
639658 }
659+ if (!mcParticle.has_mothers ()) {
660+ continue ;
661+ }
640662
641663 if (cfgEventGeneratorType >= 0 && mcCollision.getSubGeneratorId () != cfgEventGeneratorType) {
642664 continue ;
@@ -655,7 +677,58 @@ struct createTTP {
655677
656678 fRegistry .fill (HIST (" Track/hs" ), trackParCov.getPt (), trackParCov.getEta (), RecoDecay::constrainAngle (trackParCov.getPhi (), 0 , 1U ), track.sign (), mDcaInfoCov .getY () * 1e+4 , mDcaInfoCov .getZ () * 1e+4 , mDcaInfoCov .getY () / std::sqrt (trackParCov.getSigmaY2 ()), mDcaInfoCov .getZ () / std::sqrt (trackParCov.getSigmaZ2 ()));
657679
680+ lepton tmp;
681+ tmp.pt = trackParCov.getPt ();
682+ tmp.eta = trackParCov.getEta ();
683+ tmp.phi = RecoDecay::constrainAngle (trackParCov.getPhi (), 0 , 1U );
684+ tmp.mcParticleId = mcParticle.globalIndex ();
685+
686+ if (track.sign () > 0 ) {
687+ posLeptons.emplace_back (tmp);
688+ } else {
689+ negLeptons.emplace_back (tmp);
690+ }
658691 } // end of track loop
692+
693+ for (const auto & pos : posLeptons) {
694+ for (const auto & neg : negLeptons) {
695+ ROOT ::Math::PtEtaPhiMVector v1 (pos.pt , pos.eta , pos.phi , o2::constants::physics::MassElectron);
696+ ROOT ::Math::PtEtaPhiMVector v2 (neg.pt , neg.eta , neg.phi , o2::constants::physics::MassElectron);
697+ ROOT ::Math::PtEtaPhiMVector v12 = v1 + v2;
698+
699+ auto posmc = mcParticles.rawIteratorAt (pos.mcParticleId );
700+ auto negmc = mcParticles.rawIteratorAt (neg.mcParticleId );
701+
702+ int omegaId = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs (posmc, negmc, -11 , 11 , 223 , mcParticles);
703+ int phiId = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs (posmc, negmc, -11 , 11 , 333 , mcParticles);
704+ int jpsiId = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs (posmc, negmc, -11 , 11 , 443 , mcParticles);
705+ if (omegaId > 0 ) {
706+ auto mcMother = mcParticles.rawIteratorAt (omegaId);
707+ int ndau = mcMother.daughtersIds ()[1 ] - mcMother.daughtersIds ()[0 ] + 1 ;
708+ if (ndau == 2 ) {
709+ fRegistry .fill (HIST (" Pair/hMvsPt_omega" ), v12.M (), v12.Pt ());
710+ }
711+ } else if (phiId > 0 ) {
712+ auto mcMother = mcParticles.rawIteratorAt (phiId);
713+ int ndau = mcMother.daughtersIds ()[1 ] - mcMother.daughtersIds ()[0 ] + 1 ;
714+ if (ndau == 2 ) {
715+ fRegistry .fill (HIST (" Pair/hMvsPt_phi" ), v12.M (), v12.Pt ());
716+ }
717+ } else if (jpsiId > 0 ) {
718+ auto mcMother = mcParticles.rawIteratorAt (jpsiId);
719+ int ndau = mcMother.daughtersIds ()[1 ] - mcMother.daughtersIds ()[0 ] + 1 ;
720+ if (ndau == 2 ) {
721+ fRegistry .fill (HIST (" Pair/hMvsPt_jpsi" ), v12.M (), v12.Pt ());
722+ }
723+ }
724+ } // end of electron loop
725+ } // end of positron loop
726+
727+ posLeptons.clear ();
728+ posLeptons.shrink_to_fit ();
729+ negLeptons.clear ();
730+ negLeptons.shrink_to_fit ();
731+
659732 } // end of collision loop
660733 }
661734 PROCESS_SWITCH (createTTP, processMC, " process MC" , false );
0 commit comments