ATLAS Offline Software
MultiElectronFilter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 
9 MultiElectronFilter::MultiElectronFilter(const std::string& name, ISvcLocator* pSvcLocator)
10 : GenFilter(name,pSvcLocator)
11 {
12  declareProperty("Ptcut",m_Ptmin = 10000.);
13  declareProperty("Etacut",m_EtaRange = 10.0);
14  declareProperty("NElectrons",m_NElectrons = 2);
15 }
16 
17 
20  int numElectrons = 0;
21  for (itr = events()->begin(); itr != events()->end(); ++itr) {
22  const HepMC::GenEvent* genEvt = (*itr);
23  for (const auto& part: *genEvt) {
24  if ( !MC::isStable(part)) continue;
25  if ( !MC::isElectron(part)) continue;
26  if ( (part->momentum().perp() >= m_Ptmin) && std::abs(part->momentum().pseudoRapidity()) <= m_EtaRange) {
27  numElectrons++;
28  }
29  }
30  }
31  ATH_MSG_DEBUG("Found " << numElectrons << " Electrons");
32  setFilterPassed(numElectrons >= m_NElectrons);
33  return StatusCode::SUCCESS;
34 }
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
MultiElectronFilter.h
AthCommonDataStore< AthCommonMsg< Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
MultiElectronFilter::m_EtaRange
double m_EtaRange
Definition: MultiElectronFilter.h:19
python.DataFormatRates.events
events
Definition: DataFormatRates.py:105
GenFilter
Base class for event generator filtering modules.
Definition: GenFilter.h:30
MultiElectronFilter::filterEvent
virtual StatusCode filterEvent()
Definition: MultiElectronFilter.cxx:18
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::EgammaHelpers::isElectron
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
Definition: EgammaxAODHelpers.cxx:12
MultiElectronFilter::m_NElectrons
int m_NElectrons
Definition: MultiElectronFilter.h:20
MultiElectronFilter::m_Ptmin
double m_Ptmin
Definition: MultiElectronFilter.h:18
MultiElectronFilter::MultiElectronFilter
MultiElectronFilter(const std::string &name, ISvcLocator *pSvcLocator)
Definition: MultiElectronFilter.cxx:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MC::isStable
bool isStable(const T &p)
Definition: HepMCHelpers.h:30
HepMCHelpers.h