ATLAS Offline Software
Loading...
Searching...
No Matches
TileCellBuilder.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 TILERECUTILS_TILECELLBUILDER_H
6#define TILERECUTILS_TILECELLBUILDER_H
7
8/********************************************************************
9 *
10 * NAME: TileCellBuilder
11 * PACKAGE: offline/TileCalorimeter/TileRecUtils
12 *
13 * AUTHOR : A. Solodkov
14 * CREATED: 20-Jun-2004
15 *
16 * PURPOSE: Create Cells from RawChannels and store them in container
17 *
18 * Input: TileRawChannel (one by one or from TileRawChannelContainer)
19 * Output: Container or collection with TileCells
20 * Parameters:
21 * TileRawChannelContainer - Name of input container
22 *
23 ********************************************************************/
24
25// Tile includes
37
38// Calo includes
41
42// Atlas includes
49
50// Gaudi includes
51#include "GaudiKernel/ToolHandle.h"
52#include "GaudiKernel/ServiceHandle.h"
53
54// C++ STL includes
55#include <string>
56#include <vector>
57#include <memory>
58
59// forward declarations
60class TileID;
61class TileTBID;
62class TileHWID;
64class TileCell;
65class TileRawChannel;
70class TileDQstatus;
71class TileInfo;
72
73
74
81 public:
82 int nChannels = 0;
84 int nBadQuality = 0;
85 int nOverflow = 0;
86 int nUnderflow = 0;
87 int nSomeSignal = 0;
88};
89
101
108 : public extends<AthAlgTool, ICaloCellMakerTool>
109{
110 public:
111 TileCellBuilder(const std::string& type, const std::string& name, const IInterface* parent);
112
113 virtual ~TileCellBuilder();
114
115 virtual StatusCode initialize() override;
116
117 virtual StatusCode finalize() override;
118
120 virtual StatusCode process (CaloCellContainer* theCellContainer,
121 const EventContext& ctx) const override;
122
123 void reset(bool fullSizeCont, bool printReset = true);
124
125 //AlgTool InterfaceID
126 static const InterfaceID& interfaceID();
127
128private:
129 // FIXME: Get rid of this abomination.
130 friend class TileHid2RESrcID;
131
134
135 // properties
137 "TileRawChannelCnt",
138 "Input Tile raw channel container key"};
139
141 "TileRawChannelCnt",
142 "Input Tile DSP raw channel container key"};
143
145 "EventInfo",
146 "EventInfo key"};
147
148
149
151 "TileDQstatus",
152 "TileDQstatus key"};
153
155 "MBTSContainer",
156 "Output Tile MBTS container key"};
157
159 "E4prContainer",
160 "Output Tile E4 prime container key"};
161
163 m_eventInfoKey, "TileStatus",
164 "Dummy decoration key to aid scheduling"};
165
166
168
175 bool m_of2;
177
178 // thresholds for parabolic amplitude correction
182
183 float m_minEneChan[3];
186 float m_maxTime;
187 float m_minTime;
188 float m_maxChi2;
189 float m_minChi2;
197
202
207 "TileBadChannels", "TileBadChannels", "Input Tile bad channel status"};
208
213 "TileEMScale", "TileEMScale", "Input Tile EMS calibration constants"};
214
215 ToolHandle<TileCondToolTiming> m_tileToolTiming{this,
216 "TileCondToolTiming", "TileCondToolTiming", "Tile timing tool"};
217
218 ToolHandleArray<ITileRawChannelTool> m_noiseFilterTools{this,
219 "NoiseFilterTools", {}, "Tile noise filter tools"};
220
225 "TileDCS", "TileDCS", "Input Tile DCS status"};
226
231 "TileCablingSvc", "TileCablingSvc", "The Tile cabling service"};
232
235
236 //unsigned int m_bsflags; //!< other flags stored in TileRawChannelContainer
237
238 // These were accumulated, but never actually used.
239 // They also spoil reentrancy, so leave them commented-out for now.
240 // If this information is needed in the future, these can be changed
241 // to use atomics.
242 //TileDrawerRunStatus m_drawerRunStatus[5][64]; //!< overall status of drawer in whole run
243 //int m_eventErrorCounter[4]; //!< number of events with no errors(0), warnings(1), error(2), total(3)
244
245 std::vector<CaloAffectedRegionInfo> m_affectedRegionInfo_global;
246 std::vector<CaloAffectedRegionInfo> m_affectedRegionInfo_current_run;
247
248
250 {
251 // Type of TileRawChannels (Fit, OF2, etc.)
253
254 // Unit for TileRawChannels (ADC, pCb, etc.)
256
257 // max possible time when time correction is applied
258 float m_maxTimeCorr = 75.0;
259
260 // If true, amplitude is corrected by parabolic function (needed for OF without iterations)
262
263 // should time be corrected (deltat added from CondDB)
265
266 // If true, assume OF2 method for amplitude correction, otherwise - OF1
267 bool m_of2;
268 };
269
271 template<class ITERATOR, class COLLECTION>
272 void build (const EventContext& ctx,
273 TileDrawerEvtStatusArray& drawerEvtStatus,
274 VecParams& params,
275 const ITERATOR & begin,
276 const ITERATOR & end,
277 COLLECTION* coll,
278 TileCellContainer* MBTSCells,
279 TileCellContainer* E4prCells) const;
280
284 bool maskBadChannel (TileDrawerEvtStatusArray& drawerEvtStatus,
285 const TileDQstatus* DQstatus, const TileDCSState* dcsState,
286 const TileBadChannels* badChannels, TileCell* pCell, HWIdentifier hwid) const;
287 bool maskBadChannels (TileDrawerEvtStatusArray& drawerEvtStatus,
288 const TileDQstatus* DQstatus, const TileDCSState* dcsState,
289 const TileBadChannels* badChannels, TileCell* pCell) const;
290
291 void correctCell(TileCell* pCell, int correction, int pmt, int gain, float ener, float time,
292 unsigned char iqual, unsigned char qbit, int ch_type) const;
293
294 unsigned char iquality(float qual) const {
295 return std::min(255, abs((int) qual));
296 } // keep quality within 8 bits make it "unsigned char"
297
298
300 unsigned char qbits (TileDrawerEvtStatusArray& drawerEvtStatus,
301 TileFragHash::TYPE RChType,
302 int ros, int drawer,
303 bool count_over, bool good_time, bool good_ener,
304 bool overflow, bool underflow,
305 bool good_overflowfit) const;
306
307 template<typename T, typename V>
314 int m_pos;
315 typedef typename T::iterator itr_type;
317
318 public:
319
321 T* f,
322 const VecParams& params1,
323 T* s,
324 const VecParams& params2,
325 int p)
326 : m_params(params),
327 m_first(f),
328 m_params1(params1),
329 m_second(s),
330 m_params2(params2),
331 m_pos(p) {
332
333 if (m_first->begin() != m_first->end() && m_pos < 1) {
334 m_pos = 0;
335 m_itr = m_first->begin();
336 } else if (m_second->begin() != m_second->end() && m_pos < 2) {
337 m_pos = 1;
338 m_itr = m_second->begin();
339 // set parameters for second vector
340 m_params = m_params2;
341 } else {
342 m_pos = 2;
343 m_itr = m_second->end();
344 }
345 }
346
349
350
352 if (m_pos != i.m_pos || m_itr != i.m_itr) return true;
353 else return false;
354 }
355
356 V& operator*() const { return (*m_itr); }
357 V* operator->() const { return (*m_itr); }
358
360 switch (m_pos) {
361 case 0:
362 if (m_itr != m_first->end()) ++m_itr;
363 if (m_itr != m_first->end()) break;
364 m_itr = m_second->begin();
365 m_pos = 1;
366 // set parameters for second vector
368 if (m_itr != m_second->end()) break;
369 m_pos = 2;
370 // recover parameters for first vector
372 break;
373 case 1:
374 if (m_itr != m_second->end()) ++m_itr;
375 if (m_itr != m_second->end()) break;
376 m_pos = 2;
377 // recover parameters for first vector
379 break;
380 default:
381 break;
382 }
383 return *this;
384 }
385 };
386
391 bool m_run2;
392
393 // TileInfo
394 std::string m_infoName;
399};
400
401#endif
object to store information about affected regions in calorimeter
defines and typedefs for IOVSvc
if(febId1==febId2)
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
TileContainer< TileCell > TileCellContainer
Information produced by TileDQstatusAlg (used to be done by TileBeamInfoProvider).
Container class for CaloCell.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Condition object to keep Tile channel and ADC status.
DoubleVectorIterator & operator=(const DoubleVectorIterator &other)=default
DoubleVectorIterator(const DoubleVectorIterator &i)=default
DoubleVectorIterator(VecParams &params, T *f, const VecParams &params1, T *s, const VecParams &params2, int p)
bool operator!=(const DoubleVectorIterator &i)
ToolHandle< TileCondToolTiming > m_tileToolTiming
const TileDetDescrManager * m_tileMgr
Pointer to TileDetDescrManager.
SG::ReadHandleKey< TileRawChannelContainer > m_dspRawChannelContainerKey
int m_qualityCut
cut on channel quality (set energy to m_zeroEnergy for them)
virtual ~TileCellBuilder()
Destructor.
float m_timeMaxThresh
correct amplitude is time is below time max threshold
TileDrawerEvtStatus TileDrawerEvtStatusArray[5][64]
status of every drawer
SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
const TileTBID * m_tileTBID
Pointer to TileTBID.
ServiceHandle< TileCablingSvc > m_cablingSvc
Name of Tile cabling service.
float m_timeMinThresh
correct amplitude is time is above time min threshold
void reset(bool fullSizeCont, bool printReset=true)
Method to reset the options of the TileCellContainer.
TileCellBuilder(const std::string &type, const std::string &name, const IInterface *parent)
Contructor.
SG::WriteDecorHandleKey< xAOD::EventInfo > m_EventInfoTileStatusKey
bool maskBadChannel(TileDrawerEvtStatusArray &drawerEvtStatus, const TileDQstatus *DQstatus, const TileDCSState *dcsState, const TileBadChannels *badChannels, TileCell *pCell, HWIdentifier hwid) const
method to check if channels are good or bad.
bool m_mergeChannels
If true, missing raw channels are taken from DSP container.
SG::ReadHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
friend class TileHid2RESrcID
const MbtsDetDescrManager * m_mbtsMgr
Pointer to MbtsDetDescrManager.
const TileInfo * m_tileInfo
bool m_fakeCrackCells
if true=> fake E3/E4 cells added
bool maskBadChannels(TileDrawerEvtStatusArray &drawerEvtStatus, const TileDQstatus *DQstatus, const TileDCSState *dcsState, const TileBadChannels *badChannels, TileCell *pCell) const
unsigned char iquality(float qual) const
bool m_thresholdNotSet
bool variable to check whether some threshold have been set
SG::ReadCondHandleKey< TileDCSState > m_DCSStateKey
Name of TileDCSState object in condition store.
bool m_of2
If true, assume OF2 method for amplitude correction, otherwise - OF1.
const TileCablingService * m_cabling
TileCabling instance.
int m_skipGain
for two-gain calib runs skip one of two gains
float m_eneForTimeCut
keep time for channels with energy above cut
unsigned char qbits(TileDrawerEvtStatusArray &drawerEvtStatus, TileFragHash::TYPE RChType, int ros, int drawer, bool count_over, bool good_time, bool good_ener, bool overflow, bool underflow, bool good_overflowfit) const
method to compute the cell quality bits
const TileHWID * m_tileHWID
Pointer to TileHWID.
SG::ReadCondHandleKey< TileEMScale > m_emScaleKey
Name of TileEMScale in condition store.
std::vector< CaloAffectedRegionInfo > m_affectedRegionInfo_current_run
SG::WriteHandleKey< TileCellContainer > m_E4prContainerKey
float m_minEneChan[3]
channel energy thresholds for masking (normal,gap,mbts)
SG::WriteHandleKey< TileCellContainer > m_MBTSContainerKey
void correctCell(TileCell *pCell, int correction, int pmt, int gain, float ener, float time, unsigned char iqual, unsigned char qbit, int ch_type) const
Compute calibrated energy, time, etc.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
static const InterfaceID & interfaceID()
SG::ReadCondHandleKey< TileBadChannels > m_badChannelsKey
Name of TileBadChannels in condition store.
float m_zeroEnergy
energy to store in every PMT if both PMT are bad
float m_maxChi2
maximum chi2 for the PMTs in the cels
ToolHandleArray< ITileRawChannelTool > m_noiseFilterTools
void build(const EventContext &ctx, TileDrawerEvtStatusArray &drawerEvtStatus, VecParams &params, const ITERATOR &begin, const ITERATOR &end, COLLECTION *coll, TileCellContainer *MBTSCells, TileCellContainer *E4prCells) const
< method to process raw channels from a given vector and store them in collection
bool m_correctTime
should time be corrected (deltat added from CondDB)
std::vector< CaloAffectedRegionInfo > m_affectedRegionInfo_global
std::string m_dspRawChannelContainer
float m_eneForTimeCutMBTS
similar cut for MBTS in pC
virtual StatusCode finalize() override
bool m_correctAmplitude
If true, amplitude is corrected by parabolic function (needed for OF without iterations)
float m_minTime
minimum time for the PMTs in the cels
float m_ampMinThresh
correct amplitude if it's above amplitude threshold (in ADC counts)
std::string m_infoName
bool m_maskBadChannels
if true=> bad channels are masked
float m_maxTimeDiff
maximum time difference between the PMTs in the cell
float m_maxTime
maximum time for the PMTs in the cels
const TileID * m_tileID
Pointer to TileID.
float m_minChi2
minimum chi2 for the PMTs in the cels
virtual StatusCode initialize() override
Initializer.
float m_eThreshold
cell energy threshold to consider the cell
Condition object to keep Tile DCS status from DB.
Class that holds Data Quality fragment information and provides functions to extract the data quality...
This class keep detailed status info about one drawer in a given event.
This class keep detailed status info about one drawer in whole run.
TYPE
initialize
Helper class for TileCal online (hardware) identifiers.
Definition TileHWID.h:49
Helper class for TileCal offline identifiers.
Definition TileID.h:67
Helper class for TileCal offline identifiers of ancillary testbeam detectors and MBTS.
const std::string process
TileFragHash::TYPE m_RChType
TileRawChannelUnit::UNIT m_RChUnit