ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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. More...
 
virtual ~EntryLayerTool ()=default
 Destructor. More...
 
virtual StatusCode initialize () override final
 Athena algtool's Hooks. More...
 
virtual bool passesFilters (const ISFParticle &particle) override final
 Check if given particle passes the EntryLayer filters. More...
 
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) More...
 
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. More...
 
virtual StatusCode registerTrackRecordCollection (TrackRecordCollection *collection, EntryLayer layer) override final
 Register the TrackRecordCollection pointer for a layer. More...
 
virtual void setupEvent () override final
 

Private Member Functions

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

Private Attributes

ServiceHandle< ISF::IGeoIDSvcm_geoIDSvc
 GeoIDSvc will be used to determine the entry layer surface, the particle is on. More...
 
ISF::IGeoIDSvcm_geoIDSvcQuick
 
ParticleFilterArray m_particleFilterHandle
 Array of filters to decide whether a particle is added to the Entry/Exit layer. More...
 
ISF::IParticleFilter ** m_particleFilter
 
size_t m_numParticleFilters
 
TrackRecordCollectionm_collection [ISF::fNumAtlasEntryLayers]
 The entry layer collections. More...
 
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),
21  m_geoIDSvcQuick(0),
25  m_collection(),
26  m_SGName(),
27  m_volumeName()
28 {
29  // geometry identification service
30  declareProperty( "GeoIDSvc",
31  m_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 }

◆ ~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 }

◆ 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
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 }

◆ 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
162  return ISF::fUnsetEntryLayer;
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 }

◆ 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 }

◆ 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;
99  entryLayer<ISF::fNumAtlasEntryLayers;
100  entryLayer++) {
101  m_collection[entryLayer] = setupSGCollection( m_SGName[entryLayer] );
102  }
103 
104  return;
105 }

◆ 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 }

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:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
ISF::fAtlasMuonEntry
@ fAtlasMuonEntry
Definition: EntryLayer.h:38
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
ISF::EntryLayerTool::passesFilters
virtual bool passesFilters(const ISFParticle &particle) override final
Check if given particle passes the EntryLayer filters.
Definition: EntryLayerTool.cxx:109
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ISF::EntryLayerTool::m_SGName
std::string m_SGName[ISF::fNumAtlasEntryLayers]
Definition: EntryLayerTool.h:83
ISF::EntryLayerTool::m_particleFilterHandle
ParticleFilterArray m_particleFilterHandle
Array of filters to decide whether a particle is added to the Entry/Exit layer.
Definition: EntryLayerTool.h:77
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ISF::fAtlasMuonExit
@ fAtlasMuonExit
Definition: EntryLayer.h:39
AtlasHitsVector
Definition: AtlasHitsVector.h:33
ISF::IGeoIDSvc::inside
virtual ISF::InsideType inside(const Amg::Vector3D &pos, AtlasDetDescr::AtlasRegion geoID) const =0
Checks if the given position (ISFParticle) is inside/outside/onsurface a given AtlasRegion.
TrackRecordCollection
AtlasHitsVector< TrackRecord > TrackRecordCollection
Definition: TrackRecordCollection.h:12
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
dqt_zlumi_pandas.mass
mass
Definition: dqt_zlumi_pandas.py:170
ISF::EntryLayerTool::m_particleFilter
ISF::IParticleFilter ** m_particleFilter
Definition: EntryLayerTool.h:78
ISF::fSurface
@ fSurface
Definition: IGeoIDSvc.h:24
AtlasHitsVector::Emplace
void Emplace(Args &&... args)
Definition: AtlasHitsVector.h:81
ISF::EntryLayerTool::identifyEntryLayer
virtual ISF::EntryLayer identifyEntryLayer(const ISFParticle &particle) override final
Identify the corresponding entry layer for the given particle (may return ISF::fUnsetEntryLayer if pa...
Definition: EntryLayerTool.cxx:122
ISF::IParticleFilter::passFilter
virtual bool passFilter(const ISFParticle &isp) const =0
Returns a pass boolean on the particle
ISF::fNumAtlasEntryLayers
@ fNumAtlasEntryLayers
Definition: EntryLayer.h:41
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
ISF::fUnsetEntryLayer
@ fUnsetEntryLayer
Definition: EntryLayer.h:33
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
AtlasDetDescr::fAtlasMS
@ fAtlasMS
Definition: AtlasRegion.h:36
ISF::EntryLayerTool::m_geoIDSvcQuick
ISF::IGeoIDSvc * m_geoIDSvcQuick
Definition: EntryLayerTool.h:74
beamspotman.n
n
Definition: beamspotman.py:731
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:113
ISF::fFirstAtlasEntryLayer
@ fFirstAtlasEntryLayer
Definition: EntryLayer.h:35
ISF::EntryLayerTool::m_geoIDSvc
ServiceHandle< ISF::IGeoIDSvc > m_geoIDSvc
GeoIDSvc will be used to determine the entry layer surface, the particle is on.
Definition: EntryLayerTool.h:73
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:194
AtlasDetDescr::fAtlasID
@ fAtlasID
Definition: AtlasRegion.h:33
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
ISF::EntryLayerTool::m_numParticleFilters
size_t m_numParticleFilters
Definition: EntryLayerTool.h:79
ISF::EntryLayer
EntryLayer
Definition: EntryLayer.h:31
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
ISF::EntryLayerTool::setupSGCollection
TrackRecordCollection * setupSGCollection(const std::string &name)
used to setup a TrackRecordCollection on storegate
Definition: EntryLayerTool.cxx:218
AtlasDetDescr::fAtlasCalo
@ fAtlasCalo
Definition: AtlasRegion.h:35
HepMC
Definition: Barcode.h:14
ISF::fAtlasCaloEntry
@ fAtlasCaloEntry
Definition: EntryLayer.h:37
ISF::EntryLayerTool::m_collection
TrackRecordCollection * m_collection[ISF::fNumAtlasEntryLayers]
The entry layer collections.
Definition: EntryLayerTool.h:82
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
merge.status
status
Definition: merge.py:17
ISF::EntryLayerTool::m_volumeName
std::string m_volumeName[ISF::fNumAtlasEntryLayers]
Definition: EntryLayerTool.h:84
ISF::IParticleFilter
Definition: IParticleFilter.h:28