@@ -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
377379void 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