@@ -56,9 +56,12 @@ using namespace o2::aod::pwgem::photonmeson::photonpair;
5656using namespace o2 ::aod::pwgem::photonmeson::utils::mcutil;
5757using namespace o2 ::aod::pwgem::dilepton::utils::mcutil;
5858
59- using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMMCEventLabels, aod::EMEventsWeight >;
59+ using MyCollisions = soa::Join<aod::EMEvents, aod::EMEventsMult, aod::EMEventsCent, aod::EMMCEventLabels>;
6060using MyCollision = MyCollisions::iterator;
6161
62+ using MyCollisionsWithJJMC = soa::Join<MyCollisions, aod::EMEventsWeight>;
63+ using MyCollisionWithJJMC = MyCollisionsWithJJMC::iterator;
64+
6265using MyMCCollisions = soa::Join<aod::EMMCEvents, aod::BinnedGenPts>;
6366using MyMCCollision = MyMCCollisions::iterator;
6467
@@ -429,7 +432,12 @@ struct TaggingPi0MC {
429432 for (const auto & collision : collisions) {
430433 initCCDB (collision);
431434
432- if (eventcuts.onlyKeepWeightedEvents && std::fabs (collision.weight () - 1 .f ) < 1e-10 ) {
435+ float weight = 1 .f ;
436+ if constexpr (std::is_same_v<std::decay_t <TCollisions>, FilteredMyCollisionsWithJJMC>) {
437+ weight = collision.weight ();
438+ }
439+
440+ if (eventcuts.onlyKeepWeightedEvents && std::fabs (weight - 1 .f ) < 1e-10 ) {
433441 continue ;
434442 }
435443
@@ -438,13 +446,13 @@ struct TaggingPi0MC {
438446 continue ;
439447 }
440448
441- o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0 >(&fRegistry , collision, collision. weight () );
449+ o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<0 >(&fRegistry , collision, weight);
442450 if (!fEMEventCut .IsSelected (collision)) {
443451 continue ;
444452 }
445- o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1 >(&fRegistry , collision, collision. weight () );
446- fRegistry .fill (HIST (" Event/before/hCollisionCounter" ), 12.0 , collision. weight () ); // accepted
447- fRegistry .fill (HIST (" Event/after/hCollisionCounter" ), 12.0 , collision. weight () ); // accepted
453+ o2::aod::pwgem::photonmeson::utils::eventhistogram::fillEventInfo<1 >(&fRegistry , collision, weight);
454+ fRegistry .fill (HIST (" Event/before/hCollisionCounter" ), 12.0 , weight); // accepted
455+ fRegistry .fill (HIST (" Event/after/hCollisionCounter" ), 12.0 , weight); // accepted
448456
449457 if constexpr (pairtype == PairType::kPCMDalitzEE ) {
450458 auto photons1_per_collision = photons1.sliceBy (perCollision1, collision.globalIndex ());
@@ -457,8 +465,8 @@ struct TaggingPi0MC {
457465 }
458466
459467 ROOT::Math::PtEtaPhiMVector v_gamma (g1.pt (), g1.eta (), g1.phi (), 0 .f );
460- fRegistry .fill (HIST (" Photon/candidate/hPt" ), v_gamma.Pt (), collision. weight () );
461- fRegistry .fill (HIST (" Photon/candidate/hEtaPhi" ), v_gamma.Phi () > 0 ? v_gamma.Phi () : v_gamma.Phi () + 2 * M_PI, v_gamma.Eta (), collision. weight () );
468+ fRegistry .fill (HIST (" Photon/candidate/hPt" ), v_gamma.Pt (), weight);
469+ fRegistry .fill (HIST (" Photon/candidate/hEtaPhi" ), v_gamma.Phi () > 0 ? v_gamma.Phi () : v_gamma.Phi () + 2 * M_PI, v_gamma.Eta (), weight);
462470
463471 auto pos1 = g1.template posTrack_as <TSubInfos1>();
464472 auto ele1 = g1.template negTrack_as <TSubInfos1>();
@@ -475,13 +483,13 @@ struct TaggingPi0MC {
475483 }
476484
477485 if (g1mc.isPhysicalPrimary () || g1mc.producedByGenerator ()) {
478- fRegistry .fill (HIST (" Photon/primary/hPt" ), v_gamma.Pt (), collision. weight () );
479- fRegistry .fill (HIST (" Photon/primary/hEtaPhi" ), v_gamma.Phi () > 0 ? v_gamma.Phi () : v_gamma.Phi () + 2 * M_PI, v_gamma.Eta (), collision. weight () );
486+ fRegistry .fill (HIST (" Photon/primary/hPt" ), v_gamma.Pt (), weight);
487+ fRegistry .fill (HIST (" Photon/primary/hEtaPhi" ), v_gamma.Phi () > 0 ? v_gamma.Phi () : v_gamma.Phi () + 2 * M_PI, v_gamma.Eta (), weight);
480488 if (g1mc.has_mothers ()) {
481489 auto mp = g1mc.template mothers_first_as <TMCParticles>();
482490 if (std::abs (mp.pdgCode ()) == 111 ) {
483- fRegistry .fill (HIST (" Photon/fromPi0/hPt" ), v_gamma.Pt (), collision. weight () );
484- fRegistry .fill (HIST (" Photon/fromPi0/hEtaPhi" ), v_gamma.Phi () > 0 ? v_gamma.Phi () : v_gamma.Phi () + 2 * M_PI, v_gamma.Eta (), collision. weight () );
491+ fRegistry .fill (HIST (" Photon/fromPi0/hPt" ), v_gamma.Pt (), weight);
492+ fRegistry .fill (HIST (" Photon/fromPi0/hEtaPhi" ), v_gamma.Phi () > 0 ? v_gamma.Phi () : v_gamma.Phi () + 2 * M_PI, v_gamma.Eta (), weight);
485493 }
486494 }
487495 } else if (IsFromWD (g1mc.template emmcevent_as <TMCCollisions>(), g1mc, mcparticles) > 0 ) {
@@ -491,11 +499,11 @@ struct TaggingPi0MC {
491499 if (std::abs (str_had.pdgCode ()) == 310 && f1fd_k0s_to_pi0 != nullptr ) {
492500 weight = f1fd_k0s_to_pi0->Eval (str_had.pt ());
493501 }
494- fRegistry .fill (HIST (" Photon/fromWD/hPt" ), v_gamma.Pt (), collision. weight () * weight);
495- fRegistry .fill (HIST (" Photon/fromWD/hEtaPhi" ), v_gamma.Phi () > 0 ? v_gamma.Phi () : v_gamma.Phi () + 2 * M_PI, v_gamma.Eta (), collision. weight () * weight);
502+ fRegistry .fill (HIST (" Photon/fromWD/hPt" ), v_gamma.Pt (), weight * weight);
503+ fRegistry .fill (HIST (" Photon/fromWD/hEtaPhi" ), v_gamma.Phi () > 0 ? v_gamma.Phi () : v_gamma.Phi () + 2 * M_PI, v_gamma.Eta (), weight * weight);
496504 } else {
497- fRegistry .fill (HIST (" Photon/fromHS/hPt" ), v_gamma.Pt (), collision. weight () );
498- fRegistry .fill (HIST (" Photon/fromHS/hEtaPhi" ), v_gamma.Phi () > 0 ? v_gamma.Phi () : v_gamma.Phi () + 2 * M_PI, v_gamma.Eta (), collision. weight () );
505+ fRegistry .fill (HIST (" Photon/fromHS/hPt" ), v_gamma.Pt (), weight);
506+ fRegistry .fill (HIST (" Photon/fromHS/hEtaPhi" ), v_gamma.Phi () > 0 ? v_gamma.Phi () : v_gamma.Phi () + 2 * M_PI, v_gamma.Eta (), weight);
499507 }
500508
501509 for (const auto & [pos2, ele2] : combinations (CombinationsFullIndexPolicy (positrons_per_collision, electrons_per_collision))) { // ULS
@@ -529,17 +537,17 @@ struct TaggingPi0MC {
529537 ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele;
530538
531539 if (pi0mc.isPhysicalPrimary () || pi0mc.producedByGenerator ()) {
532- fRegistry .fill (HIST (" Pair/primary/hMvsPt" ), veeg.M (), v_gamma.Pt (), collision. weight () );
540+ fRegistry .fill (HIST (" Pair/primary/hMvsPt" ), veeg.M (), v_gamma.Pt (), weight);
533541 } else if (IsFromWD (pi0mc.template emmcevent_as <TMCCollisions>(), pi0mc, mcparticles) > 0 ) {
534542 int motherid_strhad = IsFromWD (pi0mc.template emmcevent_as <TMCCollisions>(), pi0mc, mcparticles);
535543 auto str_had = mcparticles.iteratorAt (motherid_strhad);
536544 float weight = 1 .f ;
537545 if (std::abs (str_had.pdgCode ()) == 310 && f1fd_k0s_to_pi0 != nullptr ) {
538546 weight = f1fd_k0s_to_pi0->Eval (str_had.pt ());
539547 }
540- fRegistry .fill (HIST (" Pair/fromWD/hMvsPt" ), veeg.M (), v_gamma.Pt (), collision. weight () * weight);
548+ fRegistry .fill (HIST (" Pair/fromWD/hMvsPt" ), veeg.M (), v_gamma.Pt (), weight * weight);
541549 } else {
542- fRegistry .fill (HIST (" Pair/fromHS/hMvsPt" ), veeg.M (), v_gamma.Pt (), collision. weight () );
550+ fRegistry .fill (HIST (" Pair/fromHS/hMvsPt" ), veeg.M (), v_gamma.Pt (), weight);
543551 }
544552
545553 } // end of dielectron loop
@@ -557,7 +565,7 @@ struct TaggingPi0MC {
557565 // ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
558566 // if (pi0id > 0) {
559567 // auto pi0mc = mcparticles.iteratorAt(pi0id);
560- // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, collision. weight() );
568+ // o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight);
561569 // }
562570 } // end of pairing loop
563571 } // end of pairing in same event
@@ -591,9 +599,34 @@ struct TaggingPi0MC {
591599 // runPairing(collisions, v0photons, phosclusters, v0legs, nullptr, perCollision_pcm, perCollision_phos, fV0PhotonCut, fPHOSCut, nullptr, nullptr);
592600 // }
593601 }
594- PROCESS_SWITCH (TaggingPi0MC, processAnalysis, " process pair analysis" , false );
602+ PROCESS_SWITCH (TaggingPi0MC, processAnalysis, " process pair analysis" , true );
603+
604+ using FilteredMyCollisionsWithJJMC = soa::Filtered<MyCollisionsWithJJMC>;
605+ void processAnalysisJJMC (FilteredMyCollisionsWithJJMC const & collisions, MyMCCollisions const & mccollisions, aod::EMMCParticles const & mcparticles, Types const &... args)
606+ {
607+ if constexpr (pairtype == PairType::kPCMDalitzEE ) {
608+ auto v0photons = std::get<0 >(std::tie (args...));
609+ auto v0legs = std::get<1 >(std::tie (args...));
610+ auto emprimaryelectrons = std::get<2 >(std::tie (args...));
611+ // LOGF(info, "electrons.size() = %d, positrons.size() = %d", electrons.size(), positrons.size());
612+ runTruePairing (collisions, v0photons, emprimaryelectrons, v0legs, emprimaryelectrons, perCollision_pcm, perCollision_electron, fV0PhotonCut , fDileptonCut , mccollisions, mcparticles);
613+ }
614+ // else if constexpr (pairtype == PairType::kPCMEMC) {
615+ // auto v0photons = std::get<0>(std::tie(args...));
616+ // auto v0legs = std::get<1>(std::tie(args...));
617+ // auto emcclusters = std::get<2>(std::tie(args...));
618+ // auto emcmatchedtracks = std::get<3>(std::tie(args...));
619+ // runPairing(collisions, v0photons, emcclusters, v0legs, nullptr, perCollision_pcm, perCollision_emc, fV0PhotonCut, fEMCCut, emcmatchedtracks, nullptr);
620+ // } else if constexpr (pairtype == PairType::kPCMPHOS) {
621+ // auto v0photons = std::get<0>(std::tie(args...));
622+ // auto v0legs = std::get<1>(std::tie(args...));
623+ // auto phosclusters = std::get<2>(std::tie(args...));
624+ // runPairing(collisions, v0photons, phosclusters, v0legs, nullptr, perCollision_pcm, perCollision_phos, fV0PhotonCut, fPHOSCut, nullptr, nullptr);
625+ // }
626+ }
627+ PROCESS_SWITCH (TaggingPi0MC, processAnalysisJJMC, " process pair analysis" , false );
595628
596629 void processDummy (MyCollisions const &) {}
597- PROCESS_SWITCH (TaggingPi0MC, processDummy, " Dummy function" , true );
630+ PROCESS_SWITCH (TaggingPi0MC, processDummy, " Dummy function" , false );
598631};
599632#endif // PWGEM_PHOTONMESON_CORE_TAGGINGPI0MC_H_
0 commit comments