10#include <vxd/dataobjects/VxdID.h>
11#include <vxd/geometry/GeoCache.h>
12#include <vxd/geometry/SensorInfoBase.h>
34 templateHisto, templateHisto)
44 const H& templateU456,
const H& templateV456);
51 enum E_side { VIndex = 0, UIndex = 1 };
63 returnValue = sensor.at(view);
65 B2WARNING(
"Unexpected VxdID /view. VxdID: " << (std::string)(vxdID)
66 <<
" view : " << view);
76 template<
class ... Types>
77 void fill(
const VxdID& vxdID,
int view, Types ... args)
84 template<
class ... Types>
85 void fill(
const VxdID& vxdID,
bool isU, Types ... args)
87 int view = isU ? UIndex : VIndex;
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);
111 for (
auto& ladder : layer)
112 for (
auto& sensor : ladder)
113 for (
auto& view : sensor)
121 for (
auto& ladder : layer)
122 for (
auto& sensor : ladder)
123 for (
auto& view : sensor)
143 typedef std::vector< t_SVDLayer >
t_SVD;
157 const H& templateU456,
const H& templateV456)
163 unsigned int layerNumber = layer.getLayerNumber();
167 for (
auto ladder : geoCache.getLadders(layer)) {
168 unsigned int ladderNumber = ladder.getLadderNumber();
173 unsigned int sensorNumber = sensor.getSensorNumber();
174 if (
m_histograms[layerNumber][ladderNumber].size() <= sensorNumber)
175 m_histograms[layerNumber][ladderNumber].resize(sensorNumber + 1);
176 m_histograms[layerNumber][ladderNumber][sensorNumber].resize(2);
178 for (
int view = VIndex ; view < UIndex + 1; view++) {
179 H h = layerNumber == 3 && view == UIndex ? templateU3 :
180 layerNumber == 3 && view == VIndex ? templateV3 :
181 view == UIndex ? templateU456 : templateV456 ;
183 m_histograms[layerNumber][ladderNumber][sensorNumber][view] =
new H(h);
194 bool isU = view == UIndex;
195 std::string name = histogram.GetName();
197 histogram.SetName(name.c_str());
199 std::string title = histogram.GetTitle();
201 histogram.SetTitle(title.c_str());
203 std::string xAxis = histogram.GetXaxis()->GetTitle();
205 histogram.SetXTitle(xAxis.c_str());
207 std::string yAxis = histogram.GetYaxis()->GetTitle();
209 histogram.SetYTitle(yAxis.c_str());
211 std::string zAxis = histogram.GetZaxis()->GetTitle();
213 histogram.SetZTitle(zAxis.c_str());
t_SVD m_histograms
the vector of vector ... that contains all histograms
~SVDHistograms()
clean everything in the destructor
void fill(const VxdID &vxdID, bool isU, Types ... args)
fill the histogram for
void clean()
delete pointers
std::vector< t_SVDLadder > t_SVDLayer
a vector of vector of vector of H, length = # ladders
SVDHistograms(const H &templateHisto)
the class is built with a default histogram for L3 and L456, U and V sides
void fill(const VxdID &vxdID, int view, Types ... args)
fill the histogram for
H * getHistogram(const VxdID &vxdID, int view)
get a reference to the histogram for
SVDHistograms()
Default constructor.
void customizeString(std::string &base, const VxdID &vxdID, bool isU)
replaces layer ladder sensor view and apv with the current numbers
std::vector< t_SVDLayer > t_SVD
a vector of vector of vector of vector of H, length = # layers
H * m_defaultHistogram
the default histogram
std::vector< H * > t_SVDSensor
a vector of H, length = 2
std::vector< t_SVDSensor > t_SVDLadder
a vector of vector of H, length = # svd sensors
ClassDef(SVDHistograms, 1)
needed by root
void reset()
Call Reset() on all histograms.
E_side
This enumeration assure the same semantic of the isU methods defined by Peter Kv.
Class to facilitate easy access to sensor information of the VXD like coordinate transformations or p...
static GeoCache & getInstance()
Return a reference to the singleton instance.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getSensorNumber() const
Get the sensor id.
baseType getLadderNumber() const
Get the ladder id.
baseType getLayerNumber() const
Get the layer id.
SVDHistograms(const H &templateU3, const H &templateV3, const H &templateU456, const H &templateV456)
Use templates to initialize all the histograms.
void customize(H &histogram, VxdID vxdID, int view)
customize the histogram with the sensor, view
Abstract base class for different kinds of events.