 |
Belle II Software
release-05-01-25
|
14 #include <klm/dataobjects/bklm/BKLMSimHit.h>
15 #include <klm/dataobjects/eklm/EKLMSimHit.h>
16 #include <klm/dbobjects/eklm/EKLMChannelData.h>
17 #include <klm/dbobjects/KLMScintillatorDigitizationParameters.h>
18 #include <klm/simulation/ScintillatorFirmware.h>
31 class ScintillatorSimulator {
36 struct Photoelectron {
51 double digitizationInitialTime,
75 const std::multimap<uint16_t, const BKLMSimHit*>::iterator& firstHit,
76 const std::multimap<uint16_t, const BKLMSimHit*>::iterator& end);
84 const std::multimap<uint16_t, const EKLMSimHit*>::iterator& firstHit,
85 const std::multimap<uint16_t, const EKLMSimHit*>::iterator& end);
127 int nPhotons,
double timeShift,
136 void fillSiPMOutput(
float* hist,
bool useDirect,
bool useReflected);
197 const KLMScintillatorDigitizationParameters*
m_DigPar;
242 enum ScintillatorFirmwareFitStatus
m_FPGAStat;
245 KLMScintillatorFirmwareFitResult
m_FPGAFit;
int m_PhotoelectronBufferSize
Size of photoelectron data buffer.
ScintillatorSimulator(const KLMScintillatorDigitizationParameters *digPar, ScintillatorFirmware *fitter, double digitizationInitialTime, bool debug)
Constructor.
Digitize EKLMSim2Hits to get EKLM StripHits.
double m_DigitizationInitialTime
Initial digitization time.
int getNGeneratedPhotoelectrons()
Get generated number of photoelectrons.
void debugOutput()
Debug output (signal and fit result histograms).
ScintillatorFirmware * m_fitter
Fitter.
double * m_SignalTimeDependence
Buffer for signal time dependence calculation.
~ScintillatorSimulator()
Destructor.
int * m_ADCAmplitude
Digital amplitude.
double getEnergy()
Get total energy deposited in the strip (sum over ssimulation hits).
int m_npe
Number of photoelectrons (generated).
KLMScintillatorFirmwareFitResult * getFPGAFit()
Get fit data.
void setChannelData(const EKLMChannelData *channelData)
Set channel data.
float getSiPMMCTime() const
Get SiPM MC time.
float * m_amplitudeDirect
Analog amplitude (direct).
double m_Pedestal
Pedestal.
struct Photoelectron * m_Photoelectrons
Buffer for photoelectron data.
bool isReflected
Direct (false) or reflected (true).
int * m_PhotoelectronIndex
Buffer for photoelectron indices.
int m_Threshold
Threshold.
double * m_SignalTimeDependenceDiff
Buffer for signal time dependence calculation.
double getNPhotoelectrons()
Get number of photoelectrons (fit result).
Abstract base class for different kinds of events.
void generatePhotoelectrons(double stripLen, double distSiPM, int nPhotons, double timeShift, bool isReflected)
Generate photoelectrons.
bool m_Debug
Debug mode (generates additional output files with histograms).
ScintillatorSimulator & operator=(const ScintillatorSimulator &)=delete
Operator = (disabled).
Class to store KLM scintillator simulation parameters in the database.
float * m_amplitudeReflected
Analog amplitude (reflected).
void simulate(const std::multimap< uint16_t, const BKLMSimHit * >::iterator &firstHit, const std::multimap< uint16_t, const BKLMSimHit * >::iterator &end)
Simulate BKLM strip.
double m_Energy
Total energy deposited in the strip.
int * sortPhotoelectrons(int nPhotoelectrons)
Sort photoelectrons.
void addRandomSiPMNoise()
Add random noise to the signal (amplitude-dependend).
float * m_amplitude
Analog amplitude.
void reallocPhotoElectronBuffers(int size)
Reallocate photoelectron buffers.
float m_SiPMMCTime
MC time at SiPM.
double m_PhotoelectronAmplitude
Photoelectron amplitude.
void fillSiPMOutput(float *hist, bool useDirect, bool useReflected)
Fill SiPM output.
KLMScintillatorFirmwareFitResult m_FPGAFit
FPGA fit data.
enum ScintillatorFirmwareFitStatus getFitStatus() const
Get fit status.
std::string m_stripName
Name of the strip.
int * m_PhotoelectronIndex2
Buffer for photoelectron indices.
const KLMScintillatorDigitizationParameters * m_DigPar
Parameters.
int bin
Hit time bin in ADC output histogram.
void simulateADC()
Simulate ADC (create digital signal from analog),.
void prepareSimulation()
Prepare simulation.
FPGA fit simulation data.
float getMCTime() const
Get MC time.
void performSimulation()
Perform common simulation stage.
enum ScintillatorFirmwareFitStatus m_FPGAStat
FPGA fit status.
double expTime
exp(-m_DigPar->PEAttenuationFreq * (-time))
double m_histRange
Stands for nDigitizations*ADCSamplingTime.