ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DetectorDescription
GeoModel
GeoModelUtilities
GeoModelUtilities
GeoDBUtils.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef GeoDBUtils_h_
6
#define GeoDBUtils_h_
7
9
#include "
GeoPrimitives/GeoPrimitives.h
"
10
11
#include "
RDBAccessSvc/IRDBAccessSvc.h
"
12
#include "
RDBAccessSvc/IRDBRecordset.h
"
13
#include "
RDBAccessSvc/IRDBRecord.h
"
14
#include <string>
15
#include "GeoModelKernel/GeoDefinitions.h"
16
#include "GaudiKernel/SystemOfUnits.h"
17
18
19
class
GeoDBUtils
{
20
21
public
:
22
23
inline
static
const
IRDBRecord
*
getTransformRecord
(
IRDBRecordset_ptr
positionRecSet,
const
std::string & key) {
24
for
(
unsigned
int
s=0;s<positionRecSet->
size
(); s++) {
25
const
IRDBRecord
*currentRec= (*positionRecSet)[s];
26
if
(key == currentRec->
getString
(
"NAME"
)) {
27
return
currentRec;
28
}
29
}
30
return
NULL;
31
}
32
33
inline
static
GeoTrf::Transform3D
getTransform
(
const
IRDBRecord
*currentRec) {
34
double
x
= currentRec->
getDouble
(
"TRANSX"
)*Gaudi::Units::mm;
35
double
y
= currentRec->
getDouble
(
"TRANSY"
)*Gaudi::Units::mm;
36
double
z
= currentRec->
getDouble
(
"TRANSZ"
)*Gaudi::Units::mm;
37
double
theta
= currentRec->
getDouble
(
"THETA"
)*Gaudi::Units::rad;
38
double
phi
= currentRec->
getDouble
(
"PHI"
)*Gaudi::Units::rad;
39
double
rotationAngle = currentRec->
getDouble
(
"ROTATIONANGLE"
)*Gaudi::Units::rad;
40
41
GeoTrf::Vector3D axis(sin(
theta
)*cos(
phi
), sin(
theta
)*sin(
phi
),cos(
theta
));
42
return
GeoTrf::Translate3D(
x
,
y
,
z
)*GeoTrf::Rotate3D(rotationAngle,axis);
43
}
44
45
};
46
#endif
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
theta
Scalar theta() const
theta method
Definition
AmgMatrixBasePlugin.h:75
GeoPrimitives.h
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
IRDBRecordset_ptr
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition
IRDBAccessSvc.h:30
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
y
#define y
x
#define x
z
#define z
GeoDBUtils
Ensure that the extensions for the Vector3D are properly loaded.
Definition
GeoDBUtils.h:19
GeoDBUtils::getTransformRecord
static const IRDBRecord * getTransformRecord(IRDBRecordset_ptr positionRecSet, const std::string &key)
Definition
GeoDBUtils.h:23
GeoDBUtils::getTransform
static GeoTrf::Transform3D getTransform(const IRDBRecord *currentRec)
Definition
GeoDBUtils.h:33
IRDBRecord
IRDBRecord is one record in the IRDBRecordset object.
Definition
IRDBRecord.h:28
IRDBRecord::getDouble
virtual double getDouble(std::string_view fieldName) const =0
Get double field value.
IRDBRecord::getString
virtual const std::string & getString(std::string_view fieldName) const =0
Get string field value.
IRDBRecordset::size
virtual unsigned int size() const =0
Generated on
for ATLAS Offline Software by
1.17.0