Skip to content

Commit 8e432b0

Browse files
author
Laura Gansbartl
committed
include of check for gamma gamma contamination in Dalitz decays
1 parent f65c6af commit 8e432b0

1 file changed

Lines changed: 62 additions & 29 deletions

File tree

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

Lines changed: 62 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#include <Math/Vector4Dfwd.h>
5757
#include <TF1.h>
5858
#include <TH2.h>
59+
#include <TPDGCode.h>
5960
#include <TString.h>
6061

6162
#include <cmath>
@@ -74,24 +75,25 @@ enum AlphaMesonCutOption {
7475

7576
template <o2::aod::pwgem::photonmeson::photonpair::PairType pairtype, o2::soa::is_table... Types>
7677
struct Pi0EtaToGammaGammaMC {
77-
o2::framework::Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
78+
o2::framework::Configurable<std::string> ccdbUrl{"ccdbUrl", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};
7879
o2::framework::Configurable<std::string> grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"};
7980
o2::framework::Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
8081
o2::framework::Configurable<bool> skipGRPOquery{"skipGRPOquery", true, "skip grpo query"};
81-
o2::framework::Configurable<float> d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"};
82+
o2::framework::Configurable<float> dBzInput{"dBzInput", -999, "bz field in kG, -999 is automatic"};
8283

8384
o2::framework::Configurable<int> cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"};
8485
o2::framework::Configurable<int> cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"};
8586
o2::framework::Configurable<float> cfgCentMin{"cfgCentMin", -1, "min. centrality"};
8687
o2::framework::Configurable<float> cfgCentMax{"cfgCentMax", 999, "max. centrality"};
87-
o2::framework::Configurable<float> maxY_rec{"maxY_rec", 0.9, "maximum rapidity for reconstructed particles"};
88-
o2::framework::Configurable<std::string> fd_k0s_to_pi0{"fd_k0s_pi0", "1.0", "feed down correction to pi0"};
88+
o2::framework::Configurable<float> maxYRec{"maxYRec", 0.9, "maximum rapidity for reconstructed particles"};
89+
o2::framework::Configurable<std::string> fdK0sToPi0{"fdK0sPi0", "1.0", "feed down correction to pi0"};
8990
o2::framework::Configurable<bool> cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"};
9091

9192
o2::framework::Configurable<int> cfgAlphaMesonCut{"cfgAlphaMesonCut", 0, "flag for photon energy asymmetry distribution cut: 0: no cut, 1: cut specific value, 2: cut depending on pT"};
9293
o2::framework::Configurable<float> cfgAlphaMeson{"cfgAlphaMeson", 0.65, "photon energy asymmetry distribution parameter for specific value cut"};
9394
o2::framework::Configurable<float> cfgAlphaMesonA{"cfgAlphaMesonA", 0.65, "photon energy asymmetry distribution parameter A for pT dependent cut (A * tanh(B*pT))"};
9495
o2::framework::Configurable<float> cfgAlphaMesonB{"cfgAlphaMesonB", 1.2, "photon energy asymmetry distribution parameter B for pT dependent cut (A * tanh(B*pT))"};
96+
o2::framework::Configurable<bool> cfgGGContaCheck{"cfgGGContaCheck", false, "check gamma gamma contamination of dalitz"};
9597

9698
EMPhotonEventCut fEMEventCut;
9799
struct : o2::framework::ConfigurableGroup {
@@ -224,7 +226,7 @@ struct Pi0EtaToGammaGammaMC {
224226
o2::framework::Configurable<float> cfg_min_Ecluster{"cfg_min_Ecluster", 0.3, "Minimum cluster energy for PHOS in GeV"};
225227
} phoscuts;
226228

227-
TF1* f1fd_k0s_to_pi0;
229+
TF1* f1fdK0sToPi0;
228230
o2::framework::HistogramRegistry fRegistry{"output", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject, false, false};
229231
// static constexpr std::string_view event_types[2] = {"before/", "after/"};
230232
// static constexpr std::string_view event_pair_types[2] = {"same/", "mix/"};
@@ -249,14 +251,20 @@ struct Pi0EtaToGammaGammaMC {
249251
DefineEMCCut();
250252
DefinePHOSCut();
251253

252-
f1fd_k0s_to_pi0 = new TF1("f1fd_k0s_to_pi0", TString(fd_k0s_to_pi0), 0.f, 100.f);
254+
f1fdK0sToPi0 = new TF1("f1fdK0sToPi0", TString(fdK0sToPi0), 0.f, 100.f);
253255

254256
fRegistry.add("Event/hNrecPerMCCollision", "Nrec per mc collision;N_{rec} collisions per MC collision", o2::framework::HistType::kTH1F, {{21, -0.5f, 20.5f}}, false);
257+
if (cfgGGContaCheck) {
258+
fRegistry.add("Event/hNGGContamEta", "Number of Eta from etaToGammaGamma; p_{T, #eta} (GeV/#it{c}); N", o2::framework::HistType::kTH1F, {{40, -0.5f, 20.5f}}, false);
259+
fRegistry.add("Event/hNGGContamPion", "Number of Pion from etaToGammaGamma; p_{T, #pi} (GeV/#it{c}); N", o2::framework::HistType::kTH1F, {{40, -0.5f, 20.5f}}, false);
260+
}
261+
fRegistry.add("Event/hNDalitzEtaPt", "Number of DalitzEta; p_{T, #eta} (GeV/#it{c}); N", o2::framework::HistType::kTH1F, {{40, -0.5f, 20.5f}}, false);
262+
fRegistry.add("Event/hNDalitzPionPt", "Number of DalitzPion; p_{T, #pi} (GeV/#it{c}) ; N", o2::framework::HistType::kTH1F, {{40, -0.5f, 20.5f}}, false);
255263

256264
mRunNumber = 0;
257265
d_bz = 0;
258266

259-
ccdb->setURL(ccdburl);
267+
ccdb->setURL(ccdbUrl);
260268
ccdb->setCaching(true);
261269
ccdb->setLocalObjectValidityChecking();
262270
ccdb->setFatalWhenNull(false);
@@ -270,10 +278,12 @@ struct Pi0EtaToGammaGammaMC {
270278
}
271279

272280
// In case override, don't proceed, please - no CCDB access required
273-
if (d_bz_input > -990) {
274-
d_bz = d_bz_input;
281+
constexpr float bzInput = -990.0f;
282+
if (dBzInput > bzInput) {
283+
d_bz = dBzInput;
275284
o2::parameters::GRPMagField grpmag;
276-
if (std::fabs(d_bz) > 1e-5) {
285+
float bzThreshold = 1e-5;
286+
if (std::fabs(d_bz) > bzThreshold) {
277287
grpmag.setL3Current(30000.f / (d_bz / 5.0f));
278288
}
279289
mRunNumber = collision.runNumber();
@@ -304,8 +314,8 @@ struct Pi0EtaToGammaGammaMC {
304314

305315
~Pi0EtaToGammaGammaMC()
306316
{
307-
delete f1fd_k0s_to_pi0;
308-
f1fd_k0s_to_pi0 = 0x0;
317+
delete f1fdK0sToPi0;
318+
f1fdK0sToPi0 = 0x0;
309319
}
310320

311321
void DefineEMEventCut()
@@ -359,7 +369,7 @@ struct Pi0EtaToGammaGammaMC {
359369
fV0PhotonCut.SetLoadMlModelsFromCCDB(pcmcuts.cfg_load_ml_models_from_ccdb);
360370
fV0PhotonCut.SetNClassesMl(pcmcuts.cfg_nclasses_ml);
361371
fV0PhotonCut.SetMlTimestampCCDB(pcmcuts.cfg_timestamp_ccdb);
362-
fV0PhotonCut.SetCcdbUrl(ccdburl);
372+
fV0PhotonCut.SetCcdbUrl(ccdbUrl);
363373
CentType mCentralityTypeMlEnum;
364374
mCentralityTypeMlEnum = static_cast<CentType>(cfgCentEstimator.value);
365375
fV0PhotonCut.SetCentralityTypeMl(mCentralityTypeMlEnum);
@@ -572,18 +582,19 @@ struct Pi0EtaToGammaGammaMC {
572582
TMCCollisions const& mccollisions, TMCParticles const& mcparticles,
573583
TLegs const& /*legs*/ = nullptr, TMatchedTracks const& matchedTracks = nullptr, TMatchedSecondaries const& matchedSecondaries = nullptr)
574584
{
575-
for (auto& collision : collisions) {
585+
for (auto const& collision : collisions) {
576586
initCCDB(collision);
577587
if ((pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) {
578588
continue;
579589
}
580590

581591
float weight = 1.f;
592+
float weightThreshold = 1e-10;
582593
if constexpr (std::is_same_v<std::decay_t<TCollisions>, o2::soa::Filtered<o2::soa::Join<o2::soa::Join<o2::aod::PMEvents, o2::aod::EMEventsAlias, o2::aod::EMEventsMult_000, o2::aod::EMEventsCent_000, o2::aod::EMMCEventLabels>, o2::aod::EMEventsWeight>>>) {
583594
weight = collision.weight();
584595
}
585596

586-
if (eventcuts.onlyKeepWeightedEvents && std::fabs(weight - 1.0) < 1e-10) {
597+
if (eventcuts.onlyKeepWeightedEvents && std::fabs(weight - 1.0) < weightThreshold) {
587598
continue;
588599
}
589600

@@ -680,7 +691,7 @@ struct Pi0EtaToGammaGammaMC {
680691
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
681692
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
682693
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
683-
if (std::fabs(v12.Rapidity()) > maxY_rec) {
694+
if (std::fabs(v12.Rapidity()) > maxYRec) {
684695
continue;
685696
}
686697

@@ -720,9 +731,9 @@ struct Pi0EtaToGammaGammaMC {
720731
}
721732

722733
if (g1mc.globalIndex() == g2mc.globalIndex()) {
723-
if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == 111)
734+
if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == PDG_t::kPi0)
724735
fRegistry.fill(HIST("Pair/Pi0/hs_FromSameGamma"), v12.M(), v12.Pt(), wpair);
725-
else if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == 221)
736+
else if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == o2::constants::physics::Pdg::kEta)
726737
fRegistry.fill(HIST("Pair/Eta/hs_FromSameGamma"), v12.M(), v12.Pt(), wpair);
727738
continue;
728739
}
@@ -732,13 +743,13 @@ struct Pi0EtaToGammaGammaMC {
732743
if (cfgRequireTrueAssociation && (pi0mc.emmceventId() != collision.emmceventId())) {
733744
continue;
734745
}
735-
o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, wpair);
746+
o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fdK0sToPi0, wpair);
736747
} else if (etaid > 0) {
737748
auto etamc = mcparticles.iteratorAt(etaid);
738749
if (cfgRequireTrueAssociation && (etamc.emmceventId() != collision.emmceventId())) {
739750
continue;
740751
}
741-
o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, wpair);
752+
o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fdK0sToPi0, wpair);
742753
}
743754
} // end of pairing loop
744755
} else if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMDalitzEE) {
@@ -792,6 +803,25 @@ struct Pi0EtaToGammaGammaMC {
792803

793804
auto pos2mc = mcparticles.iteratorAt(pos2.emmcparticleId());
794805
auto ele2mc = mcparticles.iteratorAt(ele2.emmcparticleId());
806+
if (cfgGGContaCheck) {
807+
photonid2 = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs(pos2mc, ele2mc, -11, 11, 22, mcparticles); // check possible contamination
808+
if (photonid2 > 0) {
809+
auto photon2 = mcparticles.iteratorAt(photonid2);
810+
int photon2pdg = photon2.pdgCode();
811+
int photon2mothid = photon2.mothersIds()[0];
812+
auto photon2moth = mcparticles.iteratorAt(photon2mothid);
813+
if (photon2pdg == PDG_t::kGamma && (o2::aod::pwgem::photonmeson::utils::mcutil::isGammaGammaDecay(photon2moth, mcparticles))) {
814+
int mothID = o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(photon2, mcparticles);
815+
if (mothID == o2::constants::physics::Pdg::kEta) {
816+
fRegistry.fill(HIST("Event/hNGGContamEta"), photon2moth.pt());
817+
}
818+
if (mothID == PDG_t::kPi0) {
819+
fRegistry.fill(HIST("Event/hNGGContamPion"), photon2moth.pt());
820+
}
821+
}
822+
}
823+
}
824+
795825
pi0id = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom3Prongs(g1mc, pos2mc, ele2mc, 22, -11, 11, 111, mcparticles);
796826
etaid = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom3Prongs(g1mc, pos2mc, ele2mc, 22, -11, 11, 221, mcparticles);
797827
if (pi0id < 0 && etaid < 0) {
@@ -800,21 +830,23 @@ struct Pi0EtaToGammaGammaMC {
800830
ROOT::Math::PtEtaPhiMVector v_pos(pos2.pt(), pos2.eta(), pos2.phi(), o2::constants::physics::MassElectron);
801831
ROOT::Math::PtEtaPhiMVector v_ele(ele2.pt(), ele2.eta(), ele2.phi(), o2::constants::physics::MassElectron);
802832
ROOT::Math::PtEtaPhiMVector veeg = v_gamma + v_pos + v_ele;
803-
if (std::fabs(veeg.Rapidity()) > maxY_rec) {
833+
if (std::fabs(veeg.Rapidity()) > maxYRec) {
804834
continue;
805835
}
806836
if (pi0id > 0) {
807837
auto pi0mc = mcparticles.iteratorAt(pi0id);
838+
fRegistry.fill(HIST("Event/hNDalitzPionPt"), pi0mc.pt());
808839
if (cfgRequireTrueAssociation && (pi0mc.emmceventId() != collision.emmceventId())) {
809840
continue;
810841
}
811-
o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight);
842+
o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, pi0mc, mcparticles, mccollisions, f1fdK0sToPi0, weight);
812843
} else if (etaid > 0) {
813844
auto etamc = mcparticles.iteratorAt(etaid);
845+
fRegistry.fill(HIST("Event/hNDalitzEtaPt"), etamc.pt());
814846
if (cfgRequireTrueAssociation && (etamc.emmceventId() != collision.emmceventId())) {
815847
continue;
816848
}
817-
o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight);
849+
o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, etamc, mcparticles, mccollisions, f1fdK0sToPi0, weight);
818850
}
819851
} // end of dielectron loop
820852
} // end of pcm loop
@@ -853,15 +885,15 @@ struct Pi0EtaToGammaGammaMC {
853885
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
854886
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
855887
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
856-
if (std::fabs(v12.Rapidity()) > maxY_rec) {
888+
if (std::fabs(v12.Rapidity()) > maxYRec) {
857889
continue;
858890
}
859891
// if (pi0id > 0) {
860892
// auto pi0mc = mcparticles.iteratorAt(pi0id);
861-
// o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight);
893+
// o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, pi0mc, mcparticles, mccollisions, f1fdK0sToPi0, weight);
862894
// } else if (etaid > 0) {
863895
// auto etamc = mcparticles.iteratorAt(etaid);
864-
// o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight);
896+
// o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, v12, etamc, mcparticles, mccollisions, f1fdK0sToPi0, weight);
865897
// }
866898
} // end of pairing loop
867899
} // end of pairing in same event
@@ -900,23 +932,24 @@ struct Pi0EtaToGammaGammaMC {
900932
// loop over mc stack and fill histograms for pure MC truth signals
901933
// all MC tracks which belong to the MC event corresponding to the current reconstructed event
902934

903-
for (auto& mccollision : mccollisions) {
935+
for (auto const& mccollision : mccollisions) {
904936
auto collision_per_mccoll = collisions.sliceBy(rec_perMcCollision, mccollision.globalIndex());
905937
int nrec_per_mc = collision_per_mccoll.size();
906938
fRegistry.fill(HIST("Event/hNrecPerMCCollision"), nrec_per_mc);
907939
}
908940

909-
for (auto& collision : collisions) {
941+
for (auto const& collision : collisions) {
910942
if ((pairtype == o2::aod::pwgem::photonmeson::photonpair::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) {
911943
continue; // I don't know why this is necessary in simulation.
912944
}
913945

914946
float weight = 1.f;
947+
float weightTreshhold = 1e-10;
915948
if constexpr (std::is_same_v<std::decay_t<TCollisions>, o2::soa::Filtered<o2::soa::Join<o2::soa::Join<o2::aod::PMEvents, o2::aod::EMEventsAlias, o2::aod::EMEventsMult_000, o2::aod::EMEventsCent_000, o2::aod::EMMCEventLabels>, o2::aod::EMEventsWeight>>>) {
916949
weight = collision.weight();
917950
}
918951

919-
if (eventcuts.onlyKeepWeightedEvents && std::fabs(weight - 1.0) < 1e-10) {
952+
if (eventcuts.onlyKeepWeightedEvents && std::fabs(weight - 1.0) < weightTreshhold) {
920953
continue;
921954
}
922955

0 commit comments

Comments
 (0)