ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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. More...
 
virtual ~EntryLayerToolMT ()=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::fUnsetEntryLayere 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
 

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. More...
 
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. More...
 
ISF::IParticleFilter ** m_particleFilter {}
 
size_t m_numParticleFilters {0}
 
thread_utils::ThreadLocalOwner< std::array< TrackRecordCollection *, ISF::fNumAtlasEntryLayers > > m_collectionHolder
 The entry layer collections. More...
 
std::string m_volumeName [ISF::fNumAtlasEntryLayers]
 

Detailed Description

Definition at line 41 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 14 of file EntryLayerToolMT.cxx.

14  :
15  base_class(t,n,p),
16  m_volumeName()
17 {
18  // volumeNames for TrackRecords
19  declareProperty( "CaloEntryVolumeString",
20  m_volumeName[ISF::fAtlasCaloEntry] = "IDET::IDET",
21  "VolumeName in TrackRecords in CaloEntryLayer");
22  declareProperty( "MuonEntryVolumeString",
23  m_volumeName[ISF::fAtlasMuonEntry] = "CALO::CALO",
24  "VolumeName in TrackRecords in MuonEntryLayer");
25  declareProperty( "MuonExitVolumeString",
26  m_volumeName[ISF::fAtlasMuonExit] = "MUONQ02::MUONQ02",
27  "VolumeName in TrackRecords in MuonExitLayer");
28 }

◆ ~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 70 of file EntryLayerToolMT.cxx.

70  {
71  // the return value
73 
74  const Amg::Vector3D &pos = particle.position();
75 
76  // check if particle on ID and/or Calo surface
79 
80  // on CaloEntry layer ?
81  if ( onIDSurface && onCaloSurface ) {
82  layerHit = ISF::fAtlasCaloEntry;
83  }
84 
85  // no surface hit yet -> test MS volume surface hit
86  else {
87  // check if particle on MS surface
89 
90  // on MuonEntry layer ?
91  if (onCaloSurface && onMSSurface) {
92  layerHit = ISF::fAtlasMuonEntry;
93  }
94  // on MuonExit layer ?
95  else if (onMSSurface) {
96  layerHit = ISF::fAtlasMuonExit;
97  }
98  }
99  return layerHit;
100 }

◆ initialize()

StatusCode ISF::EntryLayerToolMT::initialize ( )
finaloverridevirtual

Athena algtool's Hooks.

Definition at line 32 of file EntryLayerToolMT.cxx.

33 {
34  ATH_MSG_INFO("initialize() ...");
35 
36  // retrieve the GeoIDSvc
37  ATH_CHECK ( m_geoIDSvc.retrieve() );
38  // store a quick-access pointer to the c++ class directly
39  m_geoIDSvcQuick = &(*m_geoIDSvc);
40 
41  // retrieve the ParticleFilters
42  ATH_CHECK ( m_particleFilterHandle.retrieve() );
43  // store a quick-access pointer to the c++ classes directly
46  for ( size_t curFilter = 0; curFilter<m_numParticleFilters; curFilter++) {
47  // convert ToolHandle to standard c++ class pointer
48  m_particleFilter[curFilter] = &(*m_particleFilterHandle[curFilter]);
49  }
50 
51  ATH_MSG_INFO("initialize() successful");
52  return StatusCode::SUCCESS;
53 }

◆ passesFilters()

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

Check if given particle passes the EntryLayer filters.

Definition at line 57 of file EntryLayerToolMT.cxx.

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

◆ 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 104 of file EntryLayerToolMT.cxx.

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

◆ registerTrackRecordCollection()

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

Register the TrackRecordCollection pointer for a layer.

Definition at line 157 of file EntryLayerToolMT.cxx.

158 {
159  // Do we need to lock around this code???
160  auto* collectionArray = m_collectionHolder.get();
161  if (not collectionArray) {
162  // need to create the array of TrackRecordCollections for this thread
163  auto* temp = new std::array<TrackRecordCollection*, ISF::fNumAtlasEntryLayers>;
164  m_collectionHolder.set(temp);
165  collectionArray = m_collectionHolder.get();
166  }
167  (*collectionArray)[layer]=collection;
168  return StatusCode::SUCCESS;
169 }

◆ setupEvent()

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

Definition at line 70 of file EntryLayerToolMT.h.

70 { return; }

Member Data Documentation

◆ m_collectionHolder

thread_utils::ThreadLocalOwner< std::array<TrackRecordCollection*, ISF::fNumAtlasEntryLayers> > ISF::EntryLayerToolMT::m_collectionHolder
private

The entry layer collections.

Definition at line 83 of file EntryLayerToolMT.h.

◆ 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 74 of file EntryLayerToolMT.h.

◆ m_geoIDSvcQuick

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

Definition at line 75 of file EntryLayerToolMT.h.

◆ m_numParticleFilters

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

Definition at line 80 of file EntryLayerToolMT.h.

◆ m_particleFilter

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

Definition at line 79 of file EntryLayerToolMT.h.

◆ 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 78 of file EntryLayerToolMT.h.

◆ m_volumeName

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

Definition at line 84 of file EntryLayerToolMT.h.


The documentation for this class was generated from the following files:
ISF::fAtlasMuonEntry
@ fAtlasMuonEntry
Definition: EntryLayer.h:38
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
ISF::fAtlasMuonExit
@ fAtlasMuonExit
Definition: EntryLayer.h:39
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
ISF::EntryLayerToolMT::identifyEntryLayer
virtual ISF::EntryLayer identifyEntryLayer(const ISFParticle &particle) override final
Identify the corresponding entry layer for the given particle (may return ISF::fUnsetEntryLayere if p...
Definition: EntryLayerToolMT.cxx:70
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.
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ISF::EntryLayerToolMT::m_volumeName
std::string m_volumeName[ISF::fNumAtlasEntryLayers]
Definition: EntryLayerToolMT.h:84
ISF::fSurface
@ fSurface
Definition: IGeoIDSvc.h:24
ISF::IParticleFilter::passFilter
virtual bool passFilter(const ISFParticle &isp) const =0
Returns a pass boolean on the particle
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
ISF::fUnsetEntryLayer
@ fUnsetEntryLayer
Definition: EntryLayer.h:33
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
AtlasDetDescr::fAtlasMS
@ fAtlasMS
Definition: AtlasRegion.h:36
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:109
ISF::EntryLayerToolMT::m_particleFilterHandle
ParticleFilterArray m_particleFilterHandle
Array of filters to decide whether a particle is added to the Entry/Exit layer.
Definition: EntryLayerToolMT.h:78
ISF::EntryLayerToolMT::passesFilters
virtual bool passesFilters(const ISFParticle &particle) override final
Check if given particle passes the EntryLayer filters.
Definition: EntryLayerToolMT.cxx:57
ISF::EntryLayerToolMT::m_geoIDSvc
ServiceHandle< ISF::IGeoIDSvc > m_geoIDSvc
GeoIDSvc will be used to determine the entry layer surface, the particle is on.
Definition: EntryLayerToolMT.h:74
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ISF::EntryLayerToolMT::m_geoIDSvcQuick
ISF::IGeoIDSvc * m_geoIDSvcQuick
Definition: EntryLayerToolMT.h:75
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
ISF::EntryLayerToolMT::m_particleFilter
ISF::IParticleFilter ** m_particleFilter
Definition: EntryLayerToolMT.h:79
AtlasDetDescr::fAtlasID
@ fAtlasID
Definition: AtlasRegion.h:33
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
ISF::EntryLayer
EntryLayer
Definition: EntryLayer.h:31
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
AtlasDetDescr::fAtlasCalo
@ fAtlasCalo
Definition: AtlasRegion.h:35
HepMC
Definition: Barcode.h:14
ISF::fAtlasCaloEntry
@ fAtlasCaloEntry
Definition: EntryLayer.h:37
ISF::EntryLayerToolMT::m_numParticleFilters
size_t m_numParticleFilters
Definition: EntryLayerToolMT.h:80
merge.status
status
Definition: merge.py:17
ISF::EntryLayerToolMT::m_collectionHolder
thread_utils::ThreadLocalOwner< std::array< TrackRecordCollection *, ISF::fNumAtlasEntryLayers > > m_collectionHolder
The entry layer collections.
Definition: EntryLayerToolMT.h:83
ISF::IParticleFilter
Definition: IParticleFilter.h:28