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;
127 if (elements==
nullptr) {
129 return StatusCode::FAILURE;
136 if( !detEle.
range( id_range ) ) {
137 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << detEle.
key() <<
" : " << id_range );
138 return StatusCode::FAILURE;
140 ATH_MSG_DEBUG(
"RegSelCondAlg: " << id_range <<
"( final range )" );
153 double rMin, rMax, zMin, zMax, phiMin, phiMax;
155 rMin = element->rMin();
156 rMax = element->rMax();
157 zMin = element->zMin();
158 zMax = element->zMax();
159 phiMin = element->phiMin();
160 phiMax = element->phiMax();
167 if (element->isPixel()) {
169 const PixelID* pixelId =
dynamic_cast<const PixelID*
>(element->getIdHelper());
170 if ( pixelId!=
nullptr ) {
171 barrelEC = pixelId->
barrel_ec(element->identify());
172 if ( std::fabs(barrelEC)>3 )
continue;
173 layerDisk = pixelId->
layer_disk(element->identify());
174 if(
m_useCabling) robId=(*pixCabling)->find_entry_offrob(element->identify());
178 ATH_MSG_ERROR(
"Could not get PIXEL_ID for " << element->getIdHelper() );
183 const SCT_ID* sctId =
dynamic_cast<const SCT_ID*
>(element->getIdHelper());
184 if ( sctId!=
nullptr ) {
185 barrelEC = sctId->
barrel_ec(element->identify());
186 layerDisk = sctId->
layer_disk(element->identify());
189 if(
m_useCabling) robId = ((*sctCabling)->getOnlineIdFromHash(element->identifyHash())).rod();
193 ATH_MSG_ERROR(
"Could not get SCT_ID for " << element->getIdHelper() );
201 RegSelModule smod( zMin, zMax, rMin, rMax, phiMin, phiMax, layerDisk, barrelEC, robId, hashId );
203 rd->addModule( smod );
208 <<
" barrelEC = " << barrelEC
209 <<
", layerDisk = " << layerDisk
210 <<
", phiMin, phiMax = " << phiMin/CLHEP::degree <<
" " << phiMax/CLHEP::degree
211 <<
", rMin = " << rMin/CLHEP::mm <<
" mm, rMax = " << rMax/CLHEP::mm <<
" mm" );
227 if( lutCondData.
record( id_range, rcd ).isFailure() ) {
229 <<
" " << lutCondData.
key()
230 <<
" with range " << id_range );
231 return StatusCode::FAILURE;
237 return StatusCode::FAILURE;
243 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)
An algorithm that can be simultaneously executed in multiple threads.
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