Skip to content

Commit 307d796

Browse files
wiechulashahor02
authored andcommitted
TPC: radial binning vector for histograms
1 parent 6a85ad1 commit 307d796

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

Detectors/TPC/base/include/TPCBase/Painter.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,14 @@ struct PadCoordinates {
7171
/// create a vector of pad corner coordinate for one full sector
7272
std::vector<PadCoordinates> getPadCoordinatesSector();
7373

74+
/// binning vector with radial pad-row positions (in cm)
75+
/// \param roc roc number (0-35 IROC, 36-71 OROC, >=72 full sector)
76+
std::vector<double> getRowBinningCM(uint32_t roc = 72);
77+
7478
/// ROC title from ROC number
7579
std::string getROCTitle(const int rocNumber);
7680

77-
//using T=float;
81+
// using T=float;
7882
/// Drawing of a CalDet object
7983
/// \param CalDet object to draw
8084
/// \return TCanvas containing CalDet content

Detectors/TPC/base/src/Painter.cxx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,45 @@ std::vector<painter::PadCoordinates> painter::getPadCoordinatesSector()
7979
return padCoords;
8080
}
8181

82+
std::vector<double> painter::getRowBinningCM(uint32_t roc)
83+
{
84+
const Mapper& mapper = Mapper::instance();
85+
86+
int firstRegion = 0, lastRegion = 10;
87+
if (roc < 36) {
88+
firstRegion = 0;
89+
lastRegion = 4;
90+
} else if (roc < 72) {
91+
firstRegion = 4;
92+
lastRegion = 10;
93+
}
94+
95+
std::vector<double> binning;
96+
97+
float lastPadHeight = mapper.getPadRegionInfo(firstRegion).getPadHeight();
98+
float localX = mapper.getPadRegionInfo(firstRegion).getRadiusFirstRow();
99+
binning.emplace_back(localX - 3);
100+
binning.emplace_back(localX);
101+
for (int iregion = firstRegion; iregion < lastRegion; ++iregion) {
102+
const auto& regionInfo = mapper.getPadRegionInfo(iregion);
103+
const auto padHeight = regionInfo.getPadHeight();
104+
105+
if (std::abs(padHeight - lastPadHeight) > 1e-5) {
106+
lastPadHeight = padHeight;
107+
localX = regionInfo.getRadiusFirstRow();
108+
binning.emplace_back(localX);
109+
}
110+
111+
for (int irow = 0; irow < regionInfo.getNumberOfPadRows(); ++irow) {
112+
localX += lastPadHeight;
113+
binning.emplace_back(localX);
114+
}
115+
}
116+
binning.emplace_back(localX + 3);
117+
118+
return binning;
119+
}
120+
82121
std::string painter::getROCTitle(const int rocNumber)
83122
{
84123
const std::string_view type = (rocNumber < 36) ? "IROC" : "OROC";

0 commit comments

Comments
 (0)