ATLAS Offline Software
GenParticleSimQuasiStableFilter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // GenParticleSimQuasiStableFilter.cxx, (c) ATLAS Detector software
8 
9 // class header include
11 
12 // HepMC includes
13 #include "AtlasHepMC/GenParticle.h"
14 #include "AtlasHepMC/GenVertex.h"
15 
16 #include <algorithm>
17 
20  const std::string& n,
21  const IInterface* p )
22  : base_class(t,n,p)
23 {
24  // different options
25  declareProperty("StatusCode", m_statuscode);
26  declareProperty("MinProdRadius", m_minProdRadius);
27  declareProperty("MinDecayRadius", m_minDecayRadius);
28 }
29 
30 // Athena algtool's Hooks
32 {
33  ATH_MSG_VERBOSE("Initializing ...");
34 
35  m_minProdRadius.resize(m_statuscode.size(),0);
36  m_minDecayRadius.resize(m_statuscode.size(),0);
37 
38  // All done!
39  return StatusCode::SUCCESS;
40 }
41 #ifdef HEPMC3
43 {
44 #else
46 {
47  auto particle=&particleref;
48 #endif
49  ATH_MSG_VERBOSE( "Checking whether " << particle << " passes the filter." );
50 
51  bool passFilter = false;
52  for(unsigned int i=0;i<m_statuscode.size();++i) {
53  if(particle->status()==m_statuscode[i]) {
54  passFilter=true;
55  if(particle->end_vertex() && (m_minDecayRadius[i] > particle->end_vertex()->position().perp()) ) passFilter = false;
56  if(particle->production_vertex() && (m_minProdRadius[i] > particle->production_vertex()->position().perp()) ) passFilter = false;
57  if(passFilter) break;
58  }
59  }
60 
61  if(passFilter) {
62  ATH_MSG_DEBUG( "Accpeting particle " << particle );
63  if(particle->production_vertex()) ATH_MSG_DEBUG(" prod r="<<particle->production_vertex()->position().perp()<<" : "<<particle->production_vertex ());
64  if(particle->end_vertex()) ATH_MSG_DEBUG(" decay r="<<particle->end_vertex()->position().perp()<<" : "<<particle->end_vertex ());
65  } else {
66 // ATH_MSG_DEBUG( "Rejecting particle " << particle );
67 // if(particle.production_vertex ()) ATH_MSG_DEBUG(" prod r="<<particle.production_vertex()->position().perp()<<", min="<<m_minProdRadius[i]<<" : "<<*(particle.production_vertex ()));
68 // if(particle.end_vertex ()) ATH_MSG_DEBUG(" decay r="<<particle.end_vertex()->position().perp()<<", min="<<m_minDecayRadius[i]<<" : "<<*(particle.end_vertex ()));
69  }
70 
71  return passFilter;
72 }
73 
75 {
76  ATH_MSG_VERBOSE("Finalizing ...");
77  return StatusCode::SUCCESS;
78 }
79 
ISF::GenParticleSimQuasiStableFilter::GenParticleSimQuasiStableFilter
GenParticleSimQuasiStableFilter(const std::string &t, const std::string &n, const IInterface *p)
Constructor.
Definition: GenParticleSimQuasiStableFilter.cxx:19
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
GenVertex.h
ISF::GenParticleSimQuasiStableFilter::m_minProdRadius
std::vector< double > m_minProdRadius
minimum production radius below which particles should be ignored
Definition: GenParticleSimQuasiStableFilter.h:57
GenParticleSimQuasiStableFilter.h
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
covarianceTool.passFilter
bool passFilter
Definition: covarianceTool.py:604
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
GenParticle.h
ISF::GenParticleSimQuasiStableFilter::m_minDecayRadius
std::vector< double > m_minDecayRadius
minimum decay radius below which particles should be ignored
Definition: GenParticleSimQuasiStableFilter.h:58
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
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
ISF::GenParticleSimQuasiStableFilter::m_statuscode
std::vector< int > m_statuscode
returns true if the the particle and all daughters are on the accept list
Definition: GenParticleSimQuasiStableFilter.h:56
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
ISF::GenParticleSimQuasiStableFilter::initialize
StatusCode initialize()
Athena algtool's Hooks.
Definition: GenParticleSimQuasiStableFilter.cxx:31
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
ISF::GenParticleSimQuasiStableFilter::finalize
StatusCode finalize()
Definition: GenParticleSimQuasiStableFilter.cxx:74
ISF::GenParticleSimQuasiStableFilter::pass
bool pass(const HepMC::GenParticle &particle) const
passes through to the private version
Definition: GenParticleSimQuasiStableFilter.cxx:45
GenParticle
@ GenParticle
Definition: TruthClasses.h:30