12#include <klm/dataobjects/KLMElementNumberDefinitions.h>
13#include <klm/dataobjects/KLMSimHit.h>
14#include <klm/dbobjects/KLMScintillatorDigitizationParameters.h>
15#include <klm/dbobjects/KLMScintillatorFEEData.h>
16#include <klm/simulation/ScintillatorFirmware.h>
17#include <klm/time/KLMTime.h>
50 double digitizationInitialTime,
74 const std::multimap<KLMChannelNumber, const KLMSimHit*>::iterator& firstHit,
75 const std::multimap<KLMChannelNumber, const KLMSimHit*>::iterator& end);
117 int nPhotons,
double timeShift,
126 void fillSiPMOutput(
float* hist,
bool useDirect,
bool useReflected);
Class to store KLM scintillator simulation parameters in the database.
FPGA fit simulation data.
Digitize EKLMSim2Hits to get EKLM StripHits.
float getSiPMMCTime() const
Get SiPM MC time.
void setFEEData(const KLMScintillatorFEEData *FEEData)
Set FEE data.
int * m_PhotoelectronIndex2
Buffer for photoelectron indices.
float * m_amplitudeReflected
Analog amplitude (reflected).
void debugOutput()
Debug output (signal and fit result histograms).
enum ScintillatorFirmwareFitStatus getFitStatus() const
Get fit status.
const KLMTime * m_Time
Time.
double * m_SignalTimeDependence
Buffer for signal time dependence calculation.
void generatePhotoelectrons(double stripLen, double distSiPM, int nPhotons, double timeShift, bool isReflected)
Generate photoelectrons.
double * m_SignalTimeDependenceDiff
Buffer for signal time dependence calculation.
double m_Energy
Total energy deposited in the strip.
float m_SiPMMCTime
MC time at SiPM.
float * m_amplitudeDirect
Analog amplitude (direct).
ScintillatorSimulator(const ScintillatorSimulator &)=delete
Copy constructor (disabled).
void addRandomSiPMNoise()
Add random noise to the signal (amplitude-dependend).
void simulateADC()
Simulate ADC (create digital signal from analog),.
ScintillatorSimulator & operator=(const ScintillatorSimulator &)=delete
Operator = (disabled).
~ScintillatorSimulator()
Destructor.
void prepareSimulation()
Prepare simulation.
double getEnergy()
Get total energy deposited in the strip (sum over ssimulation hits).
double m_histRange
Time range, (number of digitizations) * (ADC sampling time).
double m_Pedestal
Pedestal.
void reallocPhotoElectronBuffers(int size)
Reallocate photoelectron buffers.
bool m_Debug
Debug mode (generates additional output files with histograms).
double m_DigitizationInitialTime
Initial digitization time.
double getNPhotoelectrons()
Get number of photoelectrons (fit result).
struct Photoelectron * m_Photoelectrons
Buffer for photoelectron data.
ScintillatorFirmware * m_fitter
Fitter.
std::string m_stripName
Name of the strip.
enum ScintillatorFirmwareFitStatus m_FPGAStat
FPGA fit status.
KLMScintillatorFirmwareFitResult * getFPGAFit()
Get fit data.
int * m_ADCAmplitude
Digital amplitude.
KLMScintillatorFirmwareFitResult m_FPGAFit
FPGA fit data.
void performSimulation()
Perform common simulation stage.
float getMCTime() const
Get MC time.
double m_PhotoelectronAmplitude
Photoelectron amplitude.
int getNGeneratedPhotoelectrons()
Get generated number of photoelectrons.
int * m_PhotoelectronIndex
Buffer for photoelectron indices.
void simulate(const std::multimap< KLMChannelNumber, const KLMSimHit * >::iterator &firstHit, const std::multimap< KLMChannelNumber, const KLMSimHit * >::iterator &end)
Simulate a strip.
float * m_amplitude
Analog amplitude.
void fillSiPMOutput(float *hist, bool useDirect, bool useReflected)
Fill SiPM output.
int m_Threshold
Threshold.
int * sortPhotoelectrons(int nPhotoelectrons)
Sort photoelectrons.
int m_npe
Number of photoelectrons (generated).
int m_PhotoelectronBufferSize
Size of photoelectron data buffer.
const KLMScintillatorDigitizationParameters * m_DigPar
Parameters.
Abstract base class for different kinds of events.
int bin
Hit time bin in ADC output histogram.
bool isReflected
Direct (false) or reflected (true).
double expTime
exp(-m_DigPar->PEAttenuationFreq * (-time))