15#include <TApplication.h>
31int main(
int argc,
char* argv[]) {
33 TApplication app(
"app", &argc, argv);
37 const double lem_th = 0.04;
39 const double lem_cpth = 0.0035;
41 const double lem_pitch = 0.07;
43 const double axis_x = 0.1;
45 const double axis_y = 0.1;
46 const double axis_z = 0.25 + lem_th / 2 + lem_cpth;
58 "gemcell/mesh.header",
"gemcell/mesh.elements",
"gemcell/mesh.nodes",
59 "gemcell/dielectrics.dat",
"gemcell/gemcell.result",
"cm");
69 sensor.
SetArea(-axis_x, -axis_y, -axis_z, axis_x, axis_y, axis_z);
72 const double tEnd = 500.0;
73 const int nsBins = 500;
81 viewDrift.
SetArea(-axis_x, -axis_y, -axis_z, axis_x, axis_y, axis_z);
86 const double zi = 0.5 * lem_th + lem_cpth + 0.1;
89 double xi = ri * cos(thetai);
90 double yi = ri * sin(thetai);
93 std::cout <<
"... avalanche complete with "
97 double bscale = tEnd / nsBins;
101 TFile* f =
new TFile(
"avalanche_signals.root",
"RECREATE");
102 TH1F* hS =
new TH1F(
"hh",
"hh", nsBins, 0, tEnd);
103 TH1F* hInt =
new TH1F(
"hInt",
"hInt", nsBins, 0, tEnd);
110 for (
int i = 0; i < nsBins; i++) {
111 double wt = sensor.
GetSignal(
"wtlel", i) / ElementaryCharge;
113 hS->Fill(i * bscale, wt);
114 hInt->Fill(i * bscale, sum);
123 const bool plotSignal =
false;
125 TCanvas* cSignal =
new TCanvas(
"signal",
"Signal");
133 TCanvas* cGeom =
new TCanvas(
"geom",
"Geometry/Avalanche/Fields");
134 cGeom->SetLeftMargin(0.14);
135 const bool plotContours =
false;
140 vf->
SetArea(-axis_x, -axis_y, axis_x, axis_y);
149 vFE.
SetArea(-axis_x, -axis_z, -axis_y, axis_x, axis_z, axis_y);
int main(int argc, char *argv[])
Calculate electron drift lines and avalanches using microscopic tracking.
size_t GetNumberOfElectronEndpoints() const
bool AvalancheElectron(const double x, const double y, const double z, const double t, const double e, const double dx=0., const double dy=0., const double dz=0.)
Calculate an avalanche initiated by a given electron.
void EnablePlotting(ViewDrift *view, const size_t nColl=100)
Switch on drift line plotting.
Component for importing field maps computed by Elmer.
void SetGas(Medium *medium)
void EnablePeriodicityX(const bool on=true)
Enable simple periodicity in the direction.
void EnableMirrorPeriodicityY(const bool on=true)
Enable mirror periodicity in the direction.
void SetTemperature(const double t)
Set the temperature [K].
void SetPressure(const double p)
void AddComponent(Component *comp)
Add a component.
double GetSignal(const std::string &label, const unsigned int bin)
Retrieve the total signal for a given electrode and time bin.
bool SetArea(const bool verbose=false)
Set the user area to the default.
void SetCanvas(TPad *pad)
Set the canvas to be painted on.
void SetArea(const double xmin, const double ymin, const double xmax, const double ymax)
virtual void SetPlane(const double fx, const double fy, const double fz, const double x0, const double y0, const double z0)
Visualize drift lines and tracks.
Draw the mesh of a field-map component.
bool Plot(const bool twod=true)
Plot method to be called by user.
void SetYaxisTitle(const std::string &ytitle)
void SetViewDrift(ViewDrift *vd)
Set the optional associated ViewDrift.
void SetXaxisTitle(const std::string &xtitle)
void SetPlane(const double fx, const double fy, const double fz, const double x0, const double y0, const double z0) override
void SetComponent(ComponentFieldMap *cmp)
Set the component from which to retrieve the mesh and field.
void SetColor(int matID, int colorID)
void SetFillMesh(const bool f)
Element fill switch; 2D only, set false for wireframe mesh.
Visualize the potential or electric field of a component or sensor.
void SetNumberOfSamples2d(const unsigned int nx, const unsigned int ny)
Set the number of points used for drawing 2D functions.
void PlotContour(const std::string &option="v")
void SetNumberOfContours(const unsigned int n)
Set the number of contour levels.
void SetSensor(Sensor *s)
Set the sensor for which to plot the field.
Plot the signal computed by a sensor as a ROOT histogram.
void SetSensor(Sensor *s)
Set the sensor from which to retrieve the signal.
void PlotSignal(const std::string &label, const std::string &optTotal="t", const std::string &optPrompt="", const std::string &optDelayed="", const bool same=false)
double RndmUniform()
Draw a random number uniformly distributed in the range [0, 1).