ATLAS Offline Software
LUCID_RDBAaccess.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "LUCID_RDBAaccess.h"
6 
7 #include "GeoModelKernel/Units.h"
8 
13 
14 #include "GaudiKernel/MsgStream.h"
15 #include "GaudiKernel/GaudiException.h"
16 #include "GaudiKernel/Bootstrap.h"
17 #include "GaudiKernel/SystemOfUnits.h"
18 
20 
21 #include "GaudiKernel/ISvcLocator.h"
22 
24 
25  ReadDB();
26  SetParameters();
27  Print();
28  CloseDB();
29 }
30 
32 
34 
35  MsgStream log(Athena::getMessageSvc(), "LUCID_GeoModel::LUCID_RDBAaccess");
36 
37  log << MSG::DEBUG << " Starting LUCID_GeoModel::LUCID_RDBAaccess " << endmsg;
38  log << MSG::DEBUG << " LUCID_RDBAaccess::ReadDB "<< endmsg;
39 
40  SmartIF<IRDBAccessSvc> iAccessSvc(Gaudi::svcLocator()->service("RDBAccessSvc"));
41  if (!iAccessSvc) {
42 
43  log << MSG::FATAL << " Could not initialize RDBAccessSvc! " << endmsg;
44 
45  throw GaudiException(" Could not initalize RDBAccessSvc ", "LUCID_GeoModel", StatusCode::FAILURE);
46  }
47 
48  DecodeVersionKey atlasVersion("ATLAS");
49  const std::string& AtlasVersion = atlasVersion.tag();
50 
51  m_lucidParams = iAccessSvc->getRecordsetPtr("LucidParams", AtlasVersion, "ATLAS");
52 
53  if (!m_lucidParams->size()) std::cerr << " ERROR: Unable to retrieve LucidParams data "<< std::endl;
54 
55  log << MSG::INFO << " LUCID data corresponding to " << AtlasVersion << " fetched " << endmsg;
56 }
57 
59 
60  MsgStream log(Athena::getMessageSvc(), "LUCID_GeoModel::LUCID_RDBAaccess");
61 
62  log << MSG::DEBUG << " LUCID_RDBAaccess::SetParameters "<< endmsg;
63 
64  log << MSG::DEBUG << " Starting LUCID_GeoModel::LUCID_RDBAaccess " << endmsg;
65 
66  IRDBRecordset::const_iterator AccessSvc_iter;
67 
68  for(AccessSvc_iter = m_lucidParams->begin(); AccessSvc_iter != m_lucidParams->end(); ++AccessSvc_iter) {
69 
70  distanceToIP = (*AccessSvc_iter)->getDouble("DISTANCETOIP")*Gaudi::Units::mm;
71  VJdistanceToIP = (*AccessSvc_iter)->getDouble("VJDISTANCETOIP")*Gaudi::Units::mm;
72  VJconelength = (*AccessSvc_iter)->getDouble("VJCONELENGTH")*Gaudi::Units::mm;
73  VJconeRadiusFront = (*AccessSvc_iter)->getDouble("VJCONERADIUSFRONT")*Gaudi::Units::mm;
74  VJconeRadiusBack = (*AccessSvc_iter)->getDouble("VJCONERADIUSBACK")*Gaudi::Units::mm;
75  VJconeThickness = (*AccessSvc_iter)->getDouble("VJCONETHICKNESS")*Gaudi::Units::mm;
76  VJconeFrontRingThickness = (*AccessSvc_iter)->getDouble("VJCONEFRONTRINGTHICKNESS")*Gaudi::Units::mm;
77  VJconeFrontRingLength = (*AccessSvc_iter)->getDouble("VJCONEFRONTRINGLENGTH")*Gaudi::Units::mm;
78  VJconeFrontRingOverlap = (*AccessSvc_iter)->getDouble("VJCONEFRONTRINGOVERLAP")*Gaudi::Units::mm;
79  cylinderLength = (*AccessSvc_iter)->getDouble("VESSELLENGTH")*Gaudi::Units::mm;
80  cylinderRadius = (*AccessSvc_iter)->getDouble("COOLINGRADIUS")*Gaudi::Units::mm;
81  cylinderThickness = (*AccessSvc_iter)->getDouble("COOLINGTHICKNESS")*Gaudi::Units::mm;
82  pmtPosition = (*AccessSvc_iter)->getDouble("LAYERRADIUS1")*Gaudi::Units::mm;
83  pmtRadius = (*AccessSvc_iter)->getDouble("TUBERADIUS")*Gaudi::Units::mm;
84  pmtThickness = (*AccessSvc_iter)->getDouble("PMTTHICKNESS")*Gaudi::Units::mm;
85  quartzDensity = (*AccessSvc_iter)->getDouble("QUARTZDENSITY")*GeoModelKernelUnits::gram/Gaudi::Units::cm3;
86  waveLengthStep = (*AccessSvc_iter)->getDouble("WAVELENGTHSTEP");
87  waveLengthMin = (*AccessSvc_iter)->getDouble("WAVELENGTHMIN");
88  waveLengthMax = (*AccessSvc_iter)->getDouble("WAVELENGTHMAX");
89  }
90 }
91 
92 void LUCID_RDBAccess::Print() const {
93 
94  MsgStream log(Athena::getMessageSvc(), "LUCID_GeoModel::LUCID_RDBAaccess");
95 
96  log << MSG::INFO << " distanceToIP [mm]: " << distanceToIP/Gaudi::Units::mm << endmsg;
97  log << MSG::INFO << " VJdistanceToIP [mm]: " << VJdistanceToIP/Gaudi::Units::mm << endmsg;
98  log << MSG::INFO << " VJconelength [mm]: " << VJconelength/Gaudi::Units::mm << endmsg;
99  log << MSG::INFO << " VJconeRadiusFront [mm]: " << VJconeRadiusFront/Gaudi::Units::mm << endmsg;
100  log << MSG::INFO << " VJconeRadiusBack [mm]: " << VJconeRadiusBack/Gaudi::Units::mm << endmsg;
101  log << MSG::INFO << " VJconeThickness [mm]: " << VJconeThickness/Gaudi::Units::mm << endmsg;
102  log << MSG::INFO << " VJconeFrontRingThickness[mm]: " << VJconeFrontRingThickness/Gaudi::Units::mm << endmsg;
103  log << MSG::INFO << " VJconeFrontRingLength [mm]: " << VJconeFrontRingLength/Gaudi::Units::mm << endmsg;
104  log << MSG::INFO << " VJconeFrontRingOverlap [mm]: " << VJconeFrontRingOverlap/Gaudi::Units::mm << endmsg;
105  log << MSG::INFO << " cylinderLength [mm]: " << cylinderLength/Gaudi::Units::mm << endmsg;
106  log << MSG::INFO << " cylinderRadius [mm]: " << cylinderRadius/Gaudi::Units::mm << endmsg;
107  log << MSG::INFO << " cylinderThickness [mm]: " << cylinderThickness/Gaudi::Units::mm << endmsg;
108  log << MSG::INFO << " pmtPosition [mm]: " << pmtPosition/Gaudi::Units::mm << endmsg;
109  log << MSG::INFO << " pmtRadius [mm]: " << pmtRadius/Gaudi::Units::mm << endmsg;
110  log << MSG::INFO << " pmtThickness [mm]: " << pmtThickness/Gaudi::Units::mm << endmsg;
111  log << MSG::INFO << " quartzDensity [g/cm3]: " << quartzDensity/(GeoModelKernelUnits::gram/Gaudi::Units::cm3) << endmsg;
112  log << MSG::INFO << " waveLengthStep [nm]: " << waveLengthStep << endmsg;
113  log << MSG::INFO << " waveLengthMin [nm]: " << waveLengthMin << endmsg;
114  log << MSG::INFO << " waveLengthMax [nm]: " << waveLengthMax << endmsg;
115 }
116 
118 
119  MsgStream log(Athena::getMessageSvc(), "LUCID_GeoModel::LUCID_RDBAaccess");
120 
121  log << MSG::DEBUG << " LUCID_RDBAaccess::CloseDB "<< endmsg;
122 
123  log << MSG::DEBUG << " ending LUCID_GeoModel::LUCID_RDBAaccess " << endmsg;
124 }
LUCID_RDBAaccess.h
LUCID_RDBAccess::cylinderRadius
double cylinderRadius
Definition: LUCID_RDBAaccess.h:35
LUCID_RDBAccess::VJconeThickness
double VJconeThickness
Definition: LUCID_RDBAaccess.h:29
LUCID_RDBAccess::distanceToIP
double distanceToIP
Definition: LUCID_RDBAaccess.h:23
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
LUCID_RDBAccess::~LUCID_RDBAccess
~LUCID_RDBAccess()
Definition: LUCID_RDBAaccess.cxx:31
LUCID_RDBAccess::VJdistanceToIP
double VJdistanceToIP
Definition: LUCID_RDBAaccess.h:25
LUCID_RDBAccess::waveLengthMin
double waveLengthMin
Definition: LUCID_RDBAaccess.h:44
LUCID_RDBAccess::cylinderThickness
double cylinderThickness
Definition: LUCID_RDBAaccess.h:36
LUCID_RDBAccess::ReadDB
void ReadDB()
Definition: LUCID_RDBAaccess.cxx:33
cm3
#define cm3
python.SystemOfUnits.gram
int gram
Definition: SystemOfUnits.py:165
LUCID_RDBAccess::VJconeFrontRingOverlap
double VJconeFrontRingOverlap
Definition: LUCID_RDBAaccess.h:32
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
LUCID_RDBAccess::pmtThickness
double pmtThickness
Definition: LUCID_RDBAaccess.h:39
LUCID_RDBAccess::SetParameters
void SetParameters()
Definition: LUCID_RDBAaccess.cxx:58
LUCID_RDBAccess::VJconeFrontRingThickness
double VJconeFrontRingThickness
Definition: LUCID_RDBAaccess.h:30
LUCID_RDBAccess::pmtPosition
double pmtPosition
Definition: LUCID_RDBAaccess.h:37
EventInfoWrite.AtlasVersion
AtlasVersion
Definition: EventInfoWrite.py:17
IRDBAccessSvc.h
Definition of the abstract IRDBAccessSvc interface.
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
LUCID_RDBAccess::VJconeRadiusFront
double VJconeRadiusFront
Definition: LUCID_RDBAaccess.h:27
DecodeVersionKey
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
Definition: DecodeVersionKey.h:18
LUCID_RDBAccess::CloseDB
static void CloseDB()
Definition: LUCID_RDBAaccess.cxx:117
LUCID_RDBAccess::LUCID_RDBAccess
LUCID_RDBAccess()
Definition: LUCID_RDBAaccess.cxx:23
DecodeVersionKey::tag
const std::string & tag() const
Return version tag.
Definition: DecodeVersionKey.cxx:91
LUCID_RDBAccess::VJconeRadiusBack
double VJconeRadiusBack
Definition: LUCID_RDBAaccess.h:28
LUCID_RDBAccess::waveLengthMax
double waveLengthMax
Definition: LUCID_RDBAaccess.h:45
LUCID_RDBAccess::cylinderLength
double cylinderLength
Definition: LUCID_RDBAaccess.h:34
LUCID_RDBAccess::quartzDensity
double quartzDensity
Definition: LUCID_RDBAaccess.h:41
LUCID_RDBAccess::pmtRadius
double pmtRadius
Definition: LUCID_RDBAaccess.h:38
LUCID_RDBAccess::Print
void Print() const
Definition: LUCID_RDBAaccess.cxx:92
DecodeVersionKey.h
LUCID_RDBAccess::VJconelength
double VJconelength
Definition: LUCID_RDBAaccess.h:26
python.SystemOfUnits.mm
int mm
Definition: SystemOfUnits.py:83
IRDBRecord.h
Definition of the abstract IRDBRecord interface.
LUCID_RDBAccess::waveLengthStep
double waveLengthStep
Definition: LUCID_RDBAaccess.h:43
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
LUCID_RDBAccess::VJconeFrontRingLength
double VJconeFrontRingLength
Definition: LUCID_RDBAaccess.h:31
IRDBRecordset.h
Definition of the abstract IRDBRecordset interface.
IRDBRecordset::const_iterator
RecordsVector::const_iterator const_iterator
Definition: IRDBRecordset.h:52
LUCID_RDBAccess::m_lucidParams
IRDBRecordset_ptr m_lucidParams
Definition: LUCID_RDBAaccess.h:49