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
48
49// Gaudi includes
50#include "GaudiKernel/ToolHandle.h"
51#include "GaudiKernel/ServiceHandle.h"
52
53// C++ STL includes
54#include <string>
55#include <vector>
56#include <memory>
57
58// forward declarations
59class TileID;
60class TileTBID;
61class TileHWID;
63class TileCell;
64class TileRawChannel;
69class TileDQstatus;
70class TileInfo;
71
72
73
80 public:
81 int nChannels = 0;
83 int nBadQuality = 0;
84 int nOverflow = 0;
85 int nUnderflow = 0;
86 int nSomeSignal = 0;
87};
88
100
107 : public extends<AthAlgTool, ICaloCellMakerTool>
108{
109 public:
110 TileCellBuilder(const std::string& type, const std::string& name, const IInterface* parent);
111
112 virtual ~TileCellBuilder();
113
114 virtual StatusCode initialize() override;
115
116 virtual StatusCode finalize() override;
117
119 virtual StatusCode process (CaloCellContainer* theCellContainer,
120 const EventContext& ctx) const override;
121
122 void reset(bool fullSizeCont, bool printReset = true);
123
124 //AlgTool InterfaceID
125 static const InterfaceID& interfaceID();
126
127private:
128 // FIXME: Get rid of this abomination.
129 friend class TileHid2RESrcID;
130
133
134 // properties
136 "TileRawChannelCnt",
137 "Input Tile raw channel container key"};
138
140 "TileRawChannelCnt",
141 "Input Tile DSP raw channel container key"};
142
144 "EventInfo",
145 "EventInfo key"};
146
147
148
150 "TileDQstatus",
151 "TileDQstatus key"};
152
154 "MBTSContainer",
155 "Output Tile MBTS container key"};
156
158 "E4prContainer",
159 "Output Tile E4 prime container key"};
160
162 m_eventInfoKey, "TileStatus",
163 "Dummy decoration key to aid scheduling"};
164
165
167
174 bool m_of2;
176
177 // thresholds for parabolic amplitude correction
181
182 float m_minEneChan[3];
185 float m_maxTime;
186 float m_minTime;
187 float m_maxChi2;
188 float m_minChi2;
196
201
206 "TileBadChannels", "TileBadChannels", "Input Tile bad channel status"};
207
212 "TileEMScale", "TileEMScale", "Input Tile EMS calibration constants"};
213
214 ToolHandle<TileCondToolTiming> m_tileToolTiming{this,
215 "TileCondToolTiming", "TileCondToolTiming", "Tile timing tool"};
216
217 ToolHandleArray<ITileRawChannelTool> m_noiseFilterTools{this,
218 "NoiseFilterTools", {}, "Tile noise filter tools"};
219
224 "TileDCS", "TileDCS", "Input Tile DCS status"};
225
230 "TileCablingSvc", "TileCablingSvc", "The Tile cabling service"};
231
234
235 //unsigned int m_bsflags; //!< other flags stored in TileRawChannelContainer
236
237 // These were accumulated, but never actually used.
238 // They also spoil reentrancy, so leave them commented-out for now.
239 // If this information is needed in the future, these can be changed
240 // to use atomics.
241 //TileDrawerRunStatus m_drawerRunStatus[5][64]; //!< overall status of drawer in whole run
242 //int m_eventErrorCounter[4]; //!< number of events with no errors(0), warnings(1), error(2), total(3)
243
244 std::vector<CaloAffectedRegionInfo> m_affectedRegionInfo_global;
245 std::vector<CaloAffectedRegionInfo> m_affectedRegionInfo_current_run;
246
247
249 {
250 // Type of TileRawChannels (Fit, OF2, etc.)
252
253 // Unit for TileRawChannels (ADC, pCb, etc.)
255
256 // max possible time when time correction is applied
257 float m_maxTimeCorr = 75.0;
258
259 // If true, amplitude is corrected by parabolic function (needed for OF without iterations)
261
262 // should time be corrected (deltat added from CondDB)
264
265 // If true, assume OF2 method for amplitude correction, otherwise - OF1
266 bool m_of2;
267 };
268
270 template<class ITERATOR, class COLLECTION>
271 void build (const EventContext& ctx,
272 TileDrawerEvtStatusArray& drawerEvtStatus,
273 VecParams& params,
274 const ITERATOR & begin,
275 const ITERATOR & end,
276 COLLECTION* coll,
277 TileCellContainer* MBTSCells,
278 TileCellContainer* E4prCells) const;
279
283 bool maskBadChannel (TileDrawerEvtStatusArray& drawerEvtStatus,
284 const TileDQstatus* DQstatus, const TileDCSState* dcsState,
285 const TileBadChannels* badChannels, TileCell* pCell, HWIdentifier hwid) const;
286 bool maskBadChannels (TileDrawerEvtStatusArray& drawerEvtStatus,
287 const TileDQstatus* DQstatus, const TileDCSState* dcsState,
288 const TileBadChannels* badChannels, TileCell* pCell) const;
289
290 void correctCell(TileCell* pCell, int correction, int pmt, int gain, float ener, float time,
291 unsigned char iqual, unsigned char qbit, int ch_type) const;
292
293 unsigned char iquality(float qual) const {
294 return std::min(255, abs((int) qual));
295 } // keep quality within 8 bits make it "unsigned char"
296
297
299 unsigned char qbits (TileDrawerEvtStatusArray& drawerEvtStatus,
300 TileFragHash::TYPE RChType,
301 int ros, int drawer,
302 bool count_over, bool good_time, bool good_ener,
303 bool overflow, bool underflow,
304 bool good_overflowfit) const;
305
306 template<typename T, typename V>
313 int m_pos;
314 typedef typename T::iterator itr_type;
316
317 public:
318
320 T* f,
321 const VecParams& params1,
322 T* s,
323 const VecParams& params2,
324 int p)
325 : m_params(params),
326 m_first(f),
327 m_params1(params1),
328 m_second(s),
329 m_params2(params2),
330 m_pos(p) {
331
332 if (m_first->begin() != m_first->end() && m_pos < 1) {
333 m_pos = 0;
334 m_itr = m_first->begin();
335 } else if (m_second->begin() != m_second->end() && m_pos < 2) {
336 m_pos = 1;
337 m_itr = m_second->begin();
338 // set parameters for second vector
339 m_params = m_params2;
340 } else {
341 m_pos = 2;
342 m_itr = m_second->end();
343 }
344 }
345
348
349
351 if (m_pos != i.m_pos || m_itr != i.m_itr) return true;
352 else return false;
353 }
354
355 V& operator*() const { return (*m_itr); }
356 V* operator->() const { return (*m_itr); }
357
359 switch (m_pos) {
360 case 0:
361 if (m_itr != m_first->end()) ++m_itr;
362 if (m_itr != m_first->end()) break;
363 m_itr = m_second->begin();
364 m_pos = 1;
365 // set parameters for second vector
367 if (m_itr != m_second->end()) break;
368 m_pos = 2;
369 // recover parameters for first vector
371 break;
372 case 1:
373 if (m_itr != m_second->end()) ++m_itr;
374 if (m_itr != m_second->end()) break;
375 m_pos = 2;
376 // recover parameters for first vector
378 break;
379 default:
380 break;
381 }
382 return *this;
383 }
384 };
385
390 bool m_run2;
391
392 // TileInfo
393 std::string m_infoName;
398};
399
400#endif
object to store information about affected regions in calorimeter
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