ATLAS Offline Software
TrigCaloDataAccessSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TrigT2CaloCommon_TrigCaloDataAccessSvc_h
6 #define TrigT2CaloCommon_TrigCaloDataAccessSvc_h
7 
8 #include <mutex>
34 
35 class TrigCaloDataAccessSvc : public extends<AthService, ITrigCaloDataAccessSvc> {
36  public:
37  TrigCaloDataAccessSvc(const std::string& name, ISvcLocator* pSvcLocator);
38 
40 
41 
42  virtual StatusCode initialize() override;
43  virtual StatusCode finalize() override;
44 
45  virtual StatusCode loadCollections ( const EventContext& context,
46  const IRoiDescriptor& roi,
47  const DETID detID,
48  const int sampling,
49  LArTT_Selector<LArCellCont>& loadedCells ) override;
50 
51  virtual StatusCode loadCollections ( const EventContext& context,
52  const IRoiDescriptor& roi,
53  std::vector<const TileCell*>& loadedCells ) override;
54 
55  virtual StatusCode loadMBTS ( const EventContext& context,
56  std::vector<const TileCell*>& loadedCells ) override;
57 
58 
59 
60  virtual StatusCode loadFullCollections ( const EventContext& context,
61  CaloConstCellContainer& cont ) override;
62 
63  private:
64 
65  PublicToolHandle<LArRodDecoder> m_larDecoder { this, "LArDecoderTool", "LArRodDecoder/LArRodDecoder", "Tool to decode LAr raw data" };
66  PublicToolHandle<TileROD_Decoder> m_tileDecoder { this, "TileDecoderTool", "TileROD_Decoder/TileROD_Decoder", "Tool to decode Tile raw data" };
67 
68  ToolHandle<GenericMonitoringTool> m_monTool{ this, "MonTool", "", "Tool to monitor performance of the service" };
69 
70  ServiceHandle<IROBDataProviderSvc> m_robDataProvider{ this, "ROBDataProvider", "ROBDataProviderSvc/ROBDataProviderSvc", ""};
71  ToolHandle<IRegSelTool> m_regionSelector_TTEM { this, "RegSelToolEM", "RegSelTool/RegSelTool_TTEM" };
72  ToolHandle<IRegSelTool> m_regionSelector_TTHEC { this, "RegSelToolHEC", "RegSelTool/RegSelTool_TTHEC" };
73  ToolHandle<IRegSelTool> m_regionSelector_FCALEM { this, "RegSelToolFCALEM", "RegSelTool/RegSelTool_FCALEM" };
74  ToolHandle<IRegSelTool> m_regionSelector_FCALHAD { this, "RegSelToolFCALHAD", "RegSelTool/RegSelTool_FCALHAD" };
75  ToolHandle<IRegSelTool> m_regionSelector_TILE { this, "RegSelToolTILE", "RegSelTool/RegSelTool_TILE" };
76 
77  Gaudi::Property<bool> m_applyOffsetCorrection { this, "ApplyOffsetCorrection", true, "Enable offset correction" };
78 
81  {this, "MCSymKey", "LArMCSym", "SG Key of LArMCSym object"} ;
83  {this, "CablingKey", "LArOnOffIdMap", "SG Key for LArOnOffIdMapping"} ;
85  {this, "RodFebKey", "LArFebRodMap", "SG Key for LArFebRodMapping"} ;
87  {this, "LArBadChannelKey", "LArBadChannel", "Key of the LArBadChannelCont CDO" };
89  {this, "LArRoIMapKey", "LArRoIMap", "Key of the LArRoIMap CDO" };
91  {this, "CaloDetDescrManager", "CaloDetDescrManager", "SG Key for CaloDetDescrManager in the Condition Store" };
93  {this, "TileHid2RESrcID", "TileHid2RESrcIDHLT", "SG Key of TileHid2RESrcID object"} ;
95  {this, "LArDeadOTXFromSC", "DeadOTXFromSC", "Key of the DeadOTXFromSC CDO" };
97 
99  for(LArCellCollection::iterator ii=coll->begin();ii!=coll->end();++ii)
100  (*ii)->setEnergyFast(0.0);
101  }
103  for ( TileCell* tr: *col ) {
104  (tr)->setEnergy_nonvirt(0.0F, 0.0F, 0, CaloGain::INVALIDGAIN);
105  (tr)->setTime_nonvirt(-100.0F);
106  (tr)->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 0);
107  (tr)->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 1);
108  } // end of for all channels
109  }
110 
115  struct FullDetIDs {
116  std::vector<uint32_t> robs;
117  std::vector<IdentifierHash> ids;
119  void merge( const std::initializer_list<FullDetIDs>& list ) {
120  for ( auto& el: list ) {
121  std::copy( el.robs.begin(), el.robs.end(), std::back_inserter(robs) );
122  std::copy( el.ids.begin(), el.ids.end(), std::back_inserter(ids) );
123  }
124  }
125 
126  };
127 
134  LArRodBlockStructure* larRodBlockStructure_per_slot; // LAr Rod Block to ease decoding
140  unsigned int lastFSEvent;
141  };
142 
143  // cells created in lateInit which must be deleted in finalize
144  std::vector<unsigned int> m_insertedCells;
145 
147 
148  std::mutex m_initMutex; // Build all tables in the first event
149  std::mutex m_getCollMutex; // Make sure writing to a collection is protected
150  std::mutex m_lardecoderProtect; // protection for the larRodDecoder
151  std::mutex m_tiledecoderProtect; // protection for the tileRodDecoder
152 
153  unsigned int lateInit( const EventContext& context );
154  bool m_lateInitDone = false;
155 
156  unsigned int convertROBs(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& robFrags, LArCellCont* larcell, LArRodBlockStructure*& larRodBlockStructure, uint16_t rodMinorVersion, uint32_t robBlockType, const LArDeadOTXFromSC* dead );
157  unsigned int convertROBs( const EventContext& context, const std::vector<IdentifierHash>& rIds, TileCellCont* tilecell, TileROD_Decoder::D0CellsHLT* d0cells );
158 
159 
163  void missingROBs( const std::vector<uint32_t>& request,
164  const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response,
165  std::set<uint32_t>& missing ) const;
166 
170  void clearMissing( const std::vector<uint32_t>& request,
171  const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response,
172  LArCellCont* larcell );
173 
177  unsigned int prepareLArCollections( const EventContext& context,
178  const IRoiDescriptor& roi,
179  const int sampling,
180  DETID detector );
181 
182  unsigned int prepareTileCollections( const EventContext& context,
183  const IRoiDescriptor& roi );
184 
185  unsigned int prepareMBTSCollections( const EventContext& context);
186 
187  unsigned int prepareFullCollections( const EventContext& context );
188 
189  unsigned int prepareLArFullCollections( const EventContext& context );
190  unsigned int prepareTileFullCollections( const EventContext& context );
191 
192  std::vector<uint32_t> m_vrodid32fullDet;
193  std::vector<uint32_t> m_vrodid32tile;
194  std::vector<unsigned int> m_mbts_add_rods;
195  const std::vector<unsigned int>* m_mbts_rods = nullptr;
196  std::vector<IdentifierHash> m_rIdstile;
197  std::vector<std::vector<uint32_t> > m_vrodid32fullDetHG;
198  size_t m_nSlots;
199 };
200 
201 
202 #endif
LArRodBlockStructure
Definition: LArRodBlockStructure.h:48
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
TileCell
Definition: TileCell.h:57
IRegSelTool.h
TrigCaloDataAccessSvc::reset_TileCol
void reset_TileCol(TileCellCollection *col)
Definition: TrigCaloDataAccessSvc.h:102
TrigCaloDataAccessSvc::HLTCaloEventCache::mutex
std::mutex mutex
Definition: TrigCaloDataAccessSvc.h:132
LArDeadOTXFromSC.h
TrigCaloDataAccessSvc::m_onOffIdMappingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_onOffIdMappingKey
Definition: TrigCaloDataAccessSvc.h:83
TrigCaloDataAccessSvc::m_regionSelector_TILE
ToolHandle< IRegSelTool > m_regionSelector_TILE
Definition: TrigCaloDataAccessSvc.h:75
TrigCaloDataAccessSvc::m_insertedCells
std::vector< unsigned int > m_insertedCells
Definition: TrigCaloDataAccessSvc.h:144
TrigCaloDataAccessSvc::m_regionSelector_TTEM
ToolHandle< IRegSelTool > m_regionSelector_TTEM
Definition: TrigCaloDataAccessSvc.h:71
TrigCaloDataAccessSvc
Definition: TrigCaloDataAccessSvc.h:35
LArFebRodMapping.h
TrigCaloDataAccessSvc::m_tileHid2RESrcIDKey
SG::ReadCondHandleKey< TileHid2RESrcID > m_tileHid2RESrcIDKey
Definition: TrigCaloDataAccessSvc.h:93
LArCellCont.h
TileCellCollection
Definition: TileCellCollection.h:12
TrigCaloDataAccessSvc::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigCaloDataAccessSvc.h:68
TrigCaloDataAccessSvc::HLTCaloEventCache::larContainer
LArCellCont * larContainer
Definition: TrigCaloDataAccessSvc.h:133
TrigCaloDataAccessSvc::FullDetIDs::merge
void merge(const std::initializer_list< FullDetIDs > &list)
Definition: TrigCaloDataAccessSvc.h:119
TrigCaloDataAccessSvc::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: TrigCaloDataAccessSvc.h:91
TrigCaloDataAccessSvc::clearMissing
void clearMissing(const std::vector< uint32_t > &request, const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &response, LArCellCont *larcell)
clear fragments of the collection for which ROBs were not available
Definition: TrigCaloDataAccessSvc.cxx:641
TrigCaloDataAccessSvc::m_lardecoderProtect
std::mutex m_lardecoderProtect
Definition: TrigCaloDataAccessSvc.h:150
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
response
MDT_Response response
Definition: MDT_ResponseTest.cxx:28
TrigCaloDataAccessSvc::m_getCollMutex
std::mutex m_getCollMutex
Definition: TrigCaloDataAccessSvc.h:149
TrigCaloDataAccessSvc::FullDetIDs
Convenience structure to keep together all ROBs and IdentifierHashes for whole detectors.
Definition: TrigCaloDataAccessSvc.h:115
TRTCalib_cfilter.detector
detector
Definition: TRTCalib_cfilter.py:241
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
TrigCaloDataAccessSvc::HLTCaloEventCache::lastFSEvent
unsigned int lastFSEvent
Definition: TrigCaloDataAccessSvc.h:140
LArRodDecoder.h
TrigCaloDataAccessSvc::m_tiledecoderProtect
std::mutex m_tiledecoderProtect
Definition: TrigCaloDataAccessSvc.h:151
TrigCaloDataAccessSvc::prepareFullCollections
unsigned int prepareFullCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:76
TrigCaloDataAccessSvc::HLTCaloEventCache::d0cells
TileROD_Decoder::D0CellsHLT * d0cells
Definition: TrigCaloDataAccessSvc.h:139
TrigCaloDataAccessSvc::initialize
virtual StatusCode initialize() override
Definition: TrigCaloDataAccessSvc.cxx:21
TrigCaloDataAccessSvc::m_febRodMappingKey
SG::ReadCondHandleKey< LArFebRodMapping > m_febRodMappingKey
Definition: TrigCaloDataAccessSvc.h:85
TrigCaloDataAccessSvc::m_nSlots
size_t m_nSlots
Definition: TrigCaloDataAccessSvc.h:198
TrigCaloDataAccessSvc::m_hLTCaloSlot
SG::SlotSpecificObj< HLTCaloEventCache > m_hLTCaloSlot
Definition: TrigCaloDataAccessSvc.h:146
TrigCaloDataAccessSvc::convertROBs
unsigned int convertROBs(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &robFrags, LArCellCont *larcell, LArRodBlockStructure *&larRodBlockStructure, uint16_t rodMinorVersion, uint32_t robBlockType, const LArDeadOTXFromSC *dead)
Definition: TrigCaloDataAccessSvc.cxx:495
LArCellCont
Class which contains statically allocated LArCellCollections.
Definition: LArCellCont.h:40
LArDeadOTXFromSC
Definition: LArDeadOTXFromSC.h:14
TrigCaloDataAccessSvc::m_regionSelector_FCALHAD
ToolHandle< IRegSelTool > m_regionSelector_FCALHAD
Definition: TrigCaloDataAccessSvc.h:74
TrigCaloDataAccessSvc::m_correctDead
bool m_correctDead
Definition: TrigCaloDataAccessSvc.h:96
SG::ReadHandleKey< CaloBCIDAverage >
TrigCaloDataAccessSvc::TrigCaloDataAccessSvc
TrigCaloDataAccessSvc(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigCaloDataAccessSvc.cxx:13
LArRoIMap.h
Mapping between calorimeter trigger id to offline/online Identifier.
LArFebEnergyCollection.h
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
TrigCaloDataAccessSvc::loadMBTS
virtual StatusCode loadMBTS(const EventContext &context, std::vector< const TileCell * > &loadedCells) override
Definition: TrigCaloDataAccessSvc.cxx:781
DETID
DETID
An enum to define subdetector names.
Definition: RegSelEnums.h:23
TrigCaloDataAccessSvc::m_deadOTXFromSCKey
SG::ReadHandleKey< LArDeadOTXFromSC > m_deadOTXFromSCKey
Definition: TrigCaloDataAccessSvc.h:95
CaloGain::INVALIDGAIN
@ INVALIDGAIN
Definition: CaloGain.h:18
LArBadChannelCont.h
GenericMonitoringTool.h
TrigCaloDataAccessSvc::FullDetIDs::ids
std::vector< IdentifierHash > ids
Definition: TrigCaloDataAccessSvc.h:117
SG::SlotSpecificObj
Maintain a set of objects, one per slot.
Definition: AthenaKernel/AthenaKernel/SlotSpecificObj.h:70
TrigCaloDataAccessSvc::prepareTileCollections
unsigned int prepareTileCollections(const EventContext &context, const IRoiDescriptor &roi)
Definition: TrigCaloDataAccessSvc.cxx:726
LArOnOffIdMapping.h
TrigCaloDataAccessSvc::HLTCaloEventCache::robBlockType
uint32_t robBlockType
Definition: TrigCaloDataAccessSvc.h:136
TileROD_Decoder::D0CellsHLT
Definition: TileROD_Decoder.h:123
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:93
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
TileROD_Decoder.h
TrigCaloDataAccessSvc::m_mbts_add_rods
std::vector< unsigned int > m_mbts_add_rods
Definition: TrigCaloDataAccessSvc.h:194
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
IRoiDescriptor
Describes the API of the Region of Ineterest geometry.
Definition: IRoiDescriptor.h:23
LArTT_Selector.h
TrigCaloDataAccessSvc::m_lateInitDone
bool m_lateInitDone
Definition: TrigCaloDataAccessSvc.h:154
TrigCaloDataAccessSvc::FullDetIDs::detid
DETID detid
Definition: TrigCaloDataAccessSvc.h:118
TileCellCont
This class builds the Tile cells.
Definition: TileCellCont.h:25
TrigCaloDataAccessSvc::loadCollections
virtual StatusCode loadCollections(const EventContext &context, const IRoiDescriptor &roi, const DETID detID, const int sampling, LArTT_Selector< LArCellCont > &loadedCells) override
Definition: TrigCaloDataAccessSvc.cxx:83
TrigCaloDataAccessSvc::prepareLArFullCollections
unsigned int prepareLArFullCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:202
python.getProblemFolderFromLogs.el
dictionary el
Definition: getProblemFolderFromLogs.py:48
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
TrigCaloDataAccessSvc::prepareTileFullCollections
unsigned int prepareTileFullCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:261
TrigCaloDataAccessSvc::HLTCaloEventCache
convience structure to keep together a collection and auxiliar full collection selectors
Definition: TrigCaloDataAccessSvc.h:131
TrigCaloDataAccessSvc::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition: TrigCaloDataAccessSvc.h:70
TrigCaloDataAccessSvc::finalize
virtual StatusCode finalize() override
Definition: TrigCaloDataAccessSvc.cxx:49
TrigCaloDataAccessSvc::HLTCaloEventCache::fullcont
CaloCellContainer * fullcont
Definition: TrigCaloDataAccessSvc.h:138
TrigCaloDataAccessSvc::m_regionSelector_TTHEC
ToolHandle< IRegSelTool > m_regionSelector_TTHEC
Definition: TrigCaloDataAccessSvc.h:72
TrigCaloDataAccessSvc::m_rIdstile
std::vector< IdentifierHash > m_rIdstile
Definition: TrigCaloDataAccessSvc.h:196
ReadCondHandleKey.h
TrigCaloDataAccessSvc::HLTCaloEventCache::tileContainer
TileCellCont * tileContainer
Definition: TrigCaloDataAccessSvc.h:137
TrigCaloDataAccessSvc::reset_LArCol
void reset_LArCol(LArCellCollection *coll)
Definition: TrigCaloDataAccessSvc.h:98
TrigCaloDataAccessSvc::prepareLArCollections
unsigned int prepareLArCollections(const EventContext &context, const IRoiDescriptor &roi, const int sampling, DETID detector)
LAr TT collections preparation code.
Definition: TrigCaloDataAccessSvc.cxx:655
TileHid2RESrcID.h
LArCellCollection
Container Class for LArCell in a ROB used by EF.
Definition: LArCellCollection.h:28
ITrigCaloDataAccessSvc.h
TrigCaloDataAccessSvc::m_regionSelector_FCALEM
ToolHandle< IRegSelTool > m_regionSelector_FCALEM
Definition: TrigCaloDataAccessSvc.h:73
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
TrigCaloDataAccessSvc::m_applyOffsetCorrection
Gaudi::Property< bool > m_applyOffsetCorrection
Definition: TrigCaloDataAccessSvc.h:77
LArTT_Selector< LArCellCont >
TrigCaloDataAccessSvc::loadFullCollections
virtual StatusCode loadFullCollections(const EventContext &context, CaloConstCellContainer &cont) override
Definition: TrigCaloDataAccessSvc.cxx:173
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
TrigCaloDataAccessSvc::m_vrodid32fullDet
std::vector< uint32_t > m_vrodid32fullDet
Definition: TrigCaloDataAccessSvc.h:192
TrigCaloDataAccessSvc::m_mcsymKey
SG::ReadCondHandleKey< LArMCSym > m_mcsymKey
Definition: TrigCaloDataAccessSvc.h:81
TrigCaloDataAccessSvc::m_mbts_rods
const std::vector< unsigned int > * m_mbts_rods
Definition: TrigCaloDataAccessSvc.h:195
CaloBCIDAverage.h
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
SG::ReadCondHandleKey< LArMCSym >
TrigCaloDataAccessSvc::m_vrodid32fullDetHG
std::vector< std::vector< uint32_t > > m_vrodid32fullDetHG
Definition: TrigCaloDataAccessSvc.h:197
TrigCaloDataAccessSvc::m_initMutex
std::mutex m_initMutex
Definition: TrigCaloDataAccessSvc.h:148
TrigCaloDataAccessSvc::m_bcidAvgKey
SG::ReadHandleKey< CaloBCIDAverage > m_bcidAvgKey
Definition: TrigCaloDataAccessSvc.h:79
Athena::Status
Status
Athena specific StatusCode values.
Definition: AthStatusCode.h:22
TileCellCont.h
TrigCaloDataAccessSvc::m_bcContKey
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
Definition: TrigCaloDataAccessSvc.h:87
CaloConstCellContainer
CaloCellContainer that can accept const cell pointers.
Definition: CaloConstCellContainer.h:45
TrigCaloDataAccessSvc::prepareMBTSCollections
unsigned int prepareMBTSCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:754
F
#define F(x, y, z)
Definition: MD5.cxx:112
TrigCaloDataAccessSvc::FullDetIDs::robs
std::vector< uint32_t > robs
Definition: TrigCaloDataAccessSvc.h:116
AthService.h
IRoiDescriptor.h
SlotSpecificObj.h
Maintain a set of objects, one per slot.
calibdata.copy
bool copy
Definition: calibdata.py:26
TrigCaloDataAccessSvc::m_larDecoder
PublicToolHandle< LArRodDecoder > m_larDecoder
Definition: TrigCaloDataAccessSvc.h:65
TrigCaloDataAccessSvc::m_vrodid32tile
std::vector< uint32_t > m_vrodid32tile
Definition: TrigCaloDataAccessSvc.h:193
TrigCaloDataAccessSvc::HLTCaloEventCache::larRodBlockStructure_per_slot
LArRodBlockStructure * larRodBlockStructure_per_slot
Definition: TrigCaloDataAccessSvc.h:134
TrigCaloDataAccessSvc::lateInit
unsigned int lateInit(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:290
TrigCaloDataAccessSvc::HLTCaloEventCache::rodMinorVersion
uint16_t rodMinorVersion
Definition: TrigCaloDataAccessSvc.h:135
LArMCSym.h
IROBDataProviderSvc.h
TrigCaloDataAccessSvc::missingROBs
void missingROBs(const std::vector< uint32_t > &request, const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &response, std::set< uint32_t > &missing) const
fill the set of missing robs given the request and response from RoBDatProvider
Definition: TrigCaloDataAccessSvc.cxx:626
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
TileL2Container.h
ServiceHandle< IROBDataProviderSvc >
TrigCaloDataAccessSvc::m_larRoIMapKey
SG::ReadCondHandleKey< LArRoIMap > m_larRoIMapKey
Definition: TrigCaloDataAccessSvc.h:89
TrigCaloDataAccessSvc::m_tileDecoder
PublicToolHandle< TileROD_Decoder > m_tileDecoder
Definition: TrigCaloDataAccessSvc.h:66