Skip to content

Commit ea2bb6a

Browse files
SteffimroStefanie Mrozinskialibuild
authored
[PWGEM] fix code-checker issues + add V0-photon track selection for photon pairs (#17128)
fixed the code-checker issues in the photonhbt.cxx task which popped up in the pull request ([PWGEM] Rewise phi-star separation cuts #17040) added a configurable for the photon pairs. This allows to select the leg track composition of the two V0 photons (counts of ITS-TPC, ITS-only, TPC-only, TRD, TOF legs per photon, class A or B). The selection is applied in same-event pairing and propagated to event mixing by storing the leg counts in the mixing pool. Disabled by default (cfgDoPhotonClassPairCut = false). Co-authored-by: Stefanie Mrozinski <stefanie.mrozinski@stud.uni-frankfurt.de> Co-authored-by: ALICE Action Bot <alibuild@cern.ch>
1 parent 23eca0d commit ea2bb6a

5 files changed

Lines changed: 621 additions & 227 deletions

File tree

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGamma.h

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#include <Math/Vector4Dfwd.h>
6262

6363
#include <algorithm>
64+
#include <array>
6465
#include <cmath>
6566
#include <cstddef>
6667
#include <cstdint>
@@ -104,6 +105,36 @@ struct Pi0EtaToGammaGamma {
104105
o2::framework::Configurable<float> cfgAlphaMesonA{"cfgAlphaMesonA", 0.65, "photon energy asymmetry distribution parameter A for pT dependent cut (A * tanh(B*pT))"};
105106
o2::framework::Configurable<float> cfgAlphaMesonB{"cfgAlphaMesonB", 1.2, "photon energy asymmetry distribution parameter B for pT dependent cut (A * tanh(B*pT))"};
106107

108+
o2::framework::Configurable<bool> cfgDoPhotonClassPairCut{"cfgDoPhotonClassPairCut", false, "apply photon-class pair selection A x B (leg track composition, PCM-PCM only)"};
109+
110+
struct : o2::framework::ConfigurableGroup {
111+
std::string prefix = "photonclassA_group";
112+
o2::framework::Configurable<int> cfgMinNLegsITSTPC{"cfgMinNLegsITSTPC", 0, "min number of ITS-TPC legs (0-2)"};
113+
o2::framework::Configurable<int> cfgMaxNLegsITSTPC{"cfgMaxNLegsITSTPC", 2, "max number of ITS-TPC legs (0-2)"};
114+
o2::framework::Configurable<int> cfgMinNLegsITSOnly{"cfgMinNLegsITSOnly", 0, "min number of ITS-only legs (0-2)"};
115+
o2::framework::Configurable<int> cfgMaxNLegsITSOnly{"cfgMaxNLegsITSOnly", 2, "max number of ITS-only legs (0-2)"};
116+
o2::framework::Configurable<int> cfgMinNLegsTPCOnly{"cfgMinNLegsTPCOnly", 0, "min number of TPC-only legs (0-2)"};
117+
o2::framework::Configurable<int> cfgMaxNLegsTPCOnly{"cfgMaxNLegsTPCOnly", 2, "max number of TPC-only legs (0-2)"};
118+
o2::framework::Configurable<int> cfgMinNLegsTRD{"cfgMinNLegsTRD", 0, "min number of legs with TRD (0-2)"};
119+
o2::framework::Configurable<int> cfgMaxNLegsTRD{"cfgMaxNLegsTRD", 2, "max number of legs with TRD (0-2)"};
120+
o2::framework::Configurable<int> cfgMinNLegsTOF{"cfgMinNLegsTOF", 0, "min number of legs with TOF (0-2)"};
121+
o2::framework::Configurable<int> cfgMaxNLegsTOF{"cfgMaxNLegsTOF", 2, "max number of legs with TOF (0-2)"};
122+
} photonclassA;
123+
124+
struct : o2::framework::ConfigurableGroup {
125+
std::string prefix = "photonclassB_group";
126+
o2::framework::Configurable<int> cfgMinNLegsITSTPC{"cfgMinNLegsITSTPC", 0, "min number of ITS-TPC legs (0-2)"};
127+
o2::framework::Configurable<int> cfgMaxNLegsITSTPC{"cfgMaxNLegsITSTPC", 2, "max number of ITS-TPC legs (0-2)"};
128+
o2::framework::Configurable<int> cfgMinNLegsITSOnly{"cfgMinNLegsITSOnly", 0, "min number of ITS-only legs (0-2)"};
129+
o2::framework::Configurable<int> cfgMaxNLegsITSOnly{"cfgMaxNLegsITSOnly", 2, "max number of ITS-only legs (0-2)"};
130+
o2::framework::Configurable<int> cfgMinNLegsTPCOnly{"cfgMinNLegsTPCOnly", 0, "min number of TPC-only legs (0-2)"};
131+
o2::framework::Configurable<int> cfgMaxNLegsTPCOnly{"cfgMaxNLegsTPCOnly", 2, "max number of TPC-only legs (0-2)"};
132+
o2::framework::Configurable<int> cfgMinNLegsTRD{"cfgMinNLegsTRD", 0, "min number of legs with TRD (0-2)"};
133+
o2::framework::Configurable<int> cfgMaxNLegsTRD{"cfgMaxNLegsTRD", 2, "max number of legs with TRD (0-2)"};
134+
o2::framework::Configurable<int> cfgMinNLegsTOF{"cfgMinNLegsTOF", 0, "min number of legs with TOF (0-2)"};
135+
o2::framework::Configurable<int> cfgMaxNLegsTOF{"cfgMaxNLegsTOF", 2, "max number of legs with TOF (0-2)"};
136+
} photonclassB;
137+
107138
EMPhotonEventCut fEMEventCut;
108139
struct : o2::framework::ConfigurableGroup {
109140
std::string prefix = "eventcut_group";
@@ -371,6 +402,9 @@ struct Pi0EtaToGammaGamma {
371402
}
372403
};
373404

405+
o2::aod::pwgem::photonmeson::utils::pairutil::V0PhotonClassSelection mPhotonClassSelA{};
406+
o2::aod::pwgem::photonmeson::utils::pairutil::V0PhotonClassSelection mPhotonClassSelB{};
407+
374408
void init(o2::framework::InitContext&)
375409
{
376410
zvtx_bin_edges = std::vector<float>(ConfVtxBins.value.begin(), ConfVtxBins.value.end());
@@ -397,6 +431,9 @@ struct Pi0EtaToGammaGamma {
397431
}
398432
DefineEMEventCut();
399433
DefinePCMCut();
434+
435+
mPhotonClassSelA = o2::aod::pwgem::photonmeson::utils::pairutil::buildV0PhotonClassSelection(photonclassA);
436+
mPhotonClassSelB = o2::aod::pwgem::photonmeson::utils::pairutil::buildV0PhotonClassSelection(photonclassB);
400437
DefineDileptonCut();
401438
DefineEMCCut();
402439
DefinePHOSCut();
@@ -799,6 +836,7 @@ struct Pi0EtaToGammaGamma {
799836
continue;
800837
}
801838
}
839+
802840
auto pos1 = g1.template posTrack_as<TLegs>();
803841
auto ele1 = g1.template negTrack_as<TLegs>();
804842
ROOT::Math::PtEtaPhiMVector v_gamma(g1.pt(), g1.eta(), g1.phi(), 0.);
@@ -882,6 +920,20 @@ struct Pi0EtaToGammaGamma {
882920
}
883921
}
884922

923+
o2::aod::pwgem::photonmeson::utils::pairutil::V0PhotonLegCounts legCounts1{}, legCounts2{};
924+
if constexpr (std::is_same_v<TDetectorTag1, PCMTag> && std::is_same_v<TDetectorTag2, PCMTag>) {
925+
auto pos1 = g1.template posTrack_as<TLegs>();
926+
auto neg1 = g1.template negTrack_as<TLegs>();
927+
auto pos2 = g2.template posTrack_as<TLegs>();
928+
auto neg2 = g2.template negTrack_as<TLegs>();
929+
legCounts1 = o2::aod::pwgem::photonmeson::utils::pairutil::getV0PhotonLegCounts(pos1, neg1);
930+
legCounts2 = o2::aod::pwgem::photonmeson::utils::pairutil::getV0PhotonLegCounts(pos2, neg2);
931+
if (cfgDoPhotonClassPairCut.value &&
932+
!o2::aod::pwgem::photonmeson::utils::pairutil::isPairPhotonClassSelected(legCounts1, legCounts2, mPhotonClassSelA, mPhotonClassSelB)) {
933+
continue;
934+
}
935+
}
936+
885937
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
886938
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
887939
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;
@@ -920,11 +972,19 @@ struct Pi0EtaToGammaGamma {
920972
fRegistry.fill(HIST("Pair/same/hs"), v12.M(), v12.Pt(), wpair);
921973

922974
if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g1.globalIndex()) == used_photonIds_per_col.end()) {
923-
emh1->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::photonmeson::utils::EMPhoton(g1.pt(), g1.eta(), g1.phi(), 0));
975+
auto emphoton1 = o2::aod::pwgem::photonmeson::utils::EMPhoton(g1.pt(), g1.eta(), g1.phi(), 0);
976+
if constexpr (std::is_same_v<TDetectorTag1, PCMTag> && std::is_same_v<TDetectorTag2, PCMTag>) {
977+
emphoton1.setLegCounts(legCounts1);
978+
}
979+
emh1->AddTrackToEventPool(key_df_collision, emphoton1);
924980
used_photonIds_per_col.emplace_back(g1.globalIndex());
925981
}
926982
if (std::find(used_photonIds_per_col.begin(), used_photonIds_per_col.end(), g2.globalIndex()) == used_photonIds_per_col.end()) {
927-
emh2->AddTrackToEventPool(key_df_collision, o2::aod::pwgem::photonmeson::utils::EMPhoton(g2.pt(), g2.eta(), g2.phi(), 0));
983+
auto emphoton2 = o2::aod::pwgem::photonmeson::utils::EMPhoton(g2.pt(), g2.eta(), g2.phi(), 0);
984+
if constexpr (std::is_same_v<TDetectorTag1, PCMTag> && std::is_same_v<TDetectorTag2, PCMTag>) {
985+
emphoton2.setLegCounts(legCounts1);
986+
}
987+
emh2->AddTrackToEventPool(key_df_collision, emphoton2);
928988
used_photonIds_per_col.emplace_back(g2.globalIndex());
929989
}
930990
ndiphoton++;
@@ -969,6 +1029,14 @@ struct Pi0EtaToGammaGamma {
9691029

9701030
for (const auto& g1 : selected_photons1_in_this_event) {
9711031
for (const auto& g2 : photons1_from_event_pool) {
1032+
if constexpr (pairtype == o2::aod::pwgem::photonmeson::photonpair::PairType::kPCMPCM) {
1033+
if (cfgDoPhotonClassPairCut.value) {
1034+
if (!g1.hasLegCounts() || !g2.hasLegCounts() ||
1035+
!o2::aod::pwgem::photonmeson::utils::pairutil::isPairPhotonClassSelected(g1.legCounts(), g2.legCounts(), mPhotonClassSelA, mPhotonClassSelB)) {
1036+
continue;
1037+
}
1038+
}
1039+
}
9721040
ROOT::Math::PtEtaPhiMVector v1(g1.pt(), g1.eta(), g1.phi(), 0.);
9731041
ROOT::Math::PtEtaPhiMVector v2(g2.pt(), g2.eta(), g2.phi(), 0.);
9741042
ROOT::Math::PtEtaPhiMVector v12 = v1 + v2;

PWGEM/PhotonMeson/Core/Pi0EtaToGammaGammaMC.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
#include <TPDGCode.h>
6060
#include <TString.h>
6161

62+
#include <array>
6263
#include <cmath>
6364
#include <cstddef>
6465
#include <cstdint>
@@ -95,6 +96,36 @@ struct Pi0EtaToGammaGammaMC {
9596
o2::framework::Configurable<float> cfgAlphaMesonB{"cfgAlphaMesonB", 1.2, "photon energy asymmetry distribution parameter B for pT dependent cut (A * tanh(B*pT))"};
9697
o2::framework::Configurable<bool> cfgGGContaCheck{"cfgGGContaCheck", false, "check gamma gamma contamination of dalitz"};
9798

99+
o2::framework::Configurable<bool> cfgDoPhotonClassPairCut{"cfgDoPhotonClassPairCut", false, "apply photon-class pair selection A x B (leg track composition, PCM-PCM only)"};
100+
101+
struct : o2::framework::ConfigurableGroup {
102+
std::string prefix = "photonclassA_group";
103+
o2::framework::Configurable<int> cfgMinNLegsITSTPC{"cfgMinNLegsITSTPC", 0, "min number of ITS-TPC legs (0-2)"};
104+
o2::framework::Configurable<int> cfgMaxNLegsITSTPC{"cfgMaxNLegsITSTPC", 2, "max number of ITS-TPC legs (0-2)"};
105+
o2::framework::Configurable<int> cfgMinNLegsITSOnly{"cfgMinNLegsITSOnly", 0, "min number of ITS-only legs (0-2)"};
106+
o2::framework::Configurable<int> cfgMaxNLegsITSOnly{"cfgMaxNLegsITSOnly", 2, "max number of ITS-only legs (0-2)"};
107+
o2::framework::Configurable<int> cfgMinNLegsTPCOnly{"cfgMinNLegsTPCOnly", 0, "min number of TPC-only legs (0-2)"};
108+
o2::framework::Configurable<int> cfgMaxNLegsTPCOnly{"cfgMaxNLegsTPCOnly", 2, "max number of TPC-only legs (0-2)"};
109+
o2::framework::Configurable<int> cfgMinNLegsTRD{"cfgMinNLegsTRD", 0, "min number of legs with TRD (0-2)"};
110+
o2::framework::Configurable<int> cfgMaxNLegsTRD{"cfgMaxNLegsTRD", 2, "max number of legs with TRD (0-2)"};
111+
o2::framework::Configurable<int> cfgMinNLegsTOF{"cfgMinNLegsTOF", 0, "min number of legs with TOF (0-2)"};
112+
o2::framework::Configurable<int> cfgMaxNLegsTOF{"cfgMaxNLegsTOF", 2, "max number of legs with TOF (0-2)"};
113+
} photonclassA;
114+
115+
struct : o2::framework::ConfigurableGroup {
116+
std::string prefix = "photonclassB_group";
117+
o2::framework::Configurable<int> cfgMinNLegsITSTPC{"cfgMinNLegsITSTPC", 0, "min number of ITS-TPC legs (0-2)"};
118+
o2::framework::Configurable<int> cfgMaxNLegsITSTPC{"cfgMaxNLegsITSTPC", 2, "max number of ITS-TPC legs (0-2)"};
119+
o2::framework::Configurable<int> cfgMinNLegsITSOnly{"cfgMinNLegsITSOnly", 0, "min number of ITS-only legs (0-2)"};
120+
o2::framework::Configurable<int> cfgMaxNLegsITSOnly{"cfgMaxNLegsITSOnly", 2, "max number of ITS-only legs (0-2)"};
121+
o2::framework::Configurable<int> cfgMinNLegsTPCOnly{"cfgMinNLegsTPCOnly", 0, "min number of TPC-only legs (0-2)"};
122+
o2::framework::Configurable<int> cfgMaxNLegsTPCOnly{"cfgMaxNLegsTPCOnly", 2, "max number of TPC-only legs (0-2)"};
123+
o2::framework::Configurable<int> cfgMinNLegsTRD{"cfgMinNLegsTRD", 0, "min number of legs with TRD (0-2)"};
124+
o2::framework::Configurable<int> cfgMaxNLegsTRD{"cfgMaxNLegsTRD", 2, "max number of legs with TRD (0-2)"};
125+
o2::framework::Configurable<int> cfgMinNLegsTOF{"cfgMinNLegsTOF", 0, "min number of legs with TOF (0-2)"};
126+
o2::framework::Configurable<int> cfgMaxNLegsTOF{"cfgMaxNLegsTOF", 2, "max number of legs with TOF (0-2)"};
127+
} photonclassB;
128+
98129
EMPhotonEventCut fEMEventCut;
99130
struct : o2::framework::ConfigurableGroup {
100131
std::string prefix = "eventcut_group";
@@ -116,6 +147,9 @@ struct Pi0EtaToGammaGammaMC {
116147
o2::framework::Configurable<bool> onlyKeepWeightedEvents{"onlyKeepWeightedEvents", false, "flag to keep only weighted events (for JJ MCs) and remove all MB events (with weight = 1)"};
117148
} eventcuts;
118149

150+
o2::aod::pwgem::photonmeson::utils::pairutil::V0PhotonClassSelection mPhotonClassSelA{};
151+
o2::aod::pwgem::photonmeson::utils::pairutil::V0PhotonClassSelection mPhotonClassSelB{};
152+
119153
V0PhotonCut fV0PhotonCut;
120154
struct : o2::framework::ConfigurableGroup {
121155
std::string prefix = "pcmcut_group";
@@ -249,6 +283,8 @@ struct Pi0EtaToGammaGammaMC {
249283
}
250284
DefineEMEventCut();
251285
DefinePCMCut();
286+
mPhotonClassSelA = o2::aod::pwgem::photonmeson::utils::pairutil::buildV0PhotonClassSelection(photonclassA);
287+
mPhotonClassSelB = o2::aod::pwgem::photonmeson::utils::pairutil::buildV0PhotonClassSelection(photonclassB);
252288
DefineDileptonCut();
253289
DefineEMCCut();
254290
DefinePHOSCut();
@@ -650,6 +686,14 @@ struct Pi0EtaToGammaGammaMC {
650686
auto pos2 = g2.template posTrack_as<TLegs>();
651687
auto ele2 = g2.template negTrack_as<TLegs>();
652688

689+
if (cfgDoPhotonClassPairCut.value &&
690+
!o2::aod::pwgem::photonmeson::utils::pairutil::isPairPhotonClassSelected(
691+
o2::aod::pwgem::photonmeson::utils::pairutil::getV0PhotonLegCounts(pos1, ele1),
692+
o2::aod::pwgem::photonmeson::utils::pairutil::getV0PhotonLegCounts(pos2, ele2),
693+
mPhotonClassSelA, mPhotonClassSelB)) {
694+
continue;
695+
}
696+
653697
auto pos1mc = pos1.template emmcparticle_as<TMCParticles>();
654698
auto ele1mc = ele1.template emmcparticle_as<TMCParticles>();
655699
auto pos2mc = pos2.template emmcparticle_as<TMCParticles>();

0 commit comments

Comments
 (0)