@@ -223,10 +223,26 @@ class FemtoDreamContainer
223223 mHistogramRegistry ->add ((folderName + " /relPair3dRmTMultPercentileQnPairphi" ).c_str (), (" ; " + femtoDKout + femtoDKside + femtoDKlong + " ; #it{m}_{T} (GeV/#it{c}); Centrality; qn; #varphi_{pair} - #Psi_{EP}" ).c_str (), kTHnSparseF , {femtoDKoutAxis, femtoDKsideAxis, femtoDKlongAxis, mTAxi4D , multPercentileAxis4D, qnAxis, pairPhiAxis});
224224 }
225225
226+ template <typename T>
227+ void init_3Dqn_MC (std::string folderName, std::string femtoDKout, std::string femtoDKside, std::string femtoDKlong,
228+ T& femtoDKoutAxis, T& femtoDKsideAxis, T& femtoDKlongAxis, bool smearingByOrigin = false )
229+ {
230+ mHistogramRegistry ->add ((folderName + " /hNoMCtruthPairsCounter" ).c_str (), " ; Counter; Entries" , kTH1I , {{1 , 0 , 1 }});
231+ mHistogramRegistry ->add ((folderName + " /hFakePairsCounter" ).c_str (), " ; Counter; Entries" , kTH1I , {{1 , 0 , 1 }});
232+ if (smearingByOrigin) {
233+ const int nOriginBins = o2::aod::femtodreamMCparticle::ParticleOriginMCTruth::kNOriginMCTruthTypes ;
234+ mHistogramRegistry ->add ((folderName + " /relPair3dresolution" ).c_str (), (" ;" + femtoDKout + " mctruth;" + femtoDKout + " _reco;" + femtoDKside + " mctruth;" + femtoDKside + " _reco;" + femtoDKlong + " mctruth;" + femtoDKlong + " _reco;" + " MC origin particle 1; MC origin particle 2;" ).c_str (),
235+ kTHnSparseF , {femtoDKoutAxis, femtoDKoutAxis, femtoDKsideAxis, femtoDKsideAxis, femtoDKlongAxis, femtoDKlongAxis, {nOriginBins, 0 , nOriginBins}, {nOriginBins, 0 , nOriginBins}});
236+ } else {
237+ mHistogramRegistry ->add ((folderName + " /relPair3dresolution" ).c_str (), (" ;" + femtoDKout + " mctruth;" + femtoDKside + " mctruth;" + femtoDKlong + " mctruth;" + femtoDKout + " _reco;" + femtoDKside + " _reco;" + femtoDKlong + " _reco;" ).c_str (),
238+ kTHnSparseF , {femtoDKoutAxis, femtoDKoutAxis, femtoDKsideAxis, femtoDKsideAxis, femtoDKlongAxis, femtoDKlongAxis});
239+ }
240+ }
241+
226242 template <typename T>
227243 void init_3Dqn (HistogramRegistry* registry,
228244 T& DKoutBins, T& DKsideBins, T& DKlongBins, T& mTBins4D , T& multPercentileBins4D,
229- bool isMC, ConfigurableAxis qnBins = {" qnBins" , {10 , 0 , 10 }, " qn binning" }, ConfigurableAxis pairPhiBins = {" phiBins" , {10 , 0 - 0.05 , TMath::Pi () + 0.05 }, " pair phi binning" })
245+ bool isMC, ConfigurableAxis qnBins = {" qnBins" , {10 , 0 , 10 }, " qn binning" }, ConfigurableAxis pairPhiBins = {" phiBins" , {10 , 0 - 0.05 , TMath::Pi () + 0.05 }, " pair phi binning" }, bool smearingByOrigin = false )
230246 {
231247 mHistogramRegistry = registry;
232248
@@ -251,6 +267,8 @@ class FemtoDreamContainer
251267 folderName = static_cast <std::string>(mFolderSuffix [mEventType ]) + static_cast <std::string>(o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth ]) + static_cast <std::string>(" _3Dqn" );
252268 init_base_3Dqn (folderName, femtoObsDKout, femtoObsDKside, femtoObsDKlong,
253269 DKoutAxis, DKsideAxis, DKlongAxis, mTAxis4D , multPercentileAxis4D, qnAxis, pairPhiAxis);
270+ init_3Dqn_MC (folderName, femtoObsDKout, femtoObsDKside, femtoObsDKlong,
271+ DKoutAxis, DKsideAxis, DKlongAxis, smearingByOrigin);
254272 }
255273 }
256274
@@ -484,11 +502,26 @@ class FemtoDreamContainer
484502 mHistogramRegistry ->fill (HIST (mFolderSuffix [mEventType ]) + HIST (o2::aod::femtodreamMCparticle::MCTypeName[mc]) + HIST (" _3Dqn" ) + HIST (" /relPair3dRmTMultPercentileQnPairphi" ), femtoDKout, femtoDKside, femtoDKlong, mT , multPercentile, myQnBin, pairPhiEP);
485503 }
486504
505+ // / Called by setPair_3Dqn only in case of Monte Carlo truth
506+ // / Fills resolution of DKout, DKside, DKlong
507+ void setPair_3Dqn_MC (std::vector<double > k3dMC, std::vector<double > k3d, const int originPart1, const int originPart2, bool smearingByOrigin)
508+ {
509+ if (smearingByOrigin) {
510+ mHistogramRegistry ->fill (HIST (mFolderSuffix [mEventType ]) + HIST (o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth ]) + HIST (" _3Dqn" ) + HIST (" /relPair3dresolution" ), k3dMC[1 ], k3d[1 ], k3dMC[2 ], k3d[2 ], k3dMC[3 ], k3d[3 ], originPart1, originPart2);
511+ } else {
512+ mHistogramRegistry ->fill (HIST (mFolderSuffix [mEventType ]) + HIST (o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth ]) + HIST (" _3Dqn" ) + HIST (" /relPair3dresolution" ), k3dMC[1 ], k3d[1 ], k3dMC[2 ], k3d[2 ], k3dMC[3 ], k3d[3 ]);
513+ }
514+ }
515+
487516 template <bool isMC, typename T1, typename T2>
488- void setPair_3Dqn (T1 const & part1, T2 const & part2, const float multPercentile, bool IsSameSpecies, const float myQnBin, const float eventPlane)
517+ void setPair_3Dqn (T1 const & part1, T2 const & part2, const float multPercentile, bool IsSameSpecies, const float myQnBin, const float eventPlane, bool smearingByOrigin = false )
489518 {
490519
491520 std::vector<double > k3d = FemtoDreamMath::newpairfunc (part1, mMassOne , part2, mMassTwo , IsSameSpecies);
521+ if (k3d.size () < 4 ) {
522+ LOG (error) << " newpairfunc returned size=" << k3d.size ();
523+ return ;
524+ }
492525 float DKout = k3d[1 ];
493526 float DKside = k3d[2 ];
494527 float DKlong = k3d[3 ];
@@ -503,12 +536,17 @@ class FemtoDreamContainer
503536 if constexpr (isMC) {
504537 if (part1.has_fdMCParticle () && part2.has_fdMCParticle ()) {
505538
506- std::vector<double > k3dMC = FemtoDreamMath::newpairfunc (part1.fdMCParticle (), mMassOne , part2.fdMCParticle (), mMassTwo , IsSameSpecies);
539+ std::vector<double > k3dMC = FemtoDreamMath::newpairfuncMC (part1.fdMCParticle (), mMassOne , part2.fdMCParticle (), mMassTwo , IsSameSpecies);
540+ if (k3dMC.size () < 4 ) {
541+ LOG (error) << " newpairfunc returned size=" << k3d.size ();
542+ return ;
543+ }
507544 const float mTMC = FemtoDreamMath::getmT (part1.fdMCParticle (), mMassOne , part2.fdMCParticle (), mMassTwo );
508545 const float pairPhiEPMC = FemtoDreamMath::getPairPhiEP (part1.fdMCParticle (), mMassOne , part2.fdMCParticle (), mMassTwo , eventPlane);
509546
510547 if (std::abs (part1.fdMCParticle ().pdgMCTruth ()) == mPDGOne && std::abs (part2.fdMCParticle ().pdgMCTruth ()) == mPDGTwo ) { // Note: all pair-histogramms are filled with MC truth information ONLY in case of non-fake candidates
511548 setPair_3Dqn_base<o2::aod::femtodreamMCparticle::MCType::kTruth >(k3dMC[1 ], k3dMC[2 ], k3dMC[3 ], mTMC , multPercentile, myQnBin, pairPhiEPMC);
549+ setPair_3Dqn_MC (k3dMC, k3d, part1.fdMCParticle ().partOriginMCTruth (), part2.fdMCParticle ().partOriginMCTruth (), smearingByOrigin);
512550 } else {
513551 mHistogramRegistry ->fill (HIST (mFolderSuffix [mEventType ]) + HIST (o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth ]) + HIST (" /hFakePairsCounter" ), 0 );
514552 }
@@ -521,10 +559,14 @@ class FemtoDreamContainer
521559 }
522560
523561 template <bool isMC, typename T1, typename T2>
524- void setPair_3Dqn (T1 const & part1, T2 const & part2, const float multPercentile, bool IsSameSpecies, const float myQnBin, const float EP1, const float EP2)
562+ void setPair_3Dqn (T1 const & part1, T2 const & part2, const float multPercentile, bool IsSameSpecies, const float myQnBin, const float EP1, const float EP2, bool smearingByOrigin = false )
525563 {
526564
527565 std::vector<double > k3d = FemtoDreamMath::newpairfunc (part1, mMassOne , part2, mMassTwo , IsSameSpecies);
566+ if (k3d.size () < 4 ) {
567+ LOG (error) << " newpairfunc returned size=" << k3d.size ();
568+ return ;
569+ }
528570 float DKout = k3d[1 ];
529571 float DKside = k3d[2 ];
530572 float DKlong = k3d[3 ];
@@ -539,12 +581,17 @@ class FemtoDreamContainer
539581 if constexpr (isMC) {
540582 if (part1.has_fdMCParticle () && part2.has_fdMCParticle ()) {
541583
542- std::vector<double > k3dMC = FemtoDreamMath::newpairfunc (part1.fdMCParticle (), mMassOne , part2.fdMCParticle (), mMassTwo , IsSameSpecies);
584+ std::vector<double > k3dMC = FemtoDreamMath::newpairfuncMC (part1.fdMCParticle (), mMassOne , part2.fdMCParticle (), mMassTwo , IsSameSpecies);
585+ if (k3dMC.size () < 4 ) {
586+ LOG (error) << " newpairfunc returned size=" << k3d.size ();
587+ return ;
588+ }
543589 const float mTMC = FemtoDreamMath::getmT (part1.fdMCParticle (), mMassOne , part2.fdMCParticle (), mMassTwo );
544590 const float pairPhiEPMC = FemtoDreamMath::getPairPhiEP (part1.fdMCParticle (), mMassOne , part2.fdMCParticle (), mMassTwo , EP1, EP2);
545591
546592 if (std::abs (part1.fdMCParticle ().pdgMCTruth ()) == mPDGOne && std::abs (part2.fdMCParticle ().pdgMCTruth ()) == mPDGTwo ) { // Note: all pair-histogramms are filled with MC truth information ONLY in case of non-fake candidates
547593 setPair_3Dqn_base<o2::aod::femtodreamMCparticle::MCType::kTruth >(k3dMC[1 ], k3dMC[2 ], k3dMC[3 ], mTMC , multPercentile, myQnBin, pairPhiEPMC);
594+ setPair_3Dqn_MC (k3dMC, k3d, part1.fdMCParticle ().partOriginMCTruth (), part2.fdMCParticle ().partOriginMCTruth (), smearingByOrigin);
548595 } else {
549596 mHistogramRegistry ->fill (HIST (mFolderSuffix [mEventType ]) + HIST (o2::aod::femtodreamMCparticle::MCTypeName[o2::aod::femtodreamMCparticle::MCType::kTruth ]) + HIST (" /hFakePairsCounter" ), 0 );
550597 }
0 commit comments