@@ -42,12 +42,15 @@ struct chargedSpectra {
4242 Configurable<float > ptMinCut{" ptMinCut" , 0 .15f , " pt min cut" };
4343 Configurable<float > ptMaxCut{" ptMaxCut" , 10 .f , " pt max cut" };
4444
45+ Configurable<bool > normINELGT0{" normINELGT0" , false , " normalize INEL>0 according to MC" };
46+
4547 // helper struct to store transient properties
4648 struct varContainer {
4749 uint32_t multMeas{0u };
4850 uint32_t multTrue{0u };
4951 bool isAcceptedEvent{false };
5052 bool isAcceptedEventMC{false };
53+ bool isINELGT0EventMC{false };
5154 bool isChargedPrimary{false };
5255 };
5356 varContainer vars;
@@ -218,6 +221,10 @@ bool chargedSpectra::initParticle(const P& particle)
218221 return false ;
219222 }
220223 vars.isChargedPrimary = particle.isPhysicalPrimary ();
224+
225+ // event class is INEL>0 in case it has a charged particle in abs(eta) < 1
226+ vars.isINELGT0EventMC = vars.isINELGT0EventMC || (vars.isChargedPrimary && (std::abs (particle.eta ()) < 1 .));
227+
221228 if (std::abs (particle.eta ()) >= etaCut) {
222229 return false ;
223230 }
@@ -280,14 +287,16 @@ void chargedSpectra::initEvent(const C& collision, const T& tracks)
280287template <typename C, typename P>
281288void chargedSpectra::initEventMC (const C& collision, const P& particles)
282289{
290+ vars.isINELGT0EventMC = false ; // will be set to true in case a charged particle within eta +-1 is found
283291 vars.multTrue = 0 ;
284292 for (auto & particle : particles) {
285293 if (!initParticle (particle) || !vars.isChargedPrimary ) {
286294 continue ;
287295 }
288296 ++vars.multTrue ;
289297 }
290- vars.isAcceptedEventMC = ((std::abs (collision.posZ ()) < 10 .f ) && (vars.multTrue > 0 ));
298+ bool isGoodEventClass = (normINELGT0) ? vars.isINELGT0EventMC : (vars.multTrue > 0 );
299+ vars.isAcceptedEventMC = isGoodEventClass && (std::abs (collision.posZ ()) < 10 .f );
291300}
292301
293302// **************************************************************************************************
0 commit comments