ATLAS Offline Software
TrigCaloDataAccessSvc.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TrigT2CaloCommon_TrigCaloDataAccessSvc_h
6 #define TrigT2CaloCommon_TrigCaloDataAccessSvc_h
7 
8 #include <mutex>
33 
34 class TrigCaloDataAccessSvc : public extends<AthService, ITrigCaloDataAccessSvc> {
35  public:
36  TrigCaloDataAccessSvc(const std::string& name, ISvcLocator* pSvcLocator);
37 
39 
40 
41  virtual StatusCode initialize() override;
42  virtual StatusCode finalize() override;
43 
44  virtual StatusCode loadCollections ( const EventContext& context,
45  const IRoiDescriptor& roi,
46  const DETID detID,
47  const int sampling,
48  LArTT_Selector<LArCellCont>& loadedCells ) override;
49 
50  virtual StatusCode loadCollections ( const EventContext& context,
51  const IRoiDescriptor& roi,
52  std::vector<const TileCell*>& loadedCells ) override;
53 
54  virtual StatusCode loadMBTS ( const EventContext& context,
55  std::vector<const TileCell*>& loadedCells ) override;
56 
57 
58 
59  virtual StatusCode loadFullCollections ( const EventContext& context,
60  CaloConstCellContainer& cont ) override;
61 
62  private:
63 
64  PublicToolHandle<LArRodDecoder> m_larDecoder { this, "LArDecoderTool", "LArRodDecoder/LArRodDecoder", "Tool to decode LAr raw data" };
65  PublicToolHandle<TileROD_Decoder> m_tileDecoder { this, "TileDecoderTool", "TileROD_Decoder/TileROD_Decoder", "Tool to decode Tile raw data" };
66 
67  ToolHandle<GenericMonitoringTool> m_monTool{ this, "MonTool", "", "Tool to monitor performance of the service" };
68 
69  ServiceHandle<IROBDataProviderSvc> m_robDataProvider{ this, "ROBDataProvider", "ROBDataProviderSvc/ROBDataProviderSvc", ""};
70  ToolHandle<IRegSelTool> m_regionSelector_TTEM { this, "RegSelToolEM", "RegSelTool/RegSelTool_TTEM" };
71  ToolHandle<IRegSelTool> m_regionSelector_TTHEC { this, "RegSelToolHEC", "RegSelTool/RegSelTool_TTHEC" };
72  ToolHandle<IRegSelTool> m_regionSelector_FCALEM { this, "RegSelToolFCALEM", "RegSelTool/RegSelTool_FCALEM" };
73  ToolHandle<IRegSelTool> m_regionSelector_FCALHAD { this, "RegSelToolFCALHAD", "RegSelTool/RegSelTool_FCALHAD" };
74  ToolHandle<IRegSelTool> m_regionSelector_TILE { this, "RegSelToolTILE", "RegSelTool/RegSelTool_TILE" };
75 
76  Gaudi::Property<bool> m_applyOffsetCorrection { this, "ApplyOffsetCorrection", true, "Enable offset correction" };
77 
80  {this, "MCSymKey", "LArMCSym", "SG Key of LArMCSym object"} ;
82  {this, "CablingKey", "LArOnOffIdMap", "SG Key for LArOnOffIdMapping"} ;
84  {this, "RodFebKey", "LArFebRodMap", "SG Key for LArFebRodMapping"} ;
86  {this, "LArBadChannelKey", "LArBadChannel", "Key of the LArBadChannelCont CDO" };
88  {this, "LArRoIMapKey", "LArRoIMap", "Key of the LArRoIMap CDO" };
90  {this, "CaloDetDescrManager", "CaloDetDescrManager", "SG Key for CaloDetDescrManager in the Condition Store" };
92  {this, "TileHid2RESrcID", "TileHid2RESrcIDHLT", "SG Key of TileHid2RESrcID object"} ;
93 
95  for(LArCellCollection::iterator ii=coll->begin();ii!=coll->end();++ii)
96  (*ii)->setEnergyFast(0.0);
97  }
99  for ( TileCell* tr: *col ) {
100  (tr)->setEnergy_nonvirt(0.0F, 0.0F, 0, CaloGain::INVALIDGAIN);
101  (tr)->setTime_nonvirt(-100.0F);
102  (tr)->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 0);
103  (tr)->setQuality_nonvirt(static_cast<unsigned char>(255), 0, 1);
104  } // end of for all channels
105  }
106 
111  struct FullDetIDs {
112  std::vector<uint32_t> robs;
113  std::vector<IdentifierHash> ids;
115  void merge( const std::initializer_list<FullDetIDs>& list ) {
116  for ( auto& el: list ) {
117  std::copy( el.robs.begin(), el.robs.end(), std::back_inserter(robs) );
118  std::copy( el.ids.begin(), el.ids.end(), std::back_inserter(ids) );
119  }
120  }
121 
122  };
123 
130  LArRodBlockStructure* larRodBlockStructure_per_slot; // LAr Rod Block to ease decoding
136  unsigned int lastFSEvent;
137  };
138 
139 
141 
142  std::mutex m_initMutex; // this will be gone once we move to new conditions
143  std::mutex m_dataPrepMutex; // this will be gone when reg sel & Rob DP will become thread safe
144  std::mutex m_getCollMutex; // this will be gone
145  std::mutex m_lardecoderProtect; // protection for the larRodDecoder
146  std::mutex m_tiledecoderProtect; // protection for the tileRodDecoder
147 
148  unsigned int lateInit( const EventContext& context );
149  bool m_lateInitDone = false;
150 
151  unsigned int convertROBs(const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& robFrags, LArCellCont* larcell, LArRodBlockStructure*& larRodBlockStructure, uint16_t rodMinorVersion, uint32_t robBlockType );
152  unsigned int convertROBs( const EventContext& context, const std::vector<IdentifierHash>& rIds, TileCellCont* tilecell, TileROD_Decoder::D0CellsHLT* d0cells );
153 
154 
158  void missingROBs( const std::vector<uint32_t>& request,
159  const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response,
160  std::set<uint32_t>& missing ) const;
161 
165  void clearMissing( const std::vector<uint32_t>& request,
166  const std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*>& response,
167  LArCellCont* larcell );
168 
172  unsigned int prepareLArCollections( const EventContext& context,
173  const IRoiDescriptor& roi,
174  const int sampling,
175  DETID detector );
176 
177  unsigned int prepareTileCollections( const EventContext& context,
178  const IRoiDescriptor& roi );
179 
180  unsigned int prepareMBTSCollections( const EventContext& context);
181 
182  unsigned int prepareFullCollections( const EventContext& context );
183 
184  unsigned int prepareLArFullCollections( const EventContext& context );
185  unsigned int prepareTileFullCollections( const EventContext& context );
186 
187  std::vector<uint32_t> m_vrodid32fullDet;
188  std::vector<uint32_t> m_vrodid32tile;
189  std::vector<unsigned int> m_mbts_add_rods;
190  const std::vector<unsigned int>* m_mbts_rods = nullptr;
191  std::vector<IdentifierHash> m_rIdstile;
192  std::vector<std::vector<uint32_t> > m_vrodid32fullDetHG;
193  size_t m_nSlots;
194 };
195 
196 
197 #endif
198 
199 
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:98
TrigCaloDataAccessSvc::HLTCaloEventCache::mutex
std::mutex mutex
Definition: TrigCaloDataAccessSvc.h:128
TrigCaloDataAccessSvc::m_onOffIdMappingKey
SG::ReadCondHandleKey< LArOnOffIdMapping > m_onOffIdMappingKey
Definition: TrigCaloDataAccessSvc.h:82
TrigCaloDataAccessSvc::m_regionSelector_TILE
ToolHandle< IRegSelTool > m_regionSelector_TILE
Definition: TrigCaloDataAccessSvc.h:74
TrigCaloDataAccessSvc::m_regionSelector_TTEM
ToolHandle< IRegSelTool > m_regionSelector_TTEM
Definition: TrigCaloDataAccessSvc.h:70
TrigCaloDataAccessSvc
Definition: TrigCaloDataAccessSvc.h:34
LArFebRodMapping.h
TrigCaloDataAccessSvc::m_tileHid2RESrcIDKey
SG::ReadCondHandleKey< TileHid2RESrcID > m_tileHid2RESrcIDKey
Definition: TrigCaloDataAccessSvc.h:92
LArCellCont.h
TileCellCollection
Definition: TileCellCollection.h:12
TrigCaloDataAccessSvc::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigCaloDataAccessSvc.h:67
TrigCaloDataAccessSvc::HLTCaloEventCache::larContainer
LArCellCont * larContainer
Definition: TrigCaloDataAccessSvc.h:129
TrigCaloDataAccessSvc::FullDetIDs::merge
void merge(const std::initializer_list< FullDetIDs > &list)
Definition: TrigCaloDataAccessSvc.h:115
TrigCaloDataAccessSvc::m_caloMgrKey
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
Definition: TrigCaloDataAccessSvc.h:90
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:617
TrigCaloDataAccessSvc::m_lardecoderProtect
std::mutex m_lardecoderProtect
Definition: TrigCaloDataAccessSvc.h:145
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:144
TrigCaloDataAccessSvc::FullDetIDs
Convenience structure to keep together all ROBs and IdentifierHashes for whole detectors.
Definition: TrigCaloDataAccessSvc.h:111
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:136
LArRodDecoder.h
TrigCaloDataAccessSvc::m_tiledecoderProtect
std::mutex m_tiledecoderProtect
Definition: TrigCaloDataAccessSvc.h:146
TrigCaloDataAccessSvc::prepareFullCollections
unsigned int prepareFullCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:72
TrigCaloDataAccessSvc::HLTCaloEventCache::d0cells
TileROD_Decoder::D0CellsHLT * d0cells
Definition: TrigCaloDataAccessSvc.h:135
TrigCaloDataAccessSvc::initialize
virtual StatusCode initialize() override
Definition: TrigCaloDataAccessSvc.cxx:20
TrigCaloDataAccessSvc::m_febRodMappingKey
SG::ReadCondHandleKey< LArFebRodMapping > m_febRodMappingKey
Definition: TrigCaloDataAccessSvc.h:84
TrigCaloDataAccessSvc::m_nSlots
size_t m_nSlots
Definition: TrigCaloDataAccessSvc.h:193
TrigCaloDataAccessSvc::m_hLTCaloSlot
SG::SlotSpecificObj< HLTCaloEventCache > m_hLTCaloSlot
Definition: TrigCaloDataAccessSvc.h:140
LArCellCont
Class which contains statically allocated LArCellCollections.
Definition: LArCellCont.h:40
TrigCaloDataAccessSvc::m_regionSelector_FCALHAD
ToolHandle< IRegSelTool > m_regionSelector_FCALHAD
Definition: TrigCaloDataAccessSvc.h:73
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:756
DETID
DETID
An enum to define subdetector names.
Definition: RegSelEnums.h:23
CaloGain::INVALIDGAIN
@ INVALIDGAIN
Definition: CaloGain.h:18
LArBadChannelCont.h
GenericMonitoringTool.h
TrigCaloDataAccessSvc::FullDetIDs::ids
std::vector< IdentifierHash > ids
Definition: TrigCaloDataAccessSvc.h:113
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:695
LArOnOffIdMapping.h
TrigCaloDataAccessSvc::HLTCaloEventCache::robBlockType
uint32_t robBlockType
Definition: TrigCaloDataAccessSvc.h:132
TileROD_Decoder::D0CellsHLT
Definition: TileROD_Decoder.h:123
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
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:189
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:149
TrigCaloDataAccessSvc::convertROBs
unsigned int convertROBs(const std::vector< const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment * > &robFrags, LArCellCont *larcell, LArRodBlockStructure *&larRodBlockStructure, uint16_t rodMinorVersion, uint32_t robBlockType)
Definition: TrigCaloDataAccessSvc.cxx:488
TrigCaloDataAccessSvc::FullDetIDs::detid
DETID detid
Definition: TrigCaloDataAccessSvc.h:114
TileCellCont
This class builds the Tile cells.
Definition: TileCellCont.h:25
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
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:79
TrigCaloDataAccessSvc::prepareLArFullCollections
unsigned int prepareLArFullCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:204
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
TrigCaloDataAccessSvc::prepareTileFullCollections
unsigned int prepareTileFullCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:256
TrigCaloDataAccessSvc::HLTCaloEventCache
convience structure to keep together a collection and auxiliar full collection selectors
Definition: TrigCaloDataAccessSvc.h:127
TrigCaloDataAccessSvc::m_robDataProvider
ServiceHandle< IROBDataProviderSvc > m_robDataProvider
Definition: TrigCaloDataAccessSvc.h:69
TrigCaloDataAccessSvc::finalize
virtual StatusCode finalize() override
Definition: TrigCaloDataAccessSvc.cxx:46
TrigCaloDataAccessSvc::HLTCaloEventCache::fullcont
CaloCellContainer * fullcont
Definition: TrigCaloDataAccessSvc.h:134
TrigCaloDataAccessSvc::m_regionSelector_TTHEC
ToolHandle< IRegSelTool > m_regionSelector_TTHEC
Definition: TrigCaloDataAccessSvc.h:71
TrigCaloDataAccessSvc::m_rIdstile
std::vector< IdentifierHash > m_rIdstile
Definition: TrigCaloDataAccessSvc.h:191
ReadCondHandleKey.h
TrigCaloDataAccessSvc::m_dataPrepMutex
std::mutex m_dataPrepMutex
Definition: TrigCaloDataAccessSvc.h:143
TrigCaloDataAccessSvc::HLTCaloEventCache::tileContainer
TileCellCont * tileContainer
Definition: TrigCaloDataAccessSvc.h:133
TrigCaloDataAccessSvc::reset_LArCol
void reset_LArCol(LArCellCollection *coll)
Definition: TrigCaloDataAccessSvc.h:94
TrigCaloDataAccessSvc::prepareLArCollections
unsigned int prepareLArCollections(const EventContext &context, const IRoiDescriptor &roi, const int sampling, DETID detector)
LAr TT collections preparation code.
Definition: TrigCaloDataAccessSvc.cxx:631
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:72
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TrigCaloDataAccessSvc::m_applyOffsetCorrection
Gaudi::Property< bool > m_applyOffsetCorrection
Definition: TrigCaloDataAccessSvc.h:76
LArTT_Selector< LArCellCont >
TrigCaloDataAccessSvc::loadFullCollections
virtual StatusCode loadFullCollections(const EventContext &context, CaloConstCellContainer &cont) override
Definition: TrigCaloDataAccessSvc.cxx:169
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
query_example.col
col
Definition: query_example.py:7
TrigCaloDataAccessSvc::m_vrodid32fullDet
std::vector< uint32_t > m_vrodid32fullDet
Definition: TrigCaloDataAccessSvc.h:187
TrigCaloDataAccessSvc::m_mcsymKey
SG::ReadCondHandleKey< LArMCSym > m_mcsymKey
Definition: TrigCaloDataAccessSvc.h:80
TrigCaloDataAccessSvc::m_mbts_rods
const std::vector< unsigned int > * m_mbts_rods
Definition: TrigCaloDataAccessSvc.h:190
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:192
TrigCaloDataAccessSvc::m_initMutex
std::mutex m_initMutex
Definition: TrigCaloDataAccessSvc.h:142
TrigCaloDataAccessSvc::m_bcidAvgKey
SG::ReadHandleKey< CaloBCIDAverage > m_bcidAvgKey
Definition: TrigCaloDataAccessSvc.h:78
Athena::Status
Status
Athena specific StatusCode values.
Definition: AthStatusCode.h:22
TileCellCont.h
TrigCaloDataAccessSvc::m_bcContKey
SG::ReadCondHandleKey< LArBadChannelCont > m_bcContKey
Definition: TrigCaloDataAccessSvc.h:86
CaloConstCellContainer
CaloCellContainer that can accept const cell pointers.
Definition: CaloConstCellContainer.h:45
TrigCaloDataAccessSvc::prepareMBTSCollections
unsigned int prepareMBTSCollections(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:726
F
#define F(x, y, z)
Definition: MD5.cxx:112
TrigCaloDataAccessSvc::FullDetIDs::robs
std::vector< uint32_t > robs
Definition: TrigCaloDataAccessSvc.h:112
AthService.h
IRoiDescriptor.h
SlotSpecificObj.h
Maintain a set of objects, one per slot.
calibdata.copy
bool copy
Definition: calibdata.py:27
TrigCaloDataAccessSvc::m_larDecoder
PublicToolHandle< LArRodDecoder > m_larDecoder
Definition: TrigCaloDataAccessSvc.h:64
TrigCaloDataAccessSvc::m_vrodid32tile
std::vector< uint32_t > m_vrodid32tile
Definition: TrigCaloDataAccessSvc.h:188
TrigCaloDataAccessSvc::HLTCaloEventCache::larRodBlockStructure_per_slot
LArRodBlockStructure * larRodBlockStructure_per_slot
Definition: TrigCaloDataAccessSvc.h:130
TrigCaloDataAccessSvc::lateInit
unsigned int lateInit(const EventContext &context)
Definition: TrigCaloDataAccessSvc.cxx:285
TrigCaloDataAccessSvc::HLTCaloEventCache::rodMinorVersion
uint16_t rodMinorVersion
Definition: TrigCaloDataAccessSvc.h:131
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:602
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:88
TrigCaloDataAccessSvc::m_tileDecoder
PublicToolHandle< TileROD_Decoder > m_tileDecoder
Definition: TrigCaloDataAccessSvc.h:65