49#ifndef TILESIMALGS_TILEDIGITSFROMPULSE_H
50#define TILESIMALGS_TILEDIGITSFROMPULSE_H
62#include "GaudiKernel/ServiceHandle.h"
63#include "GaudiKernel/Algorithm.h"
64#include "GaudiKernel/ToolHandle.h"
66#include "CLHEP/Random/RandomEngine.h"
72#include "Gaudi/Property.h"
101 virtual StatusCode
execute(
const EventContext& ctx)
override;
102 virtual StatusCode
finalize()
override;
110 Gaudi::Property<std::string>
m_infoName{
this,
"TileInfoName",
"TileInfo"};
118 "TileCondToolNoiseSample",
"TileCondToolNoiseSample",
"Tile sample noise tool"};
121 "TileDigitsContainer",
"TileDigitsCnt",
"Output Tile digits container key"};
124 "TileRawChannelContainer",
"TrueAmp",
"Output Tile raw channel container key"};
126 ServiceHandle <IAthRNGSvc>
m_rndmSvc{
this,
"RndmSvc",
"AthRNGSvc",
""};
135 Gaudi::Property<double>
m_ootAmp{
this,
"OutOfTimeAmp", 150.};
136 Gaudi::Property<double>
m_itOffset{
this,
"InTimeOffset", 0.};
137 Gaudi::Property<double>
m_ootOffset{
this,
"OutOfTimeOffset", 50.};
138 Gaudi::Property<double>
m_ped_HG{
this,
"PedestalValueHG", 100};
139 Gaudi::Property<double>
m_ped_LG{
this,
"PedestalValueLG", 100};
141 Gaudi::Property<double>
m_GNAmpOne{
this,
"GaussNoiseAmpOne", 1 / 1.039};
143 Gaudi::Property<double>
m_GNAmpTwo{
this,
"GaussNoiseAmpTwo", 0.039};
149 Gaudi::Property<float>
m_gausC2C{
this,
"GaussianC2CPhaseVariation", 0};
151 this,
"GaussianPulseTimingVariation", 0.0
155 Gaudi::Property<bool>
m_chanPed{
this,
"ChannelSpecificPedestal",
false};
156 Gaudi::Property<bool>
m_chanNoise{
this,
"ChannelSpecificNoise",
false};
160 Gaudi::Property<std::string>
m_itADistHistName{
this,
"InTimeAmpDistHistogramName",
"h_Eopt_hi"};
163 Gaudi::Property<bool>
m_simQIE{
this,
"SimulateQIE",
false};
166 this,
"UseGainDependentUndershoot",
false
169 this,
"UseRecursiveUndershoot",
false
172 Gaudi::Property<int>
m_seed{
this,
"RandomSeed", 4357};
175 Gaudi::Property<int>
m_nPul{
this,
"NPulses", 21};
177 std::vector<std::vector<std::vector<std::vector<float>>>>
m_PUAmp;
188 Gaudi::Property<bool>
m_PhaseII{
this,
"TilePhaseII",
false};
189 Gaudi::Property<bool>
m_bigain{
this,
"Bigain",
false};
192 Gaudi::Property<int>
m_avgMuForPU{
this,
"AvgMuForPileUpSimulation", 40};
212 bool makeDist(TFile*&
file, TH1F*& hist,
const std::string& fileName,
const std::string& histName=
"h_Eopt_hi");
213 bool makeDist(TFile*&
file, std::vector<std::vector<TH1F*>>& hists,
const std::string& fileName);
215 void addPileUp(
double &n_inTimeAmp,
double ootAmp,
int gain,
int ros,
int drawer,
int channel);
Property holding a SG store/key/clid from which a WriteHandle is made.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
manage multiple RandomEngines in thread-safe way.
Property holding a SG store/key/clid from which a WriteHandle is made.
Gaudi::Property< float > m_gausC2C
RMS for the in-time pulse offset (channel-to-channel phase variation).
TFile * m_pileup_AmpDistFile
File containing amplitude histograms for PU pulses.
Gaudi::Property< double > m_ped_HG
Pedestal value for HG if specific channel pedestal is not used.
TFile * m_itFile
File that holds the distribution of in-time amplitudes.
Gaudi::Property< bool > m_useRecursiveUndershoot
Recursively accumulate the long undershoot in continuous readout.
Gaudi::Property< bool > m_useGainDependentUndershoot
Use gain-dependent analytical undershoot parameters.
SG::WriteHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
Gaudi::Property< double > m_ootOffset
Out-of-time pulse offset from nominal time.
Gaudi::Property< std::string > m_ootADistFileName
Filename of file to use for amplitude distribution of out-of-time pulses.
void addPileUp(double &n_inTimeAmp, double ootAmp, int gain, int ros, int drawer, int channel)
Fill vector with pile-up amplitudes.
const TileHWID * m_tileHWID
std::array< int, 2 > m_firstAccumulatedIndex
Gaudi::Property< double > m_ped_LG
Pedestal value for LG if specific channel pedestal is not used.
virtual StatusCode initialize() override
initialize method
virtual StatusCode finalize() override
finalize method
Gaudi::Property< float > m_pileUpFraction
Probability that an out-of-time component will be added.
Gaudi::Property< std::string > m_infoName
std::string m_outputContainer
Name of the output TileDigitsContainer.
Gaudi::Property< bool > m_useOotADist
Set to TRUE in order to use a distribution for the out-of-time amplitude instead of a constant value.
Gaudi::Property< double > m_itOffset
In-time pulse offset from nominal time.
TH1F * m_ootDist
Histogram to hold the distribution of out-of-time amplitudes.
Gaudi::Property< bool > m_chanPed
Use channel specific pedestal value if true.
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
virtual StatusCode execute(const EventContext &ctx) override
execute method
TFile * m_ootOffsetFile
File that holds the distribution of out-of-time timing offsets.
std::vector< std::vector< std::vector< std::vector< double > > > > m_pulseTimeOffsets
Gaudi::Property< double > m_GNSigmaOne
Standard deviation of first gaussian of double gaussian noise.
Gaudi::Property< std::string > m_itADistHistName
Name of histogram for in-time amplitude distribution.
Gaudi::Property< std::string > m_pileupAmpDistFileName
Filename for PU amplitude distribution histograms.
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
Gaudi::Property< std::string > m_ootOffsetFileName
File name for offset timing distribution histogram.
std::unique_ptr< TRandom3 > m_random
Gaudi::Property< int > m_nPul
number of pileup pulses
Gaudi::Property< double > m_imperfectionMean
Mean value of pulse shape broadening.
Gaudi::Property< double > m_GNSigmaTwo
Standard deviation of second gaussian of double gaussian noise.
Gaudi::Property< int > m_seed
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
std::vector< std::vector< std::vector< std::array< double, 2 > > > > m_accumulatedUndershoot
Gaudi::Property< int > m_BunchSpacing
Time between pulses in ms 25, 50 or 75.
double generatePulseTimeOffset()
Generate a pulse arrival-time variation in ns.
TH1F * m_ootOffsetDist
Histogram to hold the distribution of out-of-time timing offsets.
SG::WriteHandleKey< TileDigitsContainer > m_digitsContainerKey
virtual ~TileDigitsFromPulse()
Gaudi::Property< bool > m_gaussNoise
Set to TRUE in order to create noise from double gaussian.
Gaudi::Property< std::string > m_itADistFileName
Filename of file to use for amplitude distribution of in-time pulses.
Gaudi::Property< bool > m_bigain
Gaudi::Property< double > m_itAPulseProb
Probability to add an in-time pulse.
Gaudi::Property< double > m_GNAmpOne
Amplitude of first gaussian of double gaussian noise.
TilePulseShape * m_ps[2]
Class for defining pulse.
Gaudi::Property< double > m_imperfectionRms
RMS of pulse shape broadening.
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service to use.
Gaudi::Property< double > m_gaussianPulseTimingVariation
RMS of individual pulse arrival-time variations in ns.
Gaudi::Property< int > m_avgMuForPU
TileSampleGenerator * m_tsg
Pulse generating class.
Gaudi::Property< int > m_nSamples
number of read out samples
Gaudi::Property< std::string > m_randomStreamName
Random Stream Name.
Gaudi::Property< double > m_GNAmpTwo
Amplitude of second gaussian of double gaussian noise.
Gaudi::Property< int > m_AmpDistLowLim
Set all bins to the left of this bin to 0 in the 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.
std::array< double, 2 > m_tailAtAccumulation
TH1F * m_itDist
Histogram to hold the distribution of in-time amplitudes.
Gaudi::Property< std::string > m_ootOffsetHistName
Name of the histogram for timing offset distribution.
Gaudi::Property< bool > m_chanNoise
Add channel specific noise.
Gaudi::Property< bool > m_simPulseChain
Simulate continous output of readout for HL-LHC paradigm.
Gaudi::Property< bool > m_useItADist
Set to TRUE in order to use a distribution for the in-time amplitude instead of a constant value.
Gaudi::Property< bool > m_PhaseII
std::array< int, 2 > m_firstRelevantIndex
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).
std::array< double, 2 > m_tailDecayPerBC
Gaudi::Property< bool > m_simQIE
Raw PMT pulses are generated if the option is set to true.
Gaudi::Property< bool > m_simPUwPoisson
Gaudi::Property< double > m_inTimeAmp
Amplitude of in-time pulse.
Gaudi::Property< double > m_ootAmp
Amplitude of out-of-time pulse.
Gaudi::Property< std::string > m_ootADistHistName
Name of histogram for out-of-time amplitude distribution.
Helper class for TileCal online (hardware) identifiers.
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)