31 {
32
33 TApplication app("app", &argc, argv);
34
35
36
37 const double lem_th = 0.04;
38
39 const double lem_cpth = 0.0035;
40
41 const double lem_pitch = 0.07;
42
43 const double axis_x = 0.1;
44
45 const double axis_y = 0.1;
46 const double axis_z = 0.25 + lem_th / 2 + lem_cpth;
47
48
49
51
53
55
57
59
60
62 "gemcell/mesh.header", "gemcell/mesh.elements", "gemcell/mesh.nodes",
63 "gemcell/dielectrics.dat", "gemcell/gemcell.result", "cm");
67
68
69
70
73 sensor->
SetArea(-axis_x, -axis_y, -axis_z, axis_x, axis_y, axis_z);
74
75
76 const double tEnd = 500.0;
77 const int nsBins = 500;
78
79
80
84
85
86
88 viewDrift->
SetArea(-axis_x, -axis_y, -axis_z, axis_x, axis_y, axis_z);
90
91
92
93 const double zi = 0.5 * lem_th + lem_cpth + 0.1;
96 double xi = ri *
cos(thetai);
97 double yi = ri *
sin(thetai);
98
100 std::cout << "... avalanche complete with "
102
103
104 double bscale = tEnd / nsBins;
105 double sum = 0.;
106
107
108 TFile* f = new TFile("avalanche_signals.root", "RECREATE");
109 TH1F* hS = new TH1F("hh", "hh", nsBins, 0, tEnd);
110 TH1F* hInt = new TH1F("hInt", "hInt", nsBins, 0, tEnd);
111
112
113
114
115
116
117 for (int i = 0; i < nsBins; i++) {
118 double wt = sensor->
GetSignal(
"wtlel", i) / ElementaryCharge;
119 sum += wt;
120 hS->Fill(i * bscale, wt);
121 hInt->Fill(i * bscale, sum);
122 }
123
124
125 hS->Write();
126 hInt->Write();
127 f->Close();
128
129
130 const bool plotSignal = false;
131 if (plotSignal) {
132 TCanvas* cSignal = new TCanvas("signal", "Signal");
137 }
138
139
140 TCanvas* cGeom = new TCanvas("geom", "Geometry/Avalanche/Fields");
141 cGeom->SetLeftMargin(0.14);
142 const bool plotContours = false;
143 if (plotContours) {
147 vf->
SetArea(-axis_x, -axis_y, axis_x, axis_y);
152 }
153
154
156 vFE->
SetArea(-axis_x, -axis_z, -axis_y, axis_x, axis_z, axis_y);
164 if (!plotContours) {
170 }
171
172 app.Run(kTRUE);
173
174 return 0;
175}
Calculate electron drift lines and avalanches using microscopic tracking.
void EnablePlotting(ViewDrift *view)
Switch on drift line plotting.
void SetCollisionSteps(const unsigned int n)
Set number of collisions to be skipped for plotting.
void SetSensor(Sensor *sensor)
Set the sensor.
bool AvalancheElectron(const double x0, const double y0, const double z0, const double t0, const double e0, const double dx0=0., const double dy0=0., const double dz0=0.)
Calculate an avalanche initiated by a given electron.
unsigned int GetNumberOfElectronEndpoints() const
void EnablePeriodicityX(const bool on=true)
Enable simple periodicity in the direction.
void EnableMirrorPeriodicityY(const bool on=true)
Enable mirror periodicity in the direction.
Component for importing field maps computed by Elmer.
void SetMedium(const unsigned int imat, Medium *medium)
Associate a field map material with a Medium class.
bool SetComposition(const std::string &gas1, const double f1=1., const std::string &gas2="", const double f2=0., const std::string &gas3="", const double f3=0., const std::string &gas4="", const double f4=0., const std::string &gas5="", const double f5=0., const std::string &gas6="", const double f6=0.)
Set the gas mixture.
void SetTemperature(const double t)
Set the temperature [K].
virtual void EnableDrift(const bool on=true)
Switch electron/ion/hole on/off.
void SetPressure(const double p)
bool SetArea()
Set the user area to the default.
double GetSignal(const std::string &label, const unsigned int bin)
Retrieve the total signal for a given electrode and time bin.
void AddComponent(ComponentBase *comp)
Add a component.
void SetCanvas(TCanvas *c)
Set the canvas to be painted on.
Visualize drift lines and tracks.
void SetArea(const double xmin, const double ymin, const double zmin, const double xmax, const double ymax, const double zmax)
Set the region to be plotted.
Draw the mesh of a field-map component.
void SetXaxisTitle(const char *xtitle)
void SetComponent(ComponentFieldMap *comp)
Set the component from which to retrieve the mesh and field.
void SetViewDrift(ViewDrift *vd)
Set the optional associated ViewDrift.
void SetYaxisTitle(const char *ytitle)
bool Plot()
Plot method to be called by user.
void SetPlane(double fx, double fy, double fz, double x0, double y0, double z0)
Set the projection plane.
void SetArea()
Set area to be plotted to the default.
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 SetPlane(const double fx, const double fy, const double fz, const double x0, const double y0, const double z0)
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 (at most 50).
void SetArea(const double xmin, const double ymin, const double xmax, const double ymax)
Set the viewing area (in local coordinates of the current viewing plane).
void SetSensor(Sensor *s)
Set the sensor from which to retrieve 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 bool total=true, const bool electron=false, const bool ion=false, const bool delayed=false)
double RndmUniform()
Draw a random number uniformly distributed in the range [0, 1).
DoubleAc cos(const DoubleAc &f)
DoubleAc sin(const DoubleAc &f)