41#include "GaudiKernel/ISvcLocator.h"
42#include "GaudiKernel/MsgStream.h"
43#include "GaudiKernel/IMessageSvc.h"
51 MsgStream log(msgSvc,
"buildCaloDetDescr");
54 SmartIF<StoreGateSvc> detStore{svcLocator->service(
"DetectorStore")};
56 throw std::runtime_error(
"buildCaloDetDescr failed to acquire a pointer to DetectorStore");
59 if(detStore->retrieve(cell_id,
"CaloCell_ID")!=StatusCode::SUCCESS)
60 throw std::runtime_error(
"buildCaloDetDescr failed to acquire a pointer to CaloCell_ID helper");
61 log << MSG::DEBUG <<
"Found the CaloCell_ID helper. " <<
endmsg;
64 if(detStore->retrieve(caloId_mgr,
"CaloIdManager")!=StatusCode::SUCCESS)
65 throw std::runtime_error(
"buildCaloDetDescr failed to acquire a pointer to CaloIdManager helper");
66 log << MSG::DEBUG <<
"Found the CaloIdManager helper. " <<
endmsg;
70 std::unique_ptr<CaloDetDescrManager> caloMgr = std::make_unique<CaloDetDescrManager>();
73 caloMgr->set_helper(cell_id);
74 caloMgr->set_helper(caloId_mgr);
76 caloMgr->initialize();
83 caloMgr->set_lar_geometry(cellVol.
layout());
90 bool isTestBeam =
false;
92 StatusCode status = detStore->retrieve(larMgr);
93 if(status.isFailure()) {
94 log << MSG::WARNING <<
"Could not get LArDetectorManager. Assuming TestBeam=false" <<
endmsg;
114 status = detStore->retrieve(embManager);
115 if(status.isFailure()) {
116 log << MSG::WARNING <<
"Could not get the EMBDetectorManager. No Calo Elements will be built for EMB" <<
endmsg;
138 throw std::runtime_error(
"buildCaloDetDescr Wrong Side Index for EMB region " + std::to_string(embRegion->
getEndcapIndex()));
150 caloMgr->add(embDescr);
153 double z_min = 10000.;
154 double z_max = -10000.;
155 double r_min = 10000.;
156 double r_max = -10000.;
158 double reg_min = 10000.;
159 double reg_max = -10000.;
161 std::vector<double> depth_in;
162 std::vector<double> depth_out;
166 for (
unsigned int iPhi=embRegion->
beginPhiIndex(); iPhi<embRegion->endPhiIndex(); ++iPhi) {
167 for (
unsigned int iEta=embRegion->
beginEtaIndex(); iEta<embRegion->endEtaIndex(); ++iEta) {
172 , cellPtr->getSamplingIndex()
173 , cellPtr->getRegionIndex()
180 elementPosShift.
dx = cellPosShift->
deltaX(posShiftInd);
181 elementPosShift.
dy = cellPosShift->
deltaY(posShiftInd);
182 elementPosShift.
dz = cellPosShift->
deltaZ(posShiftInd);
192 , cellPosShift ? &elementPosShift :
nullptr);
194 if(iPhi==0 && (iEta==0||iEta==1)) {
195 phi_min = embElement->
phi() - 0.5*embElement->
dphi();
200 phi_min = embElement->
phi() - 0.5*embElement->
dphi();
207 caloMgr->add(embElement);
209 if(r_min > embElement->
r()-0.5*embElement->
dr())
210 r_min = embElement->
r()-0.5*embElement->
dr();
211 if(r_max < embElement->
r()+0.5*embElement->
dr())
212 r_max = embElement->
r()+0.5*embElement->
dr();
214 if(z_min > std::abs(embElement->
z_raw())-0.5*embElement->
dz())
215 z_min = std::abs(embElement->
z_raw())-0.5*embElement->
dz();
216 if(z_max < std::abs(embElement->
z_raw())+0.5*embElement->
dz())
217 z_max = std::abs(embElement->
z_raw())+0.5*embElement->
dz();
219 if(reg_min > embElement->
eta()-0.5*embElement->
deta())
220 reg_min = embElement->
eta()-0.5*embElement->
deta();
221 if(reg_max < embElement->
eta()+0.5*embElement->
deta())
222 reg_max = embElement->
eta()+0.5*embElement->
deta();
237 double eta_max = (embRegion->
getDescriptor()->getEtaBinning()).getEnd();
283 status = detStore->retrieve(emecManager);
284 if(status.isFailure()) {
285 log << MSG::WARNING <<
"Could not get the EMECDetectorManager. No Calo Elements will be built for EMEC" <<
endmsg;
311 throw std::runtime_error(
"Wrong Endcap Index for EMEC region " + std::to_string(endcapInd));
322 throw std::runtime_error(
"Wrong Radial Index for EMEC region " + std::to_string(radialInd));
334 caloMgr->add(emecDescr);
337 double z_min = 10000.;
338 double z_max = -10000.;
339 double r_min = 10000.;
340 double r_max = -10000.;
342 double reg_min = 10000.;
343 double reg_max = -10000.;
345 std::vector<double> depth_in;
346 std::vector<double> depth_out;
350 for (
unsigned int iPhi=emecRegion->
beginPhiIndex(); iPhi<emecRegion->endPhiIndex(); ++iPhi) {
351 for (
unsigned int iEta=emecRegion->
beginEtaIndex(); iEta<emecRegion->endEtaIndex(); ++iEta) {
355 , cellPtr->getSamplingIndex()
356 , cellPtr->getRegionIndex()
363 elementPosShift.
dx = cellPosShift->
deltaX(posShiftInd);
364 elementPosShift.
dy = cellPosShift->
deltaY(posShiftInd);
365 elementPosShift.
dz = cellPosShift->
deltaZ(posShiftInd);
375 , cellPosShift ? &elementPosShift :
nullptr);
376 if((cellPosShift && iPhi==0)
378 phi_min = emecElement->
phi() - 0.5*emecElement->
dphi();
383 caloMgr->add(emecElement);
385 if(r_min > emecElement->
r()-0.5*emecElement->
dr())
386 r_min = emecElement->
r()-0.5*emecElement->
dr();
387 if(r_max < emecElement->
r()+0.5*emecElement->
dr())
388 r_max = emecElement->
r()+0.5*emecElement->
dr();
390 if(z_min > std::abs(emecElement->
z_raw())-0.5*emecElement->
dz())
391 z_min = std::abs(emecElement->
z_raw())-0.5*emecElement->
dz();
392 if(z_max < std::abs(emecElement->
z_raw())+0.5*emecElement->
dz())
393 z_max = std::abs(emecElement->
z_raw())+0.5*emecElement->
dz();
395 if(reg_min > emecElement->
eta()-0.5*emecElement->
deta())
396 reg_min = emecElement->
eta()-0.5*emecElement->
deta();
397 if(reg_max < emecElement->
eta()+0.5*emecElement->
deta())
398 reg_max = emecElement->
eta()+0.5*emecElement->
deta();
402 depth_in.push_back(std::abs(emecElement->
z_raw())-emecElement->
dz());
403 depth_out.push_back(std::abs(emecElement->
z_raw())+emecElement->
dz());
457 status = detStore->retrieve(hecManager);
458 if(status.isFailure()) {
459 log << MSG::WARNING <<
"Could not get the HECDetectorManager. No Calo Elements will be built for HEC" <<
endmsg;
484 caloMgr->add(hecDescr);
487 float z_min = 10000.f;
488 float z_max = -10000.f;
489 double r_min = 10000.;
490 double r_max = -10000.;
492 double reg_min = 10000.;
493 double reg_max = -10000.;
495 std::vector<double> depth_in;
496 std::vector<double> depth_out;
500 for (
unsigned int iPhi=hecregion->
beginPhiIndex(); iPhi<hecregion->endPhiIndex(); ++iPhi) {
501 for (
unsigned int iEta=hecregion->
beginEtaIndex(); iEta<hecregion->endEtaIndex(); ++iEta) {
508 , cellPtr->getSamplingIndex()
509 , cellPtr->getRegionIndex()
516 elementPosShift.
dx = cellPosShift->
deltaX(posShiftInd);
517 elementPosShift.
dy = cellPosShift->
deltaY(posShiftInd);
518 elementPosShift.
dz = cellPosShift->
deltaZ(posShiftInd);
528 , cellPosShift ? &elementPosShift :
nullptr);
530 if((cellPosShift && iPhi==0)
532 phi_min = hecElement->
phi() - 0.5*hecElement->
dphi();
538 caloMgr->add(hecElement);
545 if(z_min > std::abs(hecElement->
z_raw())-hecElement->
dz())
546 z_min = std::abs(hecElement->
z_raw())-hecElement->
dz();
547 if(z_max < std::abs(hecElement->
z_raw())+hecElement->
dz())
548 z_max = std::abs(hecElement->
z_raw())+hecElement->
dz();
550 if(reg_min > hecElement->
eta()-0.5*hecElement->
deta())
551 reg_min = hecElement->
eta()-0.5*hecElement->
deta();
552 if(reg_max < hecElement->
eta()+0.5*hecElement->
deta())
553 reg_max = hecElement->
eta()+0.5*hecElement->
deta();
556 depth_in.push_back(std::abs(hecElement->
z_raw())-hecElement->
dz());
557 depth_out.push_back(std::abs(hecElement->
z_raw())+hecElement->
dz());
614 status = detStore->retrieve(fcalManager);
615 if(status.isFailure()) {
616 log << MSG::WARNING <<
"Could not get the FCALDetectorManager. No Calo Elements will be built for FCAL" <<
endmsg;
622 for (fcalmodIt=fcalManager->
beginFCAL(); fcalmodIt!=fcalManager->
endFCAL(); ++fcalmodIt) {
641 caloMgr->add(fcalDescr);
643 double eta_min = 10000.;
644 double eta_max = -10000.;
645 double z_min = 10000.;
646 double z_max = -10000.;
647 double r_min = 10000.;
648 double r_max = -10000.;
650 double reg_min = 10000.;
651 double reg_max = -10000.;
653 std::vector<double> depth_in;
654 std::vector<double> depth_out;
659 for (fcaltileIt=fcalmodule->
beginTiles(); fcaltileIt!=fcalmodule->
endTiles(); ++fcaltileIt) {
662 , fcaltileIt->getIndexJ()
663 , fcaltileIt->getIndexI());
667 elementPosShift.
dx = cellPosShift->
deltaX(posShiftInd);
668 elementPosShift.
dy = cellPosShift->
deltaY(posShiftInd);
669 elementPosShift.
dz = cellPosShift->
deltaZ(posShiftInd);
679 , cellPosShift ? &elementPosShift :
nullptr);
682 unsigned int numTubes = fcaltileIt->getNumTubes();
684 fcalElement->
set_volume(.5*sqrt(3)*numTubes*tubeSpacing*tubeSpacing*dz);
686 caloMgr->add(fcalElement);
688 if(eta_min > std::abs(fcalElement->
eta_raw())-0.5*fcalElement->
deta())
689 eta_min = std::abs(fcalElement->
eta_raw())-0.5*fcalElement->
deta();
690 if(eta_max < std::abs(fcalElement->
eta_raw())+0.5*fcalElement->
deta())
691 eta_max = std::abs(fcalElement->
eta_raw())+0.5*fcalElement->
deta();
692 if(r_min > fcalElement->
r() - 0.5*fcalElement->
dr())
693 r_min = fcalElement->
r() - 0.5*fcalElement->
dr();
694 if(r_max < fcalElement->
r() + 0.5*fcalElement->
dr())
695 r_max = fcalElement->
r() + 0.5*fcalElement->
dr();
696 if(z_min > std::abs(fcalElement->
z_raw()) - 0.5*fcalElement->
dz())
697 z_min = std::abs(fcalElement->
z_raw()) - 0.5*fcalElement->
dz();
698 if(z_max < std::abs(fcalElement->
z_raw()) + 0.5*fcalElement->
dz())
699 z_max = std::abs(fcalElement->
z_raw()) + 0.5*fcalElement->
dz();
700 if(reg_min > fcalElement->
eta()-0.5*fcalElement->
deta())
701 reg_min = fcalElement->
eta()-0.5*fcalElement->
deta();
702 if(reg_max < fcalElement->
eta()+0.5*fcalElement->
deta())
703 reg_max = fcalElement->
eta()+0.5*fcalElement->
deta();
706 depth_in.push_back(std::abs(fcalElement->
z_raw()) - fcalElement->
dz());
707 depth_out.push_back(std::abs(fcalElement->
z_raw()) + fcalElement->
dz());
749 status = detStore->retrieve(tile_mgr);
750 if (status.isFailure()) {
751 log << MSG::WARNING <<
"Could not get the TileDetectorManager. No Calo Elements will be built for Tile" <<
endmsg;
754 log << MSG::DEBUG <<
" Found the TileDetDescrManager " <<
endmsg;
756 unsigned idHashMax = maxHash-minHash;
757 for(
unsigned int idhash=0; idhash < idHashMax; ++idhash) {
760 caloMgr->add(newelt);
767 for(; itr != end; ++itr) {
768 caloMgr->add_tile(*itr);
780 if(detStore->retrieve(cDDEvec) == StatusCode::SUCCESS) {
792 , IMessageSvc* msgSvc)
Scalar eta() const
pseudorapidity method
Container for a cell-level position corrections to account for distorsion of calo shape in reconstruc...
LAr subsystem specific descriptors.
std::unique_ptr< CaloDetDescrManager > buildCaloDetDescrNoAlign(ISvcLocator *svcLocator, IMessageSvc *msgSvc)
std::unique_ptr< CaloDetDescrManager > buildCaloDetDescr(ISvcLocator *svcLocator, IMessageSvc *msgSvc, const GeoAlignmentStore *geoAlignStore, const CaloRec::CaloCellPositionShift *cellPosShift)
Definition of CaloDetDescrManager.
Calo Subsystem specific Detector Elements + Dummy element for testing.
GeoIntrusivePtr< const EMBCell > EMBCellConstLink
GeoIntrusivePtr< const HECCell > HECCellConstLink
@Class: HECCellConstLink
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
double CellVolume(Identifier cell_id)
const std::string & layout()
double getFcalTubeSpacing(int sampling)
void calo_cell_hash_range(const Identifier id, IdentifierHash &caloCellMin, IdentifierHash &caloCellMax) const
to loop on 'global' cell hashes of one sub-calorimeter alone
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
Helper class for offline cell identifiers.
This class groups all DetDescr information related to a CaloCell.
float eta_raw() const
cell eta_raw
float dphi() const
cell dphi
void set_volume(double volume)
set cell volume
float eta() const
cell eta
float phi() const
cell phi
float deta() const
cell deta
float z_raw() const
cell z_raw
void set_depth_out(std::vector< double > &calo_depth)
set vector of out depths
void setLArRegMin(double reg_min)
Set LAr Region Eta Min.
int n_phi() const
phi granularity
void setLArPhiMin(double phi_min)
Set LAr Region Phi Min.
void setCaloRMin(double r_min)
Set R Min.
void setLArRegMax(double reg_max)
Set LAr Region Eta Max.
void setCaloZMax(double z_max)
Set Z Max.
void set_n_calo_depth(int n_calo_depth)
set number of calo depths
void setCaloZMin(double z_min)
Set Z Min.
void setCaloPhiMin(double phi_min)
Set Phi Min.
void setCaloPhiMax(double phi_max)
Set Phi Max.
void setCaloRMax(double r_max)
Set R Max.
void set_depth_in(std::vector< double > &calo_depth)
set vector of in depths
void setCaloEtaMin(double eta_min)
Set Eta Min.
void setLArEtaMin(double eta_min)
Set LAr Region Phi Max.
void setCaloEtaMax(double eta_max)
Set Eta Max.
This class initializes the Calo (LAr and Tile) offline identifiers.
const LArHEC_ID * getHEC_ID(void) const
const LArFCAL_ID * getFCAL_ID(void) const
const LArEM_ID * getEM_ID(void) const
Container for a cell-level rescaling-factors, typically obtained by Z->ee intercalibration.
contType::size_type size_type
float deltaX(const size_type &hashID) const
float deltaY(const size_type &hashID) const
float deltaZ(const size_type &hashID) const
const CellBinning & getPhiBinning() const
The Binning in Phi.
const CellBinning & getEtaBinning() const
The Binning in Eta.
LAr EMB Detector Element.
A manager class providing access to readout geometry information for the electromagnetic barrel calor...
EMBDetectorManager::DetectorRegionConstIterator beginDetectorRegion() const
Iterate over detector regions.
std::vector< constEMBDetectorRegion * >::const_iterator DetectorRegionConstIterator
EMBDetectorManager::DetectorRegionConstIterator endDetectorRegion() const
Iterate over detector regions.
const EMBDetDescr * getDescriptor() const
Returns the Descriptor for this region.
unsigned int beginPhiIndex() const
Returns the first phi index in the region.
EMBCellConstLink getEMBCell(unsigned int ieta, unsigned int iphi) const
Access to Cells.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index.
EMBDetectorRegion::DetectorSide getEndcapIndex() const
The endcap index.
unsigned int getRegionIndex() const
Returns the Region Index.
unsigned int beginEtaIndex() const
Returns the first eta index in the region.
Smart Pointer to EMEC Cells.
const CellBinning & getEtaBinning() const
The Binning in Eta.
const CellBinning & getPhiBinning() const
The Binning in Phi.
LAr EMEC Detector Element.
A manager class providing access to readout geometry information for the electromagnetic endcap calor...
EMECDetectorManager::DetectorRegionConstIterator endDetectorRegion() const
Iterate over detector regions.
EMECDetectorManager::DetectorRegionConstIterator beginDetectorRegion() const
Iterate over detector regions.
std::vector< constEMECDetectorRegion * >::const_iterator DetectorRegionConstIterator
EMECCellConstLink getEMECCell(unsigned int ieta, unsigned int iphi) const
Access to Cells.
unsigned int beginPhiIndex() const
returns the first phi index in the region.
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.
const EMECDetDescr * getDescriptor() const
Returns the Descriptor for this region.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index.
unsigned int beginEtaIndex() const
returns the first eta index in the region.
LAr FCAL Detector Element.
A manager class providing access to readout geometry information for the forward calorimeter.
std::vector< constFCALModule * >::const_iterator ConstIterator
FCALDetectorManager::ConstIterator beginFCAL() const
Iterate over FCAL Modules.
FCALDetectorManager::ConstIterator endFCAL() const
Iterate over FCAL Modules.
FCALModule::Endcap getEndcapIndex() const
Returns the side (O=Negative, 1=Positive)
double getFullDepthZ(const FCALTile &) const
Gets Tile (full) Depth.
std::vector< FCALTile >::const_iterator ConstIterator
FCALModule::ConstIterator beginTiles() const
Iteration over FCAL Tiles.
FCALModule::Module getModuleIndex() const
Returns the Module (1,2, or 3)
FCALModule::ConstIterator endTiles() const
Iteration over FCAL Tiles.
Ensure that the extensions for the Vector3D are properly loaded.
const CellBinning & getPhiBinning() const
The Binning in Phi.
const CellBinning & getEtaBinning() const
The Binning in Eta.
LAr HEC Detector Element.
A manager class providing access to readout geometry information for the hadronic endcap calorimeter.
HECDetectorManager::DetectorRegionConstIterator endDetectorRegion() const
Iterate over detector regions.
HECDetectorManager::DetectorRegionConstIterator beginDetectorRegion() const
Iterate over detector regions.
std::vector< constHECDetectorRegion * >::const_iterator DetectorRegionConstIterator
Description of a region of homogenous granularity in the hadronic endcap calorimeter.
unsigned int getRegionIndex() const
Returns the Region Index.
HECCellConstLink getHECCell(unsigned int ieta, unsigned int iphi) const
Retrieve a cell with eta index and phi index.
unsigned int beginPhiIndex() const
returns the first phi index in the region.
unsigned int getSamplingIndex() const
Returns the Sampling Layer Index (0-3)
const HECDetDescr * getDescriptor() const
Returns the Descriptor for this region.
unsigned int beginEtaIndex() const
returns the first eta index in the region.
HECDetectorRegion::DetectorSide getEndcapIndex() const
The endcap index.
This is a "hash" representation of an Identifier.
void isTestBeam(bool flag)
Set Test Beam flag.
Identifier region_id(const ExpandedIdentifier &exp_id) const
Build a cell identifier from an expanded identifier.
Identifier channel_id(const ExpandedIdentifier &exp_id) const
Build a cell identifier from an expanded identifier.
IdentifierHash channel_hash(Identifier channelId) const
create hash id from channel id
Helper class for LArEM offline identifiers.
Identifier module_id(const ExpandedIdentifier &exp_id) const
module identifier for a channel from ExpandedIdentifier
IdentifierHash channel_hash(Identifier channelId) const
Convert a connected channel (cell) Identifier to a hash code.
Identifier channel_id(const ExpandedIdentifier &exp_id) const
cell identifier for a channel from ExpandedIdentifier
Helper class for LArFCAL offline identifiers.
Identifier channel_id(const ExpandedIdentifier &exp_id) const
channel identifier for a channel from ExpandedIdentifier
Identifier region_id(const ExpandedIdentifier &exp_id) const
region identifier for a channel from ExpandedIdentifier
IdentifierHash channel_hash(Identifier channelId) const
create hash id from channel id
Helper class for LArHEC offline identifiers.
calo_descr_const_iterator calo_descriptors_end() const
CaloDetDescrElement * get_cell_element(unsigned int cell_hash) const
calo_descr_const_iterator calo_descriptors_begin() const
dx,dy,dz displacement of the calorimeter cell caused by sagging