Skip to content

Commit 26e60d8

Browse files
authored
[PWGCF] Update femto framework (#14592)
1 parent fcde3bc commit 26e60d8

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

PWGCF/Femto/Core/particleCleaner.h

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ template <const char* Prefix>
3030
struct ConfParticleCleaner : o2::framework::ConfigurableGroup {
3131
std::string prefix = std::string(Prefix);
3232
o2::framework::Configurable<bool> activate{"activate", false, "Activate particle cleaner"};
33-
o2::framework::Configurable<int> pdgCode{"pdgCode", 0, "Only consider particles with this exact pdg code (including the sign!). If set to 0, this is cut is ignored"};
33+
o2::framework::Configurable<std::vector<int>> requiredPdgCodes{"requiredPdgCodes", {}, "Only consider particles with this exact pdg code (including the sign!)"};
34+
o2::framework::Configurable<std::vector<int>> rejectedPdgCodes{"rejectedPdgCodes", {}, "Reject particles with this exact pdg code (including the sign!)"};
3435
o2::framework::Configurable<bool> rejectedParticleWithoutMcInformation{"rejectedParticleWithoutMcInformation", true, "If true, all particles which have no associated MC information, are rejected by default"};
3536
o2::framework::Configurable<std::vector<int>> requiredMotherPdgCodes{"requiredMotherPdgCodes", {}, "Only consider particles whose mothers have one of the supplied pdg codes (inclduing the sign!)"};
3637
o2::framework::Configurable<std::vector<int>> rejectMotherPdgCodes{"rejectMotherPdgCodes", {}, "Only consider particles whose mothers do not have one of the supplied pdg codes (inclduing the sign!)"};
@@ -85,10 +86,15 @@ class ParticleCleaner
8586
void init(T const& confMpc)
8687
{
8788
mActivate = confMpc.activate.value;
89+
8890
mRejectParticleWithoutMcInformation = confMpc.rejectedParticleWithoutMcInformation.value;
89-
mPdgCode = confMpc.pdgCode.value;
91+
92+
mRequiredPdgCodes = confMpc.requiredPdgCodes.value;
93+
mRejectedPdgCodes = confMpc.rejectedPdgCodes.value;
94+
9095
mRequiredMotherPdgCodes = confMpc.requiredMotherPdgCodes.value;
9196
mRejectMotherPdgCodes = confMpc.rejectMotherPdgCodes.value;
97+
9298
mRequiredPartonicMotherPdgCodes = confMpc.requiredPartonicMotherPdgCodes.value;
9399
mRejectPartonicMotherPdgCodes = confMpc.rejectPartonicMotherPdgCodes.value;
94100
}
@@ -110,9 +116,26 @@ class ParticleCleaner
110116
}
111117
// perfrom cuts based on mc information of the particle itself
112118
auto mcParticle = particle.template fMcParticle_as<T2>();
113-
if (mPdgCode != 0) {
114-
if (mPdgCode != mcParticle.pdgCode()) {
115-
return false;
119+
120+
// if list is empty, set it to true and skip the looop
121+
bool hasRequiredPdgCode = true;
122+
if (!mRequiredPdgCodes.empty()) {
123+
hasRequiredPdgCode = false;
124+
for (int const& pdgCode : mRequiredPdgCodes) {
125+
if (pdgCode == mcParticle.pdgCode()) {
126+
hasRequiredPdgCode = true;
127+
break;
128+
}
129+
}
130+
}
131+
132+
bool hasRejectedPdgCode = false;
133+
if (!mRejectedPdgCodes.empty()) {
134+
for (int const& pdgCode : mRejectedPdgCodes) {
135+
if (pdgCode == mcParticle.pdgCode()) {
136+
hasRejectedPdgCode = true;
137+
break;
138+
}
116139
}
117140
}
118141

@@ -166,14 +189,16 @@ class ParticleCleaner
166189
}
167190
}
168191

169-
return hasMotherWithRequiredPdgCode && !hasMotherWithRejectedPdgCode &&
192+
return hasRequiredPdgCode && !hasRejectedPdgCode &&
193+
hasMotherWithRequiredPdgCode && !hasMotherWithRejectedPdgCode &&
170194
hasPartonicMotherWithRequiredPdgCode && !hasPartonicMotherWithRejectedPdgCode;
171195
}
172196

173197
private:
174198
bool mActivate = false;
175199
bool mRejectParticleWithoutMcInformation = true;
176-
int mPdgCode = 0;
200+
std::vector<int> mRequiredPdgCodes = {};
201+
std::vector<int> mRejectedPdgCodes = {};
177202
std::vector<int> mRequiredMotherPdgCodes{};
178203
std::vector<int> mRejectMotherPdgCodes{};
179204
std::vector<int> mRequiredPartonicMotherPdgCodes{};

0 commit comments

Comments
 (0)