Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <Math/Vector4Dfwd.h>
#include <TF1.h>
#include <TH2.h>
#include <TPDGCode.h>
#include <TString.h>

#include <cmath>
Expand All @@ -74,17 +75,17 @@

template <o2::aod::pwgem::photonmeson::photonpair::PairType pairtype, o2::soa::is_table... Types>
struct Pi0EtaToGammaGammaMC {
o2::framework::Configurable<std::string> ccdburl{"ccdb-url", "http://alice-ccdb.cern.ch", "url of the ccdb repository"};

Check failure on line 78 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
o2::framework::Configurable<std::string> grpPath{"grpPath", "GLO/GRP/GRP", "Path of the grp file"};
o2::framework::Configurable<std::string> grpmagPath{"grpmagPath", "GLO/Config/GRPMagField", "CCDB path of the GRPMagField object"};
o2::framework::Configurable<bool> skipGRPOquery{"skipGRPOquery", true, "skip grpo query"};
o2::framework::Configurable<float> d_bz_input{"d_bz_input", -999, "bz field in kG, -999 is automatic"};

Check failure on line 82 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)

o2::framework::Configurable<int> cfgQvecEstimator{"cfgQvecEstimator", 0, "FT0M:0, FT0A:1, FT0C:2"};
o2::framework::Configurable<int> cfgCentEstimator{"cfgCentEstimator", 2, "FT0M:0, FT0A:1, FT0C:2"};
o2::framework::Configurable<float> cfgCentMin{"cfgCentMin", -1, "min. centrality"};
o2::framework::Configurable<float> cfgCentMax{"cfgCentMax", 999, "max. centrality"};
o2::framework::Configurable<float> maxY_rec{"maxY_rec", 0.9, "maximum rapidity for reconstructed particles"};

Check failure on line 88 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[name/configurable]

Use lowerCamelCase for names of configurables and use the same name for the struct member as for the JSON string. (Declare the type and names on the same line.)
o2::framework::Configurable<std::string> fd_k0s_to_pi0{"fd_k0s_pi0", "1.0", "feed down correction to pi0"};
o2::framework::Configurable<bool> cfgRequireTrueAssociation{"cfgRequireTrueAssociation", false, "flag to require true mc collision association"};

Expand All @@ -92,6 +93,7 @@
o2::framework::Configurable<float> cfgAlphaMeson{"cfgAlphaMeson", 0.65, "photon energy asymmetry distribution parameter for specific value cut"};
o2::framework::Configurable<float> cfgAlphaMesonA{"cfgAlphaMesonA", 0.65, "photon energy asymmetry distribution parameter A for pT dependent cut (A * tanh(B*pT))"};
o2::framework::Configurable<float> cfgAlphaMesonB{"cfgAlphaMesonB", 1.2, "photon energy asymmetry distribution parameter B for pT dependent cut (A * tanh(B*pT))"};
o2::framework::Configurable<bool> cfgGGContaCheck{"cfgGGContaCheck", false, "check gamma gamma contamination of dalitz"};

EMPhotonEventCut fEMEventCut;
struct : o2::framework::ConfigurableGroup {
Expand Down Expand Up @@ -252,6 +254,12 @@
f1fd_k0s_to_pi0 = new TF1("f1fd_k0s_to_pi0", TString(fd_k0s_to_pi0), 0.f, 100.f);

fRegistry.add("Event/hNrecPerMCCollision", "Nrec per mc collision;N_{rec} collisions per MC collision", o2::framework::HistType::kTH1F, {{21, -0.5f, 20.5f}}, false);
if (cfgGGContaCheck) {
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);
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);
}
fRegistry.add("Event/hNDalitzEtaPt", "Number of DalitzEta; p_{T, #eta} (GeV/#it{c}); N", o2::framework::HistType::kTH1F, {{40, -0.5f, 20.5f}}, false);
fRegistry.add("Event/hNDalitzPionPt", "Number of DalitzPion; p_{T, #pi} (GeV/#it{c}) ; N", o2::framework::HistType::kTH1F, {{40, -0.5f, 20.5f}}, false);

mRunNumber = 0;
d_bz = 0;
Expand All @@ -270,10 +278,10 @@
}

// In case override, don't proceed, please - no CCDB access required
if (d_bz_input > -990) {

Check failure on line 281 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
d_bz = d_bz_input;
o2::parameters::GRPMagField grpmag;
if (std::fabs(d_bz) > 1e-5) {

Check failure on line 284 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
grpmag.setL3Current(30000.f / (d_bz / 5.0f));
}
mRunNumber = collision.runNumber();
Expand Down Expand Up @@ -572,7 +580,7 @@
TMCCollisions const& mccollisions, TMCParticles const& mcparticles,
TLegs const& /*legs*/ = nullptr, TMatchedTracks const& matchedTracks = nullptr, TMatchedSecondaries const& matchedSecondaries = nullptr)
{
for (auto& collision : collisions) {

Check failure on line 583 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
initCCDB(collision);
if ((pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) {
continue;
Expand All @@ -583,7 +591,7 @@
weight = collision.weight();
}

if (eventcuts.onlyKeepWeightedEvents && std::fabs(weight - 1.0) < 1e-10) {

Check failure on line 594 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;
}

Expand Down Expand Up @@ -720,9 +728,9 @@
}

if (g1mc.globalIndex() == g2mc.globalIndex()) {
if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == 111)
if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == PDG_t::kPi0)
fRegistry.fill(HIST("Pair/Pi0/hs_FromSameGamma"), v12.M(), v12.Pt(), wpair);
else if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == 221)
else if (o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(g1mc, mcparticles) == o2::constants::physics::Pdg::kEta)
fRegistry.fill(HIST("Pair/Eta/hs_FromSameGamma"), v12.M(), v12.Pt(), wpair);
continue;
}
Expand Down Expand Up @@ -792,6 +800,25 @@

auto pos2mc = mcparticles.iteratorAt(pos2.emmcparticleId());
auto ele2mc = mcparticles.iteratorAt(ele2.emmcparticleId());
if (cfgGGContaCheck) {
photonid2 = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom2Prongs(pos2mc, ele2mc, -11, 11, 22, mcparticles); // check possible contamination
if (photonid2 > 0) {
auto photon2 = mcparticles.iteratorAt(photonid2);
int photon2pdg = photon2.pdgCode();
int photon2mothid = photon2.mothersIds()[0];
auto photon2moth = mcparticles.iteratorAt(photon2mothid);
if (photon2pdg == PDG_t::kGamma && (o2::aod::pwgem::photonmeson::utils::mcutil::isGammaGammaDecay(photon2moth, mcparticles))) {
int mothID = o2::aod::pwgem::dilepton::utils::mcutil::getMotherPDGCode(photon2, mcparticles);
if (mothID == o2::constants::physics::Pdg::kEta) {
fRegistry.fill(HIST("Event/hNGGContamEta"), photon2moth.pt());
}
if (mothID == PDG_t::kPi0) {
fRegistry.fill(HIST("Event/hNGGContamPion"), photon2moth.pt());
}
}
}
}

pi0id = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom3Prongs(g1mc, pos2mc, ele2mc, 22, -11, 11, 111, mcparticles);
etaid = o2::aod::pwgem::dilepton::utils::mcutil::FindCommonMotherFrom3Prongs(g1mc, pos2mc, ele2mc, 22, -11, 11, 221, mcparticles);
if (pi0id < 0 && etaid < 0) {
Expand All @@ -805,12 +832,14 @@
}
if (pi0id > 0) {
auto pi0mc = mcparticles.iteratorAt(pi0id);
fRegistry.fill(HIST("Event/hNDalitzPionPt"), pi0mc.pt());
if (cfgRequireTrueAssociation && (pi0mc.emmceventId() != collision.emmceventId())) {
continue;
}
o2::aod::pwgem::photonmeson::utils::nmhistogram::fillTruePairInfo(&fRegistry, veeg, pi0mc, mcparticles, mccollisions, f1fd_k0s_to_pi0, weight);
} else if (etaid > 0) {
auto etamc = mcparticles.iteratorAt(etaid);
fRegistry.fill(HIST("Event/hNDalitzEtaPt"), etamc.pt());
if (cfgRequireTrueAssociation && (etamc.emmceventId() != collision.emmceventId())) {
continue;
}
Expand Down Expand Up @@ -900,13 +929,13 @@
// loop over mc stack and fill histograms for pure MC truth signals
// all MC tracks which belong to the MC event corresponding to the current reconstructed event

for (auto& mccollision : mccollisions) {

Check failure on line 932 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
auto collision_per_mccoll = collisions.sliceBy(rec_perMcCollision, mccollision.globalIndex());
int nrec_per_mc = collision_per_mccoll.size();
fRegistry.fill(HIST("Event/hNrecPerMCCollision"), nrec_per_mc);
}

for (auto& collision : collisions) {

Check failure on line 938 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[const-ref-in-for-loop]

Use constant references for non-modified iterators in range-based for loops.
if ((pairtype == o2::aod::pwgem::photonmeson::photonpair::kPHOSPHOS || pairtype == o2::aod::pwgem::photonmeson::photonpair::kPCMPHOS) && !collision.alias_bit(triggerAliases::kTVXinPHOS)) {
continue; // I don't know why this is necessary in simulation.
}
Expand All @@ -916,7 +945,7 @@
weight = collision.weight();
}

if (eventcuts.onlyKeepWeightedEvents && std::fabs(weight - 1.0) < 1e-10) {

Check failure on line 948 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

View workflow job for this annotation

GitHub Actions / O2 linter

[magic-number]

Avoid magic numbers in expressions. Assign the value to a clearly named variable or constant.
continue;
}

Expand Down
Loading