ATLAS Offline Software
Loading...
Searching...
No Matches
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
35class TrigCaloDataAccessSvc : public extends<AthService, ITrigCaloDataAccessSvc> {
36 public:
37 TrigCaloDataAccessSvc(const std::string& name, ISvcLocator* pSvcLocator);
38
39 using ITrigCaloDataAccessSvc::Status;
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
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
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:40
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