5#include "GaudiKernel/MsgStream.h"
6#include "GaudiKernel/Bootstrap.h"
7#include "GaudiKernel/SystemOfUnits.h"
8#include "GaudiKernel/ServiceHandle.h"
32 for (
unsigned int r=0;
r<6;
r++) {
33 for (
unsigned int s=0;s<4;s++) {
34 for (
unsigned int io=0;io<2;io++) {
35 for (
unsigned int e=0;e<2;e++) {
46 ISvcLocator *svcLocator = Gaudi::svcLocator();
48 SmartIF<IGeoModelSvc> geoModel{svcLocator->service(
"GeoModelSvc")};
49 if(!geoModel.isValid())
50 throw std::runtime_error(
"Error in EMECDetectorManager, cannot access GeoModelSvc");
52 SmartIF<IGeoDbTagSvc> geoDbTagSvc{svcLocator->service(
"GeoDbTagSvc")};
53 if(!geoDbTagSvc.isValid())
54 throw std::runtime_error(
"Error in EMECDetectorManager, cannot access GeoDbTagSvc");
56 SmartIF<IRDBAccessSvc> rdbAccess{svcLocator->service(geoDbTagSvc->getParamSvcName())};
57 if(!rdbAccess.isValid())
58 throw std::runtime_error(
"Error in EMECDetectorManager, cannot access RDBAccessSvc");
60 std::string larKey, larNode;
61 if(geoDbTagSvc->getSqliteReader()==
nullptr) {
63 larKey = larVersionKey.
tag();
64 larNode = larVersionKey.
node();
67 IRDBRecordset_ptr emecSamplingSep = rdbAccess->getRecordsetPtr(
"EmecSamplingSep", larKey, larNode);
68 if (emecSamplingSep->
size()==0)
throw std::runtime_error(
"Error getting EmecSamplingSep table");
71 for (
int j=0;j<7;j++)
m_ziw.push_back(ess->
getDouble(
"ZIW",j)*Gaudi::Units::cm);
72 for (
int j=0;j<44;j++)
m_zsep12.push_back(ess->
getDouble(
"ZSEP12",j)*Gaudi::Units::cm);
73 for (
int j=0;j<22;j++)
m_zsep23.push_back(ess->
getDouble(
"ZSEP23",j)*Gaudi::Units::cm);
75 IRDBRecordset_ptr emecMagicNumbers = rdbAccess->getRecordsetPtr(
"EmecMagicNumbers", larKey, larNode);
76 if (emecMagicNumbers->
size()==0) {
77 emecMagicNumbers = rdbAccess->getRecordsetPtr(
"EmecMagicNumbers",
"EmecMagicNumbers-00");
78 if (emecMagicNumbers->
size()==0) {
79 throw std::runtime_error(
"Error getting EmecMagicNumbers table");
82 m_MagicNumbers->focalToRef =(*emecMagicNumbers)[0]->getDouble(
"FOCALTOREF")*Gaudi::Units::mm;
83 m_MagicNumbers->refToActive =(*emecMagicNumbers)[0]->getDouble(
"REFTOACTIVE")*Gaudi::Units::mm;
84 m_MagicNumbers->activeLength =(*emecMagicNumbers)[0]->getDouble(
"ACTIVELENGTH")*Gaudi::Units::mm;
85 m_MagicNumbers->refToPresampler =(*emecMagicNumbers)[0]->getDouble(
"REFTOPRESAMPLER")*Gaudi::Units::mm;
86 m_MagicNumbers->presamplerLength =(*emecMagicNumbers)[0]->getDouble(
"PRESAMPLERLENGTH")*Gaudi::Units::mm;
133 throw std::out_of_range(
"EMECDetectorManager::addDetectorRegion -- region");
136 if (isampling >= 4) {
137 throw std::out_of_range(
"EMECDetectorManager::addDetectorRegion -- sampling");
142 throw std::out_of_range(
"EMECDetectorManager::addDetectorRegion -- radius");
146 throw std::out_of_range(
"EMECDetectorManager::addDetectorRegion -- endcap");
163 if (detStore->retrieve(manager)==StatusCode::SUCCESS) {
164 out = &(manager->getEMECHVManager(io));
169 throw std::runtime_error (
"EMECDetectorManager::getHVManager: Can't find LArHVManager in DetectorStore");
180 if (detStore->retrieve(manager)==StatusCode::SUCCESS) {
181 out = &(manager->getEMECPresamplerHVManager());
186 throw std::runtime_error (
"EMECDetectorManager::getPresamplerHVManager: Can't find LArHVManager in DetectorStore");
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.
This is a collection of numbers used to specify the construction of the electromagnetic endcap calori...
CxxUtils::CachedPointer< const EMECPresamplerHVManager > m_presamplerHVManager
const EMECDetectorRegion * getDetectorRegion(unsigned int endcap, unsigned int sampling, unsigned int region, bool inner) const
Random Access to detector regions.
const EMECPresamplerHVManager & getPresamplerHVManager() const
Get the HV Manager (presampler)
EMECDetRegionArray m_DetRegionsRandom
A vector of Region pointers which exists in order to provide iterative access to any EMECDetectorRegi...
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.
CxxUtils::CachedPointer< const EMECHVManager > m_HVManager[2]
The HV Managers for the emec;.
void addTreeTop(const PVLink &treeTop)
Add a Tree Top.
EMECDetectorManager::DetectorRegionConstIterator endDetectorRegion() const
Iterate over detector regions.
EMECMagicNumbers * m_MagicNumbers
Clockwork for the EMECDetectorManager.
void addDetectorRegion(const EMECDetectorRegion *region)
Add a new HEC Detector Region.
std::vector< double > m_zsep23
A vector of doubles used to hold an array of sampling separations for the EMEC outer wheel between sa...
std::vector< double > m_zsep12
A vector of doubles used to hold an array of sampling separations for the EMEC outer wheel between sa...
unsigned int getNumDetectorRegions() const
Gets the number of detectors in the set of detector regions.
EMECDetectorManager(const EMECHVManager *hvManagerInner=nullptr, const EMECHVManager *hvManagerOuter=nullptr, const EMECPresamplerHVManager *presamplerHVManager=nullptr)
Constructor.
virtual ~EMECDetectorManager() override
Destructor.
std::vector< double > m_ziw
A vector of doubles used to hold an array of sampling separations for the EMEC inner wheel.
const EMECHVManager & getHVManager(EMECHVManager::IOType io) const
Get the HV Managers.
std::vector< PVLink > m_treeTop
This is the set of tree tops managed by this detector node.
std::vector< const EMECDetectorRegion * > m_DetRegionsIterative
A vector of Region pointers which exists in order to provide iterative access to any EMECDetectorRegi...
EMECDetectorManager::DetectorRegionConstIterator beginDetectorRegion() const
Iterate over detector regions.
std::vector< constEMECDetectorRegion * >::const_iterator DetectorRegionConstIterator
unsigned int getRadialIndex() const
Returns the Radial (Outer Wheel=0,InnerWheel=1) Index.
unsigned int getRegionIndex() const
Returns the Region Index.
EMECDetectorRegion::DetectorSide getEndcapIndex() const
The endcap index.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index.
This class provides direct access to information on the HV electrodes within the EMEC.
EMECHVModule::IOType IOType
This class provides direct access to information on the HV electrodes within the EMEC.
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
This class provides access to the High Voltage throughout the LAr.