7#include "GaudiKernel/MsgStream.h"
8#include "GaudiKernel/Bootstrap.h"
9#include "GaudiKernel/SystemOfUnits.h"
23 : GeoVDetectorManager()
29 ISvcLocator *svcLocator = Gaudi::svcLocator();
31 SmartIF<IGeoModelSvc> geoModel{svcLocator->service(
"GeoModelSvc")};
32 if(!geoModel.isValid())
33 throw std::runtime_error(
"Error in HECDetectorManager, cannot access GeoModelSvc");
35 SmartIF<IGeoDbTagSvc> geoDbTagSvc{svcLocator->service(
"GeoDbTagSvc")};
36 if(!geoDbTagSvc.isValid())
37 throw std::runtime_error(
"Error in HECDetectorManager, cannot access GeoDbTagSvc");
39 SmartIF<IRDBAccessSvc> rdbAccess{svcLocator->service(geoDbTagSvc->getParamSvcName())};
40 if(!rdbAccess.isValid())
41 throw std::runtime_error(
"Error in HECDetectorManager, cannot access RDBAccessSvc");
43 std::string larKey, larNode;
44 if(geoDbTagSvc->getSqliteReader()==
nullptr) {
46 larKey = larVersionKey.
tag();
47 larNode = larVersionKey.
node();
50 IRDBRecordset_ptr hecLongBlock = rdbAccess->getRecordsetPtr(
"HecLongitudinalBlock",larKey,larNode);
52 IRDBRecordset_ptr hadronicEndcap = rdbAccess->getRecordsetPtr(
"HadronicEndcap",larKey,larNode);
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");
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");
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");
75 if (hecPad->
size()!=hecLongBlock->
size())
throw std::runtime_error(
"Error. Hec[LongitudinalBlock,Pad] size discrepancy");
78 m_focalToRef1 = (*hadronicEndcap)[0]->getDouble(
"ZORIG")*Gaudi::Units::cm;
80 double betweenWheel=(*hadronicEndcap)[0]->getDouble(
"GAPWHL")*Gaudi::Units::cm;
83 for (
unsigned int b=0;b<hecLongBlock->
size();b++) {
84 double etaBoundary[15];
86 unsigned int blockNumber= (
unsigned int) (block->
getDouble(
"IBLC")+0.01);
87 double innerRadius= block->
getDouble(
"BLRMN")*Gaudi::Units::cm;
88 double outerRadius= block->
getDouble(
"BLRMX")*Gaudi::Units::cm;
90 unsigned int numLArGaps= (
unsigned int) (block->
getDouble(
"BLMOD") + 0.01);
91 double frontPlateThickness= block->
getDouble(
"PLATE0")*Gaudi::Units::cm;
92 double backPlateThickness= block->
getDouble(
"PLATEE")*Gaudi::Units::cm;
95 for (
int j=0;j<15;j++) etaBoundary[j]=pad->
getDouble(
"ETA",j);
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.
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