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

#include <EntryLayerTool.h>

Inheritance diagram for ISF::EntryLayerTool:
Collaboration diagram for ISF::EntryLayerTool:

Public Member Functions

 EntryLayerTool (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters.
virtual ~EntryLayerTool ()=default
 Destructor.
virtual StatusCode initialize () override final
 Athena algtool's Hooks.
virtual bool passesFilters (const ISFParticle &particle) override final
 Check if given particle passes the EntryLayer filters.
virtual ISF::EntryLayer identifyEntryLayer (const ISFParticle &particle) override final
 Identify the corresponding entry layer for the given particle (may return ISF::fUnsetEntryLayer 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 final

Private Member Functions

TrackRecordCollectionsetupSGCollection (const std::string &name)
 used to setup a TrackRecordCollection on storegate

Private Attributes

ServiceHandle< ISF::IGeoIDSvcm_geoIDSvc
 GeoIDSvc will be used to determine the entry layer surface, the particle is on.
ISF::IGeoIDSvcm_geoIDSvcQuick
ParticleFilterArray m_particleFilterHandle
 Array of filters to decide whether a particle is added to the Entry/Exit layer.
ISF::IParticleFilter ** m_particleFilter
size_t m_numParticleFilters
TrackRecordCollectionm_collection [ISF::fNumAtlasEntryLayers]
 The entry layer collections.
std::string m_SGName [ISF::fNumAtlasEntryLayers]
std::string m_volumeName [ISF::fNumAtlasEntryLayers]

Detailed Description

Author
Elmar.Ritsch -at- cern.ch

Definition at line 40 of file EntryLayerTool.h.

Constructor & Destructor Documentation

◆ EntryLayerTool()

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

Constructor with parameters.

Constructor.

Definition at line 18 of file EntryLayerTool.cxx.

18 :
19 base_class(t,n,p),
20 m_geoIDSvc("GeoIDSvc",n),
26 m_SGName(),
28{
29 // geometry identification service
30 declareProperty( "GeoIDSvc",
32 "AthenaService used to indentify sub-detector by (x,y,z) coordintes.");
33
34 // particle filters
35 declareProperty( "ParticleFilters",
37 "ISF Particle filters, defining whether a particle will be stored or not.");
38
39 // storegate collection names
40 declareProperty( "CaloEntryLayer",
41 m_SGName[ISF::fAtlasCaloEntry] = "CaloEntryLayer",
42 "Name of CaloEntryLayer collection on Storegate");
43 declareProperty( "MuonEntryLayer",
44 m_SGName[ISF::fAtlasMuonEntry] = "MuonEntryLayer",
45 "Name of MuonEntryLayer collection on Storegate");
46 declareProperty( "MuonExitLayer",
47 m_SGName[ISF::fAtlasMuonExit] = "MuonExitLayer",
48 "Name of MuonExitLayer collection on Storegate");
49
50 // volumeNames for TrackRecords
51 declareProperty( "CaloEntryVolumeString",
52 m_volumeName[ISF::fAtlasCaloEntry] = "IDET::IDET",
53 "VolumeName in TrackRecords in CaloEntryLayer");
54 declareProperty( "MuonEntryVolumeString",
55 m_volumeName[ISF::fAtlasMuonEntry] = "CALO::CALO",
56 "VolumeName in TrackRecords in MuonEntryLayer");
57 declareProperty( "MuonExitVolumeString",
58 m_volumeName[ISF::fAtlasMuonExit] = "MUONQ02::MUONQ02",
59 "VolumeName in TrackRecords in MuonExitLayer");
60}
std::string m_volumeName[ISF::fNumAtlasEntryLayers]
ServiceHandle< ISF::IGeoIDSvc > m_geoIDSvc
GeoIDSvc will be used to determine the entry layer surface, the particle is on.
std::string m_SGName[ISF::fNumAtlasEntryLayers]
TrackRecordCollection * m_collection[ISF::fNumAtlasEntryLayers]
The entry layer collections.
ParticleFilterArray m_particleFilterHandle
Array of filters to decide whether a particle is added to the Entry/Exit layer.
ISF::IParticleFilter ** m_particleFilter
ISF::IGeoIDSvc * m_geoIDSvcQuick
@ fAtlasMuonExit
Definition EntryLayer.h:39
@ fAtlasCaloEntry
Definition EntryLayer.h:37
@ fAtlasMuonEntry
Definition EntryLayer.h:38

◆ ~EntryLayerTool()

virtual ISF::EntryLayerTool::~EntryLayerTool ( )
virtualdefault

Destructor.

Member Function Documentation

◆ identifyEntryLayer()

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

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

Definition at line 122 of file EntryLayerTool.cxx.

122 {
123 // the return value
125
126 const Amg::Vector3D &pos = particle.position();
127
128 // check if particle on ID and/or Calo surface
129 bool onIDSurface = (m_geoIDSvcQuick->inside( pos, AtlasDetDescr::fAtlasID) == ISF::fSurface);
130 bool onCaloSurface = (m_geoIDSvcQuick->inside( pos, AtlasDetDescr::fAtlasCalo) == ISF::fSurface);
131
132 // on CaloEntry layer ?
133 if ( onIDSurface && onCaloSurface ) {
134 layerHit = ISF::fAtlasCaloEntry;
135 }
136
137 // no surface hit yet -> test MS volume surface hit
138 else {
139 // check if particle on MS surface
140 bool onMSSurface = (m_geoIDSvcQuick->inside( pos, AtlasDetDescr::fAtlasMS) == ISF::fSurface);
141
142 // on MuonEntry layer ?
143 if (onCaloSurface && onMSSurface) {
144 layerHit = ISF::fAtlasMuonEntry;
145 }
146 // on MuonExit layer ?
147 else if (onMSSurface) {
148 layerHit = ISF::fAtlasMuonExit;
149 }
150 }
151 return layerHit;
152}
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::EntryLayerTool::initialize ( )
finaloverridevirtual

Athena algtool's Hooks.

Definition at line 64 of file EntryLayerTool.cxx.

65{
66 ATH_MSG_INFO("initialize() ...");
67
68 // retrieve the GeoIDSvc
69 if ( m_geoIDSvc.retrieve().isFailure() ){
70 ATH_MSG_FATAL( "Could not retrieve GeoID service. Abort.");
71 return StatusCode::FAILURE;
72 }
73 // store a quick-access pointer to the c++ class directly
74 m_geoIDSvcQuick = &(*m_geoIDSvc);
75
76
77 // retrieve the ParticleFilters
78 if ( m_particleFilterHandle.retrieve().isFailure() ){
79 ATH_MSG_FATAL( "Could not retrieve ParticleFilters. Abort.");
80 return StatusCode::FAILURE;
81 }
82 // store a quick-access pointer to the c++ classes directly
84 m_particleFilter = new ISF::IParticleFilter*[ m_numParticleFilters ];
85 for ( size_t curFilter = 0; curFilter<m_numParticleFilters; curFilter++) {
86 // convert ToolHandle to standard c++ class pointer
87 m_particleFilter[curFilter] = &(*m_particleFilterHandle[curFilter]);
88 }
89
90 ATH_MSG_INFO("initialize() successful");
91 return StatusCode::SUCCESS;
92}
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)

◆ passesFilters()

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

Check if given particle passes the EntryLayer filters.

Definition at line 109 of file EntryLayerTool.cxx.

109 {
110 bool pass = true;
111 for ( size_t curFilter=0; pass && (curFilter<m_numParticleFilters); curFilter++) {
112 // check current filter
113 pass = m_particleFilter[curFilter]->passFilter( particle);
114 }
115
116 return pass;
117}

◆ registerParticle()

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

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

Definition at line 156 of file EntryLayerTool.cxx.

157{
158 // (1.) check whether the particle actually passes all the filters
159 // -> rather fast usually
160 if ( !passesFilters(particle) ) {
161 // return if not passed
163 }
164
165 // (2.) check whether the particle lies on any entry surface
166 // -> this goes second because computation intensive routines
167 // are used for this
168 if ( layerHit == ISF::fUnsetEntryLayer) {
169 layerHit = identifyEntryLayer( particle);
170 }
171
172 // (3.) if particle is on a boundary surface
173 // -> add it to TrackRecordCollection
174 if ( layerHit != ISF::fUnsetEntryLayer) {
175 ATH_MSG_VERBOSE( "Particle >>" << particle << "<< hit boundary surface, "
176 "adding it to '" << m_SGName[layerHit] << "' TrackRecord collection");
177
178 const Amg::Vector3D &pos = particle.position();
179 const Amg::Vector3D &mom = particle.momentum();
180 CLHEP::Hep3Vector hepPos( pos.x(), pos.y(), pos.z() ); // not optimal, but required by TrackRecord
181 CLHEP::Hep3Vector hepMom( mom.x(), mom.y(), mom.z() ); // not optimal, but required by TrackRecord
182
183 double mass = particle.mass();
184 double energy = sqrt(mass*mass + mom.mag2());
185
186 // Use barcode of generation zero particle from truth binding if possible (reproduces legacy AtlasG4 behaviour).
187 // Use barcode assigend to ISFParticle only if no generation zero particle is present.
188 auto truthBinding = particle.getTruthBinding();
189 auto generationZeroGenParticle = truthBinding ? truthBinding->getGenerationZeroGenParticle() : nullptr;
190 const int barcode = generationZeroGenParticle ? HepMC::barcode(generationZeroGenParticle) : HepMC::barcode(particle); // FIXME barcode-based
191 const int id = generationZeroGenParticle ? HepMC::uniqueID(generationZeroGenParticle) : particle.id();
192 const int status = generationZeroGenParticle ? generationZeroGenParticle->status() : particle.status();
193
194 m_collection[layerHit]->Emplace(particle.pdgCode(),
195 status,
196 energy,
197 hepMom,
198 hepPos,
199 particle.timeStamp(),
200 barcode, // FIXME barcode-based
201 id,
202 m_volumeName[layerHit] );
203 }
204
205 return layerHit;
206}
#define ATH_MSG_VERBOSE(x)
virtual bool passesFilters(const ISFParticle &particle) override final
Check if given particle passes the EntryLayer filters.
virtual ISF::EntryLayer identifyEntryLayer(const ISFParticle &particle) override final
Identify the corresponding entry layer for the given particle (may return ISF::fUnsetEntryLayer if pa...
int barcode(const T *p)
Definition Barcode.h:16
int uniqueID(const T &p)
status
Definition merge.py:16

◆ registerTrackRecordCollection()

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

Register the TrackRecordCollection pointer for a layer.

Definition at line 209 of file EntryLayerTool.cxx.

210{
211 m_collection[layer]=collection; // Dummy implementation.
212 return StatusCode::SUCCESS;
213}
@ layer
Definition HitInfo.h:79

◆ setupEvent()

void ISF::EntryLayerTool::setupEvent ( )
finaloverridevirtual

Definition at line 95 of file EntryLayerTool.cxx.

95 {
96
97 // initialize storegate collections at BeginEvent incident
98 for ( int entryLayer=ISF::fFirstAtlasEntryLayer;
100 entryLayer++) {
101 m_collection[entryLayer] = setupSGCollection( m_SGName[entryLayer] );
102 }
103
104 return;
105}
TrackRecordCollection * setupSGCollection(const std::string &name)
used to setup a TrackRecordCollection on storegate
@ fNumAtlasEntryLayers
Definition EntryLayer.h:41
@ fFirstAtlasEntryLayer
Definition EntryLayer.h:35

◆ setupSGCollection()

TrackRecordCollection * ISF::EntryLayerTool::setupSGCollection ( const std::string & name)
private

used to setup a TrackRecordCollection on storegate

Definition at line 218 of file EntryLayerTool.cxx.

219{
220 TrackRecordCollection *collection = 0;
221
222 // check if storegate already contains the collection
223 // (a) if yes ... try to retrieve it
224 if ( evtStore()->contains<TrackRecordCollection>(collectionName) ){
225 if ( (evtStore()->retrieve( collection, collectionName)).isFailure() )
226 ATH_MSG_ERROR( "[ --- ] Unable to retrieve TrackRecordCollection " << collectionName);
227 // (b) if no ... try to create it
228 } else {
229 collection = new TrackRecordCollection( collectionName);
230 if ( (evtStore()->record( collection, collectionName, true)).isFailure() ) {
231 ATH_MSG_ERROR( "[ --- ] Unable to record SiHitCollection " << collectionName);
232 delete collection;
233 collection=0;
234 }
235 }
236
237 return collection;
238}
#define ATH_MSG_ERROR(x)
AtlasHitsVector< TrackRecord > TrackRecordCollection
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:114
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

Member Data Documentation

◆ m_collection

TrackRecordCollection* ISF::EntryLayerTool::m_collection[ISF::fNumAtlasEntryLayers]
private

The entry layer collections.

Definition at line 82 of file EntryLayerTool.h.

◆ m_geoIDSvc

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

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

Definition at line 73 of file EntryLayerTool.h.

◆ m_geoIDSvcQuick

ISF::IGeoIDSvc* ISF::EntryLayerTool::m_geoIDSvcQuick
private

Definition at line 74 of file EntryLayerTool.h.

◆ m_numParticleFilters

size_t ISF::EntryLayerTool::m_numParticleFilters
private

Definition at line 79 of file EntryLayerTool.h.

◆ m_particleFilter

ISF::IParticleFilter** ISF::EntryLayerTool::m_particleFilter
private

Definition at line 78 of file EntryLayerTool.h.

◆ m_particleFilterHandle

ParticleFilterArray ISF::EntryLayerTool::m_particleFilterHandle
private

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

Definition at line 77 of file EntryLayerTool.h.

◆ m_SGName

std::string ISF::EntryLayerTool::m_SGName[ISF::fNumAtlasEntryLayers]
private

Definition at line 83 of file EntryLayerTool.h.

◆ m_volumeName

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

Definition at line 84 of file EntryLayerTool.h.


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