ATLAS Offline Software
Loading...
Searching...
No Matches
HECDetDescr.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/Bootstrap.h"
8#include "GaudiKernel/SystemOfUnits.h"
16
18 , unsigned int sampling
19 , unsigned int region
20 , const CellBinning &phiBinning
21 , bool isTestBeam)
22 : m_manager(detManager)
23 , m_samplingIndex(sampling)
24 , m_regionIndex(region)
25 , m_phiBinning(phiBinning)
26 , m_outerRadSegNumber(region==0 ? 9: 3)
27 , m_etaBinning(0,0,1,0)
28 , m_numBlocks(sampling==0 ? 1:2)
29 , m_firstBlock(sampling==0 ? 0 : 2*sampling-1)
30{
31 // This will soon be unnecessary (when the wheels are divided!
32 ISvcLocator *svcLocator = Gaudi::svcLocator();
33
34 SmartIF<IGeoModelSvc> geoModel{svcLocator->service("GeoModelSvc")};
35 if(!geoModel.isValid())
36 throw std::runtime_error("Error in HECDetectorManager, cannot access GeoModelSvc");
37
38 SmartIF<IGeoDbTagSvc> geoDbTagSvc{svcLocator->service("GeoDbTagSvc")};
39 if(!geoDbTagSvc.isValid())
40 throw std::runtime_error("Error in HECDetectorManager, cannot access GeoDbTagSvc");
41
42 SmartIF<IRDBAccessSvc> rdbAccess{svcLocator->service(geoDbTagSvc->getParamSvcName())};
43 if(!rdbAccess.isValid())
44 throw std::runtime_error("Error in HECDetectorManager, cannot access RDBAccessSvc");
45
46 std::string larKey, larNode;
47 if(geoDbTagSvc->getSqliteReader()==nullptr) {
48 DecodeVersionKey larVersionKey(geoModel, "LAr");
49 larKey = larVersionKey.tag();
50 larNode = larVersionKey.node();
51 }
52
53IRDBRecordset_ptr hadronicEndcap = rdbAccess->getRecordsetPtr("HadronicEndcap", larKey, larNode);
54
55 if (hadronicEndcap->size()==0) throw std::runtime_error("Error getting HadronicEndcap table");
56 // End of soon-to-be-unnecessary part.
57
58 if(!isTestBeam) {
59 m_etaBinning = CellBinning( region==0 ? (sampling<2 ? 1.5: (sampling<3 ? 1.6: 1.7)) : 2.5,
60 region==0 ? 2.5 : (sampling==0 || sampling==3) ? 3.3 : 3.1,
61 region==0 ? (sampling<2 ? 10: (sampling<3 ? 9:8)) : (sampling==0 || sampling==3) ? 4:3,
62 region==0 ? (sampling<2 ? 0: (sampling<3 ? 1:2)):0);
63 } else {
64 m_etaBinning = CellBinning( region==0 ? (sampling<2 ? 2.1: 2.3) : 2.5,
65 region==0 ? 2.5 : (sampling==0 ) ? 3.3 : 3.1,
66 region==0 ? (sampling<2 ? 4: 2) : (sampling==0) ? 4:3,
67 region==0 ? (sampling<2 ? 6: 8):0);
68 }
69
70
71 unsigned int startBlock = m_samplingIndex <2 ? 0 : 3;
72 if(isTestBeam) startBlock = 0;
73 {
74 double pos=0.0;
75 for (unsigned int b=startBlock;b<m_manager->getNumBlocks();b++) {
76 if (b>=m_firstBlock && b< (m_firstBlock+m_numBlocks)) {
77 double front = pos;
78 double back = pos+m_manager->getBlock(b)->getDepth();
79 m_zMin.push_back(front);
80 m_zMax.push_back(back);
81 }
82 pos += m_manager->getBlock(b)->getDepth();
83 if(isTestBeam && b==2) pos += (*hadronicEndcap)[0]->getDouble("GAPWHL")*Gaudi::Units::cm;
84 }
85 }
86}
87
88
90= default;
91
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.
unsigned int m_samplingIndex
std::vector< double > m_zMin
~HECDetDescr()
Destructor.
unsigned int m_regionIndex
CellBinning m_phiBinning
unsigned int m_firstBlock
HECDetDescr(const HECDetectorManager *detManager, unsigned int sampling, unsigned int region, const CellBinning &phiBinning, bool isTestBeam=false)
Constructor.
unsigned int m_outerRadSegNumber
const HECDetectorManager * m_manager
CellBinning m_etaBinning
std::vector< double > m_zMax
unsigned int m_numBlocks
A manager class providing access to readout geometry information for the hadronic endcap calorimeter.
virtual unsigned int size() const =0