Skip to content

Commit 609b9b9

Browse files
committed
Introduce ChipSimResponse with response-centre extraction logic
1 parent e38c5f2 commit 609b9b9

File tree

12 files changed

+313
-201
lines changed

12 files changed

+313
-201
lines changed

Detectors/ITSMFT/common/simulation/include/ITSMFTSimulation/AlpideSimResponse.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class AlpideRespSimMat
3838
static int constexpr getNPix() { return NPix; }
3939

4040
AlpideRespSimMat() = default;
41-
~AlpideRespSimMat() = default;
41+
virtual ~AlpideRespSimMat() = default;
4242

4343
void adopt(const AlpideRespSimMat& src, bool flipRow = false, bool flipCol = false)
4444
{
@@ -91,6 +91,7 @@ class AlpideSimResponse
9191
int getDepthBin(float pos) const;
9292
std::string composeDataName(int colBin, int rowBin);
9393

94+
protected:
9495
int mNBinCol = 0; /// number of bins in X(col direction)
9596
int mNBinRow = 0; /// number of bins in Y(row direction)
9697
int mNBinDpt = 0; /// number of bins in Z(sensor dept)

Detectors/Upgrades/ITS3/macros/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ its3_add_macro(CheckROFs.C)
2727
its3_add_macro(CheckTileNumbering.C)
2828
its3_add_macro(CreateITS3StaticDeadMap.C)
2929
its3_add_macro(TestSensorGeometry.C)
30+
its3_add_macro(CorrTracksClusters.C)

Detectors/Upgrades/ITS3/macros/test/CompareClustersAndDigitsOnChip.C

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,16 @@ void CompareClustersAndDigitsOnChip(std::string clusfile = "o2clus_its.root",
113113
const int nChips = gman->getNumberOfChips();
114114

115115
LOGP(info, "Total number of chips is {} in ITS3 (IB and OB)", nChips);
116-
116+
117117
// Create all plots
118118
LOGP(info, "Selecting chips to be visualised");
119119
std::set<int> selectedChips;
120120
std::map<std::string, std::vector<int>> chipGroups;
121-
121+
122122
for (int chipID{0}; chipID < nChips; ++chipID) {
123123
TString tpath = gman->getMatrixPath(chipID);
124124
std::string path = tpath.Data();
125-
125+
126126
std::vector<std::string> tokens;
127127
std::istringstream iss(path);
128128
std::string token;
@@ -131,14 +131,17 @@ void CompareClustersAndDigitsOnChip(std::string clusfile = "o2clus_its.root",
131131
tokens.push_back(token);
132132
}
133133
}
134-
134+
135135
std::string segmentName, staveName, carbonFormName;
136136
for (const auto& t : tokens) {
137-
if (t.find("ITS3Segment") != std::string::npos) segmentName = t;
138-
if (t.find("ITSUStave") != std::string::npos) staveName = t;
139-
if (t.find("ITS3CarbonForm") != std::string::npos) carbonFormName = t;
137+
if (t.find("ITS3Segment") != std::string::npos)
138+
segmentName = t;
139+
if (t.find("ITSUStave") != std::string::npos)
140+
staveName = t;
141+
if (t.find("ITS3CarbonForm") != std::string::npos)
142+
carbonFormName = t;
140143
}
141-
144+
142145
std::string groupKey;
143146
if (!segmentName.empty()) {
144147
groupKey = segmentName + "_" + carbonFormName;
@@ -147,7 +150,7 @@ void CompareClustersAndDigitsOnChip(std::string clusfile = "o2clus_its.root",
147150
} else {
148151
continue;
149152
}
150-
153+
151154
chipGroups[groupKey].push_back(chipID);
152155
}
153156

@@ -287,8 +290,9 @@ void CompareClustersAndDigitsOnChip(std::string clusfile = "o2clus_its.root",
287290
LOGP(info, "Creating plots");
288291
std::unordered_map<int, Data> data;
289292
auto initData = [&](int chipID, Data& dat) {
290-
if (dat.pixelArray) return;
291-
293+
if (dat.pixelArray)
294+
return;
295+
292296
int nCol{0}, nRow{0};
293297
float lengthPixArr{0}, widthPixArr{0};
294298
bool isIB = o2::its3::constants::detID::isDetITS3(chipID);
@@ -304,7 +308,7 @@ void CompareClustersAndDigitsOnChip(std::string clusfile = "o2clus_its.root",
304308
lengthPixArr = o2::itsmft::SegmentationAlpide::PitchCol * nCol;
305309
widthPixArr = o2::itsmft::SegmentationAlpide::PitchRow * nRow;
306310
}
307-
311+
308312
dat.pixelArray = new TH2F(Form("histSensor_%d", chipID), Form("SensorID=%d;z(cm);x(cm)", chipID),
309313
nCol, -0.5 * lengthPixArr, 0.5 * lengthPixArr,
310314
nRow, -0.5 * widthPixArr, 0.5 * widthPixArr);
@@ -337,7 +341,8 @@ void CompareClustersAndDigitsOnChip(std::string clusfile = "o2clus_its.root",
337341
digTree->GetEntry(iDigit);
338342
for (const auto& digit : *digArr) {
339343
const auto chipID = digit.getChipIndex();
340-
if (!selectedChips.count(chipID)) continue;
344+
if (!selectedChips.count(chipID))
345+
continue;
341346
const auto layer = gman->getLayer(chipID);
342347
bool isIB = layer < 3;
343348
float locDigiX{0}, locDigiZ{0};
@@ -451,7 +456,7 @@ void CompareClustersAndDigitsOnChip(std::string clusfile = "o2clus_its.root",
451456
if (hasAvailableDict && (pattID != o2::itsmft::CompCluster::InvalidPatternID && !dict.isGroup(pattID, isIB))) {
452457
locCOG = dict.getClusterCoordinates(cluster);
453458
} else {
454-
if(isIB) {
459+
if (isIB) {
455460
locCOG = o2::its3::TopologyDictionary::getClusterCoordinates(cluster, pattern, false);
456461
} else {
457462
locCOG = o2::itsmft::TopologyDictionary::getClusterCoordinates(cluster, pattern, false);
@@ -502,13 +507,14 @@ void CompareClustersAndDigitsOnChip(std::string clusfile = "o2clus_its.root",
502507
return;
503508
}
504509
}
505-
510+
506511
LOGP(info, "Writing to root file");
507512
double x1, y1, x2, y2;
508513
auto oFileOut = TFile::Open("CompareClustersAndDigitsOnChip.root", "RECREATE");
509514
oFileOut->cd();
510-
for (int chipID{0}; chipID < nChips ; chipID++) {
511-
if (!selectedChips.count(chipID)) continue;
515+
for (int chipID{0}; chipID < nChips; chipID++) {
516+
if (!selectedChips.count(chipID))
517+
continue;
512518
auto& dat = data[chipID];
513519
TString tpath = gman->getMatrixPath(chipID);
514520
const std::string cpath{tpath.Data() + 39, tpath.Data() + tpath.Length()};
@@ -535,7 +541,7 @@ void CompareClustersAndDigitsOnChip(std::string clusfile = "o2clus_its.root",
535541
LOGP(error, "Failed to create nested directory for chip %d", chipID);
536542
continue;
537543
}
538-
544+
539545
auto canv = new TCanvas(Form("%s_%d", p.filename().c_str(), chipID));
540546
canv->SetTitle(Form("%s_%d", p.filename().c_str(), chipID));
541547
canv->cd();
@@ -559,7 +565,7 @@ void CompareClustersAndDigitsOnChip(std::string clusfile = "o2clus_its.root",
559565
}
560566
dat.leg->Draw();
561567
canv->SetEditable(false);
562-
568+
563569
currentDir->WriteTObject(canv, canv->GetName());
564570
dat.clear();
565571
delete canv;

0 commit comments

Comments
 (0)