ATLAS Offline Software
TileDigitsMaker.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //****************************************************************************
6 // Filename : TileDigitsMaker.h
7 // Author : UC-ATLAS TileCal group
8 // Created : Feb 2006 from TileHitToDigits algorithm
9 //
10 // DESCRIPTION
11 //
12 // Creates TileDigits from TileHit
13 //
14 // Properties (JobOption Parameters):
15 //
16 // TileHitContainer string Name of container with TileHit to read
17 // TileDigitsContainer string Name of container with TileDigits to write
18 // TileInfoName string Name of object in TDS with all parameters
19 //
20 // BUGS:
21 //
22 // History:
23 //
24 //
25 //****************************************************************************
26 
27 #ifndef TILESIMALGS_TILEDIGITSMAKER_H
28 #define TILESIMALGS_TILEDIGITSMAKER_H
29 
30 // Tile includes
33 #include "TileEvent/TileDQstatus.h"
40 
41 // Pile up
43 
44 // Atlas includes
49 
50 // Gaudi includes
51 #include "GaudiKernel/ToolHandle.h"
52 #include "GaudiKernel/ServiceHandle.h"
53 
54 #include "CLHEP/Random/RandomEngine.h"
55 #include "AthenaKernel/Units.h"
56 
57 class IAthRNGSvc;
58 class PileUpMergeSvc;
59 class TileID;
60 class TileTBID;
61 class TileHWID;
62 class TileInfo;
63 class HWIdentifier;
64 class TileCablingService;
65 class TileDQstatus;
66 
67 #include <string>
68 #include <vector>
69 #include <memory>
70 
80  public:
81  // Constructor
83 
84  //Destructor
85  virtual ~TileDigitsMaker() = default;
86 
87  //Gaudi Hooks
88  virtual StatusCode initialize() override;
89  virtual StatusCode execute(const EventContext &ctx) const override;
90  virtual StatusCode finalize() override;
91 
92  private:
94  const TileHitCollection* hitCollection,
95  std::vector<std::vector<double>>& drawerBufferLo,
96  std::vector<std::vector<double>>& drawerBufferHi,
97  std::vector<int>& igain, int ros, int drawer, int drawerIdx,
98  std::vector<int>& over_gain, const TileEMScale* emScale,
99  const TileSampleNoise* sampleNoise, const TileDQstatus* dqStatus,
100  const TileBadChannels* badChannels) const;
101 
102  StatusCode fillDigitCollection(const TileHitCollection* hitCollection,
103  std::vector<std::vector<double>>& drawerBufferLo,
104  std::vector<std::vector<double>>& drawerBufferHi,
105  std::vector<int>& igain, std::vector<int>& overgain, std::vector<double>& ech_int,
106  std::vector<bool> &signal_in_channel, const TileEMScale* emScale,
107  const TileSamplingFraction* samplingFraction, const TilePulse* pulse) const;
108 
110  "TileHitContainer", "TileHitCnt", "input Tile hit container key"};
111 
113  "TileHitContainer_DigiHSTruth","TileHitCnt_DigiHSTruth", "input Tile hit container key"};
114 
115  Gaudi::Property<bool> m_onlyUseContainerName{this,
116  "OnlyUseContainerName", true, "Don't use the ReadHandleKey directly. Just extract the container name from it."};
117 
118  SG::ReadHandleKey<TileDigitsContainer> m_inputDigitContainerKey{this, "InputTileDigitContainer","",""};
119  std::string m_inputDigitContainerName{""};
120 
122  "TileDigitsContainer", "TileDigitsCnt", "Output Tile digits container key"};
123 
125  "TileDigitsContainer_DigiHSTruth", "TileDigitsCnt_DigiHSTruth", "Output DigiHSTruth Tile digits container key"};
126 
128  "TileFilteredContainer", "TileDigitsFlt", "Output filtered Tile digits container key"};
129 
130  Gaudi::Property<double> m_filterThreshold{this,
131  "FilterThreshold", 100.0 * Athena::Units::MeV, "Threshold on filtered digits (default - 100 MeV)"};
132 
133  Gaudi::Property<double> m_filterThresholdMBTS{this,
134  "FilterThresholdMBTS", 0.0 * Athena::Units::MeV, "Threshold on filtered digits of MBTS (default - 0 MeV)"};
135 
136  Gaudi::Property<std::string> m_infoName{this,
137  "TileInfoName", "TileInfo", "TileInfo object name"};
138 
139  Gaudi::Property<bool> m_integerDigits{this,
140  "IntegerDigits", true, "Round digits to integer"};
141 
142  Gaudi::Property<bool> m_calibRun{this,
143  "CalibrationRun", false, "If true -> both high and low gain saved"};
144 
145  Gaudi::Property<bool> m_rndmEvtOverlay{this,
146  "RndmEvtOverlay", false, "Pileup and/or noise added by overlaying random events (default=false)"};
147 
148  Gaudi::Property<bool> m_useCoolPulseShapes{this,
149  "UseCoolPulseShapes", true, "Pulse shapes from database (default=true)"};
150 
151  Gaudi::Property<bool> m_maskBadChannels{this,
152  "MaskBadChannels", false, "Remove channels tagged bad (default=false)"};
153 
154  Gaudi::Property<bool> m_doDigiTruth{this,
155  "DoHSTruthReconstruction", false, ""};
156 
157  Gaudi::Property<int> m_allChannels{this,
158  "AllChannels", -1, "Create all channels, use 0 or 1 or 2 (default=-1 - unset)"};
159 
160  ServiceHandle<PileUpMergeSvc> m_mergeSvc{this, "PileUpMergeSvc", "PileUpMergeSvc"};
161 
162  const TileID* m_tileID{nullptr};
163  const TileTBID* m_tileTBID{nullptr};
164  const TileHWID* m_tileHWID{nullptr};
165  const TileInfo* m_tileInfo{nullptr};
166  const TileCablingService* m_cabling{nullptr};
167 
168  std::vector<std::unique_ptr<HWIdentifier[]> > m_all_ids;
169 
170  int m_nSamples{0};
171  int m_iTrig{0};
172  int m_i_ADCmax{0};
173  float m_f_ADCmax{0.0F};
174  float m_f_ADCmaxHG{0.0F};
175  float m_ADCmaxMinusEps{0.0F};
176  float m_ADCmaxPlusEps{0.0F};
177  float m_f_ADCmaskValue{0.0F};
178  bool m_tileNoise{false};
179  bool m_tileCoherNoise{false};
180  bool m_tileThresh{false};
181  double m_tileThreshHi{0.0};
182  double m_tileThreshLo{0.0};
183 
184  std::vector<double> m_digitShapeHi;
185  int m_nShapeHi{0};
186  int m_nBinsPerXHi{0};
187  int m_binTime0Hi{0};
188  double m_timeStepHi{0.};
189 
190  std::vector<double> m_digitShapeLo;
191  int m_nShapeLo{0};
192  int m_nBinsPerXLo{0};
193  int m_binTime0Lo{0};
194  double m_timeStepLo{0.};
195 
200  "TileCablingSvc", "TileCablingSvc", "The Tile cabling service"};
201 
202  ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""};
203  Gaudi::Property<std::string> m_randomStreamName{this, "RandomStreamName", "Tile_DigitsMaker", ""};
205 
210  "TileSampleNoise", "TileSampleNoise", "Input Tile sample noise"};
211 
216  "TileEMScale", "TileEMScale", "Input Tile EMS calibration constants"};
217 
222  "TilePulseShape", "TilePulseShape", "Input Tile pulse shape"};
223 
228  "TileSamplingFraction", "TileSamplingFraction", "Input Tile sampling fraction"};
229 
234  "TileBadChannels", "TileBadChannels", "Input Tile bad channel status"};
235 
237  "TileDQstatus", "", "Input TileDQstatus key" };
238 
239 };
240 
241 #endif // TILESIMALGS_TILEDIGITSMAKER_H
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
TileEMScale
Condition object to keep calibration factors of TileCal channels.
Definition: TileEMScale.h:87
TileCablingSvc.h
TileDigitsMaker::m_ADCmaxPlusEps
float m_ADCmaxPlusEps
ADC saturation value + 0.01 or something small.
Definition: TileDigitsMaker.h:176
TileDigitsMaker
This algorithm performs digitization in TileCal, obtaining TileDigits from TileHits.
Definition: TileDigitsMaker.h:79
TileDigitsMaker::m_integerDigits
Gaudi::Property< bool > m_integerDigits
Definition: TileDigitsMaker.h:139
TileEMScale.h
TilePulse.h
TileDigitsMaker::m_cabling
const TileCablingService * m_cabling
TileCabling instance.
Definition: TileDigitsMaker.h:166
TileDigitsMaker::m_doDigiTruth
Gaudi::Property< bool > m_doDigiTruth
Definition: TileDigitsMaker.h:154
TileDigitsMaker::m_f_ADCmax
float m_f_ADCmax
ADC saturation value.
Definition: TileDigitsMaker.h:173
TileDigitsMaker::m_maskBadChannels
Gaudi::Property< bool > m_maskBadChannels
Definition: TileDigitsMaker.h:151
TileDigitsMaker::m_digitsContainer_DigiHSTruthKey
SG::WriteHandleKey< TileDigitsContainer > m_digitsContainer_DigiHSTruthKey
Definition: TileDigitsMaker.h:124
TileSampleNoise
Condition object to keep and provide Tile sample noise.
Definition: TileSampleNoise.h:18
TileDigitsMaker::m_emScaleKey
SG::ReadCondHandleKey< TileEMScale > m_emScaleKey
Name of TileEMScale in condition store.
Definition: TileDigitsMaker.h:215
TileDigitsMaker::m_filterThreshold
Gaudi::Property< double > m_filterThreshold
Definition: TileDigitsMaker.h:130
TileDigitsMaker::execute
virtual StatusCode execute(const EventContext &ctx) const override
execute method
Definition: TileDigitsMaker.cxx:262
TileDigitsMaker::m_timeStepLo
double m_timeStepLo
Time step in low gain pulse shape: 25.0 / nBinsPerXLo.
Definition: TileDigitsMaker.h:194
TileDigitsMaker::m_filterThresholdMBTS
Gaudi::Property< double > m_filterThresholdMBTS
Definition: TileDigitsMaker.h:133
TileDigitsMaker::m_filteredDigitsContainerKey
SG::WriteHandleKey< TileDigitsContainer > m_filteredDigitsContainerKey
Definition: TileDigitsMaker.h:127
TileDigitsMaker::m_tileNoise
bool m_tileNoise
If true => generate noise in TileDigits.
Definition: TileDigitsMaker.h:178
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
TileDigitsMaker::m_f_ADCmaxHG
float m_f_ADCmaxHG
ADC saturation value - 0.5.
Definition: TileDigitsMaker.h:174
TileDigitsMaker::m_sampleNoiseKey
SG::ReadCondHandleKey< TileSampleNoise > m_sampleNoiseKey
Name of TileSampleNoise in condition store.
Definition: TileDigitsMaker.h:209
TileDigitsMaker::m_cablingSvc
ServiceHandle< TileCablingSvc > m_cablingSvc
Name of Tile cabling service.
Definition: TileDigitsMaker.h:199
TileDigitsMaker::m_samplingFractionKey
SG::ReadCondHandleKey< TileSamplingFraction > m_samplingFractionKey
Name of TileSamplingFraction in condition store.
Definition: TileDigitsMaker.h:227
TileDigitsMaker::m_mergeSvc
ServiceHandle< PileUpMergeSvc > m_mergeSvc
Definition: TileDigitsMaker.h:160
TileInfo
Definition: TileInfo.h:49
TileDigitsMaker::m_digitsContainerKey
SG::WriteHandleKey< TileDigitsContainer > m_digitsContainerKey
Definition: TileDigitsMaker.h:121
SG::ReadHandleKey< TileHitContainer >
TileHitCollection
Definition: TileHitCollection.h:12
TileDigitsMaker::m_nSamples
int m_nSamples
Number of time slices for each channel.
Definition: TileDigitsMaker.h:170
HWIdentifier
Definition: HWIdentifier.h:13
TileDigitsMaker::m_hitContainer_DigiHSTruthKey
SG::ReadHandleKey< TileHitContainer > m_hitContainer_DigiHSTruthKey
Definition: TileDigitsMaker.h:112
TileDigitsMaker::m_tileTBID
const TileTBID * m_tileTBID
Definition: TileDigitsMaker.h:163
TileDigitsMaker::m_useCoolPulseShapes
Gaudi::Property< bool > m_useCoolPulseShapes
Definition: TileDigitsMaker.h:148
Example_ReadSampleNoise.drawer
drawer
Definition: Example_ReadSampleNoise.py:39
TileDigitsMaker::m_tileInfo
const TileInfo * m_tileInfo
Definition: TileDigitsMaker.h:165
TileDigitsMaker::m_nShapeHi
int m_nShapeHi
Number of bins in high gain pulse shape.
Definition: TileDigitsMaker.h:185
PileUpMergeSvc
the preferred mechanism to access information from the different event stores in a pileup job.
Definition: PileUpMergeSvc.h:58
TileDigitsMaker::~TileDigitsMaker
virtual ~TileDigitsMaker()=default
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
TileDigitsMaker::m_nBinsPerXLo
int m_nBinsPerXLo
Number of bins per bunch crossing in low gain pulse shape.
Definition: TileDigitsMaker.h:192
TileHWID
Helper class for TileCal online (hardware) identifiers.
Definition: TileHWID.h:49
TileDQstatus
Class that holds Data Quality fragment information and provides functions to extract the data quality...
Definition: TileDQstatus.h:49
TileDigitsMaker::finalize
virtual StatusCode finalize() override
finalize method
Definition: TileDigitsMaker.cxx:1088
TileDigitsMaker::m_binTime0Lo
int m_binTime0Lo
Index of time=0 bin for low gain pulse shape.
Definition: TileDigitsMaker.h:193
TileDigitsMaker::m_tileThresh
bool m_tileThresh
If true => apply threshold to Digits.
Definition: TileDigitsMaker.h:180
AthReentrantAlgorithm::AthReentrantAlgorithm
AthReentrantAlgorithm()
Default constructor:
SG::WriteHandleKey< TileDigitsContainer >
TileDigitsMaker::overlayBackgroundDigits
StatusCode overlayBackgroundDigits(const TileDigitsCollection *bkgDigitCollection, const TileHitCollection *hitCollection, std::vector< std::vector< double >> &drawerBufferLo, std::vector< std::vector< double >> &drawerBufferHi, std::vector< int > &igain, int ros, int drawer, int drawerIdx, std::vector< int > &over_gain, const TileEMScale *emScale, const TileSampleNoise *sampleNoise, const TileDQstatus *dqStatus, const TileBadChannels *badChannels) const
Definition: TileDigitsMaker.cxx:1246
TileDigitsMaker::m_binTime0Hi
int m_binTime0Hi
Index of time=0 bin for high gain pulse shape.
Definition: TileDigitsMaker.h:187
TileSamplingFraction
Condition object to keep and provide Tile Calorimeter sampling fraction and number of photoelectrons.
Definition: TileSamplingFraction.h:16
TileDigitsMaker::m_tileThreshLo
double m_tileThreshLo
Actual threshold value for low gain.
Definition: TileDigitsMaker.h:182
TileSamplingFraction.h
TileID
Helper class for TileCal offline identifiers.
Definition: TileID.h:68
TileDigitsContainer.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileDigitsMaker::m_badChannelsKey
SG::ReadCondHandleKey< TileBadChannels > m_badChannelsKey
Name of TileBadChannels in condition store.
Definition: TileDigitsMaker.h:233
TileDigitsMaker::m_nBinsPerXHi
int m_nBinsPerXHi
Number of bins per bunch crossing in high gain pulse shape.
Definition: TileDigitsMaker.h:186
WriteCellNoiseToCool.igain
igain
Definition: WriteCellNoiseToCool.py:338
TileDigitsMaker::m_tileCoherNoise
bool m_tileCoherNoise
If true => generate coherent noise in TileDigits.
Definition: TileDigitsMaker.h:179
TileDigitsMaker::m_i_ADCmax
int m_i_ADCmax
ADC saturation value.
Definition: TileDigitsMaker.h:172
maskDeadModules.ros
ros
Definition: maskDeadModules.py:35
TileCablingService
Definition: TileCablingService.h:23
TileDQstatus.h
Information produced by TileDQstatusAlg (used to be done by TileBeamInfoProvider).
TileDigitsMaker::m_randomStreamName
Gaudi::Property< std::string > m_randomStreamName
Random Stream Name.
Definition: TileDigitsMaker.h:204
TileDigitsMaker::m_calibRun
Gaudi::Property< bool > m_calibRun
Definition: TileDigitsMaker.h:142
ReadCondHandleKey.h
AthReentrantAlgorithm.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
TileDigitsMaker::m_digitShapeHi
std::vector< double > m_digitShapeHi
High gain pulse shape.
Definition: TileDigitsMaker.h:184
TileDigitsMaker::m_tileID
const TileID * m_tileID
Definition: TileDigitsMaker.h:162
TileDigitsCollection
Definition: TileDigitsCollection.h:18
TileDigitsMaker::m_inputDigitContainerName
std::string m_inputDigitContainerName
Definition: TileDigitsMaker.h:119
TileBadChannels
Condition object to keep Tile channel and ADC status.
Definition: TileBadChannels.h:24
TileDigitsMaker::m_iTrig
int m_iTrig
Index of the triggering time slice.
Definition: TileDigitsMaker.h:171
TileDigitsMaker::m_allChannels
Gaudi::Property< int > m_allChannels
Definition: TileDigitsMaker.h:157
TileDigitsMaker::m_tileThreshHi
double m_tileThreshHi
Actual threshold value for high gain.
Definition: TileDigitsMaker.h:181
TileDigitsMaker::m_rndmEvtOverlay
Gaudi::Property< bool > m_rndmEvtOverlay
Definition: TileDigitsMaker.h:145
Units.h
Wrapper to avoid constant divisions when using units.
TileDigitsMaker::m_inputDigitContainerKey
SG::ReadHandleKey< TileDigitsContainer > m_inputDigitContainerKey
Definition: TileDigitsMaker.h:118
TileHitContainer.h
TileDigitsMaker::fillDigitCollection
StatusCode fillDigitCollection(const TileHitCollection *hitCollection, std::vector< std::vector< double >> &drawerBufferLo, std::vector< std::vector< double >> &drawerBufferHi, std::vector< int > &igain, std::vector< int > &overgain, std::vector< double > &ech_int, std::vector< bool > &signal_in_channel, const TileEMScale *emScale, const TileSamplingFraction *samplingFraction, const TilePulse *pulse) const
Definition: TileDigitsMaker.cxx:1094
SG::ReadCondHandleKey< TileSampleNoise >
TileDigitsMaker::m_hitContainerKey
SG::ReadHandleKey< TileHitContainer > m_hitContainerKey
Definition: TileDigitsMaker.h:109
TileSampleNoise.h
TileDigitsMaker::m_onlyUseContainerName
Gaudi::Property< bool > m_onlyUseContainerName
Definition: TileDigitsMaker.h:115
TileDigitsMaker::m_pulseShapeKey
SG::ReadCondHandleKey< TilePulse > m_pulseShapeKey
Name of TilePulseShape in condition store.
Definition: TileDigitsMaker.h:221
PileUpMergeSvc.h
the preferred mechanism to access information from the different event stores in a pileup job.
TileDigitsMaker::m_DQstatusKey
SG::ReadHandleKey< TileDQstatus > m_DQstatusKey
Definition: TileDigitsMaker.h:236
TileDigitsMaker::m_ADCmaxMinusEps
float m_ADCmaxMinusEps
ADC saturation value - 0.01 or something small.
Definition: TileDigitsMaker.h:175
IAthRNGSvc
manage multiple RandomEngines in thread-safe way.
Definition: IAthRNGSvc.h:28
TileDigitsMaker::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileDigitsMaker.h:164
TileDigitsMaker::initialize
virtual StatusCode initialize() override
initialize method
Definition: TileDigitsMaker.cxx:66
TileDigitsMaker::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service to use.
Definition: TileDigitsMaker.h:202
TileTBID
Helper class for TileCal offline identifiers of ancillary testbeam detectors and MBTS.
Definition: Calorimeter/CaloIdentifier/CaloIdentifier/TileTBID.h:65
TilePulse
Condition object to keep and provide Tile pulse shape.
Definition: TilePulse.h:15
TileBadChannels.h
TileDigitsMaker::m_f_ADCmaskValue
float m_f_ADCmaskValue
indicates channels which were masked in background dataset
Definition: TileDigitsMaker.h:177
TileDigitsMaker::m_all_ids
std::vector< std::unique_ptr< HWIdentifier[]> > m_all_ids
Definition: TileDigitsMaker.h:168
TileDigitsMaker::m_nShapeLo
int m_nShapeLo
Number of bins in low gain pulse shape.
Definition: TileDigitsMaker.h:191
TileDigitsMaker::m_infoName
Gaudi::Property< std::string > m_infoName
Definition: TileDigitsMaker.h:136
TileDigitsMaker::m_timeStepHi
double m_timeStepHi
Time step in high gain pulse shape: 25.0 / nBinsPerXHi.
Definition: TileDigitsMaker.h:188
ServiceHandle< PileUpMergeSvc >
TileDigitsMaker::m_digitShapeLo
std::vector< double > m_digitShapeLo
Low gain pulse shape.
Definition: TileDigitsMaker.h:190