ATLAS Offline Software
Loading...
Searching...
No Matches
HECDetectorManager.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include "GaudiKernel/MsgStream.h"
8#include "GaudiKernel/Bootstrap.h"
9#include "GaudiKernel/SystemOfUnits.h"
18#include "LArHV/LArHVManager.h"
19
20// Class HECDetectorManager
21
22HECDetectorManager::HECDetectorManager(const HECHVManager* hvManager, bool isTestBeam)
23 : GeoVDetectorManager()
24 , m_HVManager(hvManager)
25 , m_isTestBeam(isTestBeam)
26{
27 setName("LArHEC");
28
29 ISvcLocator *svcLocator = Gaudi::svcLocator();
30
31 SmartIF<IGeoModelSvc> geoModel{svcLocator->service("GeoModelSvc")};
32 if(!geoModel.isValid())
33 throw std::runtime_error("Error in HECDetectorManager, cannot access GeoModelSvc");
34
35 SmartIF<IGeoDbTagSvc> geoDbTagSvc{svcLocator->service("GeoDbTagSvc")};
36 if(!geoDbTagSvc.isValid())
37 throw std::runtime_error("Error in HECDetectorManager, cannot access GeoDbTagSvc");
38
39 SmartIF<IRDBAccessSvc> rdbAccess{svcLocator->service(geoDbTagSvc->getParamSvcName())};
40 if(!rdbAccess.isValid())
41 throw std::runtime_error("Error in HECDetectorManager, cannot access RDBAccessSvc");
42
43 std::string larKey, larNode;
44 if(geoDbTagSvc->getSqliteReader()==nullptr) {
45 DecodeVersionKey larVersionKey(geoModel, "LAr");
46 larKey = larVersionKey.tag();
47 larNode = larVersionKey.node();
48 }
49
50 IRDBRecordset_ptr hecLongBlock = rdbAccess->getRecordsetPtr("HecLongitudinalBlock",larKey,larNode);
51 IRDBRecordset_ptr hecPad = rdbAccess->getRecordsetPtr("HecPad",larKey,larNode);
52 IRDBRecordset_ptr hadronicEndcap = rdbAccess->getRecordsetPtr("HadronicEndcap",larKey,larNode);
53
54 if(hecLongBlock->size()==0) {
55 hecLongBlock = rdbAccess->getRecordsetPtr("HecLongitudinalBlock", "HecLongitudinalBlock-00");
56 if (hecLongBlock->size()==0) {
57 throw std::runtime_error("Error getting HecLongitudinalBlock table");
58 }
59 }
60
61 if(hecPad->size()==0) {
62 hecPad = rdbAccess->getRecordsetPtr("HecPad","HecPad-00");
63 if (hecPad->size()==0) {
64 throw std::runtime_error("Error getting HecPad table");
65 }
66 }
67
68 if(hadronicEndcap->size()==0) {
69 hadronicEndcap = rdbAccess->getRecordsetPtr("HadronicEndcap","HadronicEndcap-00");
70 if (hadronicEndcap->size()==0) {
71 throw std::runtime_error("Error getting HadronicEndcap table");
72 }
73 }
74
75 if (hecPad->size()!=hecLongBlock->size()) throw std::runtime_error("Error. Hec[LongitudinalBlock,Pad] size discrepancy");
76
77 // Get the focal length:
78 m_focalToRef1 = (*hadronicEndcap)[0]->getDouble("ZORIG")*Gaudi::Units::cm;
80 double betweenWheel=(*hadronicEndcap)[0]->getDouble("GAPWHL")*Gaudi::Units::cm;
81 if(!m_isTestBeam) m_focalToRef2 += betweenWheel;
82
83 for (unsigned int b=0;b<hecLongBlock->size();b++) {
84 double etaBoundary[15];
85 const IRDBRecord *block = (*hecLongBlock)[b];
86 unsigned int blockNumber= (unsigned int) (block->getDouble("IBLC")+0.01); // will truncate down.
87 double innerRadius= block->getDouble("BLRMN")*Gaudi::Units::cm;
88 double outerRadius= block->getDouble("BLRMX")*Gaudi::Units::cm;
89 double depth= block->getDouble("BLDPTH")*Gaudi::Units::cm;
90 unsigned int numLArGaps= (unsigned int) (block->getDouble("BLMOD") + 0.01); // will truncate down.
91 double frontPlateThickness= block->getDouble("PLATE0")*Gaudi::Units::cm;
92 double backPlateThickness= block->getDouble("PLATEE")*Gaudi::Units::cm;
93
94 const IRDBRecord *pad = (*hecPad)[b];
95 for (int j=0;j<15;j++) etaBoundary[j]=pad->getDouble("ETA",j);
96 HECLongBlock *longBlock = new HECLongBlock(blockNumber,
97 innerRadius,
98 outerRadius,
99 depth,
100 numLArGaps,
101 frontPlateThickness,
102 backPlateThickness,
103 etaBoundary);
104 m_HecLongBlock.push_back(longBlock);
105 if ((!m_isTestBeam) && b<3) m_focalToRef2 += depth;
106 }
107
108
109}
110
111
113{
114 for (unsigned int i=0;i<getNumBlocks();i++) delete m_HecLongBlock[i];
115 for (unsigned int i=0;i<getNumDetectorRegions();i++) delete m_DetRegionsIterative[i];
116}
117
118
119
124
129
130const HECDetectorRegion * HECDetectorManager::getDetectorRegion (unsigned int endcap, unsigned int sampling, unsigned int region) const
131{
132 return m_DetRegionsRandom[endcap][sampling][region];
133}
134
136{
137 return m_DetRegionsIterative.size();
138}
139
140PVConstLink HECDetectorManager::getTreeTop (unsigned int i) const
141{
142 return m_treeTop[i];
143}
144
146{
147 return m_treeTop.size();
148}
149
154
159
160const HECLongBlock * HECDetectorManager::getBlock (unsigned int i) const
161{
162 return m_HecLongBlock[i];
163}
164
166{
167 return m_HecLongBlock.size();
168}
169
171{
172 m_DetRegionsRandom[region->getEndcapIndex()][region->getSamplingIndex()][region->getRegionIndex()] = region;
173 m_DetRegionsIterative.push_back(region);
174}
175
176void HECDetectorManager::addTreeTop (const PVLink& treeTop)
177{
178 m_treeTop.push_back(treeTop);
179}
180
182{
183 return *m_HVManager;
184}
185
186
Definition of the abstract IRDBAccessSvc interface.
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
Definition of the abstract IRDBRecord interface.
Definition of the abstract IRDBRecordset interface.
This is a helper class to query the version tags from GeoModelSvc and determine the appropriate tag a...
const std::string & tag() const
Return version tag.
const std::string & node() const
Return the version node.
void addTreeTop(const PVLink &treeTop)
Add a Tree Top.
virtual ~HECDetectorManager() override
Destructor.
HECDetectorManager::DetectorRegionConstIterator endDetectorRegion() const
Iterate over detector regions.
const HECDetectorRegion * getDetectorRegion(unsigned int endcap, unsigned int sampling, unsigned int region) const
Random Access to detector regions.
std::vector< constHECLongBlock * >::const_iterator BlockConstIterator
unsigned int getNumDetectorRegions() const
Gets the number of detectors in the set of detector regions.
HECDetectorManager::BlockConstIterator endBlock() const
Iterate over blocks.
std::vector< const HECDetectorRegion * > m_DetRegionsIterative
A vector of Region pointer which exists in order to provide iterative access to any HECDetectorRegion...
std::vector< const HECLongBlock * > m_HecLongBlock
unsigned int getNumBlocks() const
Gets the number of blocks in the set of blocks.
virtual PVConstLink getTreeTop(unsigned int i) const override
Gets the ith tree top.
virtual unsigned int getNumTreeTops() const override
Gets the total number of tree tops.
void addDetectorRegion(const HECDetectorRegion *region)
Add a new HEC Detector Region.
HECDetectorManager::BlockConstIterator beginBlock() const
Iterate over blocks.
HECDetRegionArray m_DetRegionsRandom
An array of Region pointers which exists in order to provide random access to any HECDetectorRegion h...
std::vector< PVLink > m_treeTop
This is the set of tree tops managed by this detector node.
const HECLongBlock * getBlock(unsigned int i) const
Random Access to Blocks.
HECDetectorManager::DetectorRegionConstIterator beginDetectorRegion() const
Iterate over detector regions.
std::vector< constHECDetectorRegion * >::const_iterator DetectorRegionConstIterator
HECDetectorManager(const HECHVManager *hvManager=nullptr, bool isTestBeam=false)
Constructor.
const HECHVManager * m_HVManager
const HECHVManager & getHVManager() const
Get the HV Manager.
Description of a region of homogenous granularity in the hadronic endcap calorimeter.
unsigned int getRegionIndex() const
Returns the Region Index.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index (0-3)
HECDetectorRegion::DetectorSide getEndcapIndex() const
The endcap index.
This class provides direct access to information on the HV electrodes within the barrels.
IRDBRecord is one record in the IRDBRecordset object.
Definition IRDBRecord.h:27
virtual double getDouble(const std::string &fieldName) const =0
Get double field value.
virtual unsigned int size() const =0
std::string depth
tag string for intendation
Definition fastadd.cxx:46