Garfield++ v2r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
ViewSignal.hh
Go to the documentation of this file.
1#ifndef G_VIEW_SIGNAL
2#define G_VIEW_SIGNAL
3
4#include <string>
5
6#include <TCanvas.h>
7#include <TH1D.h>
8#include <TGraph.h>
9
10namespace Garfield {
11
12class Sensor;
13
14/// Plot the signal computed by a sensor as a ROOT histogram.
15
17
18 public:
19 /// Constructor
20 ViewSignal();
21 /// Destructor
23
24 /// Set the sensor from which to retrieve the signal.
25 void SetSensor(Sensor* s);
26 /// Set the pad on which to draw the histogram.
27 void SetCanvas(TCanvas* c);
28
29 /** Plot the signal.
30 * \param label Identifier (weighting field) of the signal to be plotted.
31 * \param total Flag whether to plot the total induced signal.
32 * \param electron Flag whether to plot the electron-induced signal.
33 * \param ion Flag whether to plot the ion/hole-induced signal.
34 */
35 void PlotSignal(const std::string& label, const bool total = true,
36 const bool electron = false, const bool ion = false);
37 /** Retrieve the histogram for the induced signal.
38 * \param h histogram to be returned
39 ('t': total, 'e': electron-induced, 'h': ion-induced).
40 **/
41 TH1D* GetHistogram(const char h = 't') {
42 return h == 'e' ? m_hSignalElectrons : 'i' ? m_hSignalIons : m_hSignal;
43 }
44
45 /// Enable/disable debugging output.
46 void EnableDebugging(const bool on = true) { m_debug = on; }
47
48 private:
49 std::string m_className;
50
51 // Options
52 bool m_debug;
53
54 // Sensor
55 Sensor* m_sensor;
56
57 // Canvas
58 TCanvas* m_canvas;
59 bool m_hasExternalCanvas;
60
61 // Histograms
62 TH1D* m_hSignal;
63 TH1D* m_hSignalElectrons;
64 TH1D* m_hSignalIons;
65
66 // Threshold crossings
67 TGraph* m_gCrossings;
68
69 // Find an unused histogram name.
70 std::string FindHistogramName(const std::string& base) const;
71};
72}
73#endif
Plot the signal computed by a sensor as a ROOT histogram.
Definition: ViewSignal.hh:16
void EnableDebugging(const bool on=true)
Enable/disable debugging output.
Definition: ViewSignal.hh:46
ViewSignal()
Constructor.
Definition: ViewSignal.cc:12
TH1D * GetHistogram(const char h='t')
Definition: ViewSignal.hh:41
~ViewSignal()
Destructor.
Definition: ViewSignal.cc:24
void PlotSignal(const std::string &label, const bool total=true, const bool electron=false, const bool ion=false)
Definition: ViewSignal.cc:53
void SetSensor(Sensor *s)
Set the sensor from which to retrieve the signal.
Definition: ViewSignal.cc:33
void SetCanvas(TCanvas *c)
Set the pad on which to draw the histogram.
Definition: ViewSignal.cc:42