Skip to content

Commit abe1567

Browse files
committed
WIP check digits
1 parent 4c0b42b commit abe1567

5 files changed

Lines changed: 46 additions & 33 deletions

File tree

Detectors/Upgrades/IT3/macros/test/CheckDigitsITS3.notest renamed to Detectors/Upgrades/IT3/macros/test/CheckDigitsITS3.C

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <TTree.h>
1212

1313
#include <vector>
14-
#include "ITS3Base/GeometryTGeo.h"
14+
#include "ITSBase/GeometryTGeo.h"
1515
#include "DataFormatsITSMFT/Digit.h"
1616
#include "ITS3Base/SegmentationSuperAlpide.h"
1717
#include "ITSMFTBase/SegmentationAlpide.h"
@@ -43,10 +43,10 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
4343

4444
// Geometry
4545
o2::base::GeometryManager::loadGeometry(inputGeom);
46-
auto* gman = o2::its3::GeometryTGeo::Instance();
46+
auto* gman = o2::its::GeometryTGeo::Instance();
4747
gman->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::L2G));
4848

49-
SegmentationSuperAlpide segs[4]{SegmentationSuperAlpide(0), SegmentationSuperAlpide(1), SegmentationSuperAlpide(2), SegmentationSuperAlpide(3)};
49+
SegmentationSuperAlpide segs[3]{SegmentationSuperAlpide(0), SegmentationSuperAlpide(1), SegmentationSuperAlpide(2)};
5050
SegmentationSuperAlpide& seg = segs[0];
5151

5252
// Hits
@@ -153,7 +153,7 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
153153

154154
Int_t chipID = (*digArr)[iDigit].getChipIndex();
155155

156-
if (chipID < 4) {
156+
if (chipID / 2 < 3) {
157157
segs[chipID].detectorToLocal(ix, iz, x, z);
158158
} else {
159159
SegmentationAlpide::detectorToLocal(ix, iz, x, z);
@@ -170,15 +170,17 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
170170
nDigitRead++;
171171

172172
auto gloD = gman->getMatrixL2G(chipID)(locD); // convert to global
173-
if (chipID < 4) {
173+
if (chipID / 2 < 3) {
174174
//
175175
// invert
176-
//xyzLocS = {SegmentationSuperAlpide::Radii[detID] * startPhi, 0.f, startPos.Z()};
177-
//xyzLocE = {SegmentationSuperAlpide::Radii[detID] * endPhi, 0.f, endPos.Z()};
176+
// xyzLocS = {SegmentationSuperAlpide::Radii[detID] * startPhi, 0.f, startPos.Z()};
177+
// xyzLocE = {SegmentationSuperAlpide::Radii[detID] * endPhi, 0.f, endPos.Z()};
178178
//
179-
double radius = SegmentationSuperAlpide::Radii[chipID];
180-
double phi = locD.X() / radius;
181-
gloD.SetXYZ(radius * std::cos(phi), radius * std::sin(phi), locD.Z());
179+
double radius = SegmentationSuperAlpide::Radii[chipID / 2];
180+
bool isTop = !(chipID % 2);
181+
double phi = locD.X() / radius + (isTop ? -0.5 : 0.5) * (float)TMath::Pi();
182+
183+
gloD.SetXYZ(radius * std::cos(phi), (isTop ? radius * std::sin(phi) + 0.1 / 2 : radius * std::sin(phi) - 0.1 / 2), locD.Z());
182184
}
183185
float dx = 0., dz = 0.;
184186

@@ -194,28 +196,35 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
194196
continue;
195197
}
196198

199+
////// HITS
197200
Hit& hit = (*hitArray[lab.getEventID()])[hitEntry->second];
198201

199202
// FIXME FOR INNER BARREL
200203
auto locH = gman->getMatrixL2G(chipID) ^ (hit.GetPos()); // inverse conversion from global to local
201204
auto locHsta = gman->getMatrixL2G(chipID) ^ (hit.GetPosStart());
202205

203-
if (chipID < 4) {
204-
float startPhi{std::atan2(-hit.GetPosStart().Y(), -hit.GetPosStart().X())};
205-
float endPhi{std::atan2(-hit.GetPos().Y(), -hit.GetPos().X())};
206-
locH.SetXYZ(SegmentationSuperAlpide::Radii[chipID] * endPhi, 0.f, hit.GetPos().Z());
207-
locHsta.SetXYZ(SegmentationSuperAlpide::Radii[chipID] * startPhi, 0.f, hit.GetPosStart().Z());
206+
if (chipID / 2 < 3) {
207+
// startPhi{std::atan2(-reShiftedStartY, -startPos.X()) + (isTop ? (float)TMath::Pi() / 2 : -(float)TMath::Pi() / 2)};
208+
bool isTop = !(chipID % 2);
209+
float reShiftedY = isTop ? hit.GetPosStart().Y() - 0.1 / 2 : hit.GetPosStart().Y() + 0.1 / 2;
210+
float startPhi{std::atan2(-reShiftedY, -hit.GetPosStart().X()) + (isTop ? (float)TMath::Pi() / 2 : -(float)TMath::Pi() / 2)};
211+
float reShiftedEndY = isTop ? hit.GetPos().Y() - 0.1 / 2 : hit.GetPos().Y() + 0.1 / 2;
212+
float endPhi{std::atan2(-reShiftedEndY, -hit.GetPos().X()) + (isTop ? (float)TMath::Pi() / 2 : -(float)TMath::Pi() / 2)};
213+
locH.SetXYZ(SegmentationSuperAlpide::Radii[chipID / 2] * endPhi, 0.f, hit.GetPos().Z());
214+
locHsta.SetXYZ(SegmentationSuperAlpide::Radii[chipID / 2] * startPhi, 0.f, hit.GetPosStart().Z());
208215
}
209216

210217
locH.SetXYZ(0.5 * (locH.X() + locHsta.X()), 0.5 * (locH.Y() + locHsta.Y()), 0.5 * (locH.Z() + locHsta.Z()));
211218

212219
int row, col;
213220
float xlc = 0., zlc = 0.;
214221

215-
segs[chipID < 4 ? chipID : 0].localToDetector(locH.X(), locH.Z(), row, col);
216-
segs[chipID < 4 ? chipID : 0].detectorToLocal(row, col, xlc, zlc);
222+
segs[chipID / 2 < 3 ? chipID : 0].localToDetector(locH.X(), locH.Z(), row, col);
223+
segs[chipID / 2 < 3 ? chipID : 0].detectorToLocal(row, col, xlc, zlc);
217224

218-
nt->Fill(chipID, gloD.X(), gloD.Y(), gloD.Z(), ix, iz, row, col, locH.X(), locH.Z(), xlc, zlc, locH.X() - locD.X(), locH.Z() - locD.Z());
225+
if (chipID < 6) {
226+
nt->Fill(chipID, gloD.X(), gloD.Y(), gloD.Z(), ix, iz, row, col, locH.X(), locH.Z(), xlc, zlc, locH.X() - locD.X(), locH.Z() - locD.Z());
227+
}
219228

220229
nDigitFilled++;
221230
} // not noise
@@ -227,7 +236,7 @@ void CheckDigitsITS3(std::string digifile = "it3digits.root", std::string hitfil
227236
new TCanvas;
228237
nt->Draw("y:x");
229238
new TCanvas;
230-
nt->Draw("dx:dz", "abs(dx)<0.02 && abs(dz)<0.02");
239+
nt->Draw("dx:dz", ""); /// abs(dx)<0.02 && abs(dz)<0.02
231240

232241
f->Write();
233242
f->Close();

Detectors/Upgrades/IT3/macros/test/CheckSquasherITS3.C

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#if !defined(__CLING__) || defined(__ROOTCLING__)
1313
#include <DataFormatsITSMFT/ROFRecord.h>
14-
#include <DataFormatsITSMFT/CompCluster.h>
14+
#include <DataFormatsITS3/CompCluster.h>
1515
#include <ITSBase/GeometryTGeo.h>
1616
#include <Framework/Logger.h>
1717
#include <DataFormatsITSMFT/TopologyDictionary.h>
@@ -32,12 +32,13 @@
3232
#include <gsl/gsl>
3333
#endif
3434

35-
void getClusterPatterns(std::vector<o2::itsmft::ClusterPattern>& pattVec, std::vector<o2::itsmft::CompClusterExt>* ITSclus, std::vector<unsigned char>* ITSpatt, o2::itsmft::TopologyDictionary& mdict);
35+
void getClusterPatterns(std::vector<o2::itsmft::ClusterPattern>& pattVec, std::vector<o2::its3::CompClusterExt>* ITSclus, std::vector<unsigned char>* ITSpatt, o2::itsmft::TopologyDictionary& mdict);
3636

3737
void CheckSquasherITS3(const uint chipId = 0, const uint startingROF = 0, const unsigned int nRofs = 3, const string fname = "o2clus_it3.root")
3838
{
39-
TColor::InvertPalette();
39+
// TColor::InvertPalette();
4040
gStyle->SetOptStat(0);
41+
gStyle->SetPalette(kInvertedDarkBodyRadiator);
4142
// Geometry
4243
o2::base::GeometryManager::loadGeometry("");
4344
auto gman = o2::its::GeometryTGeo::Instance();
@@ -48,7 +49,7 @@ void CheckSquasherITS3(const uint chipId = 0, const uint startingROF = 0, const
4849
auto fITSclus = TFile::Open(fname.data(), "r");
4950
auto treeITSclus = (TTree*)fITSclus->Get("o2sim");
5051

51-
std::vector<o2::itsmft::CompClusterExt>* ITSclus = nullptr;
52+
std::vector<o2::its3::CompClusterExt>* ITSclus = nullptr;
5253
std::vector<o2::itsmft::ROFRecord>* ITSrof = nullptr;
5354
std::vector<unsigned char>* ITSpatt = nullptr;
5455
o2::dataformats::MCTruthContainer<o2::MCCompLabel>* clusLabArr = nullptr;
@@ -156,7 +157,7 @@ void CheckSquasherITS3(const uint chipId = 0, const uint startingROF = 0, const
156157
}
157158
}
158159

159-
void getClusterPatterns(std::vector<o2::itsmft::ClusterPattern>& pattVec, std::vector<o2::itsmft::CompClusterExt>* ITSclus, std::vector<unsigned char>* ITSpatt, o2::itsmft::TopologyDictionary& mdict)
160+
void getClusterPatterns(std::vector<o2::itsmft::ClusterPattern>& pattVec, std::vector<o2::its3::CompClusterExt>* ITSclus, std::vector<unsigned char>* ITSpatt, o2::itsmft::TopologyDictionary& mdict)
160161
{
161162
pattVec.reserve(ITSclus->size());
162163
auto pattIt = ITSpatt->cbegin();
@@ -168,7 +169,7 @@ void getClusterPatterns(std::vector<o2::itsmft::ClusterPattern>& pattVec, std::v
168169
int npix;
169170
o2::itsmft::ClusterPattern patt;
170171

171-
if (pattID == o2::itsmft::CompCluster::InvalidPatternID || mdict.isGroup(pattID)) {
172+
if (pattID == o2::its3::CompCluster::InvalidPatternID || mdict.isGroup(pattID)) {
172173
patt.acquirePattern(pattIt);
173174
npix = patt.getNPixels();
174175
} else {

Detectors/Upgrades/IT3/reconstruction/include/ITS3Reconstruction/Clusterer.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include <memory>
2727
#include <gsl/span>
2828
#include "ITSMFTBase/SegmentationAlpide.h"
29-
#include "DataFormatsITSMFT/CompCluster.h"
29+
#include "DataFormatsITS3/CompCluster.h"
3030
#include "DataFormatsITSMFT/ROFRecord.h"
3131
#include "ITSMFTReconstruction/PixelReader.h"
3232
#include "ITSMFTReconstruction/PixelData.h"
@@ -55,7 +55,7 @@ class MCTruthContainer;
5555
namespace its3
5656
{
5757

58-
using CompClusCont = std::vector<itsmft::CompClusterExt>;
58+
using CompClusCont = std::vector<its3::CompClusterExt>;
5959
using PatternCont = std::vector<unsigned char>;
6060
using ROFRecCont = std::vector<itsmft::ROFRecord>;
6161

@@ -66,8 +66,8 @@ class Clusterer
6666
using PixelReader = o2::itsmft::PixelReader;
6767
using PixelData = o2::itsmft::PixelData;
6868
using ChipPixelData = o2::itsmft::ChipPixelData;
69-
using CompCluster = o2::itsmft::CompCluster;
70-
using CompClusterExt = o2::itsmft::CompClusterExt;
69+
using CompCluster = o2::its3::CompCluster;
70+
using CompClusterExt = o2::its3::CompClusterExt;
7171
using Label = o2::MCCompLabel;
7272
using MCTruth = o2::dataformats::MCTruthContainer<o2::MCCompLabel>;
7373
using ConstMCTruth = o2::dataformats::ConstMCTruthContainerView<o2::MCCompLabel>;
@@ -309,6 +309,9 @@ void Clusterer::streamCluster(const std::vector<PixelData>& pixbuf, const std::a
309309
}
310310
}
311311
compClusPtr->emplace_back(row, col, pattID, bbox.chipID);
312+
if (row > 1024 || col > 1024) {
313+
LOGP(info, "row {} col {}", row, col);
314+
}
312315
}
313316

314317
} // namespace its3

Detectors/Upgrades/IT3/workflow/src/ClusterWriterSpec.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
#include "ITS3Workflow/ClusterWriterSpec.h"
1717
#include "DPLUtils/MakeRootTreeWriterSpec.h"
18-
#include "DataFormatsITSMFT/CompCluster.h"
18+
#include "DataFormatsITS3/CompCluster.h"
1919
#include "DataFormatsITSMFT/ROFRecord.h"
2020
#include "SimulationDataFormat/MCCompLabel.h"
2121
#include "SimulationDataFormat/MCTruthContainer.h"
@@ -29,7 +29,7 @@ namespace its3
2929

3030
template <typename T>
3131
using BranchDefinition = MakeRootTreeWriterSpec::BranchDefinition<T>;
32-
using CompClusType = std::vector<o2::itsmft::CompClusterExt>;
32+
using CompClusType = std::vector<o2::its3::CompClusterExt>;
3333
using PatternsType = std::vector<unsigned char>;
3434
using ROFrameRType = std::vector<o2::itsmft::ROFRecord>;
3535
using LabelsType = o2::dataformats::MCTruthContainer<o2::MCCompLabel>;

Detectors/Upgrades/IT3/workflow/src/ClustererSpec.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "ITSMFTReconstruction/ChipMappingITS.h"
2121
#include "ITS3Base/SegmentationSuperAlpide.h"
2222
#include "ITSMFTReconstruction/ClustererParam.h"
23-
#include "DataFormatsITSMFT/CompCluster.h"
23+
#include "DataFormatsITS3/CompCluster.h"
2424
#include "SimulationDataFormat/MCCompLabel.h"
2525
#include "SimulationDataFormat/ConstMCTruthContainer.h"
2626
#include "DataFormatsITSMFT/ROFRecord.h"
@@ -102,7 +102,7 @@ void ClustererDPL::run(ProcessingContext& pc)
102102
}
103103
reader.init();
104104
auto orig = o2::header::gDataOriginIT3;
105-
std::vector<o2::itsmft::CompClusterExt> clusCompVec;
105+
std::vector<o2::its3::CompClusterExt> clusCompVec;
106106
std::vector<o2::itsmft::ROFRecord> clusROFVec;
107107
std::vector<unsigned char> clusPattVec;
108108

0 commit comments

Comments
 (0)