Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
|
Sensor More...
#include <Sensor.hh>
Public Member Functions | |
Sensor ()=default | |
Constructor. | |
~Sensor () | |
Destructor. | |
void | AddComponent (ComponentBase *comp) |
Add a component. | |
unsigned int | GetNumberOfComponents () const |
Get the number of components attached to the sensor. | |
ComponentBase * | GetComponent (const unsigned int i) |
Retrieve the pointer to a given component. | |
void | AddElectrode (ComponentBase *comp, const std::string &label) |
Add an electrode. | |
unsigned int | GetNumberOfElectrodes () const |
Get the number of electrodes attached to the sensor. | |
void | Clear () |
Remove all components, electrodes and reset the sensor. | |
void | ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, double &v, Medium *&medium, int &status) |
Get the drift field and potential at (x, y, z). | |
void | ElectricField (const double x, const double y, const double z, double &ex, double &ey, double &ez, Medium *&medium, int &status) |
Get the drift field at (x, y, z). | |
void | MagneticField (const double x, const double y, const double z, double &bx, double &by, double &bz, int &status) |
Get the magnetic field at (x, y, z). | |
void | WeightingField (const double x, const double y, const double z, double &wx, double &wy, double &wz, const std::string &label) |
Get the weighting field at (x, y, z). | |
double | WeightingPotential (const double x, const double y, const double z, const std::string &label) |
Get the weighting potential at (x, y, z). | |
bool | GetMedium (const double x, const double y, const double z, Medium *&medium) |
Get the medium at (x, y, z). | |
void | EnableDebugging (const bool on=true) |
Switch debugging messages on/off. | |
bool | SetArea () |
Set the user area to the default. | |
bool | SetArea (const double xmin, const double ymin, const double zmin, const double xmax, const double ymax, const double zmax) |
Set the user area explicitly. | |
bool | GetArea (double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) |
Return the current user area. | |
bool | IsInArea (const double x, const double y, const double z) |
Check if a point is inside the user area. | |
bool | GetVoltageRange (double &vmin, double &vmax) |
Return the voltage range. | |
void | NewSignal () |
Start a new event, when computing the average signal over multiple events. | |
void | ClearSignal () |
Reset signals and induced charges of all electrodes. | |
void | SetTimeWindow (const double tstart, const double tstep, const unsigned int nsteps) |
void | GetTimeWindow (double &tstart, double &tstep, unsigned int &nsteps) const |
Retrieve the time window and binning. | |
void | EnableDelayedSignal (const bool on=true) |
Compute the component of the signal due to the delayed weighting field. | |
void | SetDelayedSignalTimes (const std::vector< double > &ts) |
Set the points in time at which to evaluate the delayed weighting field. | |
void | SetDelayedSignalAveragingOrder (const unsigned int navg) |
void | SetSignal (const std::string &label, const unsigned int bin, const double signal) |
Set/override the signal in a given time bin explicitly. | |
double | GetSignal (const std::string &label, const unsigned int bin) |
Retrieve the total signal for a given electrode and time bin. | |
double | GetElectronSignal (const std::string &label, const unsigned int bin) |
Retrieve the electron signal for a given electrode and time bin. | |
double | GetIonSignal (const std::string &label, const unsigned int bin) |
Retrieve the ion or hole signal for a given electrode and time bin. | |
double | GetDelayedElectronSignal (const std::string &label, const unsigned int bin) |
Retrieve the delayed electron signal for a given electrode and time bin. | |
double | GetDelayedIonSignal (const std::string &label, const unsigned int bin) |
Retrieve the delayed ion/hole signal for a given electrode and time bin. | |
double | GetInducedCharge (const std::string &label) |
void | SetTransferFunction (double(*f)(double t)) |
Set the function to be used for evaluating the transfer function. | |
void | SetTransferFunction (const std::vector< double > ×, const std::vector< double > &values) |
Set the points to be used for interpolating the transfer function. | |
void | SetTransferFunction (Shaper &shaper) |
Set the transfer function using a Shaper object. | |
double | GetTransferFunction (const double t) |
Evaluate the transfer function at a given time. | |
void | EnableTransferFunctionCache (const bool on=true) |
bool | ConvoluteSignal (const bool fft=false) |
Convolute the induced current with the transfer function. | |
bool | IntegrateSignal () |
Replace the current signal curve by its integral. | |
bool | IsIntegrated () const |
Return whether the signal has been integrated/convoluted. | |
bool | DelayAndSubtractFraction (const double td, const double f) |
void | SetNoiseFunction (double(*f)(double t)) |
Set the function to be used for evaluating the noise component. | |
void | AddNoise (const bool total=true, const bool electron=false, const bool ion=false) |
Add noise to the induced signal. | |
void | AddWhiteNoise (const double enc, const bool poisson=true, const double q0=1.) |
bool | ComputeThresholdCrossings (const double thr, const std::string &label, int &n) |
unsigned int | GetNumberOfThresholdCrossings () const |
bool | GetThresholdCrossing (const unsigned int i, double &time, double &level, bool &rise) const |
void | AddSignal (const double q, const double t0, const double t1, const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, const bool integrateWeightingField, const bool useWeightingPotential=false) |
Add the signal from a charge-carrier step. | |
void | AddSignal (const double q, const std::vector< double > &ts, const std::vector< std::array< double, 3 > > &xs, const std::vector< std::array< double, 3 > > &vs, const std::vector< double > &ns, const int navg) |
Add the signal from a drift line. | |
void | AddInducedCharge (const double q, const double x0, const double y0, const double z0, const double x1, const double y1, const double z1) |
Add the induced charge from a charge carrier drift between two points. | |
bool | IsWireCrossed (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, double &xc, double &yc, double &zc, const bool centre, double &rc) |
bool | IsInTrapRadius (const double q0, const double x0, const double y0, const double z0, double &xw, double &yw, double &rw) |
|
default |
Constructor.
void Garfield::Sensor::AddComponent | ( | ComponentBase * | comp | ) |
Add a component.
Definition at line 301 of file Sensor.cc.
Referenced by GarfieldPhysics::CreateGeometry(), and main().
void Garfield::Sensor::AddElectrode | ( | ComponentBase * | comp, |
const std::string & | label | ||
) |
Add an electrode.
Definition at line 310 of file Sensor.cc.
void Garfield::Sensor::AddInducedCharge | ( | const double | q, |
const double | x0, | ||
const double | y0, | ||
const double | z0, | ||
const double | x1, | ||
const double | y1, | ||
const double | z1 | ||
) |
Add the induced charge from a charge carrier drift between two points.
Definition at line 678 of file Sensor.cc.
void Garfield::Sensor::AddNoise | ( | const bool | total = true , |
const bool | electron = false , |
||
const bool | ion = false |
||
) |
Add noise to the induced signal.
Definition at line 1017 of file Sensor.cc.
void Garfield::Sensor::AddSignal | ( | const double | q, |
const double | t0, | ||
const double | t1, | ||
const double | x0, | ||
const double | y0, | ||
const double | z0, | ||
const double | x1, | ||
const double | y1, | ||
const double | z1, | ||
const bool | integrateWeightingField, | ||
const bool | useWeightingPotential = false |
||
) |
Add the signal from a charge-carrier step.
Definition at line 409 of file Sensor.cc.
void Garfield::Sensor::AddSignal | ( | const double | q, |
const std::vector< double > & | ts, | ||
const std::vector< std::array< double, 3 > > & | xs, | ||
const std::vector< std::array< double, 3 > > & | vs, | ||
const std::vector< double > & | ns, | ||
const int | navg | ||
) |
Add the signal from a drift line.
Definition at line 550 of file Sensor.cc.
void Garfield::Sensor::AddWhiteNoise | ( | const double | enc, |
const bool | poisson = true , |
||
const double | q0 = 1. |
||
) |
Add white noise to the induced signal, given a desired output ENC.
enc | Equivalent Noise Charge, in electrons. |
poisson | flag to sample the number of noise pulses from a Poisson distribution. Otherwise the noise charge in each bin is sampled from a Gaussian distribution. |
q0 | amplitude of the noise delta pulses (in electrons). |
Definition at line 1036 of file Sensor.cc.
void Garfield::Sensor::Clear | ( | ) |
Remove all components, electrodes and reset the sensor.
Definition at line 339 of file Sensor.cc.
void Garfield::Sensor::ClearSignal | ( | ) |
Reset signals and induced charges of all electrodes.
Definition at line 387 of file Sensor.cc.
Referenced by AddElectrode().
bool Garfield::Sensor::ComputeThresholdCrossings | ( | const double | thr, |
const std::string & | label, | ||
int & | n | ||
) |
Determine the threshold crossings of the current signal curve.
thr | threshold value |
label | electrode for which to compute the threshold crossings |
n | number of threshold crossings |
Definition at line 1102 of file Sensor.cc.
bool Garfield::Sensor::ConvoluteSignal | ( | const bool | fft = false | ) |
Convolute the induced current with the transfer function.
Definition at line 877 of file Sensor.cc.
bool Garfield::Sensor::DelayAndSubtractFraction | ( | const double | td, |
const double | f | ||
) |
Delay the signal and subtract an attenuated copy (modelling a constant fraction discriminator).
Definition at line 990 of file Sensor.cc.
void Garfield::Sensor::ElectricField | ( | const double | x, |
const double | y, | ||
const double | z, | ||
double & | ex, | ||
double & | ey, | ||
double & | ez, | ||
double & | v, | ||
Medium *& | medium, | ||
int & | status | ||
) |
Get the drift field and potential at (x, y, z).
Definition at line 75 of file Sensor.cc.
Referenced by Garfield::ViewField::Evaluate2D(), Garfield::ViewField::EvaluateProfile(), and Heed::HeedFieldMap::field_map().
void Garfield::Sensor::ElectricField | ( | const double | x, |
const double | y, | ||
const double | z, | ||
double & | ex, | ||
double & | ey, | ||
double & | ez, | ||
Medium *& | medium, | ||
int & | status | ||
) |
Get the drift field at (x, y, z).
Definition at line 100 of file Sensor.cc.
|
inline |
|
inline |
|
inline |
bool Garfield::Sensor::GetArea | ( | double & | xmin, |
double & | ymin, | ||
double & | zmin, | ||
double & | xmax, | ||
double & | ymax, | ||
double & | zmax | ||
) |
Return the current user area.
Definition at line 232 of file Sensor.cc.
Referenced by Garfield::TrackSrim::NewTrack().
ComponentBase * Garfield::Sensor::GetComponent | ( | const unsigned int | i | ) |
double Garfield::Sensor::GetDelayedElectronSignal | ( | const std::string & | label, |
const unsigned int | bin | ||
) |
Retrieve the delayed electron signal for a given electrode and time bin.
Definition at line 754 of file Sensor.cc.
Referenced by Garfield::ViewSignal::PlotSignal().
double Garfield::Sensor::GetDelayedIonSignal | ( | const std::string & | label, |
const unsigned int | bin | ||
) |
Retrieve the delayed ion/hole signal for a given electrode and time bin.
Definition at line 765 of file Sensor.cc.
Referenced by Garfield::ViewSignal::PlotSignal().
double Garfield::Sensor::GetElectronSignal | ( | const std::string & | label, |
const unsigned int | bin | ||
) |
Retrieve the electron signal for a given electrode and time bin.
Definition at line 733 of file Sensor.cc.
Referenced by Garfield::ViewSignal::PlotSignal().
double Garfield::Sensor::GetInducedCharge | ( | const std::string & | label | ) |
Retrieve the total induced charge for a given electrode, calculated using the weighting potentials at the start and end points.
Definition at line 798 of file Sensor.cc.
double Garfield::Sensor::GetIonSignal | ( | const std::string & | label, |
const unsigned int | bin | ||
) |
Retrieve the ion or hole signal for a given electrode and time bin.
Definition at line 744 of file Sensor.cc.
Referenced by Garfield::ViewSignal::PlotSignal().
bool Garfield::Sensor::GetMedium | ( | const double | x, |
const double | y, | ||
const double | z, | ||
Medium *& | medium | ||
) |
Get the medium at (x, y, z).
Definition at line 166 of file Sensor.cc.
Referenced by Garfield::TrackBichsel::GetCluster(), Garfield::TrackSimple::GetCluster(), Garfield::TrackElectron::GetCluster(), Garfield::TrackPAI::GetCluster(), Heed::HeedFieldMap::inside(), Garfield::TrackBichsel::NewTrack(), Garfield::TrackElectron::NewTrack(), Garfield::TrackPAI::NewTrack(), Garfield::TrackSimple::NewTrack(), Garfield::TrackHeed::NewTrack(), Garfield::TrackSrim::NewTrack(), Garfield::TrackHeed::TransportDeltaElectron(), and Garfield::TrackHeed::TransportPhoton().
|
inline |
|
inline |
|
inline |
Get the number of threshold crossings (after having called ComputeThresholdCrossings).
Definition at line 174 of file Sensor.hh.
Referenced by Garfield::ViewSignal::PlotSignal().
double Garfield::Sensor::GetSignal | ( | const std::string & | label, |
const unsigned int | bin | ||
) |
Retrieve the total signal for a given electrode and time bin.
Definition at line 788 of file Sensor.cc.
Referenced by main(), and Garfield::ViewSignal::PlotSignal().
bool Garfield::Sensor::GetThresholdCrossing | ( | const unsigned int | i, |
double & | time, | ||
double & | level, | ||
bool & | rise | ||
) | const |
Retrieve the time and type of a given threshold crossing (after having called ComputeThresholdCrossings.
i | index |
time | threshold crossing time [ns] |
level | threshold (should correspond to the value requested). |
rise | flag whether the crossing is on a rising or falling slope. |
Definition at line 1216 of file Sensor.cc.
Referenced by Garfield::ViewSignal::PlotSignal().
|
inline |
Retrieve the time window and binning.
Definition at line 89 of file Sensor.hh.
Referenced by Garfield::ViewSignal::PlotSignal().
double Garfield::Sensor::GetTransferFunction | ( | const double | t | ) |
Evaluate the transfer function at a given time.
Definition at line 868 of file Sensor.cc.
Referenced by ConvoluteSignal().
bool Garfield::Sensor::GetVoltageRange | ( | double & | vmin, |
double & | vmax | ||
) |
Return the voltage range.
Definition at line 355 of file Sensor.cc.
bool Garfield::Sensor::IntegrateSignal | ( | ) |
Replace the current signal curve by its integral.
Definition at line 968 of file Sensor.cc.
bool Garfield::Sensor::IsInArea | ( | const double | x, |
const double | y, | ||
const double | z | ||
) |
Check if a point is inside the user area.
Definition at line 258 of file Sensor.cc.
Referenced by Garfield::TrackElectron::GetCluster(), Garfield::TrackPAI::GetCluster(), Heed::HeedFieldMap::inside(), and Garfield::TrackSrim::NewTrack().
|
inline |
Return whether the signal has been integrated/convoluted.
Definition at line 143 of file Sensor.hh.
Referenced by Garfield::ViewSignal::PlotSignal().
bool Garfield::Sensor::IsInTrapRadius | ( | const double | q0, |
const double | x0, | ||
const double | y0, | ||
const double | z0, | ||
double & | xw, | ||
double & | yw, | ||
double & | rw | ||
) |
bool Garfield::Sensor::IsWireCrossed | ( | const double | x0, |
const double | y0, | ||
const double | z0, | ||
const double | x1, | ||
const double | y1, | ||
const double | z1, | ||
double & | xc, | ||
double & | yc, | ||
double & | zc, | ||
const bool | centre, | ||
double & | rc | ||
) |
Determine whether a line between two points has crossed a wire, calls ComponentBase::IsWireCrossed.
Definition at line 280 of file Sensor.cc.
void Garfield::Sensor::MagneticField | ( | const double | x, |
const double | y, | ||
const double | z, | ||
double & | bx, | ||
double & | by, | ||
double & | bz, | ||
int & | status | ||
) |
Get the magnetic field at (x, y, z).
Definition at line 124 of file Sensor.cc.
Referenced by Heed::HeedFieldMap::field_map().
|
inline |
bool Garfield::Sensor::SetArea | ( | ) |
Set the user area to the default.
Definition at line 189 of file Sensor.cc.
Referenced by GetArea(), IsInArea(), and main().
bool Garfield::Sensor::SetArea | ( | const double | xmin, |
const double | ymin, | ||
const double | zmin, | ||
const double | xmax, | ||
const double | ymax, | ||
const double | zmax | ||
) |
Set the user area explicitly.
Definition at line 213 of file Sensor.cc.
|
inline |
void Garfield::Sensor::SetDelayedSignalTimes | ( | const std::vector< double > & | ts | ) |
Set the points in time at which to evaluate the delayed weighting field.
Definition at line 400 of file Sensor.cc.
void Garfield::Sensor::SetNoiseFunction | ( | double(*)(double t) | f | ) |
void Garfield::Sensor::SetSignal | ( | const std::string & | label, |
const unsigned int | bin, | ||
const double | signal | ||
) |
Set/override the signal in a given time bin explicitly.
Definition at line 776 of file Sensor.cc.
void Garfield::Sensor::SetTimeWindow | ( | const double | tstart, |
const double | tstep, | ||
const unsigned int | nsteps | ||
) |
Set the time window and binning for the signal calculation.
tstart | start time [ns] |
tstep | bin width [ns] |
nsteps | number of bins |
Definition at line 700 of file Sensor.cc.
void Garfield::Sensor::SetTransferFunction | ( | const std::vector< double > & | times, |
const std::vector< double > & | values | ||
) |
Set the points to be used for interpolating the transfer function.
Definition at line 820 of file Sensor.cc.
void Garfield::Sensor::SetTransferFunction | ( | double(*)(double t) | f | ) |
Set the function to be used for evaluating the transfer function.
Definition at line 808 of file Sensor.cc.
void Garfield::Sensor::SetTransferFunction | ( | Shaper & | shaper | ) |
void Garfield::Sensor::WeightingField | ( | const double | x, |
const double | y, | ||
const double | z, | ||
double & | wx, | ||
double & | wy, | ||
double & | wz, | ||
const std::string & | label | ||
) |
Get the weighting field at (x, y, z).
Definition at line 138 of file Sensor.cc.
Referenced by Garfield::ViewField::Evaluate2D(), and Garfield::ViewField::EvaluateProfile().
double Garfield::Sensor::WeightingPotential | ( | const double | x, |
const double | y, | ||
const double | z, | ||
const std::string & | label | ||
) |
Get the weighting potential at (x, y, z).
Definition at line 154 of file Sensor.cc.
Referenced by Garfield::ViewField::Evaluate2D(), and Garfield::ViewField::EvaluateProfile().