Belle II Software development
GeoCache Class Reference

Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pitch size. More...

#include <GeoCache.h>

Public Member Functions

 ~GeoCache ()
 destructor to clean up structures
 
void clear ()
 Clean up internal structures.
 
void findVolumes (G4VPhysicalVolume *envelope)
 Search a given Geometry for Sensors.
 
void addSensor (SensorInfoBase *sensorinfo)
 Add a SensorInfo instance to the list of known sensors This method will manually add a SensorInfo instance to the list of known sensors.
 
const std::set< Belle2::VxdIDgetLayers (SensorInfoBase::SensorType sensortype=SensorInfoBase::VXD)
 Return a set of all known Layers.
 
const std::set< Belle2::VxdID > & getLadders (Belle2::VxdID layer) const
 Return a set of all ladder IDs belonging to a given layer.
 
const std::set< Belle2::VxdID > & getSensors (Belle2::VxdID ladder) const
 Return a set of all sensor IDs belonging to a given ladder.
 
bool validSensorID (Belle2::VxdID id) const
 Check that id is a valid sensor number.
 
const std::vector< VxdIDgetListOfSensors () const
 Get list of all sensors.
 
const SensorInfoBasegetSensorInfo (Belle2::VxdID id) const
 Return a referecne to the SensorInfo of a given SensorID.
 
const std::map< VxdID, TGeoHMatrix > & getHalfShellPlacements () const
 Retrieve stored half-shell placements into world volume.
 
const std::vector< std::pair< VxdID, TGeoHMatrix > > & getLadderPlacements (VxdID halfShell) const
 Retrieve stored ladder placements into half-shell.
 
const std::vector< std::pair< VxdID, TGeoHMatrix > > & getSensorPlacements (VxdID ladder) const
 Retrieve stored sensor placements into ladders.
 
void addHalfShellPlacement (VxdID halfShell, const G4Transform3D &placement)
 Remember how half-shell is placed into world volume.
 
void addLadderPlacement (VxdID halfShell, VxdID ladder, const G4Transform3D &placement)
 Remember how ladder is placed into half-shell.
 
void addSensorPlacement (VxdID ladder, VxdID sensor, const G4Transform3D &placement)
 Remember how sensor is placed into ladder.
 
void setupReconstructionTransformations ()
 Initialize from DB for reconstruction Updates all SensorInfo transformations for reconstruction from DB object(s) (recalculating new global positions) and registers itself for subsequent updates of DB objects to keep the hierarchy up-to-date.
 
const GeoToolsgetGeoTools ()
 Return a raw pointer to a GeoTools object.
 

Static Public Member Functions

static TGeoHMatrix g4Transform3DToTGeo (const G4Transform3D &g4)
 Covenient function to convert G4Transform3D to TGeoHMatrix.
 
static TGeoHMatrix getTGeoFromRigidBodyParams (double dU, double dV, double dW, double dAlpha, double dBeta, double dGamma)
 Convert 6 rigid body params (alignment corrections) to corresponding TGeoHMatrix Angles in radians, length units in centimeters.
 
static const SensorInfoBaseget (Belle2::VxdID id)
 Return a reference to the SensorInfo of a given SensorID.
 
static GeoCachegetInstance ()
 Return a reference to the singleton instance.
 

Private Types

typedef std::unordered_map< VxdID::baseType, SensorInfoBase * > SensorInfoMap
 Hash map to store pointers to all existing SensorInfos with constant lookup complexity.
 
typedef std::map< Belle2::VxdID, std::set< Belle2::VxdID > > SensorHierachy
 Map to store a set of unique VxdIDs belonging to one VxdID.
 

Private Member Functions

 GeoCache ()
 Singleton class, hidden constructor.
 
 GeoCache (const GeoCache &)=delete
 Singleton class, hidden copy constructor.
 
GeoCacheoperator= (const GeoCache &)=delete
 Singleton class, hidden assignment operator.
 

Private Attributes

std::set< Belle2::VxdIDm_pxdLayers
 Set of all PXD layer IDs.
 
std::set< Belle2::VxdIDm_svdLayers
 Set of all SVD layer IDs.
 
std::set< Belle2::VxdIDm_telLayers
 Set of all Tel layer IDs.
 
SensorHierachy m_ladders
 Map of all Ladder IDs belonging to a given Layer ID.
 
SensorHierachy m_sensors
 Map of all Sensor IDs belonging to a given Ladder ID.
 
std::map< VxdID, TGeoHMatrix > m_halfShellPlacements {}
 Map of shell ids and their placements in top volume.
 
std::map< VxdID, std::vector< std::pair< VxdID, TGeoHMatrix > > > m_ladderPlacements {}
 Map of shell ids and their associated ladder ids and their placements.
 
std::map< VxdID, std::vector< std::pair< VxdID, TGeoHMatrix > > > m_sensorPlacements {}
 Map of ladder ids and their associated sensor ids and their placements.
 
SensorInfoMap m_sensorInfo
 Map to find the SensorInfo for a given Sensor ID.
 
std::unique_ptr< GeoToolsm_geoToolsPtr
 Pointer to a GeoTools object.
 
DBObjPtr< VXDAlignmentm_vxdAlignments
 DBObjPtr for the alignment.
 

Detailed Description

Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pitch size.

Definition at line 39 of file GeoCache.h.

Member Typedef Documentation

◆ SensorHierachy

typedef std::map<Belle2::VxdID, std::set<Belle2::VxdID> > SensorHierachy
private

Map to store a set of unique VxdIDs belonging to one VxdID.

Like ladders belong to layers, etc.

Definition at line 158 of file GeoCache.h.

◆ SensorInfoMap

typedef std::unordered_map<VxdID::baseType, SensorInfoBase*> SensorInfoMap
private

Hash map to store pointers to all existing SensorInfos with constant lookup complexity.

Definition at line 156 of file GeoCache.h.

Constructor & Destructor Documentation

◆ ~GeoCache()

~GeoCache ( )
inline

destructor to clean up structures

Definition at line 42 of file GeoCache.h.

42{ clear(); };
void clear()
Clean up internal structures.
Definition: GeoCache.cc:38

◆ GeoCache()

GeoCache ( )
private

Singleton class, hidden constructor.

Definition at line 32 of file GeoCache.cc.

33 {
34 // Add callback to update ReconstructionTransformation whenever alignment changes
36 }
DBObjPtr< VXDAlignment > m_vxdAlignments
DBObjPtr for the alignment.
Definition: GeoCache.h:191
void setupReconstructionTransformations()
Initialize from DB for reconstruction Updates all SensorInfo transformations for reconstruction from ...
Definition: GeoCache.cc:259

Member Function Documentation

◆ addHalfShellPlacement()

void addHalfShellPlacement ( VxdID  halfShell,
const G4Transform3D &  placement 
)

Remember how half-shell is placed into world volume.

Definition at line 232 of file GeoCache.cc.

233 {
234 m_halfShellPlacements[halfShell] = g4Transform3DToTGeo(placement);
235 // Add the (empty) container for ladder placements inside this halfshell
236 m_ladderPlacements[halfShell] = std::vector<std::pair<VxdID, TGeoHMatrix>>();
237 }
static TGeoHMatrix g4Transform3DToTGeo(const G4Transform3D &g4)
Covenient function to convert G4Transform3D to TGeoHMatrix.
Definition: GeoCache.cc:349
std::map< VxdID, std::vector< std::pair< VxdID, TGeoHMatrix > > > m_ladderPlacements
Map of shell ids and their associated ladder ids and their placements.
Definition: GeoCache.h:181
std::map< VxdID, TGeoHMatrix > m_halfShellPlacements
Map of shell ids and their placements in top volume.
Definition: GeoCache.h:179

◆ addLadderPlacement()

void addLadderPlacement ( VxdID  halfShell,
VxdID  ladder,
const G4Transform3D &  placement 
)

Remember how ladder is placed into half-shell.

Definition at line 225 of file GeoCache.cc.

226 {
227 m_ladderPlacements[halfShell].push_back(std::make_pair(ladder, g4Transform3DToTGeo(placement)));
228 // Add the (empty) container for sensor placements inside this ladder
229 m_sensorPlacements[ladder] = std::vector<std::pair<VxdID, TGeoHMatrix>>();
230 }
std::map< VxdID, std::vector< std::pair< VxdID, TGeoHMatrix > > > m_sensorPlacements
Map of ladder ids and their associated sensor ids and their placements.
Definition: GeoCache.h:183

◆ addSensor()

void addSensor ( SensorInfoBase sensorinfo)

Add a SensorInfo instance to the list of known sensors This method will manually add a SensorInfo instance to the list of known sensors.

It should not be needed except for testing purposes.

Parameters
sensorinfoSensorInfoBase instance to add to the list of known sensors.

Definition at line 147 of file GeoCache.cc.

148 {
149 //Save pointer to the SensorInfo and update lists of all existing
150 //layers,ladders,sensors
151 VxdID sensorID = sensorinfo->getID();
152 VxdID ladderID = sensorID;
153 ladderID.setSensorNumber(0);
154 VxdID layerID = ladderID;
155 layerID.setLadderNumber(0);
156
157 m_sensorInfo[sensorID] = sensorinfo;
158
159 switch (sensorinfo->getType()) {
161 m_pxdLayers.insert(layerID);
162 break;
164 m_svdLayers.insert(layerID);
165 break;
167 m_telLayers.insert(layerID);
168 break;
169 default:
170 B2FATAL("Cannot use anything else as SensorTypes PXD, SVD, or TEL when creating VXD Sensors");
171 }
172 m_ladders[layerID].insert(ladderID);
173 m_sensors[ladderID].insert(sensorID);
174 }
std::set< Belle2::VxdID > m_pxdLayers
Set of all PXD layer IDs.
Definition: GeoCache.h:168
std::set< Belle2::VxdID > m_telLayers
Set of all Tel layer IDs.
Definition: GeoCache.h:172
SensorHierachy m_sensors
Map of all Sensor IDs belonging to a given Ladder ID.
Definition: GeoCache.h:176
SensorInfoMap m_sensorInfo
Map to find the SensorInfo for a given Sensor ID.
Definition: GeoCache.h:185
SensorHierachy m_ladders
Map of all Ladder IDs belonging to a given Layer ID.
Definition: GeoCache.h:174
std::set< Belle2::VxdID > m_svdLayers
Set of all SVD layer IDs.
Definition: GeoCache.h:170
@ TEL
Testbeam telescope sensor.

◆ addSensorPlacement()

void addSensorPlacement ( VxdID  ladder,
VxdID  sensor,
const G4Transform3D &  placement 
)

Remember how sensor is placed into ladder.

Definition at line 220 of file GeoCache.cc.

221 {
222 m_sensorPlacements[ladder].push_back(std::make_pair(sensor, g4Transform3DToTGeo(placement)));
223 }

◆ clear()

void clear ( )

Clean up internal structures.

Definition at line 38 of file GeoCache.cc.

39 {
40 m_pxdLayers.clear();
41 m_svdLayers.clear();
42 m_telLayers.clear();
43 m_ladders.clear();
44 m_sensors.clear();
45 m_sensorInfo.clear();
46
48 m_ladderPlacements.clear();
49 m_sensorPlacements.clear();
50 }

◆ findVolumes()

void findVolumes ( G4VPhysicalVolume *  envelope)

Search a given Geometry for Sensors.

This method will search a given Physical Volume and add all sensitive Volumes where the SensitiveDetector implementation inherits from vxd::SensitiveDetector to the cache.

The given volume must be a volume placed directly in the top volume, otherwise the transformations cannot be determined correctly.

This method should be called by the geometry creator once all sensitive volumes are placed

Parameters
envelopeGeometry tree to search, usually the Envelope of PXD or SVD

Definition at line 78 of file GeoCache.cc.

79 {
80 //So, lets loop over the geometry tree and find all sensitive volumes.
81 //To get the correct Transformation matrices we use the
82 //G4NavigationHistory which is a stack of premultiplied transformations.
83 G4NavigationHistory nav;
84 //To avoid recursion we store all volumes in a stack, starting with the
85 //envelope we are about to search in
86 stack<G4VPhysicalVolume*> volumes;
87 volumes.push(envelope);
88
89 //Now lets just continue until the stack is empty
90 while (!volumes.empty()) {
91 G4VPhysicalVolume* physical = volumes.top();
92 volumes.pop();
93 //NULL indicates that we are finished with the children of a node, so
94 //pop a transformation level
95 if (!physical) {
96 nav.BackLevel();
97 continue;
98 }
99 //Add a NULL to so that we know that all children are finished once we
100 //emptied the stack of volumes back to this NULL
101 volumes.push(0);
102 //Now enter the volume
103 nav.NewLevel(physical);
104
105 G4LogicalVolume* logical = physical->GetLogicalVolume();
106
107 //Check if we found a sensitive volume with correct type
108 SensitiveDetectorBase* sensitive = dynamic_cast<SensitiveDetectorBase*>(logical->GetSensitiveDetector());
109 if (sensitive) {
110 //Apparently we did, so get the sensor Information and add it
111 SensorInfoBase* info = sensitive->getSensorInfo();
112 if (!info) B2FATAL("No SensorInfo found for Volume " << logical->GetName());
113
114 //Convert transformation to ROOT
115 const G4AffineTransform g4transform = nav.GetTopTransform().Inverse();
116 TGeoHMatrix transform;
117 double rotation[9] = {
118 g4transform[0], g4transform[4], g4transform[8],
119 g4transform[1], g4transform[5], g4transform[9],
120 g4transform[2], g4transform[6], g4transform[10]
121 };
122 transform.SetRotation(rotation);
123 transform.SetDx(g4transform[12]*Unit::mm);
124 transform.SetDy(g4transform[13]*Unit::mm);
125 transform.SetDz(g4transform[14]*Unit::mm);
126 info->setTransformation(transform); // cppcheck-suppress nullPointerRedundantCheck
127 info->setTransformation(transform, true); // cppcheck-suppress nullPointerRedundantCheck
128
129 addSensor(info);
130 }
131
132 int nDaughters = logical->GetNoDaughters();
133 //Add all children. Since we use a stack they will be processed in
134 //opposite order In principle we do not care, but for niceness sake we
135 //add them back to front so that they are processed in the "correct"
136 //order
137 for (int i = nDaughters - 1; i >= 0; --i) {
138 G4VPhysicalVolume* daughter = logical->GetDaughter(i);
139 volumes.push(daughter);
140 }
141 }
142
143 // Finally set-up reconstruction transformations
145 }
static const double mm
[millimeters]
Definition: Unit.h:70
void addSensor(SensorInfoBase *sensorinfo)
Add a SensorInfo instance to the list of known sensors This method will manually add a SensorInfo ins...
Definition: GeoCache.cc:147

◆ g4Transform3DToTGeo()

TGeoHMatrix g4Transform3DToTGeo ( const G4Transform3D &  g4)
static

Covenient function to convert G4Transform3D to TGeoHMatrix.

Definition at line 349 of file GeoCache.cc.

350 {
351 TGeoHMatrix trafo;
352 // Differential translation
353 TGeoTranslation translation;
354 // Differential rotation
355 TGeoRotation rotation;
356
357 //NOTE: for some reason, there is cm vs. mm difference
358 trafo.SetDx(g4.getTranslation()[0] / 10.);
359 trafo.SetDy(g4.getTranslation()[1] / 10.);
360 trafo.SetDz(g4.getTranslation()[2] / 10.);
361
362 Double_t rotMatrix[9];
363 for (int i = 0; i < 3; ++i) {
364 for (int j = 0; j < 3; ++j) {
365 rotMatrix[i * 3 + j] = g4.getRotation()[i][j];
366 }
367 }
368 trafo.SetRotation(rotMatrix);
369 return trafo;
370 }

◆ get()

static const SensorInfoBase & get ( Belle2::VxdID  id)
inlinestatic

Return a reference to the SensorInfo of a given SensorID.

This function is a shorthand for GeoCache::getInstance().getSensorInfo

Definition at line 139 of file GeoCache.h.

139{ return getInstance().getSensorInfo(id); }
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
Definition: GeoCache.cc:67
static GeoCache & getInstance()
Return a reference to the singleton instance.
Definition: GeoCache.cc:214

◆ getGeoTools()

const GeoTools * getGeoTools ( )
inline

Return a raw pointer to a GeoTools object.

Returns
const GeoTools* : raw pointer, no onwership transfer

Definition at line 147 of file GeoCache.h.

148 {
149 if (!m_geoToolsPtr)
150 m_geoToolsPtr = std::unique_ptr<GeoTools>(new GeoTools());
151 return m_geoToolsPtr.get();
152 }
std::unique_ptr< GeoTools > m_geoToolsPtr
Pointer to a GeoTools object.
Definition: GeoCache.h:188

◆ getHalfShellPlacements()

const map< VxdID, TGeoHMatrix > & getHalfShellPlacements ( ) const

Retrieve stored half-shell placements into world volume.

Returns
map of VxdID for half-shell and its placement

Definition at line 239 of file GeoCache.cc.

239{return m_halfShellPlacements;}

◆ getInstance()

GeoCache & getInstance ( )
static

Return a reference to the singleton instance.

Definition at line 214 of file GeoCache.cc.

215 {
216 static unique_ptr<GeoCache> instance(new GeoCache());
217 return *instance;
218 }
GeoCache()
Singleton class, hidden constructor.
Definition: GeoCache.cc:32

◆ getLadderPlacements()

const vector< pair< VxdID, TGeoHMatrix > > & getLadderPlacements ( VxdID  halfShell) const

Retrieve stored ladder placements into half-shell.

Returns
vector of pairs, each pair contains a VxdID for ladder (layer.ladder.0) and its placement

Definition at line 250 of file GeoCache.cc.

251 {
252 auto placements = m_ladderPlacements.find(halfShell);
253 if (placements == m_ladderPlacements.end())
254 throw std::invalid_argument("Invalid half-shelve id " + (std::string) halfShell);
255
256 return placements->second;
257 }

◆ getLadders()

const set< VxdID > & getLadders ( Belle2::VxdID  layer) const

Return a set of all ladder IDs belonging to a given layer.

Definition at line 193 of file GeoCache.cc.

194 {
195 //We only index by layer, so set everything else to 0
196 layer.setLadderNumber(0);
197 layer.setSensorNumber(0);
198 layer.setSegmentNumber(0);
199 SensorHierachy::const_iterator info = m_ladders.find(layer);
200 if (info == m_ladders.end()) B2FATAL("VXD Layer " << layer << "does not exist.");
201 return info->second;
202 }

◆ getLayers()

const set< VxdID > getLayers ( SensorInfoBase::SensorType  sensortype = SensorInfoBase::VXD)

Return a set of all known Layers.

Parameters
sensortypeWether to only return the layer IDs for PXD, SVD or all VXD layers (default)
Returns
a set containing all existing Layers with the requested type

Definition at line 176 of file GeoCache.cc.

177 {
178 switch (type) {
180 return m_pxdLayers;
182 return m_svdLayers;
184 return m_telLayers;
185 default:
186 std::set<VxdID> allLayers = m_pxdLayers;
187 allLayers.insert(m_svdLayers.begin(), m_svdLayers.end());
188 allLayers.insert(m_telLayers.begin(), m_telLayers.end());
189 return allLayers;
190 }
191 }

◆ getListOfSensors()

const vector< VxdID > getListOfSensors ( ) const

Get list of all sensors.

Intended mostly for Python, where std::sets don't work.

Returns
vector of VxdIDs of all sensors in GeoCache.

Definition at line 59 of file GeoCache.cc.

60 {
61 vector<VxdID> sensors;
62 for (auto entry : m_sensorInfo)
63 sensors.push_back(entry.first);
64 return sensors;
65 }

◆ getSensorInfo()

const SensorInfoBase & getSensorInfo ( Belle2::VxdID  id) const

Return a referecne to the SensorInfo of a given SensorID.

Definition at line 67 of file GeoCache.cc.

68 {
69 id.setSegmentNumber(0);
70 SensorInfoMap::const_iterator info = m_sensorInfo.find(id);
71 if (info == m_sensorInfo.end()) {
72 B2WARNING("VXD Sensor " << id << " does not exist.");
73 return *(m_sensorInfo.begin()->second);
74 }
75 return *(info->second);
76 }

◆ getSensorPlacements()

const vector< pair< VxdID, TGeoHMatrix > > & getSensorPlacements ( VxdID  ladder) const

Retrieve stored sensor placements into ladders.

Returns
vector of pairs, each pair contains a VxdID for sensor and its placement

Definition at line 241 of file GeoCache.cc.

242 {
243 auto placements = m_sensorPlacements.find(ladder);
244 if (placements == m_sensorPlacements.end())
245 throw std::invalid_argument("Invalid ladder id " + (std::string) ladder);
246
247 return placements->second;
248 }

◆ getSensors()

const set< VxdID > & getSensors ( Belle2::VxdID  ladder) const

Return a set of all sensor IDs belonging to a given ladder.

Definition at line 204 of file GeoCache.cc.

205 {
206 //We only index by layer and ladder, set sensor to 0
207 ladder.setSensorNumber(0);
208 ladder.setSegmentNumber(0);
209 SensorHierachy::const_iterator info = m_sensors.find(ladder);
210 if (info == m_sensors.end()) B2FATAL("VXD Ladder " << ladder << "does not exist.");
211 return info->second;
212 }

◆ getTGeoFromRigidBodyParams()

TGeoHMatrix getTGeoFromRigidBodyParams ( double  dU,
double  dV,
double  dW,
double  dAlpha,
double  dBeta,
double  dGamma 
)
static

Convert 6 rigid body params (alignment corrections) to corresponding TGeoHMatrix Angles in radians, length units in centimeters.

Definition at line 372 of file GeoCache.cc.

373 {
374 // Differential translation
375 TGeoTranslation translation;
376 // Differential rotation
377 TGeoRotation rotation;
378
379 translation.SetTranslation(dU, dV, dW);
380 rotation.RotateX(- dAlpha * TMath::RadToDeg());
381 rotation.RotateY(- dBeta * TMath::RadToDeg());
382 rotation.RotateZ(- dGamma * TMath::RadToDeg());
383
384 // Differential trafo (trans + rot)
385 TGeoCombiTrans combi(translation, rotation);
386 TGeoHMatrix trafo;
387 trafo = trafo * combi;
388 return trafo;
389 }

◆ setupReconstructionTransformations()

void setupReconstructionTransformations ( )

Initialize from DB for reconstruction Updates all SensorInfo transformations for reconstruction from DB object(s) (recalculating new global positions) and registers itself for subsequent updates of DB objects to keep the hierarchy up-to-date.

So the hierarchy is as follows: Belle 2 / | | \ Ying Yang Pat Mat ... other sub-detectors / | / | | \ | \ ...... ladders ...... / / | / | | \ | \ \ ......... sensors ........

Definition at line 259 of file GeoCache.cc.

260 {
261 if (!m_vxdAlignments.isValid()) {
262 B2WARNING("No VXD alignment data. Defaults (0's) will be used!");
263 return;
264 }
265
266 // Loop over VXD sensors to read parameters for description of planar defomration
267 for (auto& sensorID : getListOfSensors()) {
268 std::vector<double> planarParameters = {
269 // Numbering of VXD alignment parameters:
270 // -> 0-6: Rigid body alignment
271 // -> 31-33: First level of surface deformation
272 // -> 41-44: Second level of surface deformation
273 // -> 51-55: Third level of surface deformation
274 m_vxdAlignments->get(sensorID, 31),
275 m_vxdAlignments->get(sensorID, 32),
276 m_vxdAlignments->get(sensorID, 33),
277 m_vxdAlignments->get(sensorID, 41),
278 m_vxdAlignments->get(sensorID, 42),
279 m_vxdAlignments->get(sensorID, 43),
280 m_vxdAlignments->get(sensorID, 44),
281 m_vxdAlignments->get(sensorID, 51),
282 m_vxdAlignments->get(sensorID, 52),
283 m_vxdAlignments->get(sensorID, 53),
284 m_vxdAlignments->get(sensorID, 54),
285 m_vxdAlignments->get(sensorID, 55),
286 };
287
288 // Store parameters for planar deformation
289 VXD::SensorInfoBase& sensorInfo = const_cast<VXD::SensorInfoBase&>(getSensorInfo(sensorID));
290 sensorInfo.setSurfaceParameters(planarParameters);
291 }
292
304 for (auto& halfShellPlacement : getHalfShellPlacements()) {
305 TGeoHMatrix trafoHalfShell = halfShellPlacement.second;
306 trafoHalfShell *= getTGeoFromRigidBodyParams(
307 m_vxdAlignments->get(halfShellPlacement.first, VXDAlignment::dU),
308 m_vxdAlignments->get(halfShellPlacement.first, VXDAlignment::dV),
309 m_vxdAlignments->get(halfShellPlacement.first, VXDAlignment::dW),
310 m_vxdAlignments->get(halfShellPlacement.first, VXDAlignment::dAlpha),
311 m_vxdAlignments->get(halfShellPlacement.first, VXDAlignment::dBeta),
312 m_vxdAlignments->get(halfShellPlacement.first, VXDAlignment::dGamma)
313 );
314
315 for (auto& ladderPlacement : getLadderPlacements(halfShellPlacement.first)) {
316 // Updated trafo
317 TGeoHMatrix trafoLadder = ladderPlacement.second;
318 trafoLadder *= getTGeoFromRigidBodyParams(
319 m_vxdAlignments->get(ladderPlacement.first, VXDAlignment::dU),
320 m_vxdAlignments->get(ladderPlacement.first, VXDAlignment::dV),
321 m_vxdAlignments->get(ladderPlacement.first, VXDAlignment::dW),
322 m_vxdAlignments->get(ladderPlacement.first, VXDAlignment::dAlpha),
323 m_vxdAlignments->get(ladderPlacement.first, VXDAlignment::dBeta),
324 m_vxdAlignments->get(ladderPlacement.first, VXDAlignment::dGamma)
325 );
326
327 for (auto& sensorPlacement : getSensorPlacements(ladderPlacement.first)) {
328 // Updated trafo
329 TGeoHMatrix trafoSensor = sensorPlacement.second;
330 trafoSensor *= getTGeoFromRigidBodyParams(
331 m_vxdAlignments->get(sensorPlacement.first, VXDAlignment::dU),
332 m_vxdAlignments->get(sensorPlacement.first, VXDAlignment::dV),
333 m_vxdAlignments->get(sensorPlacement.first, VXDAlignment::dW),
334 m_vxdAlignments->get(sensorPlacement.first, VXDAlignment::dAlpha),
335 m_vxdAlignments->get(sensorPlacement.first, VXDAlignment::dBeta),
336 m_vxdAlignments->get(sensorPlacement.first, VXDAlignment::dGamma)
337 );
338
339 // Store new reco-transformation
340 VXD::SensorInfoBase& geometry = const_cast<VXD::SensorInfoBase&>(getSensorInfo(sensorPlacement.first));
341 geometry.setTransformation(trafoHalfShell * trafoLadder * trafoSensor, true);
342
343 }
344 }
345 }
346
347 }
static const baseType dAlpha
Sensor/layer/ladder alignment in local alpha.
Definition: VXDAlignment.h:29
static const baseType dGamma
Sensor/layer/ladder alignment in local gamma.
Definition: VXDAlignment.h:33
static const baseType dW
Sensor/layer/ladder alignment in local w.
Definition: VXDAlignment.h:27
static const baseType dBeta
Sensor/layer/ladder alignment in local beta.
Definition: VXDAlignment.h:31
static const baseType dU
Sensor/layer/ladder alignment in local u.
Definition: VXDAlignment.h:23
static const baseType dV
Sensor/layer/ladder alignment in local v.
Definition: VXDAlignment.h:25
static TGeoHMatrix getTGeoFromRigidBodyParams(double dU, double dV, double dW, double dAlpha, double dBeta, double dGamma)
Convert 6 rigid body params (alignment corrections) to corresponding TGeoHMatrix Angles in radians,...
Definition: GeoCache.cc:372
const std::vector< VxdID > getListOfSensors() const
Get list of all sensors.
Definition: GeoCache.cc:59
const std::vector< std::pair< VxdID, TGeoHMatrix > > & getSensorPlacements(VxdID ladder) const
Retrieve stored sensor placements into ladders.
Definition: GeoCache.cc:241
const std::map< VxdID, TGeoHMatrix > & getHalfShellPlacements() const
Retrieve stored half-shell placements into world volume.
Definition: GeoCache.cc:239
const std::vector< std::pair< VxdID, TGeoHMatrix > > & getLadderPlacements(VxdID halfShell) const
Retrieve stored ladder placements into half-shell.
Definition: GeoCache.cc:250

◆ validSensorID()

bool validSensorID ( Belle2::VxdID  id) const

Check that id is a valid sensor number.

Parameters
idsensor id to be checked against current GeoCache information
Returns
true if there is a SensorInfo associated with id, otherwise false.

Definition at line 52 of file GeoCache.cc.

53 {
54 id.setSegmentNumber(0);
55 SensorInfoMap::const_iterator info = m_sensorInfo.find(id);
56 return (info != m_sensorInfo.end());
57 }

Member Data Documentation

◆ m_geoToolsPtr

std::unique_ptr<GeoTools> m_geoToolsPtr
private

Pointer to a GeoTools object.

Definition at line 188 of file GeoCache.h.

◆ m_halfShellPlacements

std::map<VxdID, TGeoHMatrix> m_halfShellPlacements {}
private

Map of shell ids and their placements in top volume.

Definition at line 179 of file GeoCache.h.

◆ m_ladderPlacements

std::map<VxdID, std::vector<std::pair<VxdID, TGeoHMatrix> > > m_ladderPlacements {}
private

Map of shell ids and their associated ladder ids and their placements.

Definition at line 181 of file GeoCache.h.

◆ m_ladders

SensorHierachy m_ladders
private

Map of all Ladder IDs belonging to a given Layer ID.

Definition at line 174 of file GeoCache.h.

◆ m_pxdLayers

std::set<Belle2::VxdID> m_pxdLayers
private

Set of all PXD layer IDs.

Definition at line 168 of file GeoCache.h.

◆ m_sensorInfo

SensorInfoMap m_sensorInfo
private

Map to find the SensorInfo for a given Sensor ID.

Definition at line 185 of file GeoCache.h.

◆ m_sensorPlacements

std::map<VxdID, std::vector<std::pair<VxdID, TGeoHMatrix> > > m_sensorPlacements {}
private

Map of ladder ids and their associated sensor ids and their placements.

Definition at line 183 of file GeoCache.h.

◆ m_sensors

SensorHierachy m_sensors
private

Map of all Sensor IDs belonging to a given Ladder ID.

Definition at line 176 of file GeoCache.h.

◆ m_svdLayers

std::set<Belle2::VxdID> m_svdLayers
private

Set of all SVD layer IDs.

Definition at line 170 of file GeoCache.h.

◆ m_telLayers

std::set<Belle2::VxdID> m_telLayers
private

Set of all Tel layer IDs.

Definition at line 172 of file GeoCache.h.

◆ m_vxdAlignments

DBObjPtr<VXDAlignment> m_vxdAlignments
private

DBObjPtr for the alignment.

Definition at line 191 of file GeoCache.h.


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