Skip to content

Commit 71eaa7b

Browse files
SteffimroStefanie Mrozinski
andauthored
PWGJE/mcGeneratorStudies: Added charged particle only selection (#10365)
Co-authored-by: Stefanie Mrozinski <steffimrozinski@Stefanies-MacBook-Pro.local>
1 parent 9aa6cc8 commit 71eaa7b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

PWGJE/Tasks/mcGeneratorStudies.cxx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "Common/DataModel/TrackSelectionTables.h"
2828
#include "Common/DataModel/EventSelection.h"
2929

30+
#include "TDatabasePDG.h"
31+
3032
using namespace o2;
3133
using namespace o2::framework;
3234
using namespace o2::framework::expressions;
@@ -40,6 +42,8 @@ struct MCGeneratorStudies {
4042
Configurable<float> mVertexCut{"vertexCut", 10.f, "apply z-vertex cut with value in cm"};
4143
Configurable<float> mRapidityCut{"rapidityCut", 0.9f, "Maximum absolute rapidity of counted generated particles"};
4244
Configurable<int> mSelectedParticleCode{"particlePDGCode", 111, "PDG code of the particle to be investigated (0 for all)"};
45+
Configurable<bool> mSelectOnlyChargedParticles{"mSelectOnlyChargedParticles", false, "set true to only count charged particles"};
46+
4347
Configurable<bool> mRequireGammaGammaDecay{"requireGammaGammaDecay", false, "Only count generated particles that decayed into two photons"};
4448
Configurable<bool> mRequireEMCCellContent{"requireEMCCellContent", false, "Ask forEMCal cell content instead of the kTVXinEMC trigger"};
4549

@@ -145,6 +149,8 @@ struct MCGeneratorStudies {
145149
for (auto& mcParticle : mcParticles_inColl) {
146150
if (mSelectedParticleCode != 0 && mcParticle.pdgCode() != mSelectedParticleCode)
147151
continue;
152+
else if (mSelectOnlyChargedParticles && TDatabasePDG::Instance()->GetParticle(mcParticle.pdgCode())->Charge())
153+
continue;
148154
if (fabs(mcParticle.y()) > mRapidityCut)
149155
continue;
150156
if (!mcParticle.isPhysicalPrimary() && !mcParticle.producedByGenerator())
@@ -170,6 +176,8 @@ struct MCGeneratorStudies {
170176
for (auto& mcParticle : mcParticles_inColl) {
171177
if (mSelectedParticleCode != 0 && mcParticle.pdgCode() != mSelectedParticleCode)
172178
continue;
179+
else if (mSelectOnlyChargedParticles && TDatabasePDG::Instance()->GetParticle(mcParticle.pdgCode())->Charge())
180+
continue;
173181
if (fabs(mcParticle.y()) > mRapidityCut)
174182
continue;
175183
if (!mcParticle.isPhysicalPrimary() && !mcParticle.producedByGenerator())

0 commit comments

Comments
 (0)