15#include "GaudiKernel/EventIDRange.h"
37 ATH_MSG_DEBUG(
"SiRegSelCondAlg::SiRegSelCondAlg() " << name );
54 return StatusCode::SUCCESS;
76 return StatusCode::SUCCESS;
82 std::unique_ptr<SG::ReadCondHandle<PixelCablingCondData> > pixCabling;
83 std::unique_ptr<SG::ReadCondHandle<SCT_CablingData> > sctCabling;
85 EventIDRange id_range;
92 sctCabling = std::make_unique<SG::ReadCondHandle<SCT_CablingData> >(
m_sctCablingKey, ctx );
93 if( !sctCabling->range( id_range ) ) {
94 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << sctCabling->key());
95 return StatusCode::FAILURE;
102 ATH_MSG_DEBUG(
"RegSelCondAlg: " << id_range <<
"( initial range )" );
104 pixCabling = std::make_unique<SG::ReadCondHandle<PixelCablingCondData> >(
m_pixCablingKey, ctx );
105 if( !pixCabling->range( id_range ) ) {
106 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << pixCabling->key() <<
" : " << id_range );
107 return StatusCode::FAILURE;
109 ATH_MSG_DEBUG(
"RegSelCondAlg: " << id_range <<
"( final range )" );
117 std::unique_ptr<RegSelSiLUT> rd;
120 if (isPixelLikeManager) {
132 if (elements==
nullptr) {
134 return StatusCode::FAILURE;
141 if( !detEle.
range( id_range ) ) {
142 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << detEle.
key() <<
" : " << id_range );
143 return StatusCode::FAILURE;
145 ATH_MSG_DEBUG(
"RegSelCondAlg: " << id_range <<
"( final range )" );
158 double rMin, rMax, zMin, zMax, phiMin, phiMax;
160 rMin = element->rMin();
161 rMax = element->rMax();
162 zMin = element->zMin();
163 zMax = element->zMax();
164 phiMin = element->phiMin();
165 phiMax = element->phiMax();
174 if (element->isPixel() || element->isPLR() ||
m_managerName ==
"PLR") {
176 const PixelID* pixelId =
dynamic_cast<const PixelID*
>(element->getIdHelper());
177 if ( pixelId!=
nullptr ) {
178 barrelEC = pixelId->
barrel_ec(element->identify());
181 if (
m_managerName !=
"PLR" && std::fabs(barrelEC)>3 )
continue;
182 layerDisk = pixelId->
layer_disk(element->identify());
183 if(
m_useCabling && pixCabling) robId=(*pixCabling)->find_entry_offrob(element->identify());
187 ATH_MSG_ERROR(
"Could not get PIXEL_ID for " << element->getIdHelper() );
192 const SCT_ID* sctId =
dynamic_cast<const SCT_ID*
>(element->getIdHelper());
193 if ( sctId!=
nullptr ) {
194 barrelEC = sctId->
barrel_ec(element->identify());
195 layerDisk = sctId->
layer_disk(element->identify());
198 if(
m_useCabling && sctCabling) robId = ((*sctCabling)->getOnlineIdFromHash(element->identifyHash())).rod();
202 ATH_MSG_ERROR(
"Could not get SCT_ID for " << element->getIdHelper() );
210 RegSelModule smod( zMin, zMax, rMin, rMax, phiMin, phiMax, layerDisk, barrelEC, robId, hashId );
212 rd->addModule( smod );
217 <<
" barrelEC = " << barrelEC
218 <<
", layerDisk = " << layerDisk
219 <<
", phiMin, phiMax = " << phiMin/CLHEP::degree <<
" " << phiMax/CLHEP::degree
220 <<
", rMin = " << rMin/CLHEP::mm <<
" mm, rMax = " << rMax/CLHEP::mm <<
" mm" );
236 if( lutCondData.
record( id_range, rcd ).isFailure() ) {
238 <<
" " << lutCondData.
key()
239 <<
" with range " << id_range );
240 return StatusCode::FAILURE;
246 return StatusCode::FAILURE;
252 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
RegSelCondData< IRegSelLUT > IRegSelLUTCondData
This is an Identifier helper class for the Pixel subdetector.
emacs: this is -*- c++ -*-
This is an Identifier helper class for the SCT subdetector.
emacs: this is -*- c++ -*-
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Base class for conditions algorithms.
This is a "hash" representation of an Identifier.
Class to hold the SiDetectorElement objects to be put in the detector store.
Class to hold geometrical description of a silicon detector element.
This is an Identifier helper class for the Pixel subdetector.
int layer_disk(const Identifier &id) const
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0).
This is an Identifier helper class for the SCT subdetector.
int layer_disk(const Identifier &id) const
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0).
const_pointer_type retrieve()
bool range(EventIDRange &r)
const std::string & key() const
const std::string & key() const
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const
SG::ReadCondHandleKey< SCT_CablingData > m_sctCablingKey
Sadly the PIxel and SCT cabling are different classes so need both, even if only one is to be used.
std::string m_managerName
SG::ReadCondHandleKey< PixelCablingCondData > m_pixCablingKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_detEleCollKey
virtual StatusCode execute(const EventContext &ctx) const override
SiRegSelCondAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::WriteCondHandleKey< IRegSelLUTCondData > m_tableKey
Output conditions object.
virtual StatusCode initialize() override