ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
ISF::GenParticlePositionFilter Class Reference

#include <GenParticlePositionFilter.h>

Inheritance diagram for ISF::GenParticlePositionFilter:
Collaboration diagram for ISF::GenParticlePositionFilter:

Public Member Functions

 GenParticlePositionFilter (const std::string &t, const std::string &n, const IInterface *p)
 Constructor. More...
 
 ~GenParticlePositionFilter ()
 Destructor. More...
 
StatusCode initialize ()
 Athena algtool's Hooks. More...
 
StatusCode finalize ()
 
bool pass (const HepMC::GenParticle &particle) const
 does the given particle pass the filter? More...
 

Private Attributes

ServiceHandle< IGeoIDSvcm_geoIDSvc
 
std::vector< int > m_checkRegion
 

Detailed Description

Particle filter by position, to be used for initial GenEvent read-in.

Author
Andreas.Salzburger -at- cern.ch

Definition at line 34 of file GenParticlePositionFilter.h.

Constructor & Destructor Documentation

◆ GenParticlePositionFilter()

ISF::GenParticlePositionFilter::GenParticlePositionFilter ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Constructor.

Definition at line 18 of file GenParticlePositionFilter.cxx.

21  : base_class(t,n,p),
22  m_geoIDSvc("ISF_GeoIDSvc", n),
24 {
25  // the GeoID indentification service
26  declareProperty("GeoIDService",
27  m_geoIDSvc,
28  "The GeoID Service");
29  declareProperty("CheckRegion",
31  "Check if the given particles are within the specified regions");
32 }

◆ ~GenParticlePositionFilter()

ISF::GenParticlePositionFilter::~GenParticlePositionFilter ( )
inline

Destructor.

Definition at line 41 of file GenParticlePositionFilter.h.

41 {}

Member Function Documentation

◆ finalize()

StatusCode ISF::GenParticlePositionFilter::finalize ( )

Definition at line 98 of file GenParticlePositionFilter.cxx.

99 {
100  ATH_MSG_VERBOSE("Finalizing ...");
101  return StatusCode::SUCCESS;
102 }

◆ initialize()

StatusCode ISF::GenParticlePositionFilter::initialize ( )

Athena algtool's Hooks.

Definition at line 36 of file GenParticlePositionFilter.cxx.

37 {
38  ATH_MSG_VERBOSE("initialize()");
39 
40  // retrieve the GeoIDService
41  if ( m_geoIDSvc.retrieve().isFailure()){
42  ATH_MSG_ERROR( "Could not retrieve " << m_geoIDSvc << ". Abort.");
43  return StatusCode::FAILURE;
44  }
45 
46  ATH_MSG_VERBOSE("initialize() successful");
47  return StatusCode::SUCCESS;
48 }

◆ pass()

bool ISF::GenParticlePositionFilter::pass ( const HepMC::GenParticle particle) const

does the given particle pass the filter?

Definition at line 58 of file GenParticlePositionFilter.cxx.

59 {
60  // the GenParticle production vertex
61  HepMC::GenVertexPtr vtx = particle.production_vertex();
62 #endif
63 
64  // no production vertex?
65  if (!vtx) {
66  ATH_MSG_DEBUG("GenParticle does not have a production vertex, filtering it out");
67  return false;
68  }
69 
70  // (x,y,z,t) position
71  HepMC::FourVector pos = vtx->position();
72 
73  bool inside = false;
74  // check if the particle position is inside (or on surface)
75  // of any of the given ISF Simulation GeoIDs
76  std::vector<int>::const_iterator checkRegionIt = m_checkRegion.begin();
77  std::vector<int>::const_iterator checkRegionItEnd = m_checkRegion.end();
78  for ( ; (checkRegionIt!=checkRegionItEnd) && (!inside); ++checkRegionIt) {
79  // consult the GeoID identification service
80  ISF::InsideType insideCheck = m_geoIDSvc->inside( pos.x(),
81  pos.y(),
82  pos.z(),
83  AtlasDetDescr::AtlasRegion(*checkRegionIt) );
84  // is inside only if ==fInside or ==fSurface
85  inside |= (insideCheck==ISF::fInside) || (insideCheck==ISF::fSurface);
86  }
87 
88 
89  // return whether pos was inside any of the simulation geometries
90  if (inside)
91  ATH_MSG_VERBOSE("GenParticle is inside AtlasVolume and passed the filter");
92  else
93  ATH_MSG_VERBOSE("GenParticle is outside AtlasVolume and got fitered out");
94  return inside;
95 }

Member Data Documentation

◆ m_checkRegion

std::vector<int> ISF::GenParticlePositionFilter::m_checkRegion
private

Definition at line 56 of file GenParticlePositionFilter.h.

◆ m_geoIDSvc

ServiceHandle<IGeoIDSvc> ISF::GenParticlePositionFilter::m_geoIDSvc
private

Definition at line 55 of file GenParticlePositionFilter.h.


The documentation for this class was generated from the following files:
HepMC::GenVertexPtr
HepMC::GenVertex * GenVertexPtr
Definition: GenVertex.h:59
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
AtlasDetDescr::AtlasRegion
AtlasRegion
Definition: AtlasRegion.h:27
ISF::InsideType
InsideType
Definition: IGeoIDSvc.h:22
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ISF::GenParticlePositionFilter::m_checkRegion
std::vector< int > m_checkRegion
Definition: GenParticlePositionFilter.h:56
ISF::fSurface
@ fSurface
Definition: IGeoIDSvc.h:24
ISF::fInside
@ fInside
Definition: IGeoIDSvc.h:25
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
Trk::inside
@ inside
Definition: PropDirection.h:29
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
ISF::GenParticlePositionFilter::m_geoIDSvc
ServiceHandle< IGeoIDSvc > m_geoIDSvc
Definition: GenParticlePositionFilter.h:55