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

#include <G4PolyconeGeoIDSvc.h>

Inheritance diagram for ISF::G4PolyconeGeoIDSvc:
Collaboration diagram for ISF::G4PolyconeGeoIDSvc:

Public Member Functions

 G4PolyconeGeoIDSvc (const std::string &name, ISvcLocator *svc)
 Constructor with parameters.
 ~G4PolyconeGeoIDSvc ()
 Destructor.
StatusCode initialize ()
AtlasDetDescr::AtlasRegion identifyGeoID (const Amg::Vector3D &pos) const
 A static filter that returns the AtlasRegion of the given position.
ISF::InsideType inside (const Amg::Vector3D &pos, AtlasDetDescr::AtlasRegion geoID) const
 Checks if the given position (ISFParticle) is inside a given AtlasRegion.
AtlasDetDescr::AtlasRegion identifyNextGeoID (const Amg::Vector3D &pos, const Amg::Vector3D &dir) const
 Find the AtlasRegion that the particle will enter with its next infinitesimal step along the given direction.

Private Member Functions

StatusCode fillDimensions ()
 Retrieve and fill in the dimensions for the different AtlasRegion.
void pushDimension (AtlasDetDescr::AtlasRegion geoID, double rin, double rou, double z)
void pushDimension (AtlasDetDescr::AtlasRegion geoID, double r, double z)
StatusCode createVolume (AtlasDetDescr::AtlasRegion geoID)
 Retrieve and fill in the dimensions for the different AtlasRegion.

Private Attributes

ServiceHandle< IEnvelopeDefSvcm_envDefSvc {this, "EnvelopeDefSvc", "AtlasGeometry_EnvelopeDefSvc"}
 service providing the envelope dimensions for the different sub-detectors
G4VSolid * m_volume [AtlasDetDescr::fNumAtlasRegions]
ISF::InsideType m_typeConverter [ISF::fNumInsideTypes]
 a quick way to convert G4 enum EInside to ISF::InsideType

Detailed Description

Todo
Author
Elmar.Ritsch -at- cern.ch

Definition at line 39 of file G4PolyconeGeoIDSvc.h.

Constructor & Destructor Documentation

◆ G4PolyconeGeoIDSvc()

ISF::G4PolyconeGeoIDSvc::G4PolyconeGeoIDSvc ( const std::string & name,
ISvcLocator * svc )

Constructor with parameters.

Constructor.

Definition at line 33 of file G4PolyconeGeoIDSvc.cxx.

33 :
34 base_class(name,svc),
35 m_volume(),
37{
38}
ISF::InsideType m_typeConverter[ISF::fNumInsideTypes]
a quick way to convert G4 enum EInside to ISF::InsideType
G4VSolid * m_volume[AtlasDetDescr::fNumAtlasRegions]

◆ ~G4PolyconeGeoIDSvc()

ISF::G4PolyconeGeoIDSvc::~G4PolyconeGeoIDSvc ( )

Destructor.

Definition at line 42 of file G4PolyconeGeoIDSvc.cxx.

43{
44}

Member Function Documentation

◆ createVolume()

StatusCode ISF::G4PolyconeGeoIDSvc::createVolume ( AtlasDetDescr::AtlasRegion geoID)
private

Retrieve and fill in the dimensions for the different AtlasRegion.

Definition at line 132 of file G4PolyconeGeoIDSvc.cxx.

133{
134
135 // ensure a proper numeric value for geoID
136 assert(validAtlasRegion(geoID));
137
138 ATH_MSG_INFO( "Building envelope volume for '" << AtlasDetDescr::AtlasRegionHelper::getName(geoID)
139 << "' (GeoID="<< geoID << ").");
140
141 // resetting volume for current geoID
142 m_volume[geoID] = 0;
143
144 // volume definitions
145 const double phimin = 0.;
146 const double deltaphi = 360.*CLHEP::deg;
147 const std::string volumeName( AtlasDetDescr::AtlasRegionHelper::getName(geoID));
148
149 {
150 // retrieve the vector of (r,z) values from the EnvelopeDefSvc
151 const RZPairVector &rz = m_envDefSvc->getRZBoundary( geoID );
152
153 // entries in the database table
154 size_t curVolNumPoints = rz.size();
155 if ( !curVolNumPoints)
156 {
157 ATH_MSG_ERROR("No entries for " << AtlasDetDescr::AtlasRegionHelper::getName(geoID) << " envelope in envelope definition service. Unable to build envelope.");
158 // resources cleanup
159 return StatusCode::FAILURE;
160 }
161
162 // arrays of (r,z) coordinates of the current envelope volume
163 double *z = new double[curVolNumPoints];
164 double *r = new double[curVolNumPoints];
165
166 // convert vector of pairs into two arrays
167 RZPairVector::const_iterator rzIt = rz.begin();
168 for ( size_t i=0; i<curVolNumPoints; ++i)
169 {
170 r[i] = rzIt->first;
171 z[i] = rzIt->second;
172
173 ++rzIt;
174 }
175
176 // create a G4Polycone volume with the given dimensions
177 std::stringstream curName;
178 curName << volumeName;
179 // store it in the m_volume array
180 m_volume[geoID] = new G4Polycone( curName.str(), phimin, deltaphi, curVolNumPoints, r, z);
181 // set the volume name
182 m_volume[geoID]->SetName( volumeName);
183
184 // cleanup
185 delete[] r;
186 delete[] z;
187 }
188
189 return StatusCode::SUCCESS;
190}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
bool validAtlasRegion(AtlasDetDescr::AtlasRegion region)
Check a given AtlasRegion for its validity.
Definition AtlasRegion.h:40
static Double_t rz
std::vector< RZPair > RZPairVector
Definition RZPair.h:18
#define z
static const char * getName(int region)
ServiceHandle< IEnvelopeDefSvc > m_envDefSvc
service providing the envelope dimensions for the different sub-detectors
int r
Definition globals.cxx:22

◆ fillDimensions()

StatusCode ISF::G4PolyconeGeoIDSvc::fillDimensions ( )
private

Retrieve and fill in the dimensions for the different AtlasRegion.

◆ identifyGeoID()

AtlasDetDescr::AtlasRegion ISF::G4PolyconeGeoIDSvc::identifyGeoID ( const Amg::Vector3D & pos) const

A static filter that returns the AtlasRegion of the given position.

Definition at line 94 of file G4PolyconeGeoIDSvc.cxx.

95{
96 // loop over geoIDs
97 for (unsigned short geoID=AtlasDetDescr::fFirstAtlasRegion; geoID<AtlasDetDescr::fNumAtlasRegions; ++geoID)
98 {
99 // point inside given geoID -> return geoID
101 {
102 return AtlasDetDescr::AtlasRegion(geoID);
103 }
104 }
105 // point is not inside any of the registered geoIDs
107}
ISF::InsideType inside(const Amg::Vector3D &pos, AtlasDetDescr::AtlasRegion geoID) const
Checks if the given position (ISFParticle) is inside a given AtlasRegion.
AtlasRegion
A simple enum of ATLAS regions and sub-detectors.
Definition AtlasRegion.h:21
@ fInside
Definition IGeoIDSvc.h:25

◆ identifyNextGeoID()

AtlasDetDescr::AtlasRegion ISF::G4PolyconeGeoIDSvc::identifyNextGeoID ( const Amg::Vector3D & pos,
const Amg::Vector3D & dir ) const

Find the AtlasRegion that the particle will enter with its next infinitesimal step along the given direction.

Definition at line 110 of file G4PolyconeGeoIDSvc.cxx.

112{
113
114 // if position inside a volume -> return that volume as the next geoID
116 if (validAtlasRegion(geoID))
117 {
118 return geoID;
119 }
120 //not inside - make a step towards the p direction and check if inside again
121 const Amg::Vector3D &dirUnit = dir.unit();
122 const Amg::Vector3D &posStep = pos+dirUnit;
123 AtlasDetDescr::AtlasRegion closestGeoID = identifyGeoID(posStep);
124 if (validAtlasRegion(closestGeoID))
125 {
126 return closestGeoID;
127 }
129}
AtlasDetDescr::AtlasRegion identifyGeoID(const Amg::Vector3D &pos) const
A static filter that returns the AtlasRegion of the given position.
Eigen::Matrix< double, 3, 1 > Vector3D

◆ initialize()

StatusCode ISF::G4PolyconeGeoIDSvc::initialize ( )

Definition at line 48 of file G4PolyconeGeoIDSvc.cxx.

49{
50 ATH_MSG_VERBOSE("initialize()");
51
52 // retrieve envelope definition service
53 ATH_CHECK( m_envDefSvc.retrieve() );
54
55 // create internal volume representations for the given dimensions
57 {
58 if ( createVolume( AtlasDetDescr::AtlasRegion(geoID)).isFailure())
59 {
60 ATH_MSG_ERROR("Unable to create volume representation for geoID="<<geoID);
61 }
62 }
63
64 // setup the converter for: G4 enum to ISF::InsideType
68
69 return StatusCode::SUCCESS;
70}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
StatusCode createVolume(AtlasDetDescr::AtlasRegion geoID)
Retrieve and fill in the dimensions for the different AtlasRegion.
@ fOutside
Definition IGeoIDSvc.h:23
@ fSurface
Definition IGeoIDSvc.h:24

◆ inside()

ISF::InsideType ISF::G4PolyconeGeoIDSvc::inside ( const Amg::Vector3D & pos,
AtlasDetDescr::AtlasRegion geoID ) const

Checks if the given position (ISFParticle) is inside a given AtlasRegion.

Definition at line 73 of file G4PolyconeGeoIDSvc.cxx.

74{
75 // initialized with default return value
77
78 // check for volume to be present
79 G4VSolid *curVol = m_volume[geoID];
80 if (curVol)
81 {
82 G4ThreeVector posG4( pos.x(), pos.y(), pos.z() );
83 EInside g4Where = curVol->Inside( posG4 );
84
85 // use this trick to quickly convert G4 type to ISF::InsideType
86 where = m_typeConverter[g4Where];
87 }
88
89 // hand back the position information
90 return where;
91}
InsideType
Definition IGeoIDSvc.h:22
where(filename, prepath=[])
"which" for python files -------------------------------------------------—
Definition unixtools.py:53

◆ pushDimension() [1/2]

void ISF::G4PolyconeGeoIDSvc::pushDimension ( AtlasDetDescr::AtlasRegion geoID,
double r,
double z )
private

◆ pushDimension() [2/2]

void ISF::G4PolyconeGeoIDSvc::pushDimension ( AtlasDetDescr::AtlasRegion geoID,
double rin,
double rou,
double z )
private

Member Data Documentation

◆ m_envDefSvc

ServiceHandle<IEnvelopeDefSvc> ISF::G4PolyconeGeoIDSvc::m_envDefSvc {this, "EnvelopeDefSvc", "AtlasGeometry_EnvelopeDefSvc"}
private

service providing the envelope dimensions for the different sub-detectors

Definition at line 74 of file G4PolyconeGeoIDSvc.h.

74{this, "EnvelopeDefSvc", "AtlasGeometry_EnvelopeDefSvc"};

◆ m_typeConverter

ISF::InsideType ISF::G4PolyconeGeoIDSvc::m_typeConverter[ISF::fNumInsideTypes]
private

a quick way to convert G4 enum EInside to ISF::InsideType

Definition at line 80 of file G4PolyconeGeoIDSvc.h.

◆ m_volume

G4VSolid* ISF::G4PolyconeGeoIDSvc::m_volume[AtlasDetDescr::fNumAtlasRegions]
private
Todo
:

Definition at line 77 of file G4PolyconeGeoIDSvc.h.


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