ATLAS Offline Software
TileCellBuilderFromHit.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TILERECUTILS_TILECELLBUILDERFROMHIT_H
6 #define TILERECUTILS_TILECELLBUILDERFROMHIT_H
7 
8 /********************************************************************
9  *
10  * NAME: TileCellBuilderFromHit
11  * PACKAGE: offline/TileCalorimeter/TileRecUtils
12  *
13  * AUTHOR : A. Solodkov
14  * CREATED: 10-Oct-2015
15  *
16  * PURPOSE: Create Cells from Hits and store them in container
17  *
18  * Input: TileHit from TileHitContainer
19  * Output: Container or collection with TileCells
20  * Parameters:
21  * TileHitContainer - Name of input container
22  *
23  ********************************************************************/
24 
25 // Tile includes
36 
37 // Calo includes
41 
42 // Atlas includes
52 
53 // Gaudi includes
54 #include "GaudiKernel/ToolHandle.h"
55 #include "GaudiKernel/ServiceHandle.h"
56 #include "CLHEP/Random/RandomEngine.h"
57 
58 // C++ STL includes
59 #include <string>
60 #include <vector>
61 #include <memory>
62 
63 // forward declarations
64 class TileID;
65 class TileTBID;
66 class TileHWID;
67 class TileCell;
70 class TileCellCollection;
71 class CaloCellContainer;
72 class TileCablingService;
73 
74 
81  : public extends<AthAlgTool, ICaloCellMakerTool>
82 {
83  public:
84  TileCellBuilderFromHit(const std::string& type, const std::string& name, const IInterface* parent);
85 
86  virtual ~TileCellBuilderFromHit();
87 
88  virtual StatusCode initialize() override;
89 
90  virtual StatusCode finalize() override;
91 
93  virtual StatusCode process (CaloCellContainer* theCellContainer,
94  const EventContext& ctx) const override;
95 
96  //AlgTool InterfaceID
97  static const InterfaceID& interfaceID();
98  //static const InterfaceID& interfaceID() { return ICaloCellMakerTool; };
99 
100  private:
103 
104  // properties
106  "electronicNoise",
107  "CaloNoise object to read"};
109  "TileHitCnt",
110  "Input Tile hit container key"};
111 
113  "EventInfo",
114  "EventInfo key"};
115 
116 
118  "MBTSContainer",
119  "Output Tile MBTS container key"};
120 
122  "E4prContainer",
123  "Output Tile E4 prime container key"};
128  "TileSamplingFraction", "TileSamplingFraction", "Input Tile sampling fraction"};
129 
130 
131  std::string m_infoName;
132 
135  float m_zeroEnergy;
137 
138  float m_maxTime;
139  float m_minTime;
141  float m_noiseSigma;
142 
143  const TileID* m_tileID{nullptr};
144  const TileTBID* m_tileTBID{nullptr};
145  const TileHWID* m_tileHWID{nullptr};
146  const TileCablingService* m_cabling{nullptr};
147 
149  { this, "RndmSvc", "AthRNGSvc", "Random Number Service used in TileCellBuildetFromHit" };
150 
151  ToolHandle<ITileBadChanTool> m_tileBadChanTool{this,
152  "TileBadChanTool", "TileBadChanTool", "Tile bad channel tool"};
153 
158  "TileEMScale", "TileEMScale", "Input Tile EMS calibration constants"};
159 
164  "TileCablingSvc", "TileCablingSvc", "The Tile cabling service"};
165 
166 
167  const TileDetDescrManager* m_tileMgr{nullptr};
168  const MbtsDetDescrManager* m_mbtsMgr{nullptr};
169 
171  //unsigned int m_bsflags; //!< other flags stored in TileRawChannelContainer
172 
173  // These were accumulated, but never actually used.
174  // They also spoil reentrancy, so leave them commented-out for now.
175  // If this information is needed in the future, these can be changed
176  // to use atomics.
178  //int m_eventErrorCounter[4]; //!< number of events with no errors(0), warnings(1), error(2), total(3)
179 
180  std::vector<CaloAffectedRegionInfo> m_affectedRegionInfo_global;
181  std::vector<CaloAffectedRegionInfo> m_affectedRegionInfo_current_run;
182 
184  template<class ITERATOR, class COLLECTION>
185  void build(const CaloNoise* caloNoise,
186  TileDrawerEvtStatusArray& drawerEvtStatus,
187  const ITERATOR & begin,
188  const ITERATOR & end,
189  COLLECTION * coll,
190  TileCellContainer* MBTSCells,
191  TileCellContainer* E4prCells,
192  const TileSamplingFraction* samplingFraction) const;
193 
194 
198  bool maskBadChannel (TileDrawerEvtStatusArray& drawerEvtStatus,
199  TileCell* pCell) const;
200  bool maskBadChannels (TileDrawerEvtStatusArray& drawerEvtStatus,
201  TileCell* pCell, bool single_PMT_C10, bool Ecell) const;
202 
203  void correctCell(TileCell* pCell, int correction, int pmt, int gain, float ener, float time,
204  unsigned char iqual, unsigned char qbit) const;
205 
206  unsigned char iquality(float qual) const {
207  return std::min(255, abs((int) qual));
208  } // keep quality within 8 bits make it "unsigned char"
209 
210  unsigned char qbits(TileDrawerEvtStatusArray& drawerEvtStatus,
211  int ros, int drawer, bool count_over, bool good_time, bool good_ener,
212  bool overflow, bool underflow, bool good_overflowfit) const;
213 
214  bool m_RUN2;
217 
218  static const int NSIDE = 2;
219  static const int NPHI = 8;
220  static const int NETA = 2;
221  static const int NCELLMBTS = NSIDE * NPHI * NETA;
222  inline int mbts_index(int side, int phi, int eta) const {
223  return (side * NPHI + phi) * NETA + eta;
224  }
225  static const int E4SIDE = -1;
226  static const int E4ETA = 2;
227  static const int E4NPHI = 4;
228  static const int NCELLE4PR = E4NPHI;
229  inline int e4pr_index(int phi) const {
230  return phi;
231  }
232 
233 };
234 
235 #endif
TileCellBuilderFromHit::m_samplingFractionKey
SG::ReadCondHandleKey< TileSamplingFraction > m_samplingFractionKey
Name of TileSamplingFraction in condition store.
Definition: TileCellBuilderFromHit.h:127
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
TileCellBuilderFromHit::NCELLMBTS
static const int NCELLMBTS
Definition: TileCellBuilderFromHit.h:221
TileCell
Definition: TileCell.h:57
TileCellBuilderFromHit::e4pr_index
int e4pr_index(int phi) const
Definition: TileCellBuilderFromHit.h:229
TileCellBuilderFromHit::m_noiseSigma
float m_noiseSigma
cell electronic noise if CaloNoise is switched off
Definition: TileCellBuilderFromHit.h:141
TileCablingSvc.h
TileCellBuilderFromHit::NSIDE
static const int NSIDE
Definition: TileCellBuilderFromHit.h:218
TileCellBuilderFromHit::m_RUN2plus
bool m_RUN2plus
Definition: TileCellBuilderFromHit.h:215
TileEMScale.h
TileCellBuilderFromHit::m_caloNoiseKey
SG::ReadCondHandleKey< CaloNoise > m_caloNoiseKey
Definition: TileCellBuilderFromHit.h:105
TileCellCollection
Definition: TileCellCollection.h:12
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
TileCellBuilderFromHit::m_tileHWID
const TileHWID * m_tileHWID
Pointer to TileHWID.
Definition: TileCellBuilderFromHit.h:145
TileCellBuilderFromHit::~TileCellBuilderFromHit
virtual ~TileCellBuilderFromHit()
Destructor.
Definition: TileCellBuilderFromHit.cxx:117
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
ReadBchFromCool.pmt
pmt
Definition: ReadBchFromCool.py:62
TileFragHash::TYPE
TYPE
initialize
Definition: TileFragHash.h:33
TileCellBuilderFromHit::m_MBTSContainerKey
SG::WriteHandleKey< TileCellContainer > m_MBTSContainerKey
Definition: TileCellBuilderFromHit.h:117
CaloCondBlobAlgs_fillNoiseFromASCII.gain
gain
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:110
TileCellBuilderFromHit::m_E1_TOWER
int m_E1_TOWER
Definition: TileCellBuilderFromHit.h:216
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
TileCellBuilderFromHit::m_cabling
const TileCablingService * m_cabling
Pointer to TileCabling.
Definition: TileCellBuilderFromHit.h:146
TileCellBuilderFromHit::build
void build(const CaloNoise *caloNoise, TileDrawerEvtStatusArray &drawerEvtStatus, const ITERATOR &begin, const ITERATOR &end, COLLECTION *coll, TileCellContainer *MBTSCells, TileCellContainer *E4prCells, const TileSamplingFraction *samplingFraction) const
Definition: TileCellBuilderFromHit.cxx:733
TileCellBuilderFromHit::qbits
unsigned char qbits(TileDrawerEvtStatusArray &drawerEvtStatus, 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
Definition: TileCellBuilderFromHit.cxx:431
TileFragHash.h
TileCellBuilderFromHit::E4ETA
static const int E4ETA
Definition: TileCellBuilderFromHit.h:226
TileCellBuilderFromHit::m_mbtsMgr
const MbtsDetDescrManager * m_mbtsMgr
Pointer to MbtsDetDescrManager.
Definition: TileCellBuilderFromHit.h:168
TileCellBuilderFromHit::m_emScaleKey
SG::ReadCondHandleKey< TileEMScale > m_emScaleKey
Name of TileEMScale in condition store.
Definition: TileCellBuilderFromHit.h:157
TileCellBuilderFromHit::m_affectedRegionInfo_current_run
std::vector< CaloAffectedRegionInfo > m_affectedRegionInfo_current_run
method to process raw channels from a given vector and store them in collection
Definition: TileCellBuilderFromHit.h:181
SG::ReadHandleKey< TileHitContainer >
TileCellBuilderFromHit::E4NPHI
static const int E4NPHI
Definition: TileCellBuilderFromHit.h:227
TileCellBuilderFromHit::finalize
virtual StatusCode finalize() override
Definition: TileCellBuilderFromHit.cxx:190
TileCellBuilderFromHit::m_zeroEnergy
float m_zeroEnergy
energy to store in every PMT if both PMT are bad
Definition: TileCellBuilderFromHit.h:135
TileCondToolTiming.h
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
TileCellBuilderFromHit::correctCell
void correctCell(TileCell *pCell, int correction, int pmt, int gain, float ener, float time, unsigned char iqual, unsigned char qbit) const
Compute calibrated energy, time, etc.
Definition: TileCellBuilderFromHit.cxx:409
MbtsDetDescrManager
Definition: MbtsDetDescrManager.h:16
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
TileCellBuilderFromHit::m_tileID
const TileID * m_tileID
Pointer to TileID.
Definition: TileCellBuilderFromHit.h:143
TRT::Hit::side
@ side
Definition: HitInfo.h:83
TileCellBuilderFromHit::initialize
virtual StatusCode initialize() override
Initializer.
Definition: TileCellBuilderFromHit.cxx:123
TileCellBuilderFromHit::m_eventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
Definition: TileCellBuilderFromHit.h:112
TileCellBuilderFromHit::m_RChType
TileFragHash::TYPE m_RChType
Type of TileRawChannels (Fit, OF2, etc.)
Definition: TileCellBuilderFromHit.h:170
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
TileCellBuilderFromHit::m_E4prContainerKey
SG::WriteHandleKey< TileCellContainer > m_E4prContainerKey
Definition: TileCellBuilderFromHit.h:121
TileHWID
Helper class for TileCal online (hardware) identifiers.
Definition: TileHWID.h:49
TileCellBuilderFromHit::m_infoName
std::string m_infoName
Definition: TileCellBuilderFromHit.h:131
TileCellBuilderFromHit::maskBadChannel
bool maskBadChannel(TileDrawerEvtStatusArray &drawerEvtStatus, TileCell *pCell) const
method to check if channels are good or bad.
Definition: TileCellBuilderFromHit.cxx:464
TileCellBuilderFromHit
This class creates Cells from RawChannels and stores them in a container.
Definition: TileCellBuilderFromHit.h:82
TileCellBuilderFromHit::iquality
unsigned char iquality(float qual) const
Definition: TileCellBuilderFromHit.h:206
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
TileCellBuilderFromHit::m_minTime
float m_minTime
minimum time for the PMTs in the cels
Definition: TileCellBuilderFromHit.h:139
TileSamplingFraction
Condition object to keep and provide Tile Calorimeter sampling fraction and number of photoelectrons.
Definition: TileSamplingFraction.h:16
TileDetDescrManager
Definition: TileDetDescrManager.h:33
TileSamplingFraction.h
TileID
Helper class for TileCal offline identifiers.
Definition: TileID.h:68
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileCellBuilderFromHit::E4SIDE
static const int E4SIDE
Definition: TileCellBuilderFromHit.h:225
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
TileCellBuilderFromHit::maskBadChannels
bool maskBadChannels(TileDrawerEvtStatusArray &drawerEvtStatus, TileCell *pCell, bool single_PMT_C10, bool Ecell) const
Definition: TileCellBuilderFromHit.cxx:519
TileCellBuilderFromHit::m_eneForTimeCutMBTS
float m_eneForTimeCutMBTS
similar cut for MBTS in pC
Definition: TileCellBuilderFromHit.h:134
TileCellBuilderFromHit::m_hitContainerKey
SG::ReadHandleKey< TileHitContainer > m_hitContainerKey
Definition: TileCellBuilderFromHit.h:108
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileCablingService
Definition: TileCablingService.h:23
TileCellBuilderFromHit::NCELLE4PR
static const int NCELLE4PR
Definition: TileCellBuilderFromHit.h:228
min
#define min(a, b)
Definition: cfImp.cxx:40
ReadCondHandleKey.h
TileCellBuilderFromHit::TileDrawerEvtStatusArray
TileDrawerEvtStatus TileDrawerEvtStatusArray[5][64]
status of every drawer
Definition: TileCellBuilderFromHit.h:102
CaloNoise
Definition: CaloNoise.h:16
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
HWIdentifier.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TileCellBuilderFromHit::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
< Random number service to use
Definition: TileCellBuilderFromHit.h:149
CaloNoise.h
TileCellBuilderFromHit::m_affectedRegionInfo_global
std::vector< CaloAffectedRegionInfo > m_affectedRegionInfo_global
TileDrawerRunStatus m_drawerRunStatus[5][64]; //!< overall status of drawer in whole run.
Definition: TileCellBuilderFromHit.h:180
TileCellBuilderFromHit::interfaceID
static const InterfaceID & interfaceID()
Definition: TileCellBuilderFromHit.cxx:66
CaloCellContainer
Container class for CaloCell.
Definition: CaloCellContainer.h:55
EventInfo.h
TileRawChannelUnit.h
ICaloCellMakerTool.h
TileHitContainer.h
TileCellBuilderFromHit::m_eneForTimeCut
float m_eneForTimeCut
keep time for channels with energy above cut
Definition: TileCellBuilderFromHit.h:133
SG::ReadCondHandleKey< CaloNoise >
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
TileCellBuilderFromHit::NPHI
static const int NPHI
Definition: TileCellBuilderFromHit.h:219
TileCellBuilderFromHit::process
virtual StatusCode process(CaloCellContainer *theCellContainer, const EventContext &ctx) const override
method to process all raw channels and store them in container
Definition: TileCellBuilderFromHit.cxx:197
TileCellBuilderFromHit::m_RUN2
bool m_RUN2
Definition: TileCellBuilderFromHit.h:214
TileDrawerEvtStatus
This class keep detailed status info about one drawer in a given event.
Definition: TileCellBuilder.h:80
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
TileCellBuilderFromHit::m_maskBadChannels
bool m_maskBadChannels
if true=> bad channels are masked
Definition: TileCellBuilderFromHit.h:140
TileCellBuilderFromHit::m_maxTime
float m_maxTime
maximum time for the PMTs in the cels
Definition: TileCellBuilderFromHit.h:138
TileCellBuilderFromHit::m_tileTBID
const TileTBID * m_tileTBID
Pointer to TileTBID.
Definition: TileCellBuilderFromHit.h:144
TileCellBuilderFromHit::m_qualityCut
int m_qualityCut
cut on channel quality (set energy to m_zeroEnergy for them)
Definition: TileCellBuilderFromHit.h:136
beamspotman.qual
qual
Definition: beamspotman.py:481
TileTBID
Helper class for TileCal offline identifiers of ancillary testbeam detectors and MBTS.
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:65
IOVSvcDefs.h
defines and typedefs for IOVSvc
TileCellBuilderFromHit::m_tileBadChanTool
ToolHandle< ITileBadChanTool > m_tileBadChanTool
Definition: TileCellBuilderFromHit.h:151
ITileBadChanTool.h
TileCellBuilderFromHit::m_tileMgr
const TileDetDescrManager * m_tileMgr
Pointer to TileDetDescrManager.
Definition: TileCellBuilderFromHit.h:167
TileCellBuilderFromHit::NETA
static const int NETA
Definition: TileCellBuilderFromHit.h:220
TileCellBuilderFromHit::m_cablingSvc
ServiceHandle< TileCablingSvc > m_cablingSvc
Name of Tile cabling service.
Definition: TileCellBuilderFromHit.h:163
TileContainer
Definition: TileContainer.h:38
TileCellBuilderFromHit::mbts_index
int mbts_index(int side, int phi, int eta) const
Definition: TileCellBuilderFromHit.h:222
CaloAffectedRegionInfo.h
object to store information about affected regions in calorimeter
TileCellBuilder.h
TileCellBuilderFromHit::TileCellBuilderFromHit
TileCellBuilderFromHit(const std::string &type, const std::string &name, const IInterface *parent)
Contructor.
Definition: TileCellBuilderFromHit.cxx:71
TileCellContainer.h
IAthRNGSvc.h
ServiceHandle< IAthRNGSvc >