10#include <vxd/dataobjects/VxdID.h>
11#include <vxd/geometry/GeoCache.h>
12#include <vxd/geometry/SensorInfoBase.h>
39 enum E_side { VIndex = 0, UIndex = 1 };
51 auto theView = sensor.at(view);
52 returnValue = theView.at(apv);
54 B2WARNING(
"Unexpected VxdID/view/apv. VxdID: " << (std::string)(vxdID)
70 template<
class ... Types>
71 void fill(
const VxdID& vxdID,
int view,
int apv, Types ... args)
82 template<
class ... Types>
83 void fill(
const VxdID& vxdID,
bool isU,
int apv, Types ... args)
85 int view = isU ? UIndex : VIndex;
95 std::string apv = std::to_string(user_apv);
96 std::string view = isU ?
"U" :
"V" ;
97 base = std::regex_replace(base, std::regex(
"[@]layer"), layer);
98 base = std::regex_replace(base, std::regex(
"[@]ladder"), ladder);
99 base = std::regex_replace(base, std::regex(
"[@]sensor"), sensor);
100 base = std::regex_replace(base, std::regex(
"[@]view"), view);
101 std::string side = isU ?
"P" :
"N" ;
102 base = std::regex_replace(base, std::regex(
"[@]side"), side);
103 base = std::regex_replace(base, std::regex(
"[@]apv"), apv);
111 for (
auto ladder : layer)
112 for (
auto sensor : ladder)
113 for (
auto view : sensor)
114 for (
auto apv : view)
139 typedef std::vector< t_SVDLayer >
t_SVD;
153 m_defaultHistogram =
new H(templateAPV);
157 unsigned int layerNumber = layer.getLayerNumber();
158 if (m_histograms.size() <= layerNumber)
159 m_histograms.resize(layerNumber + 1);
161 for (
auto ladder : geoCache.getLadders(layer)) {
162 unsigned int ladderNumber = ladder.getLadderNumber();
163 if (m_histograms[layerNumber].size() <= ladderNumber)
164 m_histograms[layerNumber].resize(ladderNumber + 1);
167 unsigned int sensorNumber = sensor.getSensorNumber();
168 if (m_histograms[layerNumber][ladderNumber].size() <= sensorNumber)
169 m_histograms[layerNumber][ladderNumber].resize(sensorNumber + 1);
170 m_histograms[layerNumber][ladderNumber][sensorNumber].resize(2);
172 for (
int view = VIndex ; view < UIndex + 1; view++) {
174 unsigned int viewNumber = 3;
176 if (m_histograms[layerNumber][ladderNumber][view].size() < viewNumber)
177 m_histograms[layerNumber][ladderNumber][sensorNumber].resize(viewNumber);
178 m_histograms[layerNumber][ladderNumber][sensorNumber][view].resize(nAPV);
179 for (
int apv = 0; apv < nAPV; apv ++) {
182 customize(h, sensor, view, apv);
183 m_histograms[layerNumber][ladderNumber][sensorNumber][view][apv] =
new H(h);
195 bool isU = view == UIndex;
196 std::string name = histogram.GetName();
197 customizeString(name, vxdID, isU, apv);
198 histogram.SetName(name.c_str());
200 std::string title = histogram.GetTitle();
201 customizeString(title, vxdID, isU, apv);
202 histogram.SetTitle(title.c_str());
204 std::string xAxis = histogram.GetXaxis()->GetTitle();
205 customizeString(xAxis, vxdID, isU, apv);
206 histogram.SetXTitle(xAxis.c_str());
208 std::string yAxis = histogram.GetYaxis()->GetTitle();
209 customizeString(yAxis, vxdID, isU, apv);
210 histogram.SetYTitle(yAxis.c_str());
212 std::string zAxis = histogram.GetZaxis()->GetTitle();
213 customizeString(zAxis, vxdID, isU, apv);
214 histogram.SetZTitle(zAxis.c_str());
template class for the APV Histograms
t_SVD m_histograms
the vector of vector ... that contains all histograms
~SVDAPVHistograms()
clean everything in the destructor
void clean()
delete pointers
std::vector< H * > t_Views
A t_SVDView is a vector of H that will have length = # APV chips.
std::vector< t_Views > t_SVDSensor
a vector of vector of H, length = 2
void customizeString(std::string &base, const VxdID &vxdID, bool isU, int user_apv)
replaces layer ladder sensor view and apv with the current numbers
std::vector< t_SVDLadder > t_SVDLayer
A t_SVDLayer is a vector of t_SVDLadders.
H * getHistogram(const VxdID &vxdID, int view, int apv)
get a reference to the histogram for
ClassDef(SVDAPVHistograms, 1)
needed by root
void fill(const VxdID &vxdID, int view, int apv, Types ... args)
fill the histogram for
std::vector< t_SVDLayer > t_SVD
The t_SVD is a vector of t_SVDLayers.
H * m_defaultHistogram
the default histogram
SVDAPVHistograms()
Default constructor.
std::vector< t_SVDSensor > t_SVDLadder
A t_SVDLadder is a vector of t_SVDSensors.
E_side
This enumeration assure the same semantic of the isU methods defined by Peter Kv.
void fill(const VxdID &vxdID, bool isU, int apv, Types ... args)
fill the histogram for
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
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.
SVDAPVHistograms(const H &templateAPV)
Use.
void customize(H &histogram, VxdID vxdID, int view, int apv)
customize the histogram with the sensor, view and APV numbers
Abstract base class for different kinds of events.