Belle II Software development
SVDSummaryPlots Class Reference

class to summarize SVD quantities per sensor and side More...

#include <SVDSummaryPlots.h>

Inheritance diagram for SVDSummaryPlots:

Public Types

enum  E_side {
  VIndex = 0 ,
  UIndex = 1
}
 This enumeration assure the same semantic of the isU methods defined by Peter Kv. More...
 

Public Member Functions

 SVDSummaryPlots ()
 Default constructor.
 
 SVDSummaryPlots (TString name, TString title)
 this is the default constructor
 
 ~SVDSummaryPlots ()
 clean everything in the destructor
 
TH2F * getHistogram (int view)
 get a reference to the histogram for
 
float getValue (const VxdID &vxdID, int view)
 get the value contained in the corresponding bin, given VxdID and view
 
float getValue (int layer, int ladder, int sensor, int view)
 get the value contained in the corresponding bin, given
 
void fill (int layer, int ladder, int sensor, int view, float value)
 fill the histogram for
 
void fill (const VxdID &vxdID, int view, float value)
 fill the histogram for
 
void setRunID (const TString &runID)
 set run ids in title
 
void reset ()
 Reset histograms.
 
void setStats (bool stats=true)
 set histograms stat
 
void fill (const VxdID &vxdID, bool isU, float value)
 fill the histogram for
 
void customizeString (std::string &base, bool isU)
 replaces layer ladder sensor view and apv with the current numbers
 
void clean ()
 delete pointers
 

Private Member Functions

Int_t findBinY (Int_t layer, Int_t sensor)
 find the Y bin given the layer and sensor number
 
void customize (TH2F &histogram, int view)
 customize the histogram with the sensor, view
 
 ClassDef (SVDSummaryPlots, 2)
 needed by root
 

Private Attributes

TH2F * m_histos [2]
 vector containing the U and V histograms
 
TH2F * m_defaultHistogram = nullptr
 default histograms
 
TString m_Title [2]
 Base title.
 

Detailed Description

class to summarize SVD quantities per sensor and side

Definition at line 23 of file SVDSummaryPlots.h.

Member Enumeration Documentation

◆ E_side

enum E_side

This enumeration assure the same semantic of the isU methods defined by Peter Kv.

Definition at line 58 of file SVDSummaryPlots.h.

58{ VIndex = 0, UIndex = 1 };

Constructor & Destructor Documentation

◆ SVDSummaryPlots() [1/2]

SVDSummaryPlots ( )
inline

Default constructor.

Definition at line 27 of file SVDSummaryPlots.h.

27 :
28 SVDSummaryPlots("", "") {};
SVDSummaryPlots()
Default constructor.

◆ SVDSummaryPlots() [2/2]

SVDSummaryPlots ( TString  name,
TString  title 
)
inline

this is the default constructor

Parameters
namehistogram name
titlehistogram title

Definition at line 34 of file SVDSummaryPlots.h.

35 {
36 m_defaultHistogram = new TH2F(name.Data(), title.Data(),
37 16, 0.5, 16.5,
38 19, 0, 19);
39
40 for (int view = VIndex ; view < UIndex + 1; view++) {
41 std::string hname = name.Data();
42 bool isU = (view == UIndex);
43 customizeString(hname, isU);
44 m_histos[view] = new TH2F(hname.c_str(), title.Data(),
45 16, 0.5, 16.5,
46 19, 0, 19);
47 customize(*m_histos[view], view);
48 m_Title[view] = m_histos[view]->GetTitle();
49 }
50 }
TH2F * m_histos[2]
vector containing the U and V histograms
void customizeString(std::string &base, bool isU)
replaces layer ladder sensor view and apv with the current numbers
TString m_Title[2]
Base title.
void customize(TH2F &histogram, int view)
customize the histogram with the sensor, view
TH2F * m_defaultHistogram
default histograms

◆ ~SVDSummaryPlots()

~SVDSummaryPlots ( )
inline

clean everything in the destructor

Definition at line 54 of file SVDSummaryPlots.h.

54{ clean(); };
void clean()
delete pointers

Member Function Documentation

◆ clean()

void clean ( )
inline

delete pointers

Definition at line 177 of file SVDSummaryPlots.h.

178 {
179 delete m_histos[0];
180 delete m_histos[1];
181 delete m_defaultHistogram;
182 }

◆ customize()

void customize ( TH2F &  histogram,
int  view 
)
inlineprivate

customize the histogram with the sensor, view

Definition at line 209 of file SVDSummaryPlots.h.

210 {
211
212 const int nY = 19;
213 TString Ylabels[nY] = {"", "L3.x.1", "L3.x.2",
214 " ", "L4.x.1", "L4.x.2", "L4.x.3",
215 " ", "L5.x.1", "L5.x.2", "L5.x.3", "L5.x.4",
216 " ", "L6.x.1", "L6.x.2", "L6.x.3", "L6.x.4", "L6.x.5", " "
217 };
218
219 histogram.SetMarkerSize(1.1);
220 histogram.GetXaxis()->SetTitle("ladder number");
221 histogram.GetXaxis()->SetLabelSize(0.04);
222 for (unsigned short i = 0; i < nY; i++)
223 histogram.GetYaxis()->SetBinLabel(i + 1, Ylabels[i].Data());
224
225 bool isU = view == UIndex;
226 std::string title = histogram.GetTitle();
227 customizeString(title, isU);
228 histogram.SetTitle(title.c_str());
229
230 std::string xAxis = histogram.GetXaxis()->GetTitle();
231 customizeString(xAxis, isU);
232 histogram.SetXTitle(xAxis.c_str());
233
234 std::string yAxis = histogram.GetYaxis()->GetTitle();
235 customizeString(yAxis, isU);
236 histogram.SetYTitle(yAxis.c_str());
237
238 std::string zAxis = histogram.GetZaxis()->GetTitle();
239 customizeString(zAxis, isU);
240 histogram.SetZTitle(zAxis.c_str());
241
242 }

◆ customizeString()

void customizeString ( std::string &  base,
bool  isU 
)
inline

replaces layer ladder sensor view and apv with the current numbers

Definition at line 168 of file SVDSummaryPlots.h.

169 {
170 std::string view = isU ? "U" : "V" ;
171 base = std::regex_replace(base, std::regex("[@]view"), view);
172 std::string side = isU ? "P" : "N" ;
173 base = std::regex_replace(base, std::regex("[@]side"), side);
174 }

◆ fill() [1/3]

void fill ( const VxdID vxdID,
bool  isU,
float  value 
)
inline

fill the histogram for

Parameters
vxdIDside
isUwith
value

Definition at line 156 of file SVDSummaryPlots.h.

157 {
158 int view = isU ? UIndex : VIndex;
159
160 int layer = vxdID.getLayerNumber();
161 int ladder = vxdID.getLadderNumber();
162 int sensor = vxdID.getSensorNumber();
163
164 getHistogram(view)->Fill(ladder, findBinY(layer, sensor), value);
165 }
Int_t findBinY(Int_t layer, Int_t sensor)
find the Y bin given the layer and sensor number
TH2F * getHistogram(int view)
get a reference to the histogram for

◆ fill() [2/3]

void fill ( const VxdID vxdID,
int  view,
float  value 
)
inline

fill the histogram for

Parameters
vxdID
viewwith
value

Definition at line 115 of file SVDSummaryPlots.h.

116 {
117 int layer = vxdID.getLayerNumber();
118 int ladder = vxdID.getLadderNumber();
119 int sensor = vxdID.getSensorNumber();
120
121 getHistogram(view)->Fill(ladder, findBinY(layer, sensor), value);
122 }

◆ fill() [3/3]

void fill ( int  layer,
int  ladder,
int  sensor,
int  view,
float  value 
)
inline

fill the histogram for

Parameters
layer
ladder
sensor
viewwith
value

Definition at line 107 of file SVDSummaryPlots.h.

108 {
109 getHistogram(view)->Fill(ladder, findBinY(layer, sensor), value);
110 }

◆ findBinY()

Int_t findBinY ( Int_t  layer,
Int_t  sensor 
)
inlineprivate

find the Y bin given the layer and sensor number

Definition at line 187 of file SVDSummaryPlots.h.

188 {
189
190 if (layer == 3)
191 return sensor; //2
192 if (layer == 4)
193 return 2 + 1 + sensor; //6
194 if (layer == 5)
195 return 6 + 1 + sensor; // 11
196 if (layer == 6)
197 return 11 + 1 + sensor; // 17
198 else
199 return -1;
200 }

◆ getHistogram()

TH2F * getHistogram ( int  view)
inline

get a reference to the histogram for

Parameters
viewplease, use the enumeration SVDSummaryPlots::Vindex and SVDSummaryPlots::UIndex

Definition at line 63 of file SVDSummaryPlots.h.

64 {
65 TH2F* returnValue = m_defaultHistogram;
66 try {
67 returnValue = m_histos[view];
68 } catch (...) {
69 B2WARNING("Unexpected view: " << view);
70
71 returnValue = m_defaultHistogram;
72 }
73
74 return returnValue;
75 }

◆ getValue() [1/2]

float getValue ( const VxdID vxdID,
int  view 
)
inline

get the value contained in the corresponding bin, given VxdID and view

Definition at line 78 of file SVDSummaryPlots.h.

79 {
80 int layer = vxdID.getLayerNumber();
81 int ladder = vxdID.getLadderNumber();
82 int sensor = vxdID.getSensorNumber();
83
84 int bin = m_histos[view]->FindBin(ladder, findBinY(layer, sensor));
85 return getHistogram(view)->GetBinContent(bin);
86 }

◆ getValue() [2/2]

float getValue ( int  layer,
int  ladder,
int  sensor,
int  view 
)
inline

get the value contained in the corresponding bin, given

Parameters
layer
ladder
sensor
view

Definition at line 94 of file SVDSummaryPlots.h.

95 {
96 int bin = m_histos[view]->FindBin(ladder, findBinY(layer, sensor));
97 return getHistogram(view)->GetBinContent(bin);
98 }

◆ reset()

void reset ( )
inline

Reset histograms.

Definition at line 140 of file SVDSummaryPlots.h.

141 {
142 for (int view = VIndex ; view < UIndex + 1; view++)
143 getHistogram(view)->Reset();
144 }

◆ setRunID()

void setRunID ( const TString &  runID)
inline

set run ids in title

Parameters
runID

Definition at line 127 of file SVDSummaryPlots.h.

128 {
129 for (int view = VIndex ; view < UIndex + 1; view++) {
130 // add blank if needed before adding runID
131 if (!m_Title[view].EndsWith(" "))
132 m_Title[view].Append(" ");
133
134 getHistogram(view)->SetTitle(m_Title[view] + runID);
135 }
136 }

◆ setStats()

void setStats ( bool  stats = true)
inline

set histograms stat

Parameters
stats

Definition at line 149 of file SVDSummaryPlots.h.

150 {
151 for (int view = VIndex ; view < UIndex + 1; view++)
152 getHistogram(view)->SetStats(stats);
153 }

Member Data Documentation

◆ m_defaultHistogram

TH2F* m_defaultHistogram = nullptr
private

default histograms

Definition at line 204 of file SVDSummaryPlots.h.

◆ m_histos

TH2F* m_histos[2]
private

vector containing the U and V histograms

Definition at line 202 of file SVDSummaryPlots.h.

◆ m_Title

TString m_Title[2]
private

Base title.

Definition at line 206 of file SVDSummaryPlots.h.


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