qupid 0.2
Quasi-Signal Generation Model for Pixelized Detector
Loading...
Searching...
No Matches
QPMonteCarlo Class Reference

Monte Carlo driver for cluster-size studies. More...

#include <QPMonteCarlo.hpp>

Classes

struct  Record
 One generated event, plain data only. More...
 

Public Member Functions

 QPMonteCarlo (QPDigitizerBase *digitizer, QPRandomBase &random)
 
void SetPositionRange (const double &xmin, const double &xmax, const double &ymin, const double &ymax)
 Uniform draw ranges for the signal position, µm.
 
void SetAmplitude (const double &amp)
 Fixed amplitude for every event; disables the amplitude draw.
 
void SetAmplitudeRange (const double &min, const double &max)
 Per-event uniform amplitude draw.
 
void SetSigma (const double &sigma)
 Width of the injected Gaussian.
 
void SetThreshold (const double &threshold)
 Pixel firing threshold.
 
Record Shoot ()
 Generate one event.
 
std::vector< Record > Run (int ntrial)
 Shoot() ntrial times.
 
QPDigitizerBase * GetDigitizer () const
 

Static Public Member Functions

static bool WriteCSV (const std::vector< Record > &records, const std::string &filename)
 Write records as CSV: header line amp,x,y,sig,npix, values with %.17g (round-trip double precision).
 

Detailed Description

Monte Carlo driver for cluster-size studies.

Per event: draw a signal position (and optionally an amplitude), inject one isometric Gaussian signal into the digitizer, count the pixels above threshold, clear the digitizer. Positions are in µm, amplitudes and thresholds in electrons.

The per-event draw order is fixed by Shoot() and must not change: x, then y, then amplitude (amplitude only when SetAmplitudeRange was used; SetAmplitude keeps it fixed and draws nothing). Regression baselines depend on this order.

Definition at line 20 of file QPMonteCarlo.hpp.

Constructor & Destructor Documentation

◆ QPMonteCarlo()

QPMonteCarlo::QPMonteCarlo ( QPDigitizerBase *  digitizer,
QPRandomBase &  random 
)
Parameters
digitizertarget digitizer; not owned
randomrandom engine; caller-owned, kept by reference

Definition at line 11 of file QPMonteCarlo.cpp.

Member Function Documentation

◆ SetPositionRange()

void QPMonteCarlo::SetPositionRange ( const double &  xmin,
const double &  xmax,
const double &  ymin,
const double &  ymax 
)

Uniform draw ranges for the signal position, µm.

Parameters
xminlower x bound
xmaxupper x bound
yminlower y bound
ymaxupper y bound

Definition at line 14 of file QPMonteCarlo.cpp.

◆ SetAmplitude()

void QPMonteCarlo::SetAmplitude ( const double &  amp)

Fixed amplitude for every event; disables the amplitude draw.

Parameters
ampamplitude, electrons

Definition at line 22 of file QPMonteCarlo.cpp.

◆ SetAmplitudeRange()

void QPMonteCarlo::SetAmplitudeRange ( const double &  min,
const double &  max 
)

Per-event uniform amplitude draw.

Parameters
minlower bound, electrons
maxupper bound, electrons

Definition at line 27 of file QPMonteCarlo.cpp.

◆ SetSigma()

void QPMonteCarlo::SetSigma ( const double &  sigma)

Width of the injected Gaussian.

Parameters
sigmavalue placed on both diagonal entries of the covariance-form matrix $ S = \mathrm{diag}(\sigma, \sigma) $

Definition at line 33 of file QPMonteCarlo.cpp.

◆ SetThreshold()

void QPMonteCarlo::SetThreshold ( const double &  threshold)

Pixel firing threshold.

Parameters
thresholdthreshold, electrons

Definition at line 37 of file QPMonteCarlo.cpp.

◆ Shoot()

QPMonteCarlo::Record QPMonteCarlo::Shoot ( )

Generate one event.

Draws x, then y, then the amplitude (only when SetAmplitudeRange is active); injects one QPSignalGaussian with $ S = \mathrm{diag}(\sigma, \sigma) $, counts the fired pixels at the threshold, then clears (and deletes) the injected signal.

Warning
Regression baselines are bit-identical only while this draw order is preserved.
Returns
the event record

Definition at line 41 of file QPMonteCarlo.cpp.

References QPDigitizerBase::ClearSignal(), QPMonteCarlo::Record::fAmp, QPMonteCarlo::Record::fNpix, QPMonteCarlo::Record::fSigma, QPMonteCarlo::Record::fX, QPMonteCarlo::Record::fY, QPDigitizerBase::GetFiredPixel(), QPDigitizerBase::InjectSignal(), and QPRandomBase::Uniform().

Referenced by Run().

◆ Run()

std::vector< QPMonteCarlo::Record > QPMonteCarlo::Run ( int  ntrial)

Shoot() ntrial times.

Parameters
ntrialnumber of events
Returns
accumulated records

Definition at line 62 of file QPMonteCarlo.cpp.

References Shoot().

◆ WriteCSV()

bool QPMonteCarlo::WriteCSV ( const std::vector< Record > &  records,
const std::string &  filename 
)
static

Write records as CSV: header line amp,x,y,sig,npix, values with %.17g (round-trip double precision).

Parameters
recordsevents to write
filenameoutput path
Returns
false when the file cannot be opened, true otherwise

Definition at line 71 of file QPMonteCarlo.cpp.

◆ GetDigitizer()

QPDigitizerBase * QPMonteCarlo::GetDigitizer ( ) const
inline
Returns
the target digitizer; not owned

Definition at line 80 of file QPMonteCarlo.hpp.


The documentation for this class was generated from the following files: