Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::PlottingEngineRoot Class Reference

Definition of styles and color schemes. More...

#include <PlottingEngineRoot.hh>

+ Inheritance diagram for Garfield::PlottingEngineRoot:

Public Member Functions

 PlottingEngineRoot ()
 Constructor.
 
virtual ~PlottingEngineRoot ()
 Destructor.
 
void SetDefaultStyle ()
 Apply the default Garfield ROOT style.
 
int GetRootColorLine1 ()
 
int GetRootColorLine2 ()
 
int GetRootColorElectron ()
 
int GetRootColorHole ()
 
int GetRootColorIon ()
 
int GetRootColorPhoton ()
 
int GetRootColorChargedParticle ()
 
bool GetRootColor (std::string color, int &rootcol)
 
- Public Member Functions inherited from Garfield::PlottingEngine
 PlottingEngine ()=delete
 Default constructor.
 
 PlottingEngine (const std::string &name)
 Constructor.
 
virtual ~PlottingEngine ()
 Destructor.
 
void SetSerif ()
 Use serif font.
 
void SetSansSerif ()
 Use sans-serif font.
 
void SetLineColor1 (const std::string &col)
 
void SetLineColor2 (const std::string &col)
 
void SetElectronColor (const std::string &col)
 
void SetHoleColor (const std::string &col)
 
void SetIonColor (const std::string &col)
 
void SetPhotonColor (const std::string &col)
 
void SetChargedParticleColor (const std::string &col)
 
std::string GetLineColor1 () const
 
std::string GetLineColor2 () const
 
std::string GetElectronColor () const
 
std::string GetHoleColor () const
 
std::string GetIonColor () const
 
std::string GetPhotonColor () const
 
std::string GetChargedParticleColor () const
 
void EnableDebugging (const bool on=true)
 Switch debugging messages on/off.
 

Additional Inherited Members

- Protected Attributes inherited from Garfield::PlottingEngine
std::string m_className = "PlottingEngine"
 
bool m_serif = false
 
std::string m_colorLine1 = "dark-blue"
 
std::string m_colorLine2 = "olive"
 
std::string m_colorElectron = "orange"
 
std::string m_colorHole = "red"
 
std::string m_colorIon = "dark-red"
 
std::string m_colorPhoton = "blue"
 
std::string m_colorChargedParticle = "dark-green"
 
bool m_debug = false
 

Detailed Description

Definition of styles and color schemes.

Definition at line 12 of file PlottingEngineRoot.hh.

Constructor & Destructor Documentation

◆ PlottingEngineRoot()

Garfield::PlottingEngineRoot::PlottingEngineRoot ( )

Constructor.

Definition at line 15 of file PlottingEngineRoot.cc.

16 : PlottingEngine("PlottingEngineRoot"),
17 m_garfieldStyle("Garfield", "Garfield Style") {}
PlottingEngine()=delete
Default constructor.

◆ ~PlottingEngineRoot()

Garfield::PlottingEngineRoot::~PlottingEngineRoot ( )
virtual

Destructor.

Definition at line 19 of file PlottingEngineRoot.cc.

19{}

Member Function Documentation

◆ GetRootColor()

bool Garfield::PlottingEngineRoot::GetRootColor ( std::string  color,
int &  rootcol 
)

Definition at line 164 of file PlottingEngineRoot.cc.

164 {
165 rootcol = kBlack;
166
167 // Convert to upper-case.
168 for (unsigned int i = 0; i < color.length(); ++i) {
169 color[i] = toupper(color[i]);
170 }
171
172 if (color == "BLACK") {
173 rootcol = kBlack;
174 return true;
175 }
176 if (color == "RED") {
177 rootcol = kRed + 1;
178 return true;
179 } else if (color == "GREEN") {
180 rootcol = kGreen + 2;
181 return true;
182 } else if (color == "BLUE") {
183 rootcol = kBlue + 2;
184 return true;
185 } else if (color == "DARK-RED") {
186 rootcol = kRed + 3;
187 return true;
188 } else if (color == "DARK-GREEN") {
189 rootcol = kGreen + 3;
190 return true;
191 } else if (color == "DARK-BLUE") {
192 rootcol = kBlue + 3;
193 return true;
194 } else if (color == "ORANGE") {
195 rootcol = kOrange - 3;
196 return true;
197 } else if (color == "PURPLE") {
198 rootcol = kViolet - 7;
199 return true;
200 } else if (color == "CYAN") {
201 rootcol = kCyan + 3;
202 return true;
203 } else if (color == "OLIVE") {
204 rootcol = kSpring + 4;
205 return true;
206 }
207 if (m_debug) {
208 std::cerr << m_className << "::GetRootColor:\n";
209 std::cerr << " Unknown color (" << color << ").\n";
210 }
211 return false;
212}

Referenced by GetRootColorChargedParticle(), GetRootColorElectron(), GetRootColorHole(), GetRootColorIon(), GetRootColorLine1(), GetRootColorLine2(), and GetRootColorPhoton().

◆ GetRootColorChargedParticle()

int Garfield::PlottingEngineRoot::GetRootColorChargedParticle ( )

Definition at line 155 of file PlottingEngineRoot.cc.

155 {
156 int rootcol = 0;
157 if (!GetRootColor(m_colorChargedParticle, rootcol)) {
158 m_colorChargedParticle = m_colorChargedParticleDefault;
160 }
161 return rootcol;
162}
bool GetRootColor(std::string color, int &rootcol)
std::string m_colorChargedParticle

◆ GetRootColorElectron()

int Garfield::PlottingEngineRoot::GetRootColorElectron ( )

Definition at line 119 of file PlottingEngineRoot.cc.

119 {
120 int rootcol = 0;
121 if (!GetRootColor(m_colorElectron, rootcol)) {
122 m_colorElectron = m_colorElectronDefault;
124 }
125 return rootcol;
126}

Referenced by Garfield::ViewDrift::NewElectronDriftLine(), and Garfield::ViewSignal::PlotSignal().

◆ GetRootColorHole()

int Garfield::PlottingEngineRoot::GetRootColorHole ( )

Definition at line 128 of file PlottingEngineRoot.cc.

128 {
129 int rootcol = 0;
130 if (!GetRootColor(m_colorHole, rootcol)) {
131 m_colorHole = m_colorHoleDefault;
132 GetRootColor(m_colorHole, rootcol);
133 }
134 return rootcol;
135}

Referenced by Garfield::ViewDrift::NewHoleDriftLine().

◆ GetRootColorIon()

int Garfield::PlottingEngineRoot::GetRootColorIon ( )

Definition at line 137 of file PlottingEngineRoot.cc.

137 {
138 int rootcol = 0;
139 if (!GetRootColor(m_colorIon, rootcol)) {
140 m_colorIon = m_colorIonDefault;
141 GetRootColor(m_colorIon, rootcol);
142 }
143 return rootcol;
144}

Referenced by Garfield::ViewSignal::PlotSignal().

◆ GetRootColorLine1()

int Garfield::PlottingEngineRoot::GetRootColorLine1 ( )

Definition at line 101 of file PlottingEngineRoot.cc.

101 {
102 int rootcol = 0;
103 if (!GetRootColor(m_colorLine1, rootcol)) {
104 m_colorLine1 = m_colorLine1Default;
105 GetRootColor(m_colorLine1, rootcol);
106 }
107 return rootcol;
108}

Referenced by Garfield::ViewSignal::PlotSignal().

◆ GetRootColorLine2()

int Garfield::PlottingEngineRoot::GetRootColorLine2 ( )

Definition at line 110 of file PlottingEngineRoot.cc.

110 {
111 int rootcol = 0;
112 if (!GetRootColor(m_colorLine2, rootcol)) {
113 m_colorLine2 = m_colorLine2Default;
114 GetRootColor(m_colorLine2, rootcol);
115 }
116 return rootcol;
117}

◆ GetRootColorPhoton()

int Garfield::PlottingEngineRoot::GetRootColorPhoton ( )

Definition at line 146 of file PlottingEngineRoot.cc.

146 {
147 int rootcol = 0;
148 if (!GetRootColor(m_colorPhoton, rootcol)) {
149 m_colorPhoton = m_colorPhotonDefault;
150 GetRootColor(m_colorPhoton, rootcol);
151 }
152 return rootcol;
153}

Referenced by Garfield::ViewDrift::NewPhotonTrack().

◆ SetDefaultStyle()

void Garfield::PlottingEngineRoot::SetDefaultStyle ( )

Apply the default Garfield ROOT style.

Definition at line 21 of file PlottingEngineRoot.cc.

21 {
22 m_garfieldStyle.Reset();
23 m_garfieldStyle.SetFillColor(1);
24 m_garfieldStyle.SetFillStyle(1001);
25 m_garfieldStyle.SetCanvasBorderMode(0);
26 m_garfieldStyle.SetCanvasColor(0);
27 m_garfieldStyle.SetCanvasDefH(600);
28 m_garfieldStyle.SetCanvasDefW(600);
29 m_garfieldStyle.SetPadBorderMode(0);
30 m_garfieldStyle.SetPadColor(0);
31 m_garfieldStyle.SetPadLeftMargin(0.15);
32 m_garfieldStyle.SetPadBottomMargin(0.1);
33 m_garfieldStyle.SetPadRightMargin(0.05);
34 m_garfieldStyle.SetPadTopMargin(0.05);
35 m_garfieldStyle.SetPadTickX(1);
36 m_garfieldStyle.SetPadTickY(1);
37 m_garfieldStyle.SetFrameFillColor(0);
38 m_garfieldStyle.SetFrameBorderMode(0);
39 m_garfieldStyle.SetDrawBorder(0);
40 m_garfieldStyle.SetLegendBorderSize(0);
41
42 m_garfieldStyle.SetGridColor(kGray);
43 m_garfieldStyle.SetGridStyle(3);
44 m_garfieldStyle.SetGridWidth(1);
45 m_garfieldStyle.SetPadGridX(kTRUE);
46 m_garfieldStyle.SetPadGridY(kTRUE);
47
48 const int font = m_serif ? 132 : 42;
49 const double tsize = 0.04;
50 m_garfieldStyle.SetTextFont(font);
51 m_garfieldStyle.SetTextSize(tsize);
52 m_garfieldStyle.SetTitleStyle(0);
53 m_garfieldStyle.SetTitleBorderSize(0);
54 m_garfieldStyle.SetTitleColor(1, "xyz");
55 m_garfieldStyle.SetTitleColor(1, "t");
56 m_garfieldStyle.SetTitleFillColor(0);
57 m_garfieldStyle.SetTitleFont(font, "xyz");
58 m_garfieldStyle.SetTitleFont(font, "t");
59 m_garfieldStyle.SetTitleOffset(1.2, "x");
60 m_garfieldStyle.SetTitleOffset(0, "y");
61 m_garfieldStyle.SetTitleSize(tsize, "xyz");
62 m_garfieldStyle.SetTitleSize(tsize, "t");
63
64 m_garfieldStyle.SetLegendFont(font);
65 m_garfieldStyle.SetStatStyle(0);
66 m_garfieldStyle.SetStatBorderSize(0);
67 m_garfieldStyle.SetStatColor(0);
68 m_garfieldStyle.SetStatFont(font);
69 m_garfieldStyle.SetStatFontSize(tsize);
70 m_garfieldStyle.SetStatX(0.88);
71 m_garfieldStyle.SetStatY(0.88);
72 m_garfieldStyle.SetStatW(0.25);
73 m_garfieldStyle.SetStatH(0.1);
74 m_garfieldStyle.SetOptStat(111110);
75 m_garfieldStyle.SetStatFormat("6.3g");
76 m_garfieldStyle.SetLabelFont(font, "xyz");
77 m_garfieldStyle.SetLabelSize(tsize, "xyz");
78 m_garfieldStyle.SetLabelOffset(0.01, "xyz");
79 m_garfieldStyle.SetOptTitle(0);
80 m_garfieldStyle.SetPaperSize(TStyle::kA4);
81 m_garfieldStyle.SetFuncWidth(2);
82 m_garfieldStyle.SetHistLineColor(kOrange - 3);
83 // m_garfieldStyle.SetPalette(1);
84 m_garfieldStyle.SetAxisColor(kBlack, "X");
85 m_garfieldStyle.SetAxisColor(kBlack, "Y");
86 m_garfieldStyle.SetAxisColor(kBlack, "Z");
87 m_garfieldStyle.SetNdivisions(505, "x");
88 m_garfieldStyle.SetNdivisions(510, "y");
89 m_garfieldStyle.SetMarkerStyle(20);
90 m_garfieldStyle.SetMarkerSize(1.2);
91 const double lw = 2;
92 m_garfieldStyle.SetLineWidth(lw);
93 m_garfieldStyle.SetLineStyleString(2, "[12 12]");
94 m_garfieldStyle.SetFrameLineWidth(lw);
95 m_garfieldStyle.SetHistLineWidth(lw);
96 m_garfieldStyle.SetFuncWidth(lw);
97 m_garfieldStyle.SetGridWidth(lw);
98 m_garfieldStyle.cd();
99}

Referenced by Garfield::ViewBase::ViewBase(), and Garfield::ViewGeometry::ViewGeometry().


The documentation for this class was generated from the following files: