ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::InDetPrimaryConversionSelector 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 <InDetPrimaryConversionSelector.h>

Inheritance diagram for Trk::InDetPrimaryConversionSelector:
Collaboration diagram for Trk::InDetPrimaryConversionSelector:

Public Member Functions

 InDetPrimaryConversionSelector (const std::string &type, const std::string &name, const IInterface *parent)
 ~InDetPrimaryConversionSelector ()
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
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
Till.Eifert -at- cern.ch

Definition at line 30 of file InDetPrimaryConversionSelector.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

◆ InDetPrimaryConversionSelector()

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

Definition at line 18 of file InDetPrimaryConversionSelector.cxx.

20 : AthAlgTool (type,name,parent),
21 m_minPt ( 500. ),
22 m_maxEta ( 2.5 ),
23 m_maxRStartAll ( 800.0*CLHEP::mm),
24 m_maxZStartAll (2000.0*CLHEP::mm)
25
26{
27 declareInterface<IGenParticleSelector>(this);
28
29 declareProperty("MinPt", m_minPt);
30 declareProperty("MaxEta", m_maxEta);
31 declareProperty("MaxRStartAll", m_maxRStartAll, "production vtx r for all");
32 declareProperty("MaxZStartAll", m_maxZStartAll, "production vtx z for all");
33}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
float m_maxZStartAll
Max z of start vertex for primaries + sec.
float m_maxRStartAll
Max R of start vertex for primaries and secondaries.

◆ ~InDetPrimaryConversionSelector()

Trk::InDetPrimaryConversionSelector::~InDetPrimaryConversionSelector ( )
inline

Definition at line 35 of file InDetPrimaryConversionSelector.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::InDetPrimaryConversionSelector::finalize ( )
virtual

Definition at line 43 of file InDetPrimaryConversionSelector.cxx.

43 {
44 ATH_MSG_INFO ("starting finalize() in " << name());
45 return StatusCode::SUCCESS;
46}
#define ATH_MSG_INFO(x)

◆ initialize()

StatusCode Trk::InDetPrimaryConversionSelector::initialize ( )
virtual

initialize

Definition at line 38 of file InDetPrimaryConversionSelector.cxx.

38 {
39 ATH_MSG_INFO ("initialise in " << name());
40 return StatusCode::SUCCESS;
41}

◆ 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::InDetPrimaryConversionSelector::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 49 of file InDetPrimaryConversionSelector.cxx.

49 {
50
51 if (! SimTracks) return nullptr;
52
53 std::vector<HepMC::ConstGenParticlePtr>* genSignal =
54 new std::vector<HepMC::ConstGenParticlePtr>;
55 // pile-up: vector of MCEC has more than one entry
56 DataVector<HepMC::GenEvent>::const_iterator itCollision = SimTracks->begin();
57
58 for( ; itCollision != SimTracks->end(); ++itCollision ) {
59 const HepMC::GenEvent* genEvent = *itCollision;
60
61 for (const auto& particle: *genEvent) {
62
63 // 1) require stable particle from generation or simulation
64 if (!MC::isStable(particle)) continue;
65
66 if(!particle->production_vertex()) {
67 ATH_MSG_WARNING ("GenParticle without production vertex - simulation corrupt? ");
68 ATH_MSG_DEBUG ("It's this one: " << particle);
69 continue;
70 } else {
71
72 // 2) require track inside ID - relaxed definition including decays of neutrals (secondaries)
73 if ( std::fabs(particle->production_vertex()->position().perp()) > m_maxRStartAll ||
74 std::fabs(particle->production_vertex()->position().z()) > m_maxZStartAll ) continue;
75
76 int pdgCode = particle->pdg_id();
77 if (MC::isNucleus(pdgCode)) continue; // ignore nuclei from hadronic interactions
78 ATH_MSG_DEBUG ("found particle = " << particle);
79
80 // assume for the moment we're only running over single gamma MC files ...
81 auto prodVertex = particle->production_vertex();
82 if ( std::abs(pdgCode) == 11 ) {
83 ATH_MSG_DEBUG ("Electron/Positron detected -- checking for production process ...");
84#ifdef HEPMC3
85 for ( const auto& inParticle: prodVertex->particles_in()) {
86#else
87 HepMC::GenVertex::particles_in_const_iterator ItinParticle = prodVertex->particles_in_const_begin();
88 HepMC::GenVertex::particles_out_const_iterator ItinParticleEnd = prodVertex->particles_in_const_end();
89 for ( ; ItinParticle != ItinParticleEnd; ++ItinParticle) {
90 auto inParticle=*ItinParticle;
91#endif
92 ATH_MSG_DEBUG(" --> checking morther: " << inParticle );
93 if ( MC::isPhoton(inParticle) || MC::isElectron(inParticle) ){
94 if (std::fabs(particle->momentum().perp()) > m_minPt && std::fabs(particle->momentum().pseudoRapidity()) < m_maxEta ) {
95 genSignal->push_back(particle);
96 ATH_MSG_DEBUG ("Selected this electron/positron!");
97 break;
98 } // if (particle pt, eta)
99 } // if (mother is electron or gamma ...)
100 } // loop over mother particles
101 } // if (have electron/positron)
102 } // if (have stable particle)
103 } // loop and select particles
104 } // loop and select pile-up vertices
105 return genSignal;
106}
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
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 isPhoton(const T &p)
bool isElectron(const T &p)
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
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::InDetPrimaryConversionSelector::m_maxEta
private

Definition at line 46 of file InDetPrimaryConversionSelector.h.

◆ m_maxRStartAll

float Trk::InDetPrimaryConversionSelector::m_maxRStartAll
private

Max R of start vertex for primaries and secondaries.

Definition at line 47 of file InDetPrimaryConversionSelector.h.

◆ m_maxZStartAll

float Trk::InDetPrimaryConversionSelector::m_maxZStartAll
private

Max z of start vertex for primaries + sec.

Definition at line 48 of file InDetPrimaryConversionSelector.h.

◆ m_minPt

float Trk::InDetPrimaryConversionSelector::m_minPt
private

Definition at line 45 of file InDetPrimaryConversionSelector.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: