ATLAS Offline Software
Loading...
Searching...
No Matches
TileDigitsFromPulse.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//****************************************************************************
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//C++ STL includes
69#include <vector>
70#include <string>
71
72//Simulation includes
75class TilePulseShape;
76
77class TileHWID;
78class TileInfo;
79class IAthRNGSvc;
80
81class TH1F;
82class TFile;
83class TRandom3;
84
90public:
91 // Constructor
92 TileDigitsFromPulse(const std::string& name, ISvcLocator* pSvcLocator);
93
94 //Destructor
95 virtual ~TileDigitsFromPulse();
96
97 //Gaudi Hooks
98 virtual StatusCode initialize() override;
99 virtual StatusCode execute() override;
100 virtual StatusCode finalize() override;
101
102private:
103 std::string m_outputContainer;
104
106
107 // TileInfo
108 std::string m_infoName;
111
114
115 ToolHandle<TileCondToolNoiseSample> m_tileToolNoiseSample{this,
116 "TileCondToolNoiseSample", "TileCondToolNoiseSample", "Tile sample noise tool"};
117
119 "TileDigitsContainer", "TileDigitsCnt", "Output Tile digits container key"};
120
122 "TileRawChannelContainer", "TrueAmp", "Output Tile raw channel container key"};
123
124 ServiceHandle <IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", ""};
126 Gaudi::Property<std::string> m_randomStreamName{this, "RandomStreamName", "Tile_DigitsMaker", ""};
127
128
129 //Parameters
132 double m_inTimeAmp;
133 double m_ootAmp;
134 double m_itOffset;
135 double m_ootOffset;
136 double m_ped_HG;
137 double m_ped_LG;
139 double m_GNAmpOne;
141 double m_GNAmpTwo;
147 float m_gausC2C;
148 std::string m_itADistFileName;
149 std::string m_ootADistFileName;
155 std::string m_itADistHistName;
156 std::string m_ootADistHistName;
157
158 bool m_simQIE;
160
164 int m_nPul;
165 int m_nPul_eff{}; //Used for symetrization of PU in computation
166 std::vector<std::vector<std::vector<std::vector<float>>>> m_PUAmp; // Used to store PU amplitudes
167 bool m_PhaseII; //Use parameters of TilePhaseII if the option is set to true
168 bool m_bigain; //If true, save the two gains in the ntuples
169
170 bool m_simPUwPoisson; //If true, simulate PU overlapping amplitudes n times, with n being generated with a poissonian distribution
171 int m_avgMuForPU; //Mean of the poissonian distribution to generate the number of interactions per bunch crossing for PU simulation
173
174 //Members for simulator
178
179 //Histograms for distribution
180 TH1F* m_ootDist;
181 TH1F* m_itDist;
182 TFile* m_itFile;
183 TFile* m_ootFile;
188 std::vector<std::vector<TH1F*>> m_pileup_AmpDists;
189
190 //Internal methods
191 bool makeDist(TFile*& file, TH1F*& hist, const std::string& fileName, const std::string& histName="h_Eopt_hi");
192 bool makeDist(TFile*& file, std::vector<std::vector<TH1F*>>& hists, const std::string& fileName);
193
194 void addPileUp(double &n_inTimeAmp, int gain, int ros, int drawer, int channel);
195 void addPileUpSample(int gain, int ros, int drawer, int channel);
196
197 float m_sample_tru = 0;
198
199 std::unique_ptr<TRandom3> m_random;
200};
201
202#endif // TILESIMALGS_TILEDIGITSFROMPULSE_H
203
Property holding a SG store/key/clid from which a WriteHandle is made.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
manage multiple RandomEngines in thread-safe way.
Definition IAthRNGSvc.h:28
Property holding a SG store/key/clid from which a WriteHandle is made.
TFile * m_pileup_AmpDistFile
File containing amplitude histograms for PU pulses.
bool m_useOotADist
Set to TRUE in order to use a distribution for the out-of-time amplitude instead of a constant value.
TFile * m_itFile
File that holds the distribution of in-time amplitudes.
SG::WriteHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
std::string m_itADistHistName
Name of histogram for in-time amplitude distribution.
std::string m_itADistFileName
Filename of file to use for amplitude distribution of in-time pulses.
bool m_chanNoise
Add channel specific noise.
const TileHWID * m_tileHWID
virtual StatusCode initialize() override
initialize method
virtual StatusCode finalize() override
finalize method
std::string m_outputContainer
Name of the output TileDigitsContainer.
double m_ootAmp
Amplitude of out-of-time pulse.
std::string m_ootADistFileName
Filename of file to use for amplitude distribution of out-of-time pulses.
TH1F * m_ootDist
Histogram to hold the distribution of out-of-time amplitudes.
std::string m_ootADistHistName
Name of histogram for out-of-time amplitude distribution.
bool m_simPulseChain
Simulate continous output of readout for HL-LHC paradigm.
TFile * m_ootFile
File that holds the distribution of out-of-time amplitudes.
TileFragHash::TYPE m_rChType
Type of TileRawChannels (Digitizar, OF1, OF2, Fit, etc.)(see TileFragHash.h)
TileSampleBuffer * m_buf
Buffer class to hold generated pulses.
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
TFile * m_ootOffsetFile
File that holds the distribution of out-of-time timing offsets.
virtual StatusCode execute() override
execute method
double m_itOffset
In-time pulse offset from nominal time.
void addPileUpSample(int gain, int ros, int drawer, int channel)
Fill only a BC with pile-up amplitude.
std::vector< std::vector< std::vector< std::vector< float > > > > m_PUAmp
std::unique_ptr< TRandom3 > m_random
double m_ped_HG
Pedestal value for HG if specific channel pedestal is not used.
double m_GNAmpTwo
Amplitude of second gaussian of double gaussian noise.
float m_gausC2C
RMS for the in-time pulse offset (channel-to-channel phase variation)
std::string m_ootOffsetFileName
File name for offset timing distribution histogram.
bool m_useOffsetHisto
Internally used to keep track of wether a histogram has been opened or not.
TileRawChannelUnit::UNIT m_rChUnit
Units used for the TileRawChannels (ADC, pCb, etc.)(see TileInfo.h)
const TileInfo * m_tileInfo
int m_nPul
number of pileup pulses
double m_GNAmpOne
Amplitude of first gaussian of double gaussian noise.
double m_ootOffset
Out-of-time pulse offset from nominal time.
TH1F * m_ootOffsetDist
Histogram to hold the distribution of out-of-time timing offsets.
SG::WriteHandleKey< TileDigitsContainer > m_digitsContainerKey
TilePulseShape * m_ps[2]
Class for defining pulse.
double m_GNSigmaTwo
Standard deviation of second gaussian of double gaussian noise.
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service to use.
TileSampleGenerator * m_tsg
Pulse generating class.
double m_itAPulseProb
Probability to add an in-time pulse.
bool m_simQIE
Raw PMT pulses are generated if the option is set to true.
double m_imperfectionMean
Mean value of pulse shape broadening.
Gaudi::Property< std::string > m_randomStreamName
Random Stream Name.
std::string m_pileupAmpDistFileName
Filename for PU amplitude distribution histograms.
bool makeDist(TFile *&file, TH1F *&hist, const std::string &fileName, const std::string &histName="h_Eopt_hi")
Method to read distribution from file.
TH1F * m_itDist
Histogram to hold the distribution of in-time amplitudes.
double m_GNSigmaOne
Standard deviation of first gaussian of double gaussian noise.
int m_AmpDistLowLim
Set all bins to the left of this bin to 0 in the amplitude distribution histograms.
double m_ped_LG
Pedestal value for LG if specific channel pedestal is not used.
double m_imperfectionRms
RMS of pulse shape broadening.
float m_pileUpFraction
Probability that an out-of-time component will be added.
TileDigitsFromPulse(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< std::vector< TH1F * > > m_pileup_AmpDists
Matrix of PU amplitude distribution histograms (PU per partition and channel)
bool m_useItADist
Set to TRUE in order to use a distribution for the in-time amplitude instead of a constant value.
bool m_chanPed
Use channel specific pedestal value if true.
void addPileUp(double &n_inTimeAmp, int gain, int ros, int drawer, int channel)
Fill vector with pile-up amplitudes.
bool m_gaussNoise
Set to TRUE in order to create noise from double gaussian.
std::string m_ootOffsetHistName
Name of the histogram for timing offset distribution.
int m_nSamples
number of read out samples
int m_BunchSpacing
Time between pulses in ms 25, 50 or 75.
double m_inTimeAmp
Amplitude of in-time pulse.
TYPE
initialize
Helper class for TileCal online (hardware) identifiers.
Definition TileHWID.h:49
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
TFile * file