Garfield++ 5.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
ViewIsochrons.hh
Go to the documentation of this file.
1#ifndef G_VIEW_ISOCHRONS
2#define G_VIEW_ISOCHRONS
3
5#include "ViewBase.hh"
6
7namespace Garfield {
8
9class Sensor;
10class Component;
11
12/// Draw equal time contour lines.
13
14class ViewIsochrons : public ViewBase {
15 public:
16 /// Constructor.
18 /// Destructor.
19 ~ViewIsochrons() = default;
20
21 /// Set the sensor.
22 void SetSensor(Sensor* s);
23 /// Set the component.
24 void SetComponent(Component* c);
25
26 /** Draw equal time contour lines.
27 * \param tstep Time interval.
28 * \param points List of starting points.
29 * \param rev If true, the drift time is measured from the end
30 * points of the drift lines.
31 * \param colour Draw contour lines using colours.
32 * \param markers Draw markers (as opposed to lines).
33 * \param plotDriftLines Draw drift lines together with the isochrons.
34 */
35 void PlotIsochrons(const double tstep,
36 const std::vector<std::array<double, 3> >& points,
37 const bool rev = false,
38 const bool colour = false, const bool markers = false,
39 const bool plotDriftLines = true);
40
41 /// Request electron drift lines with negative (default) or
42 /// positive charge.
43 void DriftElectrons(const bool positive = false) {
44 m_particle = Particle::Electron;
45 m_positive = positive;
46 }
47 /// Request ion drift lines with positive (default) or negative charge.
48 void DriftIons(const bool negative = false) {
49 m_particle = Particle::Ion;
50 m_positive = !negative;
51 }
52 /// Sort (or not) the points on a contour line (default: sorting is done).
53 void EnableSorting(const bool on = true) { m_sortContours = on; }
54 /// Check (or not) that drift-lines do not cross isochrons
55 /// (default: check is done).
56 void CheckCrossings(const bool on = true) { m_checkCrossings = on; }
57 /// Set the aspect ratio above which an isochron is considered
58 /// linear (as opposed to circular).
59 void SetAspectRatioSwitch(const double ar);
60 /// Fractional distance between two points for closing a
61 /// circular isochron (default: 0.2).
62 void SetLoopThreshold(const double thr);
63 /// Fractional distance over which isochron segments are connected
64 /// (default: 0.2).
65 void SetConnectionThreshold(const double thr);
66
67 private:
68 Sensor* m_sensor = nullptr;
69 Component* m_component = nullptr;
70
71 // Type of particle to be used for computing drift lines.
72 Particle m_particle = Particle::Electron;
73 bool m_positive = false;
74
75 short m_markerStyle = 5;
76 short m_lineStyle = 2;
77
78 bool m_sortContours = true;
79 double m_aspectRatio = 3.;
80 double m_loopThreshold = 0.2;
81 double m_connectionThreshold = 0.2;
82 bool m_checkCrossings = true;
83
84 bool SetPlotLimits();
85
86 void ComputeDriftLines(const double tstep,
87 const std::vector<std::array<double, 3> >& points,
88 std::vector<std::vector<std::array<double, 3> > >& driftLines,
89 std::vector<std::array<double, 3> >& startPoints,
90 std::vector<std::array<double, 3> >& endPoints,
91 std::vector<int>& statusCodes, const bool rev = false);
92 void SortContour(
93 std::vector<std::pair<std::array<double, 4>, unsigned int> >& contour,
94 bool& circle);
95
96};
97}
98#endif
Abstract base class for components.
Definition Component.hh:13
ViewBase()=delete
Default constructor.
void SetComponent(Component *c)
Set the component.
void CheckCrossings(const bool on=true)
void DriftIons(const bool negative=false)
Request ion drift lines with positive (default) or negative charge.
void PlotIsochrons(const double tstep, const std::vector< std::array< double, 3 > > &points, const bool rev=false, const bool colour=false, const bool markers=false, const bool plotDriftLines=true)
void SetConnectionThreshold(const double thr)
~ViewIsochrons()=default
Destructor.
void DriftElectrons(const bool positive=false)
void SetAspectRatioSwitch(const double ar)
void EnableSorting(const bool on=true)
Sort (or not) the points on a contour line (default: sorting is done).
void SetLoopThreshold(const double thr)
void SetSensor(Sensor *s)
Set the sensor.