 |
ATLAS Offline Software
|
Go to the documentation of this file.
41 #include <CLHEP/Random/Randomize.h>
42 #include <CLHEP/Units/SystemOfUnits.h>
55 using CLHEP::RandGaussQ;
56 using CLHEP::RandFlat;
175 ATH_MSG_FATAL(
"Could not find input file Distributions_small_h2000_177531_JetTauEtmiss.root");
176 return StatusCode::FAILURE;
180 return StatusCode::FAILURE;
190 ATH_MSG_FATAL(
"Could not find input file Distributions_MB_minbias_inelastic_lowjetphoton_e8314_e7400_s3508.root");
191 return StatusCode::FAILURE;
196 return StatusCode::FAILURE;
197 ATH_MSG_DEBUG(
"Made PU amp distributions for each partition and channel");
205 ATH_MSG_FATAL(
"Could not find input file Distributions_small_h2000_177531_ZeroBias.root");
206 return StatusCode::FAILURE;
210 return StatusCode::FAILURE;
233 ATH_MSG_FATAL(
"Could not initialize find Random Number Service.");
234 return StatusCode::FAILURE;
265 return StatusCode::SUCCESS;
275 const EventContext& ctx = Gaudi::Hive::currentContext();
282 auto digitsContainer = std::make_unique<TileMutableDigitsContainer>(
true,
295 double tFit = 0,
ped = 100;
297 TF1 *
pdf =
new TF1();
298 TF1 *pdf_PhaseI =
new TF1();
299 TF1 *pdf_lo =
new TF1();
300 TF1 *pdf_hi =
new TF1();
305 Double_t sigma_lo = 1;
306 pdf_lo =
new TF1(
"pdf_lo",
"(1/(sqrt(2*pi)*[0])) * (exp(-0.5*(x/[0])**2)/(sqrt(2*pi)*[0]))", -100, 100);
307 pdf_lo->SetParameter(0,sigma_lo);
309 Double_t sigma_hi = 2.5;
310 pdf_hi =
new TF1(
"pdf_hi",
"(1/(sqrt(2*pi)*[0])) * (exp(-0.5*(x/[0])**2)/(sqrt(2*pi)*[0]))", -100, 100);
311 pdf_hi->SetParameter(0,sigma_hi);
317 pdf_PhaseI =
new TF1(
"pdf_PhaseI",
"[0] * (exp(-0.5*(x/[1])**2)/(sqrt(2*pi)*[1]) + [2] *exp(-0.5*(x/[3])**2)/(sqrt(2*pi)*[3]))", -100., 100.);
329 double n_inTimeAmp = 0.0;
347 bool isHGSaturated =
false;
380 double scaleFactor = (
m_PhaseII ? 40.0 : 64.0);
381 n_inTimeAmp /= scaleFactor;
383 ampValue /= scaleFactor;
388 pdf = (
gain==1) ? pdf_hi : pdf_lo;
405 RandGaussQ::shootArray(*rngWrapper, samples.size(), Rndm, 0.0, 1.0);
406 RandFlat::shootArray(*rngWrapper, 1, Rndm_dG, 0.0, 1.0);
407 for (
unsigned int js = 0; js < samples.size(); ++js) {
409 if (Rndm_dG[0] <
Norm)
410 samples[js] += (
float) Hfn1 * Rndm[js];
412 samples[js] += (
float) Hfn2 * Rndm[js];
416 for (
unsigned int i = 0;
i < samples.size(); ++
i) {
418 isHGSaturated =
true;
436 auto rawChannel = std::make_unique<TileRawChannel>(
digit->adc_HWID(),
455 auto rawChannel = std::make_unique<TileRawChannel>(
digit->adc_HWID(),
479 for (
int i = 0;
i < 7;
i++)
503 auto rawChannel = std::make_unique<TileRawChannel>(
digit->adc_HWID(),
514 bool isHGSaturated =
false;
531 pdf = (
gain == 1) ? pdf_hi : pdf_lo;
588 isHGSaturated =
true;
593 samples.push_back(
sample);
603 auto rawChannel = std::make_unique<TileRawChannel>(
636 return StatusCode::SUCCESS;
652 return StatusCode::SUCCESS;
657 if (
file->IsZombie()) {
668 hist->SetBinContent(
i, 0.);
680 if (
file->IsZombie()) {
687 hists.push_back(std::vector<TH1F*>());
701 hist->SetBinContent(
i, 0.);
724 for (
int imu = 0; imu<
mu; imu++){
740 ATH_MSG_VERBOSE(
"Random amplitudes for PU: " << amp_1 <<
" " << amp_2);
790 double scaleFactor =
m_PhaseII ? 40 : 64;
791 n_inTimeAmp /= scaleFactor;
804 auto random = std::make_unique<TRandom3>(
m_seed);
809 for (
int imu = 0; imu<
mu; imu++){
double m_ped_LG
Pedestal value for LG if specific channel pedestal is not used.
def retrieve(aClass, aKey=None)
bool makeDist(TFile *&file, TH1F *&hist, const std::string &fileName, const std::string &histName="h_Eopt_hi")
Method to read distribution from file.
virtual StatusCode finalize() override
finalize method
TileSampleBuffer * m_buf
Buffer class to hold generated pulses.
void setSeed(const std::string &algName, const EventContext &ctx)
Set the random seed using a string (e.g.
double m_GNSigmaOne
Standard deviation of first gaussian of double gaussian noise.
void fillNSamples(double t0, double pedestal, double amp_it, const std::vector< float > &_pu, TF1 *pdf, bool addNoise, double itOffset=0, int nSamples=7, int nPul=21)
TileSampleGenerator * m_tsg
Pulse generating class.
const std::vector< double > & digitsFullShapeLo() const
Return shape vector with full binning to produce the TileDigits from sub-hits.
int m_nPul
number of pileup pulses
TilePulseShape * m_ps[2]
Class for defining pulse.
std::vector< std::vector< TH1F * > > m_pileup_AmpDists
Matrix of PU amplitude distribution histograms (PU per partition and channel)
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
double m_itAPulseProb
Probability to add an in-time pulse.
const TileHWID * m_tileHWID
void addPileUp(double &n_inTimeAmp, int gain, int ros, int drawer, int channel)
Fill vector with pile-up amplitudes.
bool m_simQIE
Raw PMT pulses are generated if the option is set to true.
void getValueVector(std::vector< float > &vec)
TFile * m_pileup_AmpDistFile
File containing amplitude histograms for PU pulses.
std::string m_itADistHistName
Name of histogram for in-time amplitude distribution.
double m_ootOffset
Out-of-time pulse offset from nominal time.
bool m_useOffsetHisto
Internally used to keep track of wether a histogram has been opened or not.
double m_imperfectionRms
RMS of pulse shape broadening.
bool m_chanPed
Use channel specific pedestal value if true.
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
std::string m_ootOffsetHistName
Name of the histogram for timing offset distribution.
void fill7SamplesQIE(float amp_it, float *amp_pu)
std::vector< std::vector< std::vector< std::vector< float > > > > m_PUAmp
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
double m_ootAmp
Amplitude of out-of-time pulse.
size_type adc_hash_max() const
ADC hash table max size.
void addPileUpSample(int gain, int ros, int drawer, int channel)
Fill only a BC with pile-up amplitude.
int m_nSamples
number of read out samples
bool m_useItADist
Set to TRUE in order to use a distribution for the in-time amplitude instead of a constant value.
pointer nextElementPtr()
obtain the next available element in pool by pointer pool is resized if its limit has been reached On...
bool m_chanNoise
Add channel specific noise.
msgSvc
Provide convenience handles for various services.
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_itADistFileName
Filename of file to use for amplitude distribution of in-time pulses.
const std::vector< double > & digitsFullShapeHi() const
Return shape vector with full binning to produce the TileDigits from sub-hits.
SG::WriteHandleKey< TileDigitsContainer > m_digitsContainerKey
std::string m_pileupAmpDistFileName
Filename for PU amplitude distribution histograms.
Point Norm(const Point &a)
Helper for holding non-const raw data prior to recording in SG.
TH1F * m_ootDist
Histogram to hold the distribution of out-of-time amplitudes.
std::string m_ootOffsetFileName
File name for offset timing distribution histogram.
const TileInfo * m_tileInfo
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
ServiceHandle< IAthRNGSvc > m_rndmSvc
Random number service to use.
double m_itOffset
In-time pulse offset from nominal time.
int scalePulse(double leftSF=1., double rightSF=1.)
double m_imperfectionMean
Mean value of pulse shape broadening.
bool m_useOotADist
Set to TRUE in order to use a distribution for the out-of-time amplitude instead of a constant value.
virtual StatusCode initialize() override
initialize method
int m_BunchSpacing
Time between pulses in ms 25, 50 or 75.
double m_GNAmpTwo
Amplitude of second gaussian of double gaussian noise.
float fillSample(double t0, double pedestal, const std::vector< float > &_pu, TF1 *pdf, bool addNoise, int nPul=21, int gain=1)
A wrapper class for event-slot-local random engines.
std::string to_string(const DetectorType &type)
TH1F * m_ootOffsetDist
Histogram to hold the distribution of out-of-time timing offsets.
bool m_simPulseChain
Simulate continous output of readout for HL-LHC paradigm.
std::string m_ootADistHistName
Name of histogram for out-of-time amplitude distribution.
std::string m_ootADistFileName
Filename of file to use for amplitude distribution of out-of-time pulses.
HWIdentifier adc_id(int ros, int drawer, int channel, int adc) const
adc HWIdentifer
bool m_gaussNoise
Set to TRUE in order to create noise from double gaussian.
double m_GNSigmaTwo
Standard deviation of second gaussian of double gaussian noise.
TileDigitsFromPulse(const std::string &name, ISvcLocator *pSvcLocator)
Helper for holding non-const raw data prior to recording in SG.
double m_ped_HG
Pedestal value for HG if specific channel pedestal is not used.
int m_AmpDistLowLim
Set all bins to the left of this bin to 0 in the amplitude distribution histograms.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
#define ATH_MSG_WARNING(x)
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
virtual ~TileDigitsFromPulse()
float m_gausC2C
RMS for the in-time pulse offset (channel-to-channel phase variation)
ToolHandle< TileCondToolNoiseSample > m_tileToolNoiseSample
TFile * m_itFile
File that holds the distribution of in-time amplitudes.
float m_pileUpFraction
Probability that an out-of-time component will be added.
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
void setPulseShape(TilePulseShape *ps)
TH1F * m_itDist
Histogram to hold the distribution of in-time amplitudes.
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
double m_GNAmpOne
Amplitude of first gaussian of double gaussian noise.
TileRawChannelUnit::UNIT m_rChUnit
Units used for the TileRawChannels (ADC, pCb, etc.)(see TileInfo.h)
std::unique_ptr< TRandom3 > m_random
TileFragHash::TYPE m_rChType
Type of TileRawChannels (Digitizar, OF1, OF2, Fit, etc.)(see TileFragHash.h)
TFile * m_ootFile
File that holds the distribution of out-of-time amplitudes.
SG::WriteHandleKey< TileRawChannelContainer > m_rawChannelContainerKey
double m_inTimeAmp
Amplitude of in-time pulse.
void setPulseShape(const std::vector< double > &shapevec)
int ADCmax() const
Returns the maximum ADC output (10 bits --> 1023)
Gaudi::Property< std::string > m_randomStreamName
Random Stream Name.
virtual StatusCode execute() override
execute method
TFile * m_ootOffsetFile
File that holds the distribution of out-of-time timing offsets.