ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::InDetReconstructableSelector Class Reference

Modular concept to select truth particles for the truth tree filling and efficiency calculation, this one selects detectable tracks in the ID. More...

#include <InDetReconstructableSelector.h>

Inheritance diagram for Trk::InDetReconstructableSelector:
Collaboration diagram for Trk::InDetReconstructableSelector:

Public Member Functions

 InDetReconstructableSelector (const std::string &type, const std::string &name, const IInterface *parent)
 ~InDetReconstructableSelector ()
virtual StatusCode initialize ()
 initialize
virtual StatusCode finalize ()
virtual std::vector< HepMC::ConstGenParticlePtr > * selectGenSignal (const McEventCollection *) const
 main method performing the genparticle selection; it works on the entire collection.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Interface ID, declared here, and defined below.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

float m_minPt
float m_maxEta
bool m_selectPrimariesOnly
float m_maxRStartPrimary
 Max R of start vertex to be considered primary.
float m_maxZStartPrimary
 Max Z of start vertex to be considered primary.
float m_maxRStartAll
 Max R of start vertex for primaries and secondaries.
float m_maxZStartAll
 Max z of start vertex for primaries + sec.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Modular concept to select truth particles for the truth tree filling and efficiency calculation, this one selects detectable tracks in the ID.

This implementation of Trk::IGenParticleSelector selects generated particles which produce a detectable trace in the Inner Detector. It works by testing if production and end vertices are within Inner Detector acceptance.

Author
Sebastian.Fleischmann -at- cern.ch, Wolfgang.Liebig -at- cern.ch

Definition at line 30 of file InDetReconstructableSelector.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ InDetReconstructableSelector()

Trk::InDetReconstructableSelector::InDetReconstructableSelector ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 17 of file InDetReconstructableSelector.cxx.

19 : AthAlgTool (type,name,parent),
20 m_minPt (1000.),
21 m_maxEta ( 3.0),
23 m_maxRStartPrimary ( 25.0*CLHEP::mm),
24 m_maxZStartPrimary ( 200.0*CLHEP::mm),
25 m_maxRStartAll ( 360.0*CLHEP::mm),
26 m_maxZStartAll (2000.0*CLHEP::mm)
27
28{
29 declareInterface<IGenParticleSelector>(this);
30
31 declareProperty("MinPt", m_minPt);
32 declareProperty("MaxEta", m_maxEta);
33 declareProperty("SelectPrimariesOnly",m_selectPrimariesOnly, "flag to restrict to primaries or not");
34 declareProperty("MaxRStartPrimary", m_maxRStartPrimary, "production vtx r for primaries");
35 declareProperty("MaxZStartPrimary", m_maxZStartPrimary, "production vtx z for primaries");
36 declareProperty("MaxRStartAll", m_maxRStartAll, "production vtx r for all");
37 declareProperty("MaxZStartAll", m_maxZStartAll, "production vtx z for all");
38}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
float m_maxZStartPrimary
Max Z of start vertex to be considered primary.
float m_maxZStartAll
Max z of start vertex for primaries + sec.
float m_maxRStartAll
Max R of start vertex for primaries and secondaries.
float m_maxRStartPrimary
Max R of start vertex to be considered primary.

◆ ~InDetReconstructableSelector()

Trk::InDetReconstructableSelector::~InDetReconstructableSelector ( )
inline

Definition at line 35 of file InDetReconstructableSelector.h.

35{}

Member Function Documentation

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode Trk::InDetReconstructableSelector::finalize ( )
virtual

Definition at line 48 of file InDetReconstructableSelector.cxx.

48 {
49 ATH_MSG_INFO ("starting finalize() in " << name());
50 return StatusCode::SUCCESS;
51}
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode Trk::InDetReconstructableSelector::initialize ( )
virtual

initialize

Definition at line 43 of file InDetReconstructableSelector.cxx.

43 {
44 ATH_MSG_INFO ("initialise in " << name());
45 return StatusCode::SUCCESS;
46}

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & Trk::IGenParticleSelector::interfaceID ( )
inlinestaticinherited

Interface ID, declared here, and defined below.

Definition at line 40 of file IGenParticleSelector.h.

40 {
42}
static const InterfaceID IID_IGenParticleSelector("IGenParticleSelector", 1, 0)

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ selectGenSignal()

std::vector< HepMC::ConstGenParticlePtr > * Trk::InDetReconstructableSelector::selectGenSignal ( const McEventCollection * SimTracks) const
virtual

main method performing the genparticle selection; it works on the entire collection.

It is a factory.

Implements Trk::IGenParticleSelector.

Definition at line 54 of file InDetReconstructableSelector.cxx.

54 {
55
56 if (! SimTracks) return nullptr;
57
58 std::vector<HepMC::ConstGenParticlePtr>* genSignal =
59 new std::vector<HepMC::ConstGenParticlePtr>;
60
61 // pile-up: vector of MCEC has more than one entry
62 DataVector<HepMC::GenEvent>::const_iterator itCollision = SimTracks->begin();
63
64 for( ; itCollision != SimTracks->end(); ++itCollision ) {
65 const HepMC::GenEvent* genEvent = *itCollision;
66
67 for ( const auto& particle: *genEvent) {
68
69
70 // 1) require stable particle from generation or simulation
71 if (!MC::isStable(particle)) continue;
72
73 if(particle->production_vertex() == nullptr) {
74 ATH_MSG_WARNING ("GenParticle without production vertex - simulation corrupt? ");
75 ATH_MSG_DEBUG ("It's this one: " << particle);
76 continue;
77 } else {
78
79 // 2) require track inside ID - relaxed definition including decays of neutrals (secondaries)
80 if ( std::abs(particle->production_vertex()->position().perp()) > m_maxRStartAll ||
81 std::abs(particle->production_vertex()->position().z()) > m_maxZStartAll ) continue;
82
83 // 3) if jobOption, require strict definition of particles from within beam pipe
85 ( std::abs(particle->production_vertex()->position().perp()) > m_maxRStartPrimary ||
86 std::abs(particle->production_vertex()->position().z()) > m_maxZStartPrimary ) ) continue;
87
88 int pdgCode = particle->pdg_id();
89 if (MC::isNucleus(pdgCode)) continue; // ignore nuclei from hadronic interactions
90 const float charge = MC::charge(pdgCode);
91 if (std::abs(charge)<0.5) continue;
92
93 if (std::abs(particle->momentum().perp()) > m_minPt && std::abs(particle->momentum().pseudoRapidity()) < m_maxEta ) {
94 genSignal->push_back(particle);
95 }
96 }
97 } // loop and select particles
98 } // loop and select pile-up vertices
99 return genSignal;
100}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
double charge(const T &p)
Definition AtlasPID.h:997
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
double charge(const T &p)
bool isNucleus(const T &p)
PDG rule 16 Nuclear codes are given as 10-digit numbers ±10LZZZAAAI.
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_maxEta

float Trk::InDetReconstructableSelector::m_maxEta
private

Definition at line 46 of file InDetReconstructableSelector.h.

◆ m_maxRStartAll

float Trk::InDetReconstructableSelector::m_maxRStartAll
private

Max R of start vertex for primaries and secondaries.

Definition at line 50 of file InDetReconstructableSelector.h.

◆ m_maxRStartPrimary

float Trk::InDetReconstructableSelector::m_maxRStartPrimary
private

Max R of start vertex to be considered primary.

Definition at line 48 of file InDetReconstructableSelector.h.

◆ m_maxZStartAll

float Trk::InDetReconstructableSelector::m_maxZStartAll
private

Max z of start vertex for primaries + sec.

Definition at line 51 of file InDetReconstructableSelector.h.

◆ m_maxZStartPrimary

float Trk::InDetReconstructableSelector::m_maxZStartPrimary
private

Max Z of start vertex to be considered primary.

Definition at line 49 of file InDetReconstructableSelector.h.

◆ m_minPt

float Trk::InDetReconstructableSelector::m_minPt
private

Definition at line 45 of file InDetReconstructableSelector.h.

◆ m_selectPrimariesOnly

bool Trk::InDetReconstructableSelector::m_selectPrimariesOnly
private

Definition at line 47 of file InDetReconstructableSelector.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: