17#include "GaudiKernel/EventIDRange.h"
26#include "eformat/SourceIdentifier.h"
39 ATH_MSG_DEBUG(
"RegSelCondAlg_LAr::RegSelCondAlg_LAr() " << name );
53 return StatusCode::SUCCESS;
60 ATH_MSG_INFO(
"RegSelConfAlg_LAr:execute() " << name() );
73 return StatusCode::SUCCESS;
81 if( !roiMap.
range( range ) ) {
83 return StatusCode::FAILURE;
85 ATH_MSG_DEBUG(
"RegSelCondAlg_LAr: " << name() <<
" found range: " << range );
91 std::unique_ptr<IRegSelLUT> rd =
createTable (**roiMap);
93 if ( !rd )
return StatusCode::FAILURE;
106 if( lutCondData.
record( rcd ).isFailure() ) {
108 <<
" " << lutCondData.
key()
109 <<
" with range " << range );
110 return StatusCode::FAILURE;
116 return StatusCode::FAILURE;
122 return StatusCode::SUCCESS;
130 std::unique_ptr<RegSelectorHashMap> lut(
nullptr);
138 if (
detStore()->retrieve(manager).isFailure() ) {
143 if (
detStore()->retrieve(helper).isFailure() ) {
196 std::unique_ptr<RegionSelectorLUT> lut_stuff = std::make_unique<RegionSelectorLUT>( lut_size );
201 for ( ; it2!=it2_end ; ++it2 ) {
206 int samp = helper->sampling(layer_id);
207 int layer = helper->layer(layer_id);
208 bool isFcal = helper->is_fcal(layer_id);
210 if ( isFcal != fcal )
continue;
211 if ( sampling==0 && samp!=0 )
continue;
212 if ( sampling!=0 && samp==0 )
continue;
213 if ( fcal_layer==0 && layer!=0 ) {
214 ATH_MSG_DEBUG(
"Whoa! how did this happen ? should never be able to get here: " << samp <<
" " << layer <<
" " << isFcal );
219 float dEta = region->
deta() ;
220 float dPhi = region->
dphi() ;
222 float eta1 = region->
eta()-dEta/2. ;
223 float eta2 = eta1+dEta;
225 float phi1 = region->
phi()-dPhi/2. ;
226 float phi2 = phi1+dPhi;
230 IdContext IdCntx = helper->layer_context();
232 if (helper->get_hash(layer_id, hashid, &IdCntx ) != 0) {
237 if ( isFcal && ( samp != 0 ) ) {
238 if ( helper->pos_neg_z(layer_id)==1 ) {
253 int pseudolayer = helper->eta(layer_id);
257 layer = ( pseudolayer<2 ? 0 : 1 );
260 if ( helper->pos_neg_z(layer_id)==1 ) {
271 layer = ( pseudolayer<2 ? 2 : 3 );
274 if ( helper->pos_neg_z(layer_id)==1 ) {
287 const std::vector<HWIdentifier>& vROBID = roiMap.
collectionID((
unsigned int)hashid);
290 if( !vROBID.empty() ) {
292 if( vROBID.size() > 1 ) {
294 <<
") ROBID for this TT, sampling, layer, etamin, phimin= "
295 << helper->show_to_string(layer_id) <<
" "
296 << samp <<
" " << layer <<
" " << eta1 <<
" " << phi1
301 std::vector<HWIdentifier>::const_iterator it = vROBID.begin();
302 std::vector<HWIdentifier>::const_iterator it_end = vROBID.end();
304 for ( ; it!=it_end ; ++it ) {
308 eformat::SubDetector detid = (eformat::SubDetector) larReadoutModuleSvc.
subDet(mId);
310 uint16_t m = larReadoutModuleSvc.
rodFragId(mId);
313 eformat::helper::SourceIdentifier sid(detid,m);
315 uint32_t rod_id = sid.code();
317 lut_stuff->additem( (
double)eta1, (
double)eta2, (
double)phi1, (
double)phi2, samp, layer, (
int)hashid, (
int)rod_id );
320 <<
" hashid,sampling, layer, etamin, phimin= "
321 << helper->show_to_string(layer_id) <<
" "
323 << samp <<
" " << layer <<
" " << eta1 <<
" " << phi1 );
333 ATH_MSG_DEBUG (
"No ROBID for this TT, sign, sampling, layer, etamin, phimin= "
334 << helper->show_to_string(layer_id)
335 <<
" " << samp <<
" " << layer <<
" " << eta1 <<
" " << phi1 );
348 lut = std::make_unique<RegSelectorHashMap>();
349 lut->addLut( lut_stuff.get());
350 lut->mountDataStruct();
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_INFO(x,...)
RegSelCondData< IRegSelLUT > IRegSelLUTCondData
emacs: this is -*- c++ -*-
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
Base class for conditions algorithms.
Helper class for offline TT identifiers.
This class is used to build the CaloTTDescriptors and CaloTTDetDescrRegions carrying the geometry inf...
calo_region_vec::const_iterator calo_region_const_iterator
This class provides an interface to the geometrical description of the Calorimeter Trigger Towers.
double deta() const
return size in phi (unsigned)
double phi() const
return coordinateof the Det Descr Region: phi
double eta() const
return coordinateof the Det Descr Region: eta (signed)
virtual Identifier identify() const
double dphi() const
return size in eta (unsigned)
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
This is a "hash" representation of an Identifier.
Service for creating and interpreting LAr readout modules identifiers.
static int subDet(const HWIdentifier &id)
return sub-detector identifier
static int rodFragId(const HWIdentifier &id)
return ROD fragment identifier ( == ROL == ROB identifier )
Mapping between calorimeter trigger id to offline/online Identifier.
const std::vector< COLL_ID > & collectionID(const TT_ID &id) const
Get list of robIds for a given trigger tower ID.
SG::ReadCondHandleKey< LArRoIMap > m_roiMapKey
virtual StatusCode execute(const EventContext &ctx) const override
SG::WriteCondHandleKey< IRegSelLUTCondData > m_tableKey
Output conditions object.
std::unique_ptr< RegSelectorHashMap > createTable(const LArRoIMap &roiMap) const
std::string m_managerName
virtual StatusCode initialize() override
RegSelCondAlg_LAr(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
bool range(EventIDRange &r)
const std::string & key() const
const std::string & key() const
void addDependency(const EventIDRange &range)
StatusCode record(const EventIDRange &range, T *t)
record handle, with explicit range DEPRECATED
const DataObjID & fullKey() const