ATLAS Offline Software
Loading...
Searching...
No Matches
TrigCaloDataAccessSvc.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TrigT2CaloCommon_TrigCaloDataAccessSvc_h
6#define TrigT2CaloCommon_TrigCaloDataAccessSvc_h
7
8
11
30
31#include <mutex>
32#include <algorithm> //std::copy
33#include <string>
34#include <vector>
35#include <cstdint>
36#include <iterator> //std::back_inserter
37#include <set>
38#include <initializer_list>
39
40class TileCellCont;
41class LArCellCont;
42class IRoiDescriptor;
43
44
45class TrigCaloDataAccessSvc : public extends<AthService, ITrigCaloDataAccessSvc> {
46 public:
47 TrigCaloDataAccessSvc(const std::string& name, ISvcLocator* pSvcLocator);
48
49 using ITrigCaloDataAccessSvc::Status;
50
51
52 virtual StatusCode initialize() override;
53 virtual StatusCode finalize() override;
54
55 virtual StatusCode loadCollections ( const EventContext& context,
56 const IRoiDescriptor& roi,
57 const DETID detID,
58 const int sampling,
59 LArTT_Selector<LArCellCont>& loadedCells ) override;
60
61 virtual StatusCode loadCollections ( const EventContext& context,
62 const IRoiDescriptor& roi,
63 std::vector<const TileCell*>& loadedCells ) override;
64
65 virtual StatusCode loadMBTS ( const EventContext& context,
66 std::vector<const TileCell*>& loadedCells ) override;
67
68
69
70 virtual StatusCode loadFullCollections ( const EventContext& context,
71 CaloConstCellContainer& cont ) override;
72
73 private:
74
75 PublicToolHandle<LArRodDecoder> m_larDecoder { this, "LArDecoderTool", "LArRodDecoder/LArRodDecoder", "Tool to decode LAr raw data" };
76 PublicToolHandle<TileROD_Decoder> m_tileDecoder { this, "TileDecoderTool", "TileROD_Decoder/TileROD_Decoder", "Tool to decode Tile raw data" };
77
78 ToolHandle<GenericMonitoringTool> m_monTool{ this, "MonTool", "", "Tool to monitor performance of the service" };
79
80 ServiceHandle<IROBDataProviderSvc> m_robDataProvider{ this, "ROBDataProvider", "ROBDataProviderSvc/ROBDataProviderSvc", ""};
81 ToolHandle<IRegSelTool> m_regionSelector_TTEM { this, "RegSelToolEM", "RegSelTool/RegSelTool_TTEM" };
82 ToolHandle<IRegSelTool> m_regionSelector_TTHEC { this, "RegSelToolHEC", "RegSelTool/RegSelTool_TTHEC" };
83 ToolHandle<IRegSelTool> m_regionSelector_FCALEM { this, "RegSelToolFCALEM", "RegSelTool/RegSelTool_FCALEM" };
84 ToolHandle<IRegSelTool> m_regionSelector_FCALHAD { this, "RegSelToolFCALHAD", "RegSelTool/RegSelTool_FCALHAD" };
85 ToolHandle<IRegSelTool> m_regionSelector_TILE { this, "RegSelToolTILE", "RegSelTool/RegSelTool_TILE" };
86
87 Gaudi::Property<bool> m_applyOffsetCorrection { this, "ApplyOffsetCorrection", true, "Enable offset correction" };
88
91 {this, "MCSymKey", "LArMCSym", "SG Key of LArMCSym object"} ;
93 {this, "CablingKey", "LArOnOffIdMap", "SG Key for LArOnOffIdMapping"} ;
95 {this, "RodFebKey", "LArFebRodMap", "SG Key for LArFebRodMapping"} ;
97 {this, "LArBadChannelKey", "LArBadChannel", "Key of the LArBadChannelCont CDO" };
99 {this, "LArRoIMapKey", "LArRoIMap", "Key of the LArRoIMap CDO" };
101 {this, "CaloDetDescrManager", "CaloDetDescrManager", "SG Key for CaloDetDescrManager in the Condition Store" };
103 {this, "TileHid2RESrcID", "TileHid2RESrcIDHLT", "SG Key of TileHid2RESrcID object"} ;
105 {this, "LArDeadOTXFromSC", "DeadOTXFromSC", "Key of the DeadOTXFromSC CDO" };
107
109 for(LArCellCollection::iterator ii=coll->begin();ii!=coll->end();++ii)
110 (*ii)->setEnergyFast(0.0);
111 }
113 for ( TileCell* tr: *col ) {
114 (tr)->setEnergy_nonvirt(0.0F, 0.0F, 0, CaloGain::INVALIDGAIN);
115 (tr)->setTime_nonvirt(-100.0F);
116 (tr)->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 0);
117 (tr)->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 1);
118 } // end of for all channels
119 }
120
125 struct FullDetIDs {
126 std::vector<uint32_t> robs;
127 std::vector<IdentifierHash> ids;
129 void merge( const std::initializer_list<FullDetIDs>& list ) {
130 for ( auto& el: list ) {
131 std::copy( el.robs.begin(), el.robs.end(), std::back_inserter(robs) );
132 std::copy( el.ids.begin(), el.ids.end(), std::back_inserter(ids) );
133 }
134 }
135
136 };
137
152
153 // cells created in lateInit which must be deleted in finalize
154 std::vector<unsigned int> m_insertedCells;
155
157
158 std::mutex m_initMutex; // Build all tables in the first event
159 std::mutex m_getCollMutex; // Make sure writing to a collection is protected
160 std::mutex m_lardecoderProtect; // protection for the larRodDecoder
161 std::mutex m_tiledecoderProtect; // protection for the tileRodDecoder
162
163 unsigned int lateInit( const EventContext& context );
164 bool m_lateInitDone = false;
165
166 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 );
167 unsigned int convertROBs( const EventContext& context, const std::vector<IdentifierHash>& rIds, TileCellCont* tilecell, TileROD_Decoder::D0CellsHLT* d0cells );
168
169
173 void missingROBs( const std::vector<uint32_t>& request,
174 const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response,
175 std::set<uint32_t>& missing ) const;
176
180 void clearMissing( const std::vector<uint32_t>& request,
181 const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response,
182 LArCellCont* larcell );
183
187 unsigned int prepareLArCollections( const EventContext& context,
188 const IRoiDescriptor& roi,
189 const int sampling,
190 DETID detector );
191
192 unsigned int prepareTileCollections( const EventContext& context,
193 const IRoiDescriptor& roi );
194
195 unsigned int prepareMBTSCollections( const EventContext& context);
196
197 unsigned int prepareFullCollections( const EventContext& context );
198
199 unsigned int prepareLArFullCollections( const EventContext& context );
200 unsigned int prepareTileFullCollections( const EventContext& context );
201
202 std::vector<uint32_t> m_vrodid32fullDet;
203 std::vector<uint32_t> m_vrodid32tile;
204 std::vector<unsigned int> m_mbts_add_rods;
205 const std::vector<unsigned int>* m_mbts_rods = nullptr;
206 std::vector<IdentifierHash> m_rIdstile;
207 std::vector<std::vector<uint32_t> > m_vrodid32fullDetHG;
208 size_t m_nSlots;
209};
210
211
212#endif
Maintain a set of objects, one per slot.
Definition of CaloDetDescrManager.
Mapping between calorimeter trigger id to offline/online Identifier.
MDT_Response response
DETID
An enum to define subdetector names.
Definition RegSelEnums.h:23
Property holding a SG store/key/clid from which a ReadHandle is made.
Container class for CaloCell.
CaloCellContainer that can accept const cell pointers.
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Describes the API of the Region of Ineterest geometry.
Container Class for LArCell in a ROB used by EF.
Class which contains statically allocated LArCellCollections.
Definition LArCellCont.h:42
Property holding a SG store/key/clid from which a ReadHandle is made.
Maintain a set of objects, one per slot.
This class builds the Tile cells.
PublicToolHandle< TileROD_Decoder > m_tileDecoder
std::vector< unsigned int > m_mbts_add_rods
ToolHandle< IRegSelTool > m_regionSelector_TTHEC
unsigned int prepareLArFullCollections(const EventContext &context)
SG::ReadCondHandleKey< TileHid2RESrcID > m_tileHid2RESrcIDKey
SG::ReadHandleKey< CaloBCIDAverage > m_bcidAvgKey
void reset_TileCol(TileCellCollection *col)
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
SG::ReadCondHandleKey< LArFebRodMapping > m_febRodMappingKey
Gaudi::Property< bool > m_applyOffsetCorrection
SG::ReadCondHandleKey< LArOnOffIdMapping > m_onOffIdMappingKey
std::vector< uint32_t > m_vrodid32tile
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
PublicToolHandle< LArRodDecoder > m_larDecoder
ToolHandle< GenericMonitoringTool > m_monTool
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
virtual StatusCode initialize() override
virtual StatusCode loadCollections(const EventContext &context, const IRoiDescriptor &roi, const DETID detID, const int sampling, LArTT_Selector< LArCellCont > &loadedCells) override
TrigCaloDataAccessSvc(const std::string &name, ISvcLocator *pSvcLocator)
ToolHandle< IRegSelTool > m_regionSelector_FCALEM
unsigned int lateInit(const EventContext &context)
SG::ReadHandleKey< LArDeadOTXFromSC > m_deadOTXFromSCKey
virtual StatusCode loadMBTS(const EventContext &context, std::vector< const TileCell * > &loadedCells) override
unsigned int prepareTileFullCollections(const EventContext &context)
SG::ReadCondHandleKey< LArRoIMap > m_larRoIMapKey
std::vector< std::vector< uint32_t > > m_vrodid32fullDetHG
ToolHandle< IRegSelTool > m_regionSelector_TTEM
SG::SlotSpecificObj< HLTCaloEventCache > m_hLTCaloSlot
std::vector< unsigned int > m_insertedCells
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
std::vector< uint32_t > m_vrodid32fullDet
const std::vector< unsigned int > * m_mbts_rods
ToolHandle< IRegSelTool > m_regionSelector_FCALHAD
unsigned int prepareLArCollections(const EventContext &context, const IRoiDescriptor &roi, const int sampling, DETID detector)
LAr TT collections preparation code.
ToolHandle< IRegSelTool > m_regionSelector_TILE
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)
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
unsigned int prepareFullCollections(const EventContext &context)
SG::ReadCondHandleKey< LArMCSym > m_mcsymKey
void reset_LArCol(LArCellCollection *coll)
virtual StatusCode finalize() override
unsigned int prepareTileCollections(const EventContext &context, const IRoiDescriptor &roi)
std::vector< IdentifierHash > m_rIdstile
virtual StatusCode loadFullCollections(const EventContext &context, CaloConstCellContainer &cont) override
unsigned int prepareMBTSCollections(const EventContext &context)
@ INVALIDGAIN
Definition CaloGain.h:18
Convenience structure to keep together all ROBs and IdentifierHashes for whole detectors.
std::vector< IdentifierHash > ids
void merge(const std::initializer_list< FullDetIDs > &list)
convience structure to keep together a collection and auxiliar full collection selectors