ATLAS Offline Software
TileDigitsFromPulse.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 //****************************************************************************
6 // Filename : TileDigitsFromPulse.h
7 // Author : Simon Molander <simon.molander@cern.ch>
8 // Created : Feb 2013
9 //
10 // DESCRIPTION
11 //
12 // Create TileDigits from pulse simulator
13 //
14 // Properties (JobOption Parameters):
15 //
16 // OutputDigitsContainer string Name of container with TileDigits to write
17 // ImperfectionMean double Mean value of pulse shape broadening
18 // ImperfectionRMS double RMS of pulse shape broadening
19 // InTimeAmp double Amplitude of in-time pulse
20 // OutOfTimeAmp double Amplitude of out-of-time pulse
21 // InTimeOffset double In-time pulse offset from nominal time
22 // OutOfTimeOffset double Out-of-time pulse offset from nominal time
23 // UseGaussNoise bool Set to TRUE in order to create noise from double gaussian
24 // GaussNoiseAmpOne double Amplitude of first gaussian of double gaussian noise.
25 // GaussNoiseSigmaOne double Standard deviation of first gaussian of double gaussian noise.
26 // GaussNoiseAmpTwo double Amplitude of second gaussian of double gaussian noise.
27 // GaussNoiseSigmaTwo double Standard deviation of second gaussian of double gaussian noise.
28 // UseInTimeAmpDist bool Set to TRUE in order to use a distribution for the in-time amplitude instead of a const.
29 // UseOutOfTimeAmpDist bool Set to TRUE in order to use a distribution for the out-of-time amplitude instead of a const.
30 // InTimeAmpDistFileName string Filename of file to use for amplitude distribution of in-time pulses
31 // OutOfTimeAmpDistFileName string Filename of file to use for amplitude distribution of out-of-time pulses
32 // PileUpFraction float Probability that an out-of-time component will be added
33 // GaussianC2CPhaseVariation float RMS for the in-time pulse offset (channel-to-channel phase variation)
34 // ChannelSpecificPedestal bool Set to TRUE in order to use a channel specific value for the pedestal
35 // ChannelSpecificNoise bool Set to TRUE in order to add channel specific noise
36 // OutOfTimeOffsetHistogramFile string Filename of file containing histogram of pile-up timing distribution
37 // OutOfTimeOffsetHistogramName string name of the histogram to use for pile-up timing distribution
38 // AmpDistLowerLimit int Set all bins lower than this to zero. Default = 135.
39 // InTimeAmpDistHistogramName string Name of the histogram to use for in-time amplitude distribution
40 // OutOfTimeAmpDistHistogramName string Name of the histogram to use for out-of-time amplitude distribution
41 //
42 // BUGS:
43 //
44 // History:
45 //
46 //
47 //****************************************************************************
48 
49 #ifndef TILESIMALGS_TILEDIGITSFROMPULSE_H
50 #define TILESIMALGS_TILEDIGITSFROMPULSE_H
51 
52 // Tile includes
56 
57 // Athena includes
60 
61 // Gaudi includes
62 #include "GaudiKernel/ServiceHandle.h"
63 #include "GaudiKernel/Algorithm.h"
64 #include "GaudiKernel/ToolHandle.h"
65 
66 #include "CLHEP/Random/RandomEngine.h"
67 
68 #include <string>
69 
70 //Simulation includes
72 class TileSampleBuffer;
73 class TilePulseShape;
74 
75 class TileHWID;
76 class TileInfo;
77 class IAthRNGSvc;
78 
79 class TH1F;
80 class TFile;
81 
87 public:
88  // Constructor
89  TileDigitsFromPulse(const std::string& name, ISvcLocator* pSvcLocator);
90 
91  //Destructor
92  virtual ~TileDigitsFromPulse();
93 
94  //Gaudi Hooks
95  virtual StatusCode initialize() override;
96  virtual StatusCode execute() override;
97  virtual StatusCode finalize() override;
98 
99 private:
100  std::string m_outputContainer;
101 
103 
104  // TileInfo
105  std::string m_infoName;
108 
111 
112  ToolHandle<TileCondToolNoiseSample> m_tileToolNoiseSample{this,
113  "TileCondToolNoiseSample", "TileCondToolNoiseSample", "Tile sample noise tool"};
114 
116  "TileDigitsContainer", "TileDigitsCnt", "Output Tile digits container key"};
117 
119  "TileRawChannelContainer", "TrueAmp", "Output Tile raw channel container key"};
120 
121  ServiceHandle <IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""};
122  Gaudi::Property<std::string> m_randomStreamName{this, "RandomStreamName", "Tile_DigitsMaker", ""};
124 
125 
126  //Parameters
129  double m_inTimeAmp;
130  double m_ootAmp;
131  double m_itOffset;
132  double m_ootOffset;
133  double m_ped_HG;
134  double m_ped_LG;
136  double m_GNAmpOne;
137  double m_GNSigmaOne;
138  double m_GNAmpTwo;
139  double m_GNSigmaTwo;
143  float m_gausC2C;
144  std::string m_itADistFileName;
145  std::string m_ootADistFileName;
146  bool m_chanPed;
147  bool m_chanNoise;
148  std::string m_ootOffsetFileName;
149  std::string m_ootOffsetHistName;
151  std::string m_itADistHistName;
152  std::string m_ootADistHistName;
153 
154  bool m_simQIE;
155 
156  int m_seed;
159  int m_nPul;
160  int m_nPul_eff; //Used for symetrization of PU in computation
161  std::vector<float> m_PUAmp;
162  bool m_PhaseII; //Use parameters of TilePhaseII if the option is set to true
163  bool m_bigain; //If true, save the two gains in the ntuples
164 
165  bool m_simPUwPoisson; //If true, simulate PU overlapping amplitudes n times, with n being generated with a poissonian distribution
166  int m_avgMuForPU; //Mean of the poissonian distribution to generate the number of interactions per bunch crossing for PU simulation
168 
169  //Members for simulator
173 
174  //Histograms for distribution
177  TFile* m_itFile;
178  TFile* m_ootFile;
183  std::vector<std::vector<TH1F*>> m_pileup_AmpDists;
184 
185  //Internal methods
186  bool makeDist(TFile*& file, TH1F*& hist, const std::string& fileName, const std::string& histName="h_Eopt_hi");
187  bool makeDist(TFile*& file, std::vector<std::vector<TH1F*>>& hists, const std::string& fileName);
188 
189 };
190 
191 #endif // TILESIMALGS_TILEDIGITSFROMPULSE_H
192 
TileDigitsFromPulse::m_ped_LG
double m_ped_LG
Pedestal value for LG if specific channel pedestal is not used.
Definition: TileDigitsFromPulse.h:134
TileDigitsFromPulse::makeDist
bool makeDist(TFile *&file, TH1F *&hist, const std::string &fileName, const std::string &histName="h_Eopt_hi")
Method to read distribution from file.
Definition: TileDigitsFromPulse.cxx:571
TileDigitsFromPulse::finalize
virtual StatusCode finalize() override
finalize method
Definition: TileDigitsFromPulse.cxx:555
TileDigitsFromPulse::m_buf
TileSampleBuffer * m_buf
Buffer class to hold generated pulses.
Definition: TileDigitsFromPulse.h:171
TileDigitsFromPulse::m_i_ADCmax
int m_i_ADCmax
Definition: TileDigitsFromPulse.h:107
TileDigitsFromPulse::m_GNSigmaOne
double m_GNSigmaOne
Standard deviation of first gaussian of double gaussian noise.
Definition: TileDigitsFromPulse.h:137
TileDigitsFromPulse::m_tsg
TileSampleGenerator * m_tsg
Pulse generating class.
Definition: TileDigitsFromPulse.h:172
TileDigitsFromPulse::m_nPul
int m_nPul
number of pileup pulses
Definition: TileDigitsFromPulse.h:159
TileDigitsFromPulse::m_ps
TilePulseShape * m_ps[2]
Class for defining pulse.
Definition: TileDigitsFromPulse.h:170
AddEmptyComponent.histName
string histName
Definition: AddEmptyComponent.py:64
TileDigitsFromPulse
This algorithm creates TileDigits from pulses provided by pulse simulator.
Definition: TileDigitsFromPulse.h:86
TileDigitsFromPulse::m_pileup_AmpDists
std::vector< std::vector< TH1F * > > m_pileup_AmpDists
Matrix of PU amplitude distribution histograms (PU per partition and channel)
Definition: TileDigitsFromPulse.h:183
plotmaker.hist
hist
Definition: plotmaker.py:148
TileDigitsFromPulse::m_tileHWID
const TileHWID * m_tileHWID
Definition: TileDigitsFromPulse.h:102
TileFragHash::TYPE
TYPE
initialize
Definition: TileFragHash.h:33
TileDigitsFromPulse::m_simQIE
bool m_simQIE
Raw PMT pulses are generated if the option is set to true.
Definition: TileDigitsFromPulse.h:154
TileDigitsFromPulse::m_pileup_AmpDistFile
TFile * m_pileup_AmpDistFile
File containing amplitude histograms for PU pulses.
Definition: TileDigitsFromPulse.h:182
TileDigitsFromPulse::m_itADistHistName
std::string m_itADistHistName
Name of histogram for in-time amplitude distribution.
Definition: TileDigitsFromPulse.h:151
TileDigitsFromPulse::m_ootOffset
double m_ootOffset
Out-of-time pulse offset from nominal time.
Definition: TileDigitsFromPulse.h:132
TileDigitsFromPulse::m_useOffsetHisto
bool m_useOffsetHisto
Internally used to keep track of wether a histogram has been opened or not.
Definition: TileDigitsFromPulse.h:181
TilePulseShape
Definition: TilePulseShape.h:17
TileDigitsFromPulse::m_PUAmp
std::vector< float > m_PUAmp
Definition: TileDigitsFromPulse.h:161
TileDigitsFromPulse::m_imperfectionRms
double m_imperfectionRms
RMS of pulse shape broadening.
Definition: TileDigitsFromPulse.h:128
TileSampleBuffer
Definition: TileSampleBuffer.h:14
TileDigitsFromPulse::m_nPul_eff
int m_nPul_eff
Definition: TileDigitsFromPulse.h:160
TileInfo
Definition: TileInfo.h:49
TileDigitsFromPulse::m_chanPed
bool m_chanPed
Use channel specific pedestal value if true.
Definition: TileDigitsFromPulse.h:146
TileDigitsFromPulse::m_ootOffsetHistName
std::string m_ootOffsetHistName
Name of the histogram for timing offset distribution.
Definition: TileDigitsFromPulse.h:149
TileDigitsFromPulse::m_infoName
std::string m_infoName
Definition: TileDigitsFromPulse.h:105
TileDigitsFromPulse::m_ootAmp
double m_ootAmp
Amplitude of out-of-time pulse.
Definition: TileDigitsFromPulse.h:130
AthAlgorithm.h
TileRawChannelContainer.h
TileHWID
Helper class for TileCal online (hardware) identifiers.
Definition: TileHWID.h:49
TileDigitsFromPulse::m_nSamples
int m_nSamples
number of read out samples
Definition: TileDigitsFromPulse.h:158
TileDigitsFromPulse::m_useItADist
bool m_useItADist
Set to TRUE in order to use a distribution for the in-time amplitude instead of a constant value.
Definition: TileDigitsFromPulse.h:140
TileDigitsFromPulse::m_chanNoise
bool m_chanNoise
Add channel specific noise.
Definition: TileDigitsFromPulse.h:147
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
TileCondToolNoiseSample.h
SG::WriteHandleKey< TileDigitsContainer >
TileDigitsFromPulse::m_outputContainer
std::string m_outputContainer
Name of the output TileDigitsContainer.
Definition: TileDigitsFromPulse.h:100
TileDigitsContainer.h
TileDigitsFromPulse::m_bigain
bool m_bigain
Definition: TileDigitsFromPulse.h:163
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TileDigitsFromPulse::m_itADistFileName
std::string m_itADistFileName
Filename of file to use for amplitude distribution of in-time pulses.
Definition: TileDigitsFromPulse.h:144
TileDigitsFromPulse::m_digitsContainerKey
SG::WriteHandleKey< TileDigitsContainer > m_digitsContainerKey
Definition: TileDigitsFromPulse.h:115
TileDigitsFromPulse::m_pileupAmpDistFileName
std::string m_pileupAmpDistFileName
Filename for PU amplitude distribution histograms.
Definition: TileDigitsFromPulse.h:167
file
TFile * file
Definition: tile_monitor.h:29
TileSampleGenerator
Definition: TileSampleGenerator.h:16
TileDigitsFromPulse::m_ootDist
TH1F * m_ootDist
Histogram to hold the distribution of out-of-time amplitudes.
Definition: TileDigitsFromPulse.h:175
TileDigitsFromPulse::m_ootOffsetFileName
std::string m_ootOffsetFileName
File name for offset timing distribution histogram.
Definition: TileDigitsFromPulse.h:148
MakeTH3DFromTH2Ds.hists
hists
Definition: MakeTH3DFromTH2Ds.py:72
TileDigitsFromPulse::m_tileInfo
const TileInfo * m_tileInfo
Definition: TileDigitsFromPulse.h:106
TileDigitsFromPulse::m_rndmSvc
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service to use.
Definition: TileDigitsFromPulse.h:121
TileRawChannelUnit::UNIT
UNIT
Definition: TileRawChannelUnit.h:16
TileDigitsFromPulse::m_itOffset
double m_itOffset
In-time pulse offset from nominal time.
Definition: TileDigitsFromPulse.h:131
AthAlgorithm
Definition: AthAlgorithm.h:47
TileDigitsFromPulse::m_imperfectionMean
double m_imperfectionMean
Mean value of pulse shape broadening.
Definition: TileDigitsFromPulse.h:127
TileDigitsFromPulse::m_useOotADist
bool m_useOotADist
Set to TRUE in order to use a distribution for the out-of-time amplitude instead of a constant value.
Definition: TileDigitsFromPulse.h:141
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
TileDigitsFromPulse::initialize
virtual StatusCode initialize() override
initialize method
Definition: TileDigitsFromPulse.cxx:146
TileDigitsFromPulse::m_BunchSpacing
int m_BunchSpacing
Time between pulses in ms 25, 50 or 75.
Definition: TileDigitsFromPulse.h:157
TileDigitsFromPulse::m_GNAmpTwo
double m_GNAmpTwo
Amplitude of second gaussian of double gaussian noise.
Definition: TileDigitsFromPulse.h:138
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TileDigitsFromPulse::m_ootOffsetDist
TH1F * m_ootOffsetDist
Histogram to hold the distribution of out-of-time timing offsets.
Definition: TileDigitsFromPulse.h:179
TileDigitsFromPulse::m_ootADistHistName
std::string m_ootADistHistName
Name of histogram for out-of-time amplitude distribution.
Definition: TileDigitsFromPulse.h:152
TileDigitsFromPulse::m_ootADistFileName
std::string m_ootADistFileName
Filename of file to use for amplitude distribution of out-of-time pulses.
Definition: TileDigitsFromPulse.h:145
TileDigitsFromPulse::m_simPUwPoisson
bool m_simPUwPoisson
Definition: TileDigitsFromPulse.h:165
TileDigitsFromPulse::m_gaussNoise
bool m_gaussNoise
Set to TRUE in order to create noise from double gaussian.
Definition: TileDigitsFromPulse.h:135
TileDigitsFromPulse::m_GNSigmaTwo
double m_GNSigmaTwo
Standard deviation of second gaussian of double gaussian noise.
Definition: TileDigitsFromPulse.h:139
TileDigitsFromPulse::TileDigitsFromPulse
TileDigitsFromPulse(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TileDigitsFromPulse.cxx:61
TileDigitsFromPulse::m_seed
int m_seed
Definition: TileDigitsFromPulse.h:156
TileDigitsFromPulse::m_ped_HG
double m_ped_HG
Pedestal value for HG if specific channel pedestal is not used.
Definition: TileDigitsFromPulse.h:133
TileDigitsFromPulse::m_AmpDistLowLim
int m_AmpDistLowLim
Set all bins to the left of this bin to 0 in the amplitude distribution histograms.
Definition: TileDigitsFromPulse.h:150
TileDigitsFromPulse::~TileDigitsFromPulse
virtual ~TileDigitsFromPulse()
Definition: TileDigitsFromPulse.cxx:132
TileDigitsFromPulse::m_gausC2C
float m_gausC2C
RMS for the in-time pulse offset (channel-to-channel phase variation)
Definition: TileDigitsFromPulse.h:143
TileDigitsFromPulse::m_PhaseII
bool m_PhaseII
Definition: TileDigitsFromPulse.h:162
TileDigitsFromPulse::m_tileToolNoiseSample
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
Definition: TileDigitsFromPulse.h:112
TileDigitsFromPulse::m_itFile
TFile * m_itFile
File that holds the distribution of in-time amplitudes.
Definition: TileDigitsFromPulse.h:177
TileDigitsFromPulse::m_pileUpFraction
float m_pileUpFraction
Probability that an out-of-time component will be added.
Definition: TileDigitsFromPulse.h:142
IAthRNGSvc
manage multiple RandomEngines in thread-safe way.
Definition: IAthRNGSvc.h:28
TileDigitsFromPulse::m_itDist
TH1F * m_itDist
Histogram to hold the distribution of in-time amplitudes.
Definition: TileDigitsFromPulse.h:176
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
TileDigitsFromPulse::m_GNAmpOne
double m_GNAmpOne
Amplitude of first gaussian of double gaussian noise.
Definition: TileDigitsFromPulse.h:136
TileDigitsFromPulse::m_rChUnit
TileRawChannelUnit::UNIT m_rChUnit
Units used for the TileRawChannels (ADC, pCb, etc.)(see TileInfo.h)
Definition: TileDigitsFromPulse.h:109
TileDigitsFromPulse::m_rChType
TileFragHash::TYPE m_rChType
Type of TileRawChannels (Digitizar, OF1, OF2, Fit, etc.)(see TileFragHash.h)
Definition: TileDigitsFromPulse.h:110
TileDigitsFromPulse::m_ootFile
TFile * m_ootFile
File that holds the distribution of out-of-time amplitudes.
Definition: TileDigitsFromPulse.h:178
TileDigitsFromPulse::m_rawChannelContainerKey
SG::WriteHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
Definition: TileDigitsFromPulse.h:118
TileDigitsFromPulse::m_inTimeAmp
double m_inTimeAmp
Amplitude of in-time pulse.
Definition: TileDigitsFromPulse.h:129
TileDigitsFromPulse::m_avgMuForPU
int m_avgMuForPU
Definition: TileDigitsFromPulse.h:166
TileDigitsFromPulse::m_randomStreamName
Gaudi::Property< std::string > m_randomStreamName
Random Stream Name.
Definition: TileDigitsFromPulse.h:123
TileDigitsFromPulse::execute
virtual StatusCode execute() override
execute method
Definition: TileDigitsFromPulse.cxx:252
ServiceHandle< IAthRNGSvc >
TileDigitsFromPulse::m_ootOffsetFile
TFile * m_ootOffsetFile
File that holds the distribution of out-of-time timing offsets.
Definition: TileDigitsFromPulse.h:180