Skip to content
Merged
Show file tree
Hide file tree
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
72 changes: 70 additions & 2 deletions PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include <Math/Vector4Dfwd.h>

#include <algorithm>
#include <array>
#include <cmath>
#include <cstddef>
#include <cstdint>
Expand All @@ -79,12 +80,12 @@

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

Check failure on line 83 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.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 87 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.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<uint64_t> ndiff_bc_mix{"ndiff_bc_mix", 594, "difference in global BC required in mixed events"};

Check failure on line 88 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.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"};
Expand All @@ -104,6 +105,36 @@
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> cfgDoPhotonClassPairCut{"cfgDoPhotonClassPairCut", false, "apply photon-class pair selection A x B (leg track composition, PCM-PCM only)"};

struct : o2::framework::ConfigurableGroup {
std::string prefix = "photonclassA_group";
o2::framework::Configurable<int> cfgMinNLegsITSTPC{"cfgMinNLegsITSTPC", 0, "min number of ITS-TPC legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsITSTPC{"cfgMaxNLegsITSTPC", 2, "max number of ITS-TPC legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsITSOnly{"cfgMinNLegsITSOnly", 0, "min number of ITS-only legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsITSOnly{"cfgMaxNLegsITSOnly", 2, "max number of ITS-only legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTPCOnly{"cfgMinNLegsTPCOnly", 0, "min number of TPC-only legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTPCOnly{"cfgMaxNLegsTPCOnly", 2, "max number of TPC-only legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTRD{"cfgMinNLegsTRD", 0, "min number of legs with TRD (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTRD{"cfgMaxNLegsTRD", 2, "max number of legs with TRD (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTOF{"cfgMinNLegsTOF", 0, "min number of legs with TOF (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTOF{"cfgMaxNLegsTOF", 2, "max number of legs with TOF (0-2)"};
} photonclassA;

struct : o2::framework::ConfigurableGroup {
std::string prefix = "photonclassB_group";
o2::framework::Configurable<int> cfgMinNLegsITSTPC{"cfgMinNLegsITSTPC", 0, "min number of ITS-TPC legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsITSTPC{"cfgMaxNLegsITSTPC", 2, "max number of ITS-TPC legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsITSOnly{"cfgMinNLegsITSOnly", 0, "min number of ITS-only legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsITSOnly{"cfgMaxNLegsITSOnly", 2, "max number of ITS-only legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTPCOnly{"cfgMinNLegsTPCOnly", 0, "min number of TPC-only legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTPCOnly{"cfgMaxNLegsTPCOnly", 2, "max number of TPC-only legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTRD{"cfgMinNLegsTRD", 0, "min number of legs with TRD (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTRD{"cfgMaxNLegsTRD", 2, "max number of legs with TRD (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTOF{"cfgMinNLegsTOF", 0, "min number of legs with TOF (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTOF{"cfgMaxNLegsTOF", 2, "max number of legs with TOF (0-2)"};
} photonclassB;

EMPhotonEventCut fEMEventCut;
struct : o2::framework::ConfigurableGroup {
std::string prefix = "eventcut_group";
Expand Down Expand Up @@ -371,6 +402,9 @@
}
};

o2::aod::pwgem::photonmeson::utils::pairutil::V0PhotonClassSelection mPhotonClassSelA{};
o2::aod::pwgem::photonmeson::utils::pairutil::V0PhotonClassSelection mPhotonClassSelB{};

void init(o2::framework::InitContext&)
{
zvtx_bin_edges = std::vector<float>(ConfVtxBins.value.begin(), ConfVtxBins.value.end());
Expand All @@ -397,6 +431,9 @@
}
DefineEMEventCut();
DefinePCMCut();

mPhotonClassSelA = o2::aod::pwgem::photonmeson::utils::pairutil::buildV0PhotonClassSelection(photonclassA);
mPhotonClassSelB = o2::aod::pwgem::photonmeson::utils::pairutil::buildV0PhotonClassSelection(photonclassB);
DefineDileptonCut();
DefineEMCCut();
DefinePHOSCut();
Expand Down Expand Up @@ -424,10 +461,10 @@
}

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

Check failure on line 464 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.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 467 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.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 @@ -636,7 +673,7 @@
void RotationBackground(const ROOT::Math::PtEtaPhiMVector& meson, ROOT::Math::PtEtaPhiMVector photon1, ROOT::Math::PtEtaPhiMVector photon2, TPhotons const& photons_coll, unsigned int ig1, unsigned int ig2, float eventWeight)
{
// if less than 3 clusters are present skip event since we need at least 3 clusters
if (photons_coll.size() < 3) {

Check failure on line 676 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.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.
return;
}
const float rotationAngle = o2::constants::math::PIHalf; // rotaion angle 90 degree
Expand Down Expand Up @@ -746,7 +783,7 @@
int zbin = lower_bound(zvtx_bin_edges.begin(), zvtx_bin_edges.end(), collision.posZ()) - zvtx_bin_edges.begin() - 1;
if (zbin < 0) {
zbin = 0;
} else if (static_cast<int>(zvtx_bin_edges.size()) - 2 < zbin) {

Check failure on line 786 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.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.
zbin = static_cast<int>(zvtx_bin_edges.size()) - 2;
}

Expand All @@ -754,7 +791,7 @@
int centbin = lower_bound(cent_bin_edges.begin(), cent_bin_edges.end(), centrality) - cent_bin_edges.begin() - 1;
if (centbin < 0) {
centbin = 0;
} else if (static_cast<int>(cent_bin_edges.size()) - 2 < centbin) {

Check failure on line 794 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.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.
centbin = static_cast<int>(cent_bin_edges.size()) - 2;
}

Expand All @@ -762,7 +799,7 @@
int epbin = lower_bound(ep_bin_edges.begin(), ep_bin_edges.end(), ep2) - ep_bin_edges.begin() - 1;
if (epbin < 0) {
epbin = 0;
} else if (static_cast<int>(ep_bin_edges.size()) - 2 < epbin) {

Check failure on line 802 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.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.
epbin = static_cast<int>(ep_bin_edges.size()) - 2;
}

Expand All @@ -775,7 +812,7 @@

if (occbin < 0) {
occbin = 0;
} else if (static_cast<int>(occ_bin_edges.size()) - 2 < occbin) {

Check failure on line 815 in PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.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.
occbin = static_cast<int>(occ_bin_edges.size()) - 2;
}

Expand All @@ -799,6 +836,7 @@
continue;
}
}

auto pos1 = g1.template posTrack_as<TLegs>();
auto ele1 = g1.template negTrack_as<TLegs>();
ROOT::Math::PtEtaPhiMVector v_gamma(g1.pt(), g1.eta(), g1.phi(), 0.);
Expand Down Expand Up @@ -882,6 +920,20 @@
}
}

o2::aod::pwgem::photonmeson::utils::pairutil::V0PhotonLegCounts legCounts1{}, legCounts2{};
if constexpr (std::is_same_v<TDetectorTag1, PCMTag> && std::is_same_v<TDetectorTag2, PCMTag>) {
auto pos1 = g1.template posTrack_as<TLegs>();
auto neg1 = g1.template negTrack_as<TLegs>();
auto pos2 = g2.template posTrack_as<TLegs>();
auto neg2 = g2.template negTrack_as<TLegs>();
legCounts1 = o2::aod::pwgem::photonmeson::utils::pairutil::getV0PhotonLegCounts(pos1, neg1);
legCounts2 = o2::aod::pwgem::photonmeson::utils::pairutil::getV0PhotonLegCounts(pos2, neg2);
if (cfgDoPhotonClassPairCut.value &&
!o2::aod::pwgem::photonmeson::utils::pairutil::isPairPhotonClassSelected(legCounts1, legCounts2, mPhotonClassSelA, mPhotonClassSelB)) {
continue;
}
}

ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
Expand Down Expand Up @@ -920,11 +972,19 @@
fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), wpair);

if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) {
emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::photonmeson::utils::EMPhoton(g1.pt(), g1.eta(), g1.phi(), 0));
auto emphoton1 = o2::aod::pwgem::photonmeson::utils::EMPhoton(g1.pt(), g1.eta(), g1.phi(), 0);
if constexpr (std::is_same_v<TDetectorTag1, PCMTag> && std::is_same_v<TDetectorTag2, PCMTag>) {
emphoton1.setLegCounts(legCounts1);
}
emh1->AddTrackToEventPool(key_df_collision, emphoton1);
used_photonIds_per_col.emplace_back(g1.globalIndex());
}
if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) {
emh2->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::photonmeson::utils::EMPhoton(g2.pt(), g2.eta(), g2.phi(), 0));
auto emphoton2 = o2::aod::pwgem::photonmeson::utils::EMPhoton(g2.pt(), g2.eta(), g2.phi(), 0);
if constexpr (std::is_same_v<TDetectorTag1, PCMTag> && std::is_same_v<TDetectorTag2, PCMTag>) {
emphoton2.setLegCounts(legCounts1);
}
emh2->AddTrackToEventPool(key_df_collision, emphoton2);
used_photonIds_per_col.emplace_back(g2.globalIndex());
}
ndiphoton++;
Expand Down Expand Up @@ -969,6 +1029,14 @@

for (const auto& g1 : selected_photons1_in_this_event) {
for (const auto& g2 : photons1_from_event_pool) {
if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) {
if (cfgDoPhotonClassPairCut.value) {
if (!g1.hasLegCounts() || !g2.hasLegCounts() ||
!o2::aod::pwgem::photonmeson::utils::pairutil::isPairPhotonClassSelected(g1.legCounts(), g2.legCounts(), mPhotonClassSelA, mPhotonClassSelB)) {
continue;
}
}
}
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
Expand Down
44 changes: 44 additions & 0 deletions PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include <TPDGCode.h>
#include <TString.h>

#include <array>
#include <cmath>
#include <cstddef>
#include <cstdint>
Expand Down Expand Up @@ -95,6 +96,36 @@ struct Pi0EtaToGammaGammaMC {
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"};

o2::framework::Configurable<bool> cfgDoPhotonClassPairCut{"cfgDoPhotonClassPairCut", false, "apply photon-class pair selection A x B (leg track composition, PCM-PCM only)"};

struct : o2::framework::ConfigurableGroup {
std::string prefix = "photonclassA_group";
o2::framework::Configurable<int> cfgMinNLegsITSTPC{"cfgMinNLegsITSTPC", 0, "min number of ITS-TPC legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsITSTPC{"cfgMaxNLegsITSTPC", 2, "max number of ITS-TPC legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsITSOnly{"cfgMinNLegsITSOnly", 0, "min number of ITS-only legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsITSOnly{"cfgMaxNLegsITSOnly", 2, "max number of ITS-only legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTPCOnly{"cfgMinNLegsTPCOnly", 0, "min number of TPC-only legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTPCOnly{"cfgMaxNLegsTPCOnly", 2, "max number of TPC-only legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTRD{"cfgMinNLegsTRD", 0, "min number of legs with TRD (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTRD{"cfgMaxNLegsTRD", 2, "max number of legs with TRD (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTOF{"cfgMinNLegsTOF", 0, "min number of legs with TOF (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTOF{"cfgMaxNLegsTOF", 2, "max number of legs with TOF (0-2)"};
} photonclassA;

struct : o2::framework::ConfigurableGroup {
std::string prefix = "photonclassB_group";
o2::framework::Configurable<int> cfgMinNLegsITSTPC{"cfgMinNLegsITSTPC", 0, "min number of ITS-TPC legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsITSTPC{"cfgMaxNLegsITSTPC", 2, "max number of ITS-TPC legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsITSOnly{"cfgMinNLegsITSOnly", 0, "min number of ITS-only legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsITSOnly{"cfgMaxNLegsITSOnly", 2, "max number of ITS-only legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTPCOnly{"cfgMinNLegsTPCOnly", 0, "min number of TPC-only legs (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTPCOnly{"cfgMaxNLegsTPCOnly", 2, "max number of TPC-only legs (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTRD{"cfgMinNLegsTRD", 0, "min number of legs with TRD (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTRD{"cfgMaxNLegsTRD", 2, "max number of legs with TRD (0-2)"};
o2::framework::Configurable<int> cfgMinNLegsTOF{"cfgMinNLegsTOF", 0, "min number of legs with TOF (0-2)"};
o2::framework::Configurable<int> cfgMaxNLegsTOF{"cfgMaxNLegsTOF", 2, "max number of legs with TOF (0-2)"};
} photonclassB;

EMPhotonEventCut fEMEventCut;
struct : o2::framework::ConfigurableGroup {
std::string prefix = "eventcut_group";
Expand All @@ -116,6 +147,9 @@ struct Pi0EtaToGammaGammaMC {
o2::framework::Configurable<bool> onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"};
} eventcuts;

o2::aod::pwgem::photonmeson::utils::pairutil::V0PhotonClassSelection mPhotonClassSelA{};
o2::aod::pwgem::photonmeson::utils::pairutil::V0PhotonClassSelection mPhotonClassSelB{};

V0PhotonCut fV0PhotonCut;
struct : o2::framework::ConfigurableGroup {
std::string prefix = "pcmcut_group";
Expand Down Expand Up @@ -249,6 +283,8 @@ struct Pi0EtaToGammaGammaMC {
}
DefineEMEventCut();
DefinePCMCut();
mPhotonClassSelA = o2::aod::pwgem::photonmeson::utils::pairutil::buildV0PhotonClassSelection(photonclassA);
mPhotonClassSelB = o2::aod::pwgem::photonmeson::utils::pairutil::buildV0PhotonClassSelection(photonclassB);
DefineDileptonCut();
DefineEMCCut();
DefinePHOSCut();
Expand Down Expand Up @@ -650,6 +686,14 @@ struct Pi0EtaToGammaGammaMC {
auto pos2 = g2.template posTrack_as<TLegs>();
auto ele2 = g2.template negTrack_as<TLegs>();

if (cfgDoPhotonClassPairCut.value &&
!o2::aod::pwgem::photonmeson::utils::pairutil::isPairPhotonClassSelected(
o2::aod::pwgem::photonmeson::utils::pairutil::getV0PhotonLegCounts(pos1, ele1),
o2::aod::pwgem::photonmeson::utils::pairutil::getV0PhotonLegCounts(pos2, ele2),
mPhotonClassSelA, mPhotonClassSelB)) {
continue;
}

auto pos1mc = pos1.template emmcparticle_as<TMCParticles>();
auto ele1mc = ele1.template emmcparticle_as<TMCParticles>();
auto pos2mc = pos2.template emmcparticle_as<TMCParticles>();
Expand Down
Loading
Loading