2727#include " Common/DataModel/TrackSelectionTables.h"
2828#include " Common/DataModel/EventSelection.h"
2929
30+ #include " TDatabasePDG.h"
31+
3032using namespace o2 ;
3133using namespace o2 ::framework;
3234using 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