Belle II Software development
SVDHistograms< H > Class Template Reference

template class for SVd histograms More...

#include <SVDHistograms.h>

Inheritance diagram for SVDHistograms< H >:

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

 SVDHistograms ()
 Default constructor.
 
 SVDHistograms (const H &templateHisto)
 the class is built with a default histogram for L3 and L456, U and V sides
 
 SVDHistograms (const H &templateU3, const H &templateV3, const H &templateU456, const H &templateV456)
 Use templates to initialize all the histograms.
 
 ~SVDHistograms ()
 clean everything in the destructor
 
H * getHistogram (const VxdID &vxdID, int view)
 get a reference to the histogram for
 
template<class ... Types>
void fill (const VxdID &vxdID, int view, Types ... args)
 fill the histogram for
 
template<class ... Types>
void fill (const VxdID &vxdID, bool isU, Types ... args)
 fill the histogram for
 
void customizeString (std::string &base, const VxdID &vxdID, bool isU)
 replaces layer ladder sensor view and apv with the current numbers
 
void clean ()
 delete pointers
 
void reset ()
 Call Reset() on all histograms.
 

Private Types

typedef std::vector< H * > t_SVDSensor
 a vector of H, length = 2
 
typedef std::vector< t_SVDSensort_SVDLadder
 a vector of vector of H, length = # svd sensors
 
typedef std::vector< t_SVDLaddert_SVDLayer
 a vector of vector of vector of H, length = # ladders
 
typedef std::vector< t_SVDLayert_SVD
 a vector of vector of vector of vector of H, length = # layers
 

Private Member Functions

void customize (H &histogram, VxdID vxdID, int view)
 customize the histogram with the sensor, view
 
 ClassDef (SVDHistograms, 1)
 needed by root
 

Private Attributes

t_SVD m_histograms
 the vector of vector ... that contains all histograms
 
H * m_defaultHistogram
 the default histogram
 

Detailed Description

template<class H>
class Belle2::SVDHistograms< H >

template class for SVd histograms

Definition at line 24 of file SVDHistograms.h.

Member Typedef Documentation

◆ t_SVD

typedef std::vector< t_SVDLayer > t_SVD
private

a vector of vector of vector of vector of H, length = # layers

Definition at line 143 of file SVDHistograms.h.

◆ t_SVDLadder

typedef std::vector< t_SVDSensor > t_SVDLadder
private

a vector of vector of H, length = # svd sensors

Definition at line 137 of file SVDHistograms.h.

◆ t_SVDLayer

typedef std::vector< t_SVDLadder > t_SVDLayer
private

a vector of vector of vector of H, length = # ladders

Definition at line 140 of file SVDHistograms.h.

◆ t_SVDSensor

typedef std::vector< H* > t_SVDSensor
private

a vector of H, length = 2

Definition at line 134 of file SVDHistograms.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 51 of file SVDHistograms.h.

51{ VIndex = 0, UIndex = 1 };

Constructor & Destructor Documentation

◆ SVDHistograms() [1/2]

SVDHistograms ( )
inline

Default constructor.

Definition at line 28 of file SVDHistograms.h.

28 :
29 SVDHistograms(H(), H(), H(), H()) {};
SVDHistograms()
Default constructor.
Definition: SVDHistograms.h:28

◆ SVDHistograms() [2/2]

SVDHistograms ( const H &  templateHisto)
inlineexplicit

the class is built with a default histogram for L3 and L456, U and V sides

Use

Parameters
templateHistoto initialize all the histograms

Definition at line 32 of file SVDHistograms.h.

32 :
33 SVDHistograms(templateHisto, templateHisto,
34 templateHisto, templateHisto)
35 {};

◆ ~SVDHistograms()

~SVDHistograms ( )
inline

clean everything in the destructor

Definition at line 47 of file SVDHistograms.h.

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

Member Function Documentation

◆ clean()

void clean ( )
inline

delete pointers

Definition at line 107 of file SVDHistograms.h.

108 {
109
110 for (auto& layer : m_histograms)
111 for (auto& ladder : layer)
112 for (auto& sensor : ladder)
113 for (auto& view : sensor)
114 delete view;
115 }
t_SVD m_histograms
the vector of vector ... that contains all histograms

◆ customizeString()

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

replaces layer ladder sensor view and apv with the current numbers

Definition at line 92 of file SVDHistograms.h.

93 {
94 std::string layer = std::to_string(vxdID.getLayerNumber());
95 std::string ladder = std::to_string(vxdID.getLadderNumber());
96 std::string sensor = std::to_string(vxdID.getSensorNumber());
97 std::string view = isU ? "U" : "V" ;
98 base = std::regex_replace(base, std::regex("[@]layer"), layer);
99 base = std::regex_replace(base, std::regex("[@]ladder"), ladder);
100 base = std::regex_replace(base, std::regex("[@]sensor"), sensor);
101 base = std::regex_replace(base, std::regex("[@]view"), view);
102 std::string side = isU ? "P" : "N" ;
103 base = std::regex_replace(base, std::regex("[@]side"), side);
104 }

◆ fill() [1/2]

void fill ( const VxdID vxdID,
bool  isU,
Types ...  args 
)
inline

fill the histogram for

Parameters
vxdIDside
isUwith
args

Definition at line 85 of file SVDHistograms.h.

86 {
87 int view = isU ? UIndex : VIndex;
88 getHistogram(vxdID, view)->Fill(args...);
89 }
H * getHistogram(const VxdID &vxdID, int view)
get a reference to the histogram for
Definition: SVDHistograms.h:56

◆ fill() [2/2]

void fill ( const VxdID vxdID,
int  view,
Types ...  args 
)
inline

fill the histogram for

Parameters
vxdIDside
viewwith
args

Definition at line 77 of file SVDHistograms.h.

78 {
79 getHistogram(vxdID, view)->Fill(args...);
80 }

◆ getHistogram()

H * getHistogram ( const VxdID vxdID,
int  view 
)
inline

get a reference to the histogram for

Parameters
vxdIDside
viewplease, use the enumeration SVDHistograms::Vindex and SVDHistograms::UIndex

Definition at line 56 of file SVDHistograms.h.

57 {
58 H* returnValue = m_defaultHistogram;
59 try {
60 auto& layer = m_histograms.at(vxdID.getLayerNumber());
61 auto& ladder = layer.at(vxdID.getLadderNumber());
62 auto& sensor = ladder.at(vxdID.getSensorNumber());
63 returnValue = sensor.at(view);
64 } catch (...) {
65 B2WARNING("Unexpected VxdID /view. VxdID: " << (std::string)(vxdID)
66 << " view : " << view);
67
68 returnValue = m_defaultHistogram;
69 }
70
71 return returnValue;
72 }
H * m_defaultHistogram
the default histogram

◆ reset()

void reset ( )
inline

Call Reset() on all histograms.

Definition at line 118 of file SVDHistograms.h.

119 {
120 for (auto& layer : m_histograms)
121 for (auto& ladder : layer)
122 for (auto& sensor : ladder)
123 for (auto& view : sensor)
124 view->Reset();
125 }

Member Data Documentation

◆ m_defaultHistogram

H* m_defaultHistogram
private

the default histogram

Definition at line 146 of file SVDHistograms.h.

◆ m_histograms

t_SVD m_histograms
private

the vector of vector ... that contains all histograms

Definition at line 145 of file SVDHistograms.h.


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