ATLAS Offline Software
LUCID_RDBAaccess.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 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  m_svcLocator = Gaudi::svcLocator();
41  IRDBAccessSvc* iAccessSvc = nullptr;
42 
43  StatusCode result = m_svcLocator->service("RDBAccessSvc", iAccessSvc);
44 
45  if (result.isFailure() || iAccessSvc == nullptr) {
46 
47  log << MSG::FATAL << " Could not initialize RDBAccessSvc! " << endmsg;
48 
49  throw GaudiException(" Could not initalize RDBAccessSvc ", "LUCID_GeoModel", StatusCode::FAILURE);
50  }
51 
52  DecodeVersionKey atlasVersion("ATLAS");
53  const std::string& AtlasVersion = atlasVersion.tag();
54 
55  m_lucidParams = iAccessSvc->getRecordsetPtr("LucidParams", AtlasVersion, "ATLAS");
56 
57  if (!m_lucidParams->size()) std::cerr << " ERROR: Unable to retrieve LucidParams data "<< std::endl;
58 
59  log << MSG::INFO << " LUCID data corresponding to " << AtlasVersion << " fetched " << endmsg;
60 }
61 
63 
64  MsgStream log(Athena::getMessageSvc(), "LUCID_GeoModel::LUCID_RDBAaccess");
65 
66  log << MSG::DEBUG << " LUCID_RDBAaccess::SetParameters "<< endmsg;
67 
68  log << MSG::DEBUG << " Starting LUCID_GeoModel::LUCID_RDBAaccess " << endmsg;
69 
70  IRDBRecordset::const_iterator AccessSvc_iter;
71 
72  for(AccessSvc_iter = m_lucidParams->begin(); AccessSvc_iter != m_lucidParams->end(); ++AccessSvc_iter) {
73 
74  distanceToIP = (*AccessSvc_iter)->getDouble("DISTANCETOIP")*Gaudi::Units::mm;
75  VJdistanceToIP = (*AccessSvc_iter)->getDouble("VJDISTANCETOIP")*Gaudi::Units::mm;
76  VJconelength = (*AccessSvc_iter)->getDouble("VJCONELENGTH")*Gaudi::Units::mm;
77  VJconeRadiusFront = (*AccessSvc_iter)->getDouble("VJCONERADIUSFRONT")*Gaudi::Units::mm;
78  VJconeRadiusBack = (*AccessSvc_iter)->getDouble("VJCONERADIUSBACK")*Gaudi::Units::mm;
79  VJconeThickness = (*AccessSvc_iter)->getDouble("VJCONETHICKNESS")*Gaudi::Units::mm;
80  VJconeFrontRingThickness = (*AccessSvc_iter)->getDouble("VJCONEFRONTRINGTHICKNESS")*Gaudi::Units::mm;
81  VJconeFrontRingLength = (*AccessSvc_iter)->getDouble("VJCONEFRONTRINGLENGTH")*Gaudi::Units::mm;
82  VJconeFrontRingOverlap = (*AccessSvc_iter)->getDouble("VJCONEFRONTRINGOVERLAP")*Gaudi::Units::mm;
83  cylinderLength = (*AccessSvc_iter)->getDouble("VESSELLENGTH")*Gaudi::Units::mm;
84  cylinderRadius = (*AccessSvc_iter)->getDouble("COOLINGRADIUS")*Gaudi::Units::mm;
85  cylinderThickness = (*AccessSvc_iter)->getDouble("COOLINGTHICKNESS")*Gaudi::Units::mm;
86  pmtPosition = (*AccessSvc_iter)->getDouble("LAYERRADIUS1")*Gaudi::Units::mm;
87  pmtRadius = (*AccessSvc_iter)->getDouble("TUBERADIUS")*Gaudi::Units::mm;
88  pmtThickness = (*AccessSvc_iter)->getDouble("PMTTHICKNESS")*Gaudi::Units::mm;
89  quartzDensity = (*AccessSvc_iter)->getDouble("QUARTZDENSITY")*GeoModelKernelUnits::gram/Gaudi::Units::cm3;
90  waveLengthStep = (*AccessSvc_iter)->getDouble("WAVELENGTHSTEP");
91  waveLengthMin = (*AccessSvc_iter)->getDouble("WAVELENGTHMIN");
92  waveLengthMax = (*AccessSvc_iter)->getDouble("WAVELENGTHMAX");
93  }
94 }
95 
96 void LUCID_RDBAccess::Print() const {
97 
98  MsgStream log(Athena::getMessageSvc(), "LUCID_GeoModel::LUCID_RDBAaccess");
99 
100  log << MSG::INFO << " distanceToIP [mm]: " << distanceToIP/Gaudi::Units::mm << endmsg;
101  log << MSG::INFO << " VJdistanceToIP [mm]: " << VJdistanceToIP/Gaudi::Units::mm << endmsg;
102  log << MSG::INFO << " VJconelength [mm]: " << VJconelength/Gaudi::Units::mm << endmsg;
103  log << MSG::INFO << " VJconeRadiusFront [mm]: " << VJconeRadiusFront/Gaudi::Units::mm << endmsg;
104  log << MSG::INFO << " VJconeRadiusBack [mm]: " << VJconeRadiusBack/Gaudi::Units::mm << endmsg;
105  log << MSG::INFO << " VJconeThickness [mm]: " << VJconeThickness/Gaudi::Units::mm << endmsg;
106  log << MSG::INFO << " VJconeFrontRingThickness[mm]: " << VJconeFrontRingThickness/Gaudi::Units::mm << endmsg;
107  log << MSG::INFO << " VJconeFrontRingLength [mm]: " << VJconeFrontRingLength/Gaudi::Units::mm << endmsg;
108  log << MSG::INFO << " VJconeFrontRingOverlap [mm]: " << VJconeFrontRingOverlap/Gaudi::Units::mm << endmsg;
109  log << MSG::INFO << " cylinderLength [mm]: " << cylinderLength/Gaudi::Units::mm << endmsg;
110  log << MSG::INFO << " cylinderRadius [mm]: " << cylinderRadius/Gaudi::Units::mm << endmsg;
111  log << MSG::INFO << " cylinderThickness [mm]: " << cylinderThickness/Gaudi::Units::mm << endmsg;
112  log << MSG::INFO << " pmtPosition [mm]: " << pmtPosition/Gaudi::Units::mm << endmsg;
113  log << MSG::INFO << " pmtRadius [mm]: " << pmtRadius/Gaudi::Units::mm << endmsg;
114  log << MSG::INFO << " pmtThickness [mm]: " << pmtThickness/Gaudi::Units::mm << endmsg;
115  log << MSG::INFO << " quartzDensity [g/cm3]: " << quartzDensity/(GeoModelKernelUnits::gram/Gaudi::Units::cm3) << endmsg;
116  log << MSG::INFO << " waveLengthStep [nm]: " << waveLengthStep << endmsg;
117  log << MSG::INFO << " waveLengthMin [nm]: " << waveLengthMin << endmsg;
118  log << MSG::INFO << " waveLengthMax [nm]: " << waveLengthMax << endmsg;
119 }
120 
122 
123  MsgStream log(Athena::getMessageSvc(), "LUCID_GeoModel::LUCID_RDBAaccess");
124 
125  log << MSG::DEBUG << " LUCID_RDBAaccess::CloseDB "<< endmsg;
126 
127  log << MSG::DEBUG << " ending LUCID_GeoModel::LUCID_RDBAaccess " << endmsg;
128 }
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
get_generator_info.result
result
Definition: get_generator_info.py:21
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
IRDBAccessSvc::getRecordsetPtr
virtual IRDBRecordset_ptr getRecordsetPtr(const std::string &node, const std::string &tag, const std::string &tag2node="", const std::string &connName="ATLASDD")=0
Provides access to the Recordset object containing HVS-tagged data.
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:62
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.
IRDBAccessSvc
IRDBAccessSvc is an abstract interface to the athena service that provides the following functionalit...
Definition: IRDBAccessSvc.h:45
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
LUCID_RDBAccess::m_svcLocator
ISvcLocator * m_svcLocator
Definition: LUCID_RDBAaccess.h:50
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:121
LUCID_RDBAccess::LUCID_RDBAccess
LUCID_RDBAccess()
Definition: LUCID_RDBAaccess.cxx:23
DecodeVersionKey::tag
const std::string & tag() const
Return version tag.
Definition: DecodeVersionKey.cxx:93
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:96
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