Skip to content

Commit 326f42f

Browse files
committed
ITS3: improve stepping speed & trk frame
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 62d32d2 commit 326f42f

File tree

4 files changed

+59
-53
lines changed

4 files changed

+59
-53
lines changed

Detectors/Upgrades/ITS3/base/include/ITS3Base/SpecsV2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ namespace carbonfoam
104104
// TODO: Waiting for the further information from WP5(Corrado)
105105
constexpr double HringLength{6.0 * mm}; // from blueprint
106106
constexpr double longeronsWidth{2.0 * mm}; // what is the height of the longerons?
107-
constexpr double longeronsLength{segment::length - 2 * HringLength}; // 263mm from blueprint; overrriden to be consitent
107+
constexpr double longeronsLength{segment::length - (2 * HringLength)}; // 263mm from blueprint; overrriden to be consitent
108108
constexpr double edgeBetwChipAndFoam{1.0 * mm}; // from blueprint but not used cause forms are already overlapping
109109
constexpr double gapBetwHringsLongerons{0.05 * mm}; // from blueprint
110110
constexpr std::array<int, 3> nHoles{11, 11, 11}; // how many holes for each layer?

Detectors/Upgrades/ITS3/reconstruction/src/IOUtils.cxx

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include "ITS3Reconstruction/IOUtils.h"
13-
#include "ITStracking/IOUtils.h"
1413
#include "ITStracking/TimeFrame.h"
1514
#include "ITStracking/BoundedAllocator.h"
1615
#include "DataFormatsITSMFT/CompCluster.h"
1716
#include "DataFormatsITSMFT/ROFRecord.h"
1817
#include "ITS3Reconstruction/TopologyDictionary.h"
1918
#include "ITSBase/GeometryTGeo.h"
20-
#include "ITS3Base/SpecsV2.h"
2119
#include "ITStracking/TrackingConfigParam.h"
2220
#include "Framework/Logger.h"
2321

22+
#include <math.h>
23+
24+
#include <math.h>
25+
2426
#include <limits>
2527

2628
namespace o2::its3::ioutils
@@ -45,7 +47,7 @@ void convertCompactClusters(gsl::span<const itsmft::CompClusterExt> clusters,
4547
}
4648

4749
for (auto& c : clusters) {
48-
float sigmaY2, sigmaZ2, sigmaYZ = 0;
50+
float sigmaY2 = NAN, sigmaZ2 = NAN;
4951
auto locXYZ = extractClusterData(c, pattIt, dict, sigmaY2, sigmaZ2);
5052
const auto detID = c.getSensorID();
5153
auto& cl3d = output.emplace_back(detID, geom->getMatrixT2L(detID) ^ locXYZ); // local --> tracking
@@ -54,7 +56,7 @@ void convertCompactClusters(gsl::span<const itsmft::CompClusterExt> clusters,
5456
sigmaY2 += conf.sysErrY2[lrID];
5557
sigmaZ2 += conf.sysErrZ2[lrID];
5658
}
57-
cl3d.setErrors(sigmaY2, sigmaZ2, sigmaYZ);
59+
cl3d.setErrors(sigmaY2, sigmaZ2, 0.f);
5860
}
5961
}
6062

@@ -76,34 +78,39 @@ int loadROFrameDataITS3(its::TimeFrame<7>* tf,
7678
for (size_t iRof{0}; iRof < rofs.size(); ++iRof) {
7779
const auto& rof = rofs[iRof];
7880
for (int clusterId{rof.getFirstEntry()}; clusterId < rof.getFirstEntry() + rof.getNEntries(); ++clusterId) {
79-
auto& c = clusters[clusterId];
80-
auto sensorID = c.getSensorID();
81-
auto layer = geom->getLayer(sensorID);
81+
const auto& c = clusters[clusterId];
82+
const auto sensorID = c.getSensorID();
83+
const auto layer = geom->getLayer(sensorID);
8284

8385
float sigmaY2{0}, sigmaZ2{0}, sigmaYZ{0};
8486
uint8_t clusterSize{0};
85-
auto locXYZ = extractClusterData(c, pattIt, dict, sigmaY2, sigmaZ2, clusterSize);
87+
const auto locXYZ = extractClusterData(c, pattIt, dict, sigmaY2, sigmaZ2, clusterSize);
8688
clusterSizeVec.push_back(clusterSize);
8789

8890
// Transformation to the local --> global
89-
auto gloXYZ = geom->getMatrixL2G(sensorID) * locXYZ;
91+
const auto gloXYZ = geom->getMatrixL2G(sensorID) * locXYZ;
9092

9193
// Inverse transformation to the local --> tracking
92-
o2::math_utils::Point3D<float> trkXYZ = geom->getMatrixT2L(sensorID) ^ locXYZ;
94+
const o2::math_utils::Point3D<float> trkXYZ = geom->getMatrixT2L(sensorID) ^ locXYZ;
9395

9496
// Tracking alpha angle
95-
float alpha = geom->getSensorRefAlpha(sensorID);
96-
97-
tf->addTrackingFrameInfoToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), trkXYZ.x(), alpha,
98-
std::array<float, 2>{trkXYZ.y(), trkXYZ.z()},
97+
// We want that each cluster rotates its tracking frame to the clusters phi
98+
// that way the track linearization around the measurement is less biases to the arc
99+
// this means automatically that the measurement on the arc is at 0
100+
// const float alpha = geom->getSensorRefAlpha(sensorID);
101+
const float radius = std::hypot(gloXYZ.x(), gloXYZ.y());
102+
const float alpha = std::atan2(gloXYZ.y(), gloXYZ.x());
103+
104+
tf->addTrackingFrameInfoToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), radius, alpha,
105+
std::array<float, 2>{0, trkXYZ.z()},
99106
std::array<float, 3>{sigmaY2, sigmaYZ, sigmaZ2});
100107

101108
/// Rotate to the global frame
102109
tf->addClusterToLayer(layer, gloXYZ.x(), gloXYZ.y(), gloXYZ.z(), tf->getUnsortedClusters()[layer].size());
103110
tf->addClusterExternalIndexToLayer(layer, clusterId);
104111
}
105112
for (unsigned int iL{0}; iL < tf->getUnsortedClusters().size(); ++iL) {
106-
tf->mROFramesClusters[iL][iRof + 1] = tf->getUnsortedClusters()[iL].size();
113+
tf->mROFramesClusters[iL][iRof + 1] = (int)tf->getUnsortedClusters()[iL].size();
107114
}
108115
}
109116

Detectors/Upgrades/ITS3/simulation/include/ITS3Simulation/ITS3Layer.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace o2::its3
2626
{
2727

2828
/// This class defines the geometry for the ITS3 IB layers.
29-
class ITS3Layer
29+
class ITS3Layer final
3030
{
3131
// The hierarchy will be the following:
3232
// ITS2 -> ITS3
@@ -76,7 +76,6 @@ class ITS3Layer
7676
void buildPartial(TGeoVolume* motherVolume, TGeoMatrix* mat = nullptr, BuildLevel level = BuildLevel::kAll, bool createMaterials = false);
7777

7878
private:
79-
bool mBuilt{false};
8079
TGeoMedium* mSilicon{nullptr};
8180
TGeoMedium* mAir{nullptr};
8281
TGeoMedium* mCarbon{nullptr};
@@ -91,7 +90,7 @@ class ITS3Layer
9190
void createSegment();
9291
void createChip();
9392
void createCarbonForm();
94-
TGeoCompositeShape* getHringShape(TGeoTubeSeg* Hring);
93+
TGeoCompositeShape* getHringShape(TGeoTubeSeg* Hring) const;
9594
void createLayerImpl();
9695

9796
uint8_t mNLayer{0}; // Layer number

Detectors/Upgrades/ITS3/simulation/src/ITS3Layer.cxx

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ void ITS3Layer::createLayer(TGeoVolume* motherVolume)
6767
// Create one layer of ITS3 and attach it to the motherVolume.
6868
getMaterials();
6969
createLayerImpl();
70-
mBuilt = true;
7170

7271
if (motherVolume == nullptr) {
7372
return;
7473
}
74+
7575
// Add it to motherVolume
7676
auto* trans = new TGeoTranslation(0, 0, -constants::segment::lengthSensitive / 2.);
7777
motherVolume->AddNode(mLayer, 0, trans);
@@ -122,18 +122,18 @@ void ITS3Layer::createTile()
122122
mTile->AddNode(mPixelArray, 0, phiRotPixelArray);
123123

124124
// Biasing
125-
double biasPhi1 = constants::pixelarray::width / mR * o2m::Rad2Deg + readoutPhi2;
126-
double biasPhi2 = biasing::width / mR * o2m::Rad2Deg + biasPhi1;
125+
double biasPhi1 = (constants::pixelarray::width / mR * o2m::Rad2Deg) + readoutPhi2;
126+
double biasPhi2 = (biasing::width / mR * o2m::Rad2Deg) + biasPhi1;
127127
auto biasing = new TGeoTubeSeg(mRmin, mRmax, biasing::length / 2, biasPhi1, biasPhi2);
128128
auto biasingVol = new TGeoVolume(Form("biasing%d", mNLayer), biasing, mSilicon);
129129
biasingVol->SetLineColor(biasing::color);
130130
biasingVol->RegisterYourself();
131131
mTile->AddNode(biasingVol, 0);
132132

133133
// Power Switches are on the side right side of the pixel array and biasing.
134-
auto zMovePowerSwitches = new TGeoTranslation(0, 0, +powerswitches::length / 2. + constants::pixelarray::length / 2.);
134+
auto zMovePowerSwitches = new TGeoTranslation(0, 0, (+powerswitches::length / 2.) + (constants::pixelarray::length / 2.));
135135
double powerPhi1 = readoutPhi2;
136-
double powerPhi2 = powerswitches::width / mR * o2m::Rad2Deg + powerPhi1;
136+
double powerPhi2 = (powerswitches::width / mR * o2m::Rad2Deg) + powerPhi1;
137137
auto powerSwitches = new TGeoTubeSeg(mRmin, mRmax, powerswitches::length / 2, powerPhi1, powerPhi2);
138138
auto powerSwitchesVol = new TGeoVolume(Form("powerswitches%d", mNLayer), powerSwitches, mSilicon);
139139
powerSwitchesVol->SetLineColor(powerswitches::color);
@@ -166,7 +166,7 @@ void ITS3Layer::createRSU()
166166
// Lower Left
167167
auto zMoveLL1 = new TGeoTranslation(0, 0, constants::tile::length);
168168
auto zMoveLL2 = new TGeoTranslation(0, 0, constants::tile::length * 2.);
169-
auto zMoveLLDB = new TGeoTranslation(0, 0, -databackbone::length / 2. - constants::pixelarray::length / 2.);
169+
auto zMoveLLDB = new TGeoTranslation(0, 0, (-databackbone::length / 2.) - (constants::pixelarray::length / 2.));
170170
// Lets attach the tiles to the QS.
171171
mRSU->AddNode(mTile, nCopyRSU++, nullptr);
172172
mRSU->AddNode(mTile, nCopyRSU++, zMoveLL1);
@@ -175,9 +175,9 @@ void ITS3Layer::createRSU()
175175

176176
// Lower Right
177177
auto zMoveLR0 = new TGeoTranslation(0, 0, +length / 2.);
178-
auto zMoveLR1 = new TGeoTranslation(0, 0, constants::tile::length + length / 2.);
179-
auto zMoveLR2 = new TGeoTranslation(0, 0, constants::tile::length * 2. + length / 2.);
180-
auto zMoveLRDB = new TGeoTranslation(0, 0, -databackbone::length / 2. + length / 2. - constants::pixelarray::length / 2.);
178+
auto zMoveLR1 = new TGeoTranslation(0, 0, constants::tile::length + (length / 2.));
179+
auto zMoveLR2 = new TGeoTranslation(0, 0, (constants::tile::length * 2.) + (length / 2.));
180+
auto zMoveLRDB = new TGeoTranslation(0, 0, (-databackbone::length / 2.) + (length / 2.) - (constants::pixelarray::length / 2.));
181181
// Lets attach the tiles to the QS.
182182
mRSU->AddNode(mTile, nCopyRSU++, zMoveLR0);
183183
mRSU->AddNode(mTile, nCopyRSU++, zMoveLR1);
@@ -192,7 +192,7 @@ void ITS3Layer::createRSU()
192192
// Upper Left
193193
auto zMoveUL1 = new TGeoCombiTrans(0, 0, constants::tile::length, rot);
194194
auto zMoveUL2 = new TGeoCombiTrans(0, 0, constants::tile::length * 2., rot);
195-
auto zMoveULDB = new TGeoCombiTrans(0, 0, -databackbone::length / 2. - constants::pixelarray::length / 2., rot);
195+
auto zMoveULDB = new TGeoCombiTrans(0, 0, (-databackbone::length / 2.) - (constants::pixelarray::length / 2.), rot);
196196
// Lets attach the tiles to the QS.
197197
mRSU->AddNode(mTile, nCopyRSU++, rot);
198198
mRSU->AddNode(mTile, nCopyRSU++, zMoveUL1);
@@ -201,9 +201,9 @@ void ITS3Layer::createRSU()
201201

202202
// Upper Right
203203
auto zMoveUR0 = new TGeoCombiTrans(0, 0, +length / 2., rot);
204-
auto zMoveUR1 = new TGeoCombiTrans(0, 0, constants::tile::length + length / 2., rot);
205-
auto zMoveUR2 = new TGeoCombiTrans(0, 0, constants::tile::length * 2. + length / 2., rot);
206-
auto zMoveURDB = new TGeoCombiTrans(0, 0, -databackbone::length / 2. + length / 2. - constants::pixelarray::length / 2., rot);
204+
auto zMoveUR1 = new TGeoCombiTrans(0, 0, constants::tile::length + (length / 2.), rot);
205+
auto zMoveUR2 = new TGeoCombiTrans(0, 0, (constants::tile::length * 2.) + (length / 2.), rot);
206+
auto zMoveURDB = new TGeoCombiTrans(0, 0, (-databackbone::length / 2.) + (length / 2.) - (constants::pixelarray::length / 2.), rot);
207207
// Lets attach the tiles to the QS.
208208
mRSU->AddNode(mTile, nCopyRSU++, zMoveUR0);
209209
mRSU->AddNode(mTile, nCopyRSU++, zMoveUR1);
@@ -225,9 +225,9 @@ void ITS3Layer::createSegment()
225225
mSegment = new TGeoVolumeAssembly(its3TGeo::getITS3SegmentPattern(mNLayer));
226226
mSegment->VisibleDaughters();
227227

228-
for (size_t i{0}; i < nRSUs; ++i) {
229-
auto zMove = new TGeoTranslation(0, 0, +i * constants::rsu::length + constants::rsu::databackbone::length + constants::pixelarray::length / 2.);
230-
mSegment->AddNode(mRSU, i, zMove);
228+
for (unsigned int i{0}; i < nRSUs; ++i) {
229+
auto zMove = new TGeoTranslation(0, 0, (i * constants::rsu::length) + constants::rsu::databackbone::length + (constants::pixelarray::length / 2.));
230+
mSegment->AddNode(mRSU, (int)i, zMove);
231231
}
232232

233233
// LEC
@@ -242,7 +242,7 @@ void ITS3Layer::createSegment()
242242
mSegment->AddNode(lecVol, 0, zMoveLEC);
243243

244244
// REC; reuses lecPhi1,2
245-
auto zMoveREC = new TGeoTranslation(0, 0, nRSUs * constants::rsu::length + rec::length / 2.);
245+
auto zMoveREC = new TGeoTranslation(0, 0, (nRSUs * constants::rsu::length) + (rec::length / 2.));
246246
auto rec =
247247
new TGeoTubeSeg(mRmin, mRmax, rec::length / 2., lecPhi1, lecPhi2);
248248
auto recVol = new TGeoVolume(Form("rec%d", mNLayer), rec, mSilicon);
@@ -266,11 +266,11 @@ void ITS3Layer::createChip()
266266
auto phiOffset = constants::segment::width / mR * o2m::Rad2Deg;
267267
for (unsigned int i{0}; i < constants::nSegments[mNLayer]; ++i) {
268268
auto rot = new TGeoRotation(Form("its3PhiSegmentOffset_%d_%d", mNLayer, i), 0, 0, phiOffset * i);
269-
mChip->AddNode(mSegment, i, rot);
269+
mChip->AddNode(mSegment, (int)i, rot);
270270
}
271271

272272
// Add metal stack positioned radially outward
273-
auto zMoveMetal = new TGeoTranslation(0, 0, constants::metalstack::length / 2. - constants::segment::lec::length);
273+
auto zMoveMetal = new TGeoTranslation(0, 0, (constants::metalstack::length / 2.) - constants::segment::lec::length);
274274
auto metal = new TGeoTubeSeg(mRmax, mRmax + constants::metalstack::thickness, constants::metalstack::length / 2., 0, constants::nSegments[mNLayer] * phiOffset);
275275
auto metalVol = new TGeoVolume(Form("metal%d", mNLayer), metal, mCopper);
276276
metalVol->SetLineColor(constants::metalstack::color);
@@ -296,7 +296,7 @@ void ITS3Layer::createCarbonForm()
296296
dRadius = constants::carbonfoam::thicknessOuterFoam; // TODO: lack of carbon foam radius for layer 2, use 0.7 cm as a temporary value
297297
}
298298
double phiSta = edgeBetwChipAndFoam / (0.5 * constants::radii[mNLayer + 1] + constants::radii[mNLayer]) * o2m::Rad2Deg;
299-
double phiEnd = (constants::nSegments[mNLayer] * constants::segment::width) / constants::radii[mNLayer] * o2m::Rad2Deg - phiSta;
299+
double phiEnd = ((constants::nSegments[mNLayer] * constants::segment::width) / constants::radii[mNLayer] * o2m::Rad2Deg) - phiSta;
300300
double phiLongeronsCover = longeronsWidth / (0.5 * constants::radii[mNLayer + 1] + constants::radii[mNLayer]) * o2m::Rad2Deg;
301301

302302
// H-rings foam
@@ -308,35 +308,37 @@ void ITS3Layer::createCarbonForm()
308308
HringCVol->SetLineColor(color);
309309
auto HringAVol = new TGeoVolume(Form("hringA%d", mNLayer), HringAWithHoles, mCarbon);
310310
HringAVol->SetLineColor(color);
311-
auto zMoveHringC = new TGeoTranslation(0, 0, -constants::segment::lec::length + HringLength / 2.);
312-
auto zMoveHringA = new TGeoTranslation(0, 0, -constants::segment::lec::length + HringLength / 2. + constants::segment::length - HringLength);
311+
auto zMoveHringC = new TGeoTranslation(0, 0, -constants::segment::lec::length + (HringLength / 2.));
312+
auto zMoveHringA = new TGeoTranslation(0, 0, -constants::segment::lec::length + (HringLength / 2.) + constants::segment::length - HringLength);
313313

314314
// Longerons are made by same material
315+
// added separately to make navigation faster
315316
[[maybe_unused]] auto longeronR = new TGeoTubeSeg(Form("longeronR%d", mNLayer), mRmax, mRmax + dRadius, longeronsLength / 2., phiSta, phiSta + phiLongeronsCover);
316317
[[maybe_unused]] auto longeronL = new TGeoTubeSeg(Form("longeronL%d", mNLayer), mRmax, mRmax + dRadius, longeronsLength / 2., phiEnd - phiLongeronsCover, phiEnd);
317-
TString nameLongerons = Form("longeronR%d + longeronL%d", mNLayer, mNLayer);
318-
auto longerons = new TGeoCompositeShape(nameLongerons);
319-
auto longeronsVol = new TGeoVolume(Form("longerons%d", mNLayer), longerons, mCarbon);
320-
longeronsVol->SetLineColor(color);
321-
auto zMoveLongerons = new TGeoTranslation(0, 0, -constants::segment::lec::length + constants::segment::length / 2.);
318+
auto longeronRVol = new TGeoVolume(Form("longeronR%d", mNLayer), longeronR, mCarbon);
319+
longeronRVol->SetLineColor(color);
320+
auto longeronLVol = new TGeoVolume(Form("longeronL%d", mNLayer), longeronL, mCarbon);
321+
longeronLVol->SetLineColor(color);
322+
auto zMoveLongerons = new TGeoTranslation(0, 0, -constants::segment::lec::length + (constants::segment::length / 2.));
322323

323324
mCarbonForm->AddNode(HringCVol, 0, zMoveHringC);
324325
mCarbonForm->AddNode(HringAVol, 0, zMoveHringA);
325-
mCarbonForm->AddNode(longeronsVol, 0, zMoveLongerons);
326+
mCarbonForm->AddNode(longeronRVol, 0, zMoveLongerons);
327+
mCarbonForm->AddNode(longeronLVol, 0, zMoveLongerons);
326328
mCarbonForm->AddNode(mChip, 0);
327329
}
328330

329-
TGeoCompositeShape* ITS3Layer::getHringShape(TGeoTubeSeg* Hring)
331+
TGeoCompositeShape* ITS3Layer::getHringShape(TGeoTubeSeg* Hring) const
330332
{
331333
// Function to dig holes in H-rings
332334
using namespace constants::carbonfoam;
333335
double stepPhiHoles = (Hring->GetPhi2() - Hring->GetPhi1()) / (nHoles[mNLayer]);
334-
double phiHolesSta = Hring->GetPhi1() + stepPhiHoles / 2.;
336+
double phiHolesSta = Hring->GetPhi1() + (stepPhiHoles / 2.);
335337
double radiusHring = 0.5 * (Hring->GetRmin() + Hring->GetRmax());
336338
TGeoCompositeShape* HringWithHoles = nullptr;
337339
TString nameAllHoles = "";
338340
for (int iHoles = 0; iHoles < nHoles[mNLayer]; iHoles++) {
339-
double phiHole = phiHolesSta + stepPhiHoles * iHoles;
341+
double phiHole = phiHolesSta + (stepPhiHoles * iHoles);
340342
TString nameHole = Form("hole_%d_%d", iHoles, mNLayer);
341343
[[maybe_unused]] auto hole = new TGeoTube(nameHole, 0, radiusHoles[mNLayer], 3 * Hring->GetDz());
342344
// move hole to the hring radius
@@ -376,9 +378,7 @@ void ITS3Layer::createLayerImpl()
376378

377379
void ITS3Layer::buildPartial(TGeoVolume* motherVolume, TGeoMatrix* mat, BuildLevel level, bool createMaterials)
378380
{
379-
if (!mBuilt) {
380-
getMaterials(createMaterials);
381-
}
381+
getMaterials(createMaterials);
382382
switch (level) {
383383
case BuildLevel::kPixelArray:
384384
createPixelArray();

0 commit comments

Comments
 (0)