15#include "GaudiKernel/EventIDRange.h"
36 ATH_MSG_DEBUG(
"SiRegSelCondAlg::SiRegSelCondAlg() " << name );
53 return StatusCode::SUCCESS;
75 return StatusCode::SUCCESS;
81 std::unique_ptr<SG::ReadCondHandle<PixelCablingCondData> > pixCabling;
82 std::unique_ptr<SG::ReadCondHandle<SCT_CablingData> > sctCabling;
84 EventIDRange id_range;
91 sctCabling = std::make_unique<SG::ReadCondHandle<SCT_CablingData> >(
m_sctCablingKey, ctx );
92 if( !sctCabling->range( id_range ) ) {
93 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << sctCabling->key());
94 return StatusCode::FAILURE;
101 ATH_MSG_DEBUG(
"RegSelCondAlg: " << id_range <<
"( initial range )" );
103 pixCabling = std::make_unique<SG::ReadCondHandle<PixelCablingCondData> >(
m_pixCablingKey, ctx );
104 if( !pixCabling->range( id_range ) ) {
105 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << pixCabling->key() <<
" : " << id_range );
106 return StatusCode::FAILURE;
108 ATH_MSG_DEBUG(
"RegSelCondAlg: " << id_range <<
"( final range )" );
116 std::unique_ptr<RegSelSiLUT> rd;
119 if (isPixelLikeManager) {
131 if (elements==
nullptr) {
133 return StatusCode::FAILURE;
140 if( !detEle.
range( id_range ) ) {
141 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << detEle.
key() <<
" : " << id_range );
142 return StatusCode::FAILURE;
144 ATH_MSG_DEBUG(
"RegSelCondAlg: " << id_range <<
"( final range )" );
157 double rMin, rMax, zMin, zMax, phiMin, phiMax;
159 rMin = element->rMin();
160 rMax = element->rMax();
161 zMin = element->zMin();
162 zMax = element->zMax();
163 phiMin = element->phiMin();
164 phiMax = element->phiMax();
173 if (element->isPixel() || element->isPLR() ||
m_managerName ==
"PLR") {
175 const PixelID* pixelId =
dynamic_cast<const PixelID*
>(element->getIdHelper());
176 if ( pixelId!=
nullptr ) {
177 barrelEC = pixelId->
barrel_ec(element->identify());
180 if (
m_managerName !=
"PLR" && std::fabs(barrelEC)>3 )
continue;
181 layerDisk = pixelId->
layer_disk(element->identify());
182 if(
m_useCabling) robId=(*pixCabling)->find_entry_offrob(element->identify());
186 ATH_MSG_ERROR(
"Could not get PIXEL_ID for " << element->getIdHelper() );
191 const SCT_ID* sctId =
dynamic_cast<const SCT_ID*
>(element->getIdHelper());
192 if ( sctId!=
nullptr ) {
193 barrelEC = sctId->
barrel_ec(element->identify());
194 layerDisk = sctId->
layer_disk(element->identify());
197 if(
m_useCabling) robId = ((*sctCabling)->getOnlineIdFromHash(element->identifyHash())).rod();
201 ATH_MSG_ERROR(
"Could not get SCT_ID for " << element->getIdHelper() );
209 RegSelModule smod( zMin, zMax, rMin, rMax, phiMin, phiMax, layerDisk, barrelEC, robId, hashId );
211 rd->addModule( smod );
216 <<
" barrelEC = " << barrelEC
217 <<
", layerDisk = " << layerDisk
218 <<
", phiMin, phiMax = " << phiMin/CLHEP::degree <<
" " << phiMax/CLHEP::degree
219 <<
", rMin = " << rMin/CLHEP::mm <<
" mm, rMax = " << rMax/CLHEP::mm <<
" mm" );
235 if( lutCondData.
record( id_range, rcd ).isFailure() ) {
237 <<
" " << lutCondData.
key()
238 <<
" with range " << id_range );
239 return StatusCode::FAILURE;
245 return StatusCode::FAILURE;
251 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