ATLAS Offline Software
Loading...
Searching...
No Matches
ISF::EntryLayerToolMT Class Reference

#include <EntryLayerToolMT.h>

Inheritance diagram for ISF::EntryLayerToolMT:
Collaboration diagram for ISF::EntryLayerToolMT:

Public Member Functions

 EntryLayerToolMT (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters.
virtual ~EntryLayerToolMT ()=default
 Destructor.
virtual StatusCode initialize () override final
 Athena algtool's Hooks.
virtual bool passesFilters (const ISFParticle &particle) override final
 handle for incident service
virtual ISF::EntryLayer identifyEntryLayer (const ISFParticle &particle) override final
 Identify the corresponding entry layer for the given particle (may return ISF::fUnsetEntryLayere if particle is not on an entry layer surface)
virtual ISF::EntryLayer registerParticle (const ISF::ISFParticle &particle, ISF::EntryLayer entryLayer) override final
 Add the given particle to the corresponding Entry/Exit layer if applicable.
virtual StatusCode registerTrackRecordCollection (TrackRecordCollection *collection, EntryLayer layer) override final
 Register the TrackRecordCollection pointer for a layer.
virtual void setupEvent () override

Private Attributes

ServiceHandle< ISF::IGeoIDSvcm_geoIDSvc {this, "GeoIDSvc", "GeoIDSvc", "AthenaService used to indentify sub-detector by (x,y,z) coordintes."}
 GeoIDSvc will be used to determine the entry layer surface, the particle is on.
ISF::IGeoIDSvcm_geoIDSvcQuick {}
ParticleFilterArray m_particleFilterHandle {this, "ParticleFilters", {}, "ISF Particle filters, defining whether a particle will be stored or not."}
 Array of filters to decide whether a particle is added to the Entry/Exit layer.
ISF::IParticleFilter ** m_particleFilter {}
size_t m_numParticleFilters {0}
std::string m_volumeName [ISF::fNumAtlasEntryLayers]

Static Private Attributes

static thread_local std::unique_ptr< std::array< TrackRecordCollection *, ISF::fNumAtlasEntryLayers > > s_collection
 The entry layer collections.

Detailed Description

Definition at line 42 of file EntryLayerToolMT.h.

Constructor & Destructor Documentation

◆ EntryLayerToolMT()

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

Constructor with parameters.

Constructor.

Definition at line 16 of file EntryLayerToolMT.cxx.

16 :
17 base_class(t,n,p),
19{
20 // volumeNames for TrackRecords
21 declareProperty( "CaloEntryVolumeString",
22 m_volumeName[ISF::fAtlasCaloEntry] = "IDET::IDET",
23 "VolumeName in TrackRecords in CaloEntryLayer");
24 declareProperty( "MuonEntryVolumeString",
25 m_volumeName[ISF::fAtlasMuonEntry] = "CALO::CALO",
26 "VolumeName in TrackRecords in MuonEntryLayer");
27 declareProperty( "MuonExitVolumeString",
28 m_volumeName[ISF::fAtlasMuonExit] = "MUONQ02::MUONQ02",
29 "VolumeName in TrackRecords in MuonExitLayer");
30}
std::string m_volumeName[ISF::fNumAtlasEntryLayers]
@ fAtlasMuonExit
Definition EntryLayer.h:39
@ fAtlasCaloEntry
Definition EntryLayer.h:37
@ fAtlasMuonEntry
Definition EntryLayer.h:38

◆ ~EntryLayerToolMT()

virtual ISF::EntryLayerToolMT::~EntryLayerToolMT ( )
virtualdefault

Destructor.

Member Function Documentation

◆ identifyEntryLayer()

ISF::EntryLayer ISF::EntryLayerToolMT::identifyEntryLayer ( const ISFParticle & particle)
finaloverridevirtual

Identify the corresponding entry layer for the given particle (may return ISF::fUnsetEntryLayere if particle is not on an entry layer surface)

Definition at line 72 of file EntryLayerToolMT.cxx.

72 {
73 // the return value
75
76 const Amg::Vector3D &pos = particle.position();
77
78 // check if particle on ID and/or Calo surface
79 bool onIDSurface = (m_geoIDSvcQuick->inside( pos, AtlasDetDescr::fAtlasID) == ISF::fSurface);
80 bool onCaloSurface = (m_geoIDSvcQuick->inside( pos, AtlasDetDescr::fAtlasCalo) == ISF::fSurface);
81
82 // on CaloEntry layer ?
83 if ( onIDSurface && onCaloSurface ) {
84 layerHit = ISF::fAtlasCaloEntry;
85 }
86
87 // no surface hit yet -> test MS volume surface hit
88 else {
89 // check if particle on MS surface
90 bool onMSSurface = (m_geoIDSvcQuick->inside( pos, AtlasDetDescr::fAtlasMS) == ISF::fSurface);
91
92 // on MuonEntry layer ?
93 if (onCaloSurface && onMSSurface) {
94 layerHit = ISF::fAtlasMuonEntry;
95 }
96 // on MuonExit layer ?
97 else if (onMSSurface) {
98 layerHit = ISF::fAtlasMuonExit;
99 }
100 }
101 return layerHit;
102}
ISF::IGeoIDSvc * m_geoIDSvcQuick
Eigen::Matrix< double, 3, 1 > Vector3D
EntryLayer
Identifiers for the TrackRecordCollections on the boundaries between CaloEntry: Inner Detector - Calo...
Definition EntryLayer.h:31
@ fUnsetEntryLayer
Definition EntryLayer.h:33
@ fSurface
Definition IGeoIDSvc.h:24
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ initialize()

StatusCode ISF::EntryLayerToolMT::initialize ( )
finaloverridevirtual

Athena algtool's Hooks.

Definition at line 34 of file EntryLayerToolMT.cxx.

35{
36 ATH_MSG_INFO("initialize() ...");
37
38 // retrieve the GeoIDSvc
39 ATH_CHECK ( m_geoIDSvc.retrieve() );
40 // store a quick-access pointer to the c++ class directly
41 m_geoIDSvcQuick = &(*m_geoIDSvc);
42
43 // retrieve the ParticleFilters
44 ATH_CHECK ( m_particleFilterHandle.retrieve() );
45 // store a quick-access pointer to the c++ classes directly
47 m_particleFilter = new ISF::IParticleFilter*[ m_numParticleFilters ];
48 for ( size_t curFilter = 0; curFilter<m_numParticleFilters; curFilter++) {
49 // convert ToolHandle to standard c++ class pointer
50 m_particleFilter[curFilter] = &(*m_particleFilterHandle[curFilter]);
51 }
52
53 ATH_MSG_INFO("initialize() successful");
54 return StatusCode::SUCCESS;
55}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
ServiceHandle< ISF::IGeoIDSvc > m_geoIDSvc
GeoIDSvc will be used to determine the entry layer surface, the particle is on.
ISF::IParticleFilter ** m_particleFilter
ParticleFilterArray m_particleFilterHandle
Array of filters to decide whether a particle is added to the Entry/Exit layer.

◆ passesFilters()

bool ISF::EntryLayerToolMT::passesFilters ( const ISFParticle & particle)
finaloverridevirtual

handle for incident service

Check if given particle passes the EntryLayer filters.

Check if given particle passes the EntryLayer filters

Definition at line 59 of file EntryLayerToolMT.cxx.

59 {
60 bool pass = true;
61 for ( size_t curFilter=0; pass && (curFilter<m_numParticleFilters); curFilter++) {
62 // check current filter
63 pass = m_particleFilter[curFilter]->passFilter( particle);
64 }
65
66 return pass;
67}

◆ registerParticle()

ISF::EntryLayer ISF::EntryLayerToolMT::registerParticle ( const ISF::ISFParticle & particle,
ISF::EntryLayer entryLayer )
finaloverridevirtual

Add the given particle to the corresponding Entry/Exit layer if applicable.

Definition at line 106 of file EntryLayerToolMT.cxx.

107{
108 // (1.) check whether the particle actually passes all the filters
109 // -> rather fast usually
110 if ( !passesFilters(particle) ) {
111 // return if not passed
113 }
114
115 // (2.) check whether the particle lies on any entry surface
116 // -> this goes second because computation intensive routines
117 // are used for this
118 if ( layerHit == ISF::fUnsetEntryLayer) {
119 layerHit = identifyEntryLayer( particle);
120 }
121
122 // (3.) if particle is on a boundary surface
123 // -> add it to TrackRecordCollection
124 if ( layerHit != ISF::fUnsetEntryLayer) {
125 ATH_MSG_VERBOSE( "Particle >>" << particle << "<< hit boundary surface, "
126 "adding it to '" << (*s_collection)[layerHit]->Name() << "' TrackRecord collection");
127
128 const Amg::Vector3D &pos = particle.position();
129 const Amg::Vector3D &mom = particle.momentum();
130 CLHEP::Hep3Vector hepPos( pos.x(), pos.y(), pos.z() ); // not optimal, but required by TrackRecord
131 CLHEP::Hep3Vector hepMom( mom.x(), mom.y(), mom.z() ); // not optimal, but required by TrackRecord
132
133 double mass = particle.mass();
134 double energy = std::sqrt(mass*mass + mom.mag2());
135
136 // Use barcode of generation zero particle from truth binding if possible (reproduces legacy AtlasG4 behaviour).
137 // Use barcode assigend to ISFParticle only if no generation zero particle is present.
138 auto truthBinding = particle.getTruthBinding();
139 auto generationZeroGenParticle = truthBinding ? truthBinding->getGenerationZeroGenParticle() : nullptr;
140 const int barcode = generationZeroGenParticle ? HepMC::barcode(generationZeroGenParticle) : HepMC::barcode(particle); // FIXME barcode-based
141 const int id = generationZeroGenParticle ? HepMC::uniqueID(generationZeroGenParticle) : particle.id();
142 const int status = generationZeroGenParticle ? generationZeroGenParticle->status() : particle.status();
143
144 (*s_collection)[layerHit]->Emplace(particle.pdgCode(),
145 status,
146 energy,
147 hepMom,
148 hepPos,
149 particle.timeStamp(),
150 barcode, // FIXME barcode-based
151 id,
152 m_volumeName[layerHit] );
153 }
154
155 return layerHit;
156}
#define ATH_MSG_VERBOSE(x)
JetDumper::Name Name
Definition JetDumper.cxx:19
virtual bool passesFilters(const ISFParticle &particle) override final
handle for incident service
static thread_local std::unique_ptr< std::array< TrackRecordCollection *, ISF::fNumAtlasEntryLayers > > s_collection
The entry layer collections.
virtual ISF::EntryLayer identifyEntryLayer(const ISFParticle &particle) override final
Identify the corresponding entry layer for the given particle (may return ISF::fUnsetEntryLayere if p...
int barcode(const T *p)
Definition Barcode.h:16
int uniqueID(const T &p)
status
Definition merge.py:16

◆ registerTrackRecordCollection()

StatusCode ISF::EntryLayerToolMT::registerTrackRecordCollection ( TrackRecordCollection * collection,
EntryLayer layer )
finaloverridevirtual

Register the TrackRecordCollection pointer for a layer.

Definition at line 159 of file EntryLayerToolMT.cxx.

160{
161 if (!s_collection) {
162 // need to create the array of TrackRecordCollections for this thread
163 s_collection = std::make_unique<std::array<TrackRecordCollection*, ISF::fNumAtlasEntryLayers>>();
164 }
165 (*s_collection)[layer]=collection;
166 return StatusCode::SUCCESS;
167}
@ layer
Definition HitInfo.h:79

◆ setupEvent()

virtual void ISF::EntryLayerToolMT::setupEvent ( )
inlineoverridevirtual

Definition at line 71 of file EntryLayerToolMT.h.

71{ return; }

Member Data Documentation

◆ m_geoIDSvc

ServiceHandle<ISF::IGeoIDSvc> ISF::EntryLayerToolMT::m_geoIDSvc {this, "GeoIDSvc", "GeoIDSvc", "AthenaService used to indentify sub-detector by (x,y,z) coordintes."}
private

GeoIDSvc will be used to determine the entry layer surface, the particle is on.

Definition at line 75 of file EntryLayerToolMT.h.

75{this, "GeoIDSvc", "GeoIDSvc", "AthenaService used to indentify sub-detector by (x,y,z) coordintes."};

◆ m_geoIDSvcQuick

ISF::IGeoIDSvc* ISF::EntryLayerToolMT::m_geoIDSvcQuick {}
private

Definition at line 76 of file EntryLayerToolMT.h.

76{};

◆ m_numParticleFilters

size_t ISF::EntryLayerToolMT::m_numParticleFilters {0}
private

Definition at line 81 of file EntryLayerToolMT.h.

81{0};

◆ m_particleFilter

ISF::IParticleFilter** ISF::EntryLayerToolMT::m_particleFilter {}
private

Definition at line 80 of file EntryLayerToolMT.h.

80{};

◆ m_particleFilterHandle

ParticleFilterArray ISF::EntryLayerToolMT::m_particleFilterHandle {this, "ParticleFilters", {}, "ISF Particle filters, defining whether a particle will be stored or not."}
private

Array of filters to decide whether a particle is added to the Entry/Exit layer.

Definition at line 79 of file EntryLayerToolMT.h.

79{this, "ParticleFilters", {}, "ISF Particle filters, defining whether a particle will be stored or not."};

◆ m_volumeName

std::string ISF::EntryLayerToolMT::m_volumeName[ISF::fNumAtlasEntryLayers]
private

Definition at line 85 of file EntryLayerToolMT.h.

◆ s_collection

thread_local std::unique_ptr< std::array< TrackRecordCollection *, ISF::fNumAtlasEntryLayers > > ISF::EntryLayerToolMT::s_collection
staticprivate

The entry layer collections.

Definition at line 84 of file EntryLayerToolMT.h.


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