ATLAS Offline Software
GeoIDSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef ISF_SERVICES_GEOIDSVC_H
6 #define ISF_SERVICES_GEOIDSVC_H 1
7 
8 // framework includes
9 #include "GaudiKernel/ServiceHandle.h"
11 
12 // STL includes
13 #include <vector>
14 #include <list>
15 #include <set>
16 
17 // DetectorDescription
19 
20 // ISF includes
22 
23 // EnvelopeDefinitionService
24 #include "SubDetectorEnvelopes/IEnvelopeDefSvc.h" //Required for RZPair definition.
25 
26 namespace ISF {
27 
28  typedef std::pair<double, AtlasDetDescr::AtlasRegion> RadiusGeoIDPair;
29  typedef std::list<RZPair> RZPairList;
30 
31  struct SortByRadius {
32  bool operator() (const RadiusGeoIDPair& lhs, const RadiusGeoIDPair& rhs) const
33  {return lhs.first<rhs.first;}
34  };
35  typedef std::set<RadiusGeoIDPair, SortByRadius> RadiusGeoIDPairSet;
36 
43  class GeoIDSvc : public extends<AthService, ISF::IGeoIDSvc> {
44  public:
46  GeoIDSvc(const std::string& name,ISvcLocator* svc);
47 
49  ~GeoIDSvc() = default;
50 
51  // Athena algtool's Hooks
53 
56 
59 
60 
64 
65  private:
66  std::unique_ptr<RZPairList> prepareRZPairs( AtlasDetDescr::AtlasRegion geoID);
67 
69  bool checkSymmetric( RZPairList& positiveZ, RZPairList& negativeZ);
70 
71  template <typename T> inline int sign(T val);
72 
74  ServiceHandle<IEnvelopeDefSvc> m_envDefSvc{this, "EnvelopeDefSvc", "ISF_ISFEnvelopeDefSvc",
75  "The EnvelopeDefinitionService describing the AtlasRegion boundaries."};
76 
78  DoubleProperty m_tolerance{this,"Tolerance", 1e-5,
79  "Estimated tolerance within which coordinates are considered being equal."};
80 
82  double *m_zBins{};
83  int m_numZBins{0};
87  };
88 
89  //
90  // inline functions
91  //
92 
94  template <typename T> inline int ISF::GeoIDSvc::sign(T val) {
95  return (T(0) < val) - (val < T(0));
96  }
97 
98 } // ISF namespace
99 
100 #endif //> !ISF_SERVICES_GEOIDSVC_H
AtlasDetDescr::fNumAtlasRegions
@ fNumAtlasRegions
Definition: AtlasRegion.h:39
ISF::RadiusGeoIDPairSet
std::set< RadiusGeoIDPair, SortByRadius > RadiusGeoIDPairSet
Definition: GeoIDSvc.h:35
ISF::RadiusGeoIDPair
std::pair< double, AtlasDetDescr::AtlasRegion > RadiusGeoIDPair
Definition: GeoIDSvc.h:28
IEnvelopeDefSvc.h
AtlasRegion.h
AtlasDetDescr::AtlasRegion
AtlasRegion
Definition: AtlasRegion.h:27
ISF::SortByRadius
Definition: GeoIDSvc.h:31
ISF::GeoIDSvc::m_zBins
double * m_zBins
Definition: GeoIDSvc.h:82
ISF::InsideType
InsideType
Definition: IGeoIDSvc.h:22
ISF::GeoIDSvc::sign
int sign(T val)
a branchless signum function
Definition: GeoIDSvc.h:94
ISF::GeoIDSvc::m_radiusBins
RadiusGeoIDPair * m_radiusBins
m_radiusBins[m_numZBins][numCurRadiusBins]
Definition: GeoIDSvc.h:85
ISF::GeoIDSvc::prepareRZPairs
std::unique_ptr< RZPairList > prepareRZPairs(AtlasDetDescr::AtlasRegion geoID)
Definition: GeoIDSvc.cxx:270
ISF::GeoIDSvc::~GeoIDSvc
~GeoIDSvc()=default
Destructor.
ISF::GeoIDSvc::initialize
StatusCode initialize()
Definition: GeoIDSvc.cxx:25
ISF::GeoIDSvc::identifyGeoID
AtlasDetDescr::AtlasRegion identifyGeoID(const Amg::Vector3D &pos) const
A static filter that returns the SimGeoID of the given position.
Definition: GeoIDSvc.cxx:222
ISF::RZPairList
std::list< RZPair > RZPairList
Definition: GeoIDSvc.h:29
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ISF::GeoIDSvc::identifyNextGeoID
AtlasDetDescr::AtlasRegion identifyNextGeoID(const Amg::Vector3D &pos, const Amg::Vector3D &dir) const
Find the SimGeoID that the particle will enter with its next infinitesimal step along the given direc...
Definition: GeoIDSvc.cxx:254
ISF::GeoIDSvc::m_numZBins
int m_numZBins
Definition: GeoIDSvc.h:83
IGeoIDSvc.h
ISF::GeoIDSvc::GeoIDSvc
GeoIDSvc(const std::string &name, ISvcLocator *svc)
Constructor with parameters.
Definition: GeoIDSvc.cxx:19
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
beamspotman.dir
string dir
Definition: beamspotman.py:623
ISF::GeoIDSvc::inside
ISF::InsideType inside(const Amg::Vector3D &pos, AtlasDetDescr::AtlasRegion geoID) const
Checks if the given position (or ISFParticle) is inside a given SimGeoID.
Definition: GeoIDSvc.cxx:189
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
ISF::GeoIDSvc::m_envDefSvc
ServiceHandle< IEnvelopeDefSvc > m_envDefSvc
service providing the envelope dimensions for the different sub-detectors
Definition: GeoIDSvc.h:74
DiTauMassTools::MaxHistStrategyV2::e
e
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:26
ISF
ISFParticleOrderedQueue.
Definition: PrimaryParticleInformation.h:13
ISF::GeoIDSvc::m_maxRBins
int m_maxRBins
Definition: GeoIDSvc.h:86
ISF::SortByRadius::operator()
bool operator()(const RadiusGeoIDPair &lhs, const RadiusGeoIDPair &rhs) const
Definition: GeoIDSvc.h:32
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
ISF::GeoIDSvc::checkSymmetric
bool checkSymmetric(RZPairList &positiveZ, RZPairList &negativeZ)
Check if given RZPairLists are symmetric around z==0 plane.
Definition: GeoIDSvc.cxx:391
AthService.h
ISF::GeoIDSvc::m_tolerance
DoubleProperty m_tolerance
(estimated) tolerance within which coordinates are considered equal
Definition: GeoIDSvc.h:78
ISF::GeoIDSvc
Definition: GeoIDSvc.h:43
ServiceHandle< IEnvelopeDefSvc >