26 {
27
28 TApplication app("app", &argc, argv);
29
30
31
32 const double rwire = 1.0;
33
34 const double axis_x = 5;
35
36 const double axis_y = 5;
37 const double axis_z = 5;
38
39
41
42 gas.SetTemperature(293.15);
43
44 gas.SetPressure(740.);
45
46
48 "wire2d/mesh.header", "wire2d/mesh.elements", "wire2d/mesh.nodes",
49 "wire2d/dielectrics.dat", "wire2d/wire2d.result", "cm");
50 elm.SetGas(&gas);
51 elm.SetRangeZ(-5.,5.);
52
53
56 sensor.
SetArea(-axis_x, -axis_y, -axis_z, axis_x, axis_y, axis_z);
57
58
60
61
63 viewDrift.
SetArea(-axis_x, -axis_y, -axis_z, axis_x, axis_y, axis_z);
64 aval.EnablePlotting(&viewDrift, 100);
65
66
67 const double zi = 1.0;
68 double ri = rwire + 2.0;
70 double xi = ri *
cos(thetai);
71 double yi = ri *
sin(thetai);
72
73 std::cout << "Avalanche of a single electron starting from ("
74 << xi << ", " << yi << ", " << zi << ")..." << std::endl;
75 aval.AvalancheElectron(xi, yi, zi, 0., 0., 0., 0., 0.);
76
77 std::cout << "... avalanche complete with "
78 << aval.GetNumberOfElectronEndpoints() << " electron tracks.\n";
79
80
81 TCanvas* cGeom = new TCanvas("geom", "Geometry/Avalanche/Fields");
82 cGeom->SetLeftMargin(0.14);
83 const bool plotContours = false;
84 if (plotContours) {
88 vf->
SetArea(-axis_x, -axis_y, axis_x, axis_y);
93 }
94
95
97 vFE.
SetArea(-axis_x, -axis_z, -axis_y, axis_x, axis_z, axis_y);
103 if (!plotContours) {
107 }
110 app.Run();
111 return 0;
112}
Calculate electron drift lines and avalanches using microscopic tracking.
Component for importing two-dimensional field maps computed by Elmer.
void AddComponent(Component *comp)
Add a component.
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.
double RndmUniform()
Draw a random number uniformly distributed in the range [0, 1).
DoubleAc cos(const DoubleAc &f)
DoubleAc sin(const DoubleAc &f)