Garfield++ 4.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 (Component *comp) |
Add a component. | |
size_t | GetNumberOfComponents () const |
Get the number of components attached to the sensor. | |
Component * | GetComponent (const unsigned int i) |
Retrieve the pointer to a given component. | |
void | EnableComponent (const unsigned int i, const bool on) |
Activate/deactivate a given component. | |
void | EnableMagneticField (const unsigned int i, const bool on) |
Activate/deactivate use of the magnetic field of a given component. | |
void | AddElectrode (Component *comp, const std::string &label) |
Add an electrode. | |
size_t | 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 | GetSignal (const std::string &label, const unsigned int bin, const int comp) |
Retrieve the electron signal for a given electrode and time bin. | |
double | GetPromptSignal (const std::string &label, const unsigned int bin) |
Retrieve the prompt signal for a given electrode and time bin. | |
double | GetDelayedSignal (const std::string &label, const unsigned int bin) |
Retrieve the delayed 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) |
Calculated using the weighting potentials at the start and end points. | |
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 | PrintTransferFunction () |
Print some information about the presently set transfer function. | |
void | EnableTransferFunctionCache (const bool on=true) |
bool | ConvoluteSignal (const std::string &label, const bool fft=false) |
bool | ConvoluteSignals (const bool fft=false) |
Convolute all induced currents with the transfer function. | |
bool | IntegrateSignal (const std::string &label) |
Replace the signal on a given electrode by its integral. | |
bool | IntegrateSignals () |
Replace the signals on all electrodes curve by their integrals. | |
bool | IsIntegrated (const std::string &label) 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 std::string &label, const double enc, const bool poisson=true, const double q0=1.) |
void | AddWhiteNoise (const double enc, const bool poisson=true, const double q0=1.) |
Add white noise to the induced signals on all electrodes. | |
bool | ComputeThresholdCrossings (const double thr, const std::string &label, int &n) |
size_t | 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, const bool useWeightingPotential=false) |
Add the signal from a drift line. | |
void | ExportSignal (const std::string &label, const std::string &filename) |
Exporting induced signal to a csv file. | |
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) |
double | IntegrateFluxLine (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, const double xp, const double yp, const double zp, const unsigned int nI, const int isign=0) |
double | GetTotalInducedCharge (const std::string label) |
|
default |
Constructor.
void Garfield::Sensor::AddComponent | ( | Component * | comp | ) |
Add a component.
Definition at line 316 of file Sensor.cc.
Referenced by GarfieldPhysics::InitializePhysics(), main(), and Garfield::ViewField::PlotFieldLines().
void Garfield::Sensor::AddElectrode | ( | Component * | comp, |
const std::string & | label | ||
) |
Add an electrode.
Definition at line 349 of file Sensor.cc.
Referenced by main().
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 798 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 1309 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 452 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, | ||
const bool | useWeightingPotential = false |
||
) |
Add the signal from a drift line.
Definition at line 649 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 signals on all electrodes.
Definition at line 1375 of file Sensor.cc.
void Garfield::Sensor::AddWhiteNoise | ( | const std::string & | label, |
const double | enc, | ||
const bool | poisson = true , |
||
const double | q0 = 1. |
||
) |
Add white noise to the induced signal, given a desired output ENC.
label | name of the electrode |
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 1328 of file Sensor.cc.
void Garfield::Sensor::Clear | ( | ) |
Remove all components, electrodes and reset the sensor.
Definition at line 379 of file Sensor.cc.
void Garfield::Sensor::ClearSignal | ( | ) |
Reset signals and induced charges of all electrodes.
Definition at line 429 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 1439 of file Sensor.cc.
bool Garfield::Sensor::ConvoluteSignal | ( | const std::string & | label, |
const bool | fft = false |
||
) |
Convolute the induced current on a given electrode with the transfer function.
Definition at line 1082 of file Sensor.cc.
Referenced by ConvoluteSignal(), and ConvoluteSignals().
bool Garfield::Sensor::ConvoluteSignals | ( | const bool | fft = false | ) |
Convolute all induced currents with the transfer function.
Definition at line 1105 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 1283 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 65 of file Sensor.cc.
Referenced by Heed::HeedFieldMap::field_map(), and Garfield::DriftLineRKF::FieldLine().
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 91 of file Sensor.cc.
void Garfield::Sensor::EnableComponent | ( | const unsigned int | i, |
const bool | on | ||
) |
|
inline |
|
inline |
void Garfield::Sensor::EnableMagneticField | ( | const unsigned int | i, |
const bool | on | ||
) |
|
inline |
void Garfield::Sensor::ExportSignal | ( | const std::string & | label, |
const std::string & | filename | ||
) |
Exporting induced signal to a csv file.
Definition at line 1663 of file Sensor.cc.
bool Garfield::Sensor::GetArea | ( | double & | xmin, |
double & | ymin, | ||
double & | zmin, | ||
double & | xmax, | ||
double & | ymax, | ||
double & | zmax | ||
) |
Return the current user area.
Definition at line 228 of file Sensor.cc.
Referenced by Garfield::DriftLineRKF::FieldLine(), Garfield::TrackSrim::NewTrack(), and Garfield::ViewBase::PlotLimits().
Component * 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 878 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 889 of file Sensor.cc.
Referenced by Garfield::ViewSignal::PlotSignal().
double Garfield::Sensor::GetDelayedSignal | ( | const std::string & | label, |
const unsigned int | bin | ||
) |
Retrieve the delayed signal for a given electrode and time bin.
Definition at line 958 of file Sensor.cc.
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 857 of file Sensor.cc.
Referenced by main(), and Garfield::ViewSignal::PlotSignal().
double Garfield::Sensor::GetInducedCharge | ( | const std::string & | label | ) |
Calculated using the weighting potentials at the start and end points.
Definition at line 969 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 868 of file Sensor.cc.
Referenced by main(), and 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 159 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::TrackTrim::NewTrack(), Garfield::TrackHeed::TransportDeltaElectron(), and Garfield::TrackHeed::TransportPhoton().
|
inline |
|
inline |
|
inline |
Get the number of threshold crossings (after having called ComputeThresholdCrossings).
Definition at line 201 of file Sensor.hh.
Referenced by Garfield::ViewSignal::Plot(), and Garfield::ViewSignal::PlotSignal().
double Garfield::Sensor::GetPromptSignal | ( | const std::string & | label, |
const unsigned int | bin | ||
) |
Retrieve the prompt signal for a given electrode and time bin.
Definition at line 946 of file Sensor.cc.
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 912 of file Sensor.cc.
Referenced by main(), Garfield::ViewSignal::Plot(), and Garfield::ViewSignal::PlotSignal().
double Garfield::Sensor::GetSignal | ( | const std::string & | label, |
const unsigned int | bin, | ||
const int | comp | ||
) |
Retrieve the electron signal for a given electrode and time bin.
Definition at line 922 of file Sensor.cc.
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 1553 of file Sensor.cc.
Referenced by Garfield::ViewSignal::Plot(), and Garfield::ViewSignal::PlotSignal().
|
inline |
Retrieve the time window and binning.
Definition at line 96 of file Sensor.hh.
Referenced by Garfield::ViewSignal::Plot(), and Garfield::ViewSignal::PlotSignal().
double Garfield::Sensor::GetTotalInducedCharge | ( | const std::string | label | ) |
Definition at line 1700 of file Sensor.cc.
double Garfield::Sensor::GetTransferFunction | ( | const double | t | ) |
Evaluate the transfer function at a given time.
Definition at line 1041 of file Sensor.cc.
Referenced by PrintTransferFunction().
bool Garfield::Sensor::GetVoltageRange | ( | double & | vmin, |
double & | vmax | ||
) |
Return the voltage range.
Definition at line 396 of file Sensor.cc.
Referenced by GetVoltageRange().
double Garfield::Sensor::IntegrateFluxLine | ( | const double | x0, |
const double | y0, | ||
const double | z0, | ||
const double | x1, | ||
const double | y1, | ||
const double | z1, | ||
const double | xp, | ||
const double | yp, | ||
const double | zp, | ||
const unsigned int | nI, | ||
const int | isign = 0 |
||
) |
Integrate the electric field flux through a line from (x0,y0,z0) to (x1,y1,z1) along a direction (xp,yp,zp).
Definition at line 301 of file Sensor.cc.
Referenced by Garfield::ViewField::EqualFluxIntervals(), and Garfield::ViewField::FixedFluxIntervals().
bool Garfield::Sensor::IntegrateSignal | ( | const std::string & | label | ) |
Replace the signal on a given electrode by its integral.
Definition at line 1244 of file Sensor.cc.
Referenced by IntegrateSignal(), IntegrateSignals(), and Garfield::ViewSignal::Plot().
bool Garfield::Sensor::IntegrateSignals | ( | ) |
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 254 of file Sensor.cc.
Referenced by Garfield::TrackElectron::GetCluster(), Garfield::TrackPAI::GetCluster(), Heed::HeedFieldMap::inside(), and Garfield::TrackSrim::NewTrack().
bool Garfield::Sensor::IsIntegrated | ( | const std::string & | label | ) | const |
Return whether the signal has been integrated/convoluted.
Definition at line 1276 of file Sensor.cc.
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 | ||
) |
Definition at line 290 of file Sensor.cc.
Referenced by IsInTrapRadius().
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 Component::IsWireCrossed.
Definition at line 276 of file Sensor.cc.
Referenced by Garfield::DriftLineRKF::FieldLine(), and IsWireCrossed().
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 116 of file Sensor.cc.
Referenced by Heed::HeedFieldMap::field_map().
|
inline |
void Garfield::Sensor::PrintTransferFunction | ( | ) |
Print some information about the presently set transfer function.
Definition at line 1050 of file Sensor.cc.
bool Garfield::Sensor::SetArea | ( | ) |
Set the user area to the default.
Definition at line 183 of file Sensor.cc.
Referenced by GetArea(), IsInArea(), main(), and Garfield::ViewField::PlotFieldLines().
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 208 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 443 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 900 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 820 of file Sensor.cc.
Referenced by main().
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 991 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 979 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 131 of file Sensor.cc.
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 147 of file Sensor.cc.