ATLAS Offline Software
Loading...
Searching...
No Matches
TileGeoSectionBuilder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
10
11#include "GeoModelKernel/GeoPcon.h"
12#include "GeoModelKernel/GeoTubs.h"
13#include "GeoModelKernel/GeoTube.h"
14#include "GeoModelKernel/GeoTrd.h"
15#include "GeoModelKernel/GeoTrap.h"
16#include "GeoModelKernel/GeoBox.h"
17#include "GeoModelKernel/GeoMaterial.h"
18#include "GeoModelKernel/GeoLogVol.h"
19#include "GeoModelKernel/GeoPhysVol.h"
20#include "GeoModelKernel/GeoNameTag.h"
21#include "GeoModelKernel/GeoTransform.h"
22#include "GeoModelKernel/GeoSerialIdentifier.h"
23#include "GeoModelKernel/GeoIdentifierTag.h"
24#include "GeoModelKernel/GeoDefinitions.h"
25#include "GeoModelKernel/Units.h"
26
27#include "GeoModelKernel/GeoShapeUnion.h"
28#include "GeoModelKernel/GeoShapeShift.h"
29#include "GeoModelKernel/GeoShapeSubtraction.h"
30#include "GeoModelKernel/GeoCutVolAction.h"
31
32#include "GeoGenericFunctions/AbsFunction.h"
33#include "GeoGenericFunctions/Variable.h"
34#include "GeoModelKernel/GeoXF.h"
35#include "GeoModelKernel/GeoSerialTransformer.h"
37
38#include "GaudiKernel/MsgStream.h"
39#include "GaudiKernel/SystemOfUnits.h"
40
41#include "boost/io/ios_state.hpp"
42#include <iostream>
43
44#include <assert.h>
45
46#define MLOG(x) if (m_log->level()<=MSG::x) *m_log << MSG::x
47
48using namespace GeoGenfun;
49using namespace GeoXF;
50
51
53 TileDddbManager * pDbManager,
54 const TileSwitches & switches,
55 MsgStream * log)
56 : m_theMaterialManager(matManager)
57 , m_dbManager(pDbManager)
58 , m_log(log)
59 , m_switches(switches)
61 , m_barrelGlue(0.)
63 , m_verbose(log->level()<=MSG::VERBOSE)
67{
68}
69
70
72
73
75 int sec_number,
76 double tile_rmax,
77 double rminb,
78 double dzglue,
79 double delta_phi,
80 int ModuleNcp,
81 double zlen_itc2,
82 bool neg)
83{
84 (*m_log) << MSG::DEBUG <<" TileGeoSectionBuilder::fillSection ModuleNcp= "<<ModuleNcp<< endmsg;
85
86 double tan_delta_phi_2 = std::tan(delta_phi/2*Gaudi::Units::deg);
87
88 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
89 // Obtain required materials - Air and Iron
90
91 const GeoMaterial* matAir = m_theMaterialManager->getMaterial("std::Air");
92 const GeoMaterial* matIron = (m_switches.steel) ? m_theMaterialManager->getMaterial("tile::Steel")
93 : m_theMaterialManager->getMaterial("std::Iron");
94 const GeoMaterial* matAluminium{nullptr};
95
96 // -----------------------------------------------------------------------------------------------------------------
97 // Cut-outs
98 //static bool First =true;
99 double dX1 =0., dX2 =0., dY1 =0., dY2 =0., dZ1 =0., dZ2 =0.;
100 std::string volname ="";
101
102 // Cuting positioning
103 float PosXcut =0., PosYcut =0., PosY =0., Rmore =0.;
104 float Radius =0., YcorA =0., YcorB =0., lenPla =0., Blia =0.;
105
106 // General rotation and transformations
107 float phi = (double(ModuleNcp-1) + 0.5)*delta_phi;
108
109 // Special module flag
110 int SideFl = 1;
111 if (ModuleNcp>=35 && ModuleNcp<=37) SideFl = -1;
112
113 GeoTrf::Transform3D TransCut2(GeoTrf::Transform3D::Identity());
114 GeoTrf::Transform3D TransCutL(GeoTrf::Transform3D::Identity());
115 GeoTrf::Transform3D TransCutR(GeoTrf::Transform3D::Identity());
116
117 GeoIntrusivePtr<const GeoShapeUnion> CutA{nullptr};
118 GeoIntrusivePtr<GeoShape> CutB{nullptr};
119
120 // ext. barrel Cuts description
121 if (sec_number==2 && m_dbManager->BoolCuts() && ((ModuleNcp>=35 && ModuleNcp<=37) || (ModuleNcp>=60 && ModuleNcp<=62))) {
122 volname = "CutB"; m_dbManager->SetCurrentCuts(volname);
123 PosXcut = m_dbManager->CutsXpos();
124 PosYcut = m_dbManager->CutsYpos();
125 Rmore = 0.8*Gaudi::Units::cm;
126
127 // Inert materials, CutB1
128 dX1 = m_dbManager->CutsDX1()+Rmore;
129 dX2 = m_dbManager->CutsDX2()+Rmore;
130 dY1 = m_dbManager->CutsDY1()+Rmore;
131 dY2 = m_dbManager->CutsDY2()+Rmore;
132 dZ1 = m_dbManager->CutsDZ1();
133
134 checking("CutB1", false, 1, dX1,dX2,dY1,dY2,dZ1);
135 GeoTrd* CutB1 = new GeoTrd(dX1,dX2,dY1,dY2,dZ1);
136 //const GeoShape& CutB = *CutB1;
137 CutB = CutB1;
138
139 // Materials are in cuting region, 1up Iron plate
140 volname = "Cut1up"; m_dbManager->SetCurrentCuts(volname); //>>
141 PosY = m_dbManager->CutsYpos();
142
143 dX1 = m_dbManager->CutsDX1()+Rmore;
144 dX2 = m_dbManager->CutsDX2()+Rmore;
145 dY1 = m_dbManager->CutsDY1();
146 dY2 = m_dbManager->CutsDY2();
147 dZ1 = m_dbManager->CutsDZ1();
148
149 checking("Cut1up", false, 1, dX1,dX2,dY1,dY2,dZ1);
150 GeoTrd* Cut1up = new GeoTrd(dX1,dX2,dY1,dY2,dZ1);
151
152 volname = "Cut2down"; m_dbManager->SetCurrentCuts(volname); //>>
153 dX1 = m_dbManager->CutsDX1()+Rmore;
154 dX2 = m_dbManager->CutsDX2()+Rmore;
155 dY1 = m_dbManager->CutsDY1();
156 dY2 = m_dbManager->CutsDY2();
157 dZ2 = m_dbManager->CutsDZ1();
158
159 checking("Cut2down", false, 1, dX1,dX2,dY1,dY2,dZ2);
160 GeoTrd* Cut1down = new GeoTrd(dX1,dX2,dY1,dY2,dZ2);
161
162 GeoTrf::Translate3D yPosA(0.,0.,-dZ1-dZ2);
163
164 const GeoShapeUnion& CutA1 = Cut1up->add(*Cut1down<<yPosA);
165 CutA = &CutA1;
166
167 Radius = (m_dbManager->TILBrmaximal() + m_dbManager->TILBrminimal())/2 * Gaudi::Units::cm;
168
169 if (ModuleNcp==35||ModuleNcp==62) { YcorA = 5*Gaudi::Units::cm; YcorB = 5*Gaudi::Units::cm; lenPla =0.8*Gaudi::Units::cm, Blia = 17.4*Gaudi::Units::cm;}
170 if (ModuleNcp==36||ModuleNcp==61) { YcorA = 6.5*Gaudi::Units::cm; YcorB = 6*Gaudi::Units::cm; lenPla =1.7*Gaudi::Units::cm; Blia = 16.9*Gaudi::Units::cm;}
171 if (ModuleNcp==37||ModuleNcp==60) { YcorA = 8*Gaudi::Units::cm; YcorB = 9*Gaudi::Units::cm; lenPla =2.8*Gaudi::Units::cm; Blia = 16.4*Gaudi::Units::cm;}
172
173 TransCut2 = GeoTrf::TranslateZ3D(-Radius)
174 * GeoTrf::RotateX3D((90-phi)*Gaudi::Units::deg) * GeoTrf::RotateY3D(180*Gaudi::Units::deg)
175 * GeoTrf::Translate3D(0.1*Gaudi::Units::cm,SideFl*17.5*Gaudi::Units::cm,-PosY+YcorA);
176
177 // For modules on the side C apply extra transformation
178 // which implements ReflectZ(0)
179 if (neg) {
180 GeoTrf::Vector3D ptTmp = TransCut2*GeoTrf::Vector3D(0.,0.,0.);
181 TransCut2 = GeoTrf::TranslateX3D(2*ptTmp.x())*GeoTrf::RotateZ3D(180*Gaudi::Units::deg)*TransCut2;
182 }
183
184 if (ModuleNcp>=60 && ModuleNcp<=62) {
185 TransCutL = GeoTrf::TranslateZ3D(-Radius)
186 * GeoTrf::RotateY3D(180*Gaudi::Units::deg) * GeoTrf::RotateX3D(phi*Gaudi::Units::deg)
187 * GeoTrf::Translate3D(-1.4*Gaudi::Units::cm,PosYcut+YcorB,-PosXcut-Blia);
188
189 // ReflectZ for C side
190 if (neg) {
191 GeoTrf::Vector3D ptTmp = TransCutL*GeoTrf::Vector3D(0.,0.,0.);
192 TransCutL = GeoTrf::TranslateX3D(2*ptTmp.x())*GeoTrf::RotateZ3D(180*Gaudi::Units::deg)*TransCutL;
193 }
194
195 } else if (ModuleNcp>=35 && ModuleNcp<=37) {
196 TransCutR = GeoTrf::TranslateZ3D(-Radius)
197 * GeoTrf::RotateY3D(180*Gaudi::Units::deg) * GeoTrf::RotateX3D(phi*Gaudi::Units::deg)
198 * GeoTrf::Translate3D(-1.4*Gaudi::Units::cm,PosYcut+YcorB,PosXcut+Blia)
199 * GeoTrf::RotateY3D(180*Gaudi::Units::deg);
200 // ReflectZ for C side
201 if (neg) {
202 GeoTrf::Vector3D ptTmp = TransCutR*GeoTrf::Vector3D(0.,0.,0.);
203 TransCutR = GeoTrf::TranslateX3D(2*ptTmp.x())*GeoTrf::RotateZ3D(180*Gaudi::Units::deg)*TransCutR;
204 }
205 }
206
207 if (m_log->level()<=MSG::DEBUG)
208 (*m_log) << MSG::DEBUG <<" _fillSection: CutA and CutB Ok"<< endmsg;
209 } // end if, BoolCuts
210
211 //---------------------Girder-----------------------------------------
212
213 int Id4 = m_dbManager->GetModType()%100;
214 double thicknessGirderMother = 0.0;
215 double specialModuleZShift = 0.0;
216
217 if (m_dbManager->TILBngirder() > 0) {
218 // Mother volume for girder
219 thicknessGirderMother = (m_dbManager->TILBdzmodul() - m_dbManager->TILBdzend() - m_dbManager->TILBdzend2())*Gaudi::Units::cm;
220 // special module with special girder
221 if ((Id4 == 7) && (sec_number == 3))
222 thicknessGirderMother = (m_dbManager->TILBdzgir() - m_dbManager->TILBdzend() - m_dbManager->TILBdzend2())*Gaudi::Units::cm;
223
224 double heightGirderMother = (tile_rmax - m_dbManager->TILBrmax())*Gaudi::Units::cm;
225 double dy1GirderMother = m_dbManager->TILBrmax() * tan_delta_phi_2 * Gaudi::Units::cm;
226 double dy2GirderMother = tile_rmax * tan_delta_phi_2 * Gaudi::Units::cm;
227 // ps test the TILB DZGIR
228 // std::cout <<"\t\t PS Girder Module = "<<ModuleNcp<< std::endl;
229 // std::cout <<"\t\t PS thicknessGirderMother = "<<thicknessGirderMother<< std::endl;
230 //ps account for special ITC modules 14,15,18,19
231 if ((Id4 == 7) && (sec_number == 3)) {
232 specialModuleZShift = 0.5*Gaudi::Units::cm*(m_dbManager->TILBdzgir() - m_dbManager->TILBdzmodul());
233 }
234 //
235 checking("GirderMother", false, 3,
236 thicknessGirderMother/2,thicknessGirderMother/2,dy1GirderMother,dy2GirderMother,heightGirderMother/2);
237
238 GeoTrd* girderMother = new GeoTrd(thicknessGirderMother/2,
239 thicknessGirderMother/2,
240 dy1GirderMother,
241 dy2GirderMother,
242 heightGirderMother/2);
243
244 GeoLogVol* lvGirderMother = new GeoLogVol("GirderMother",girderMother,matAir);
245 PVLink pvGirderMother = new GeoPhysVol(lvGirderMother);
246
247 fillGirder(pvGirderMother,
248 tile_rmax,
249 m_dbManager->TILBrmax(),
250 tan_delta_phi_2,
251 thicknessGirderMother*(1./Gaudi::Units::cm));
252
253 GeoTransform* tfGirderMother{nullptr};
254
255 if (sec_number==3)
256 tfGirderMother = new GeoTransform(GeoTrf::Translate3D((m_dbManager->TILBdzend()-m_dbManager->TILBdzend2())*Gaudi::Units::cm/2, 0.,
257 (m_dbManager->TILBrmax()-m_dbManager->TILBrmin())*Gaudi::Units::cm/2));
258 else
259 tfGirderMother = new GeoTransform(GeoTrf::Translate3D((m_dbManager->TILBdzend()-m_dbManager->TILBdzend2())*Gaudi::Units::cm/2, 0.,
260 (m_dbManager->TILBrmax()-rminb)*Gaudi::Units::cm/2));
261
262 mother->add(tfGirderMother);
263 mother->add(pvGirderMother);
264
265 if (m_log->level()<=MSG::DEBUG)
266 (*m_log) << MSG::DEBUG <<" _fillSection: GirderMother Ok "<< endmsg;
267
268 } // End Girder
269
270 //--------------------Front Plate-------------------------------------
271 double thicknessFrontPlate, heightFrontPlate, dy1FrontPlate, dy2FrontPlate;
272 double rless =.150; // 150 [mkm]
273 int NbPeriod =0;
274
275 if (m_dbManager->TILBdrfront() > 0) {
276 if (sec_number==3) {
277 //ITC coverplate
278 thicknessFrontPlate = (m_dbManager->TILBdzmodul() - zlen_itc2)*Gaudi::Units::cm;
279
280 if (thicknessFrontPlate > rless) {
281 heightFrontPlate = m_dbManager->TILBdrfront()*Gaudi::Units::cm;
282 dy1FrontPlate = (rminb*tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
283 dy2FrontPlate = (m_dbManager->TILBrmin()*tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
284
285 if (m_log->level()<=MSG::DEBUG)
286 (*m_log) << MSG::DEBUG <<" FrontPlateSh dX1,dX2= "<<thicknessFrontPlate/2<<", "<<thicknessFrontPlate/2
287 <<" dY1,dY2= "<<dy1FrontPlate<<" "<<dy2FrontPlate<<" dZ= "<<heightFrontPlate/2
288 << endmsg;
289
290 GeoTrd* frontPlateSh = new GeoTrd(thicknessFrontPlate/2,
291 thicknessFrontPlate/2,
292 dy1FrontPlate,
293 dy2FrontPlate,
294 heightFrontPlate/2);
295
296 GeoLogVol* lvFrontPlateSh = new GeoLogVol("FrontPlateSh",frontPlateSh,matIron);
297 PVLink pvFrontPlateSh = new GeoPhysVol(lvFrontPlateSh);
298 GeoTransform* tfFrontPlateSh = new GeoTransform(GeoTrf::Translate3D(
299 -m_dbManager->TILBdzmodul()/2*Gaudi::Units::cm+thicknessFrontPlate/2, 0.,
300 (rminb - tile_rmax)/2*Gaudi::Units::cm));
301
302 mother->add(tfFrontPlateSh);
303 mother->add(pvFrontPlateSh);
304
305 } else {
306 if (m_log->level()<=MSG::DEBUG)
307 (*m_log) << MSG::DEBUG <<" FrontPlateSh was lost "<< endmsg;
308 }
309
310 } else if (sec_number==2 && (m_dbManager->BoolCuts() &&
311 ((ModuleNcp>=35 && ModuleNcp<=37)||(ModuleNcp>=60 && ModuleNcp<=62)) )) {
312
313 std::string volname ="";
314 double dXCutA = 0, dXCutB = 0;
315
316 volname = "Cut1up"; m_dbManager->SetCurrentCuts(volname);
317 dXCutA = m_dbManager->CutsDX1();
318
319 volname = "CutB"; m_dbManager->SetCurrentCuts(volname);
320 dXCutB = m_dbManager->CutsDX1();
321
322 thicknessFrontPlate = (m_dbManager->TILBdzmodul() - m_dbManager->TILBdzend1() - m_dbManager->TILBdzend2())*Gaudi::Units::cm;
323 heightFrontPlate = m_dbManager->TILBdrfront()*Gaudi::Units::cm;
324 dy1FrontPlate = (rminb*tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
325 dy2FrontPlate = (m_dbManager->TILBrmin()*tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
326
327 GeoTrd* frontPlate = new GeoTrd(thicknessFrontPlate/2 -(dXCutA+dXCutB),
328 thicknessFrontPlate/2 -(dXCutA+dXCutB),
329 dy1FrontPlate,
330 dy2FrontPlate,
331 heightFrontPlate/2);
332
333 // Cuting of Plate
334 /*
335 GeoTrf::Transform3D TCu2 = GeoTrf::RotateX3D((90-phi)*Gaudi::Units::deg) * GeoTrf::RotateY3D(180*Gaudi::Units::deg)
336 * GeoTrf::Translate3D(thicknessFrontPlate/2-dXCutA,0,0);
337 GeoTransform* TCu = new GeoTransform(TCu2);
338
339 const GeoShape &tmp_frontPlate = frontPlate->subtract((*CutA)<<TCu2);
340 .subtract((*CutB)<<TransCutL);
341 */
342
343 GeoLogVol* lvFrontPlate = new GeoLogVol("FrontPlate",frontPlate,matIron);
344 PVLink pvFrontPlate = new GeoPhysVol(lvFrontPlate);
345 GeoTransform* tfFrontPlate = new GeoTransform(GeoTrf::Translate3D(
346 (m_dbManager->TILBdzend1() - m_dbManager->TILBdzend2())/2*Gaudi::Units::cm+ dXCutB, 0.,
347 (m_dbManager->TILBrmin()-m_dbManager->TILBdrfront()/2-(tile_rmax + rminb)/2)*Gaudi::Units::cm));
348
349 mother->add(tfFrontPlate);
350 mother->add(pvFrontPlate);
351
352 if (m_log->level()<=MSG::DEBUG)
353 (*m_log) << MSG::DEBUG<<" _fillSection: FrontPlate Cut Ok "<< endmsg;
354
355 } else {
356 //Ordinary frontplate
357 thicknessFrontPlate = (m_dbManager->TILBdzmodul() - m_dbManager->TILBdzend1() - m_dbManager->TILBdzend2())*Gaudi::Units::cm;
358 heightFrontPlate = m_dbManager->TILBdrfront()*Gaudi::Units::cm;
359 dy1FrontPlate = (rminb*tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
360 dy2FrontPlate = (m_dbManager->TILBrmin()*tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
361
362 GeoTrd* frontPlate = new GeoTrd(thicknessFrontPlate/2,
363 thicknessFrontPlate/2,
364 dy1FrontPlate,
365 dy2FrontPlate,
366 heightFrontPlate/2);
367
368 GeoLogVol* lvFrontPlate = new GeoLogVol("FrontPlate",frontPlate,matIron);
369 PVLink pvFrontPlate = new GeoPhysVol(lvFrontPlate);
370 GeoTransform* tfFrontPlate = new GeoTransform(GeoTrf::Translate3D(
371 (m_dbManager->TILBdzend1() - m_dbManager->TILBdzend2())/2*Gaudi::Units::cm, 0.,
372 (m_dbManager->TILBrmin()-m_dbManager->TILBdrfront()/2-(tile_rmax + rminb)/2)*Gaudi::Units::cm));
373
374 mother->add(tfFrontPlate);
375 mother->add(pvFrontPlate);
376 }
377 } // End Front Plate
378
379 //--------------------End Plates--------------------------------------
380 double dy1EndPlate, dy2EndPlate, thicknessEndPlate, heightEndPlate;
381
382 //VARIABLES FOR END PLATE HOLE
383 double heightEPHole = m_dbManager->TILBflangex()*Gaudi::Units::cm;
384 double dyEPHole = m_dbManager->TILBflangex()*Gaudi::Units::cm/2;
385
386 // ps . shifts for end plates in cutout regions
387 GeoTrf::Transform3D cutOutTransformation(GeoTrf::Transform3D::Identity());
388 //first endplate
389 GeoIntrusivePtr<GeoTransform> tfEndPlateSh{nullptr};
390
391 if (m_dbManager->TILBdzend1() > 0) {
392 if (m_dbManager->TILBdzend() < m_dbManager->TILBdzend1()) {
393
394 //Short endplate
395 dy1EndPlate = rminb * tan_delta_phi_2 * Gaudi::Units::cm;
396 dy2EndPlate = m_dbManager->TILBrmax() * tan_delta_phi_2 * Gaudi::Units::cm;
397 thicknessEndPlate = m_dbManager->TILBdzend1() * Gaudi::Units::cm;
398 heightEndPlate = (m_dbManager->TILBrmax() - rminb) * Gaudi::Units::cm;
399 //
400 // creating standart endplate. It is the same for
401 // both standard mosules and modules with cuts
402 //
403 GeoTrd* endPlateSh = new GeoTrd(thicknessEndPlate/2,
404 thicknessEndPlate/2,
405 dy1EndPlate,
406 dy2EndPlate,
407 heightEndPlate/2);
408 GeoLogVol* lvEndPlateSh{nullptr};
409
410 // if ( sec_number==2 && ( (ModuleNcp==37)||( ModuleNcp==60) ) )
411 if (sec_number==2 && ((ModuleNcp>=35 && ModuleNcp<=37)||(ModuleNcp>=60 && ModuleNcp<=62)) ) { // Short endplate Cut-outs
412
413 //
414 // shape for the cutted part
415 //
416 GeoTrd* endPlateShCut = new GeoTrd(thicknessEndPlate,
417 thicknessEndPlate,
418 heightEndPlate/2.,
419 heightEndPlate/2.,
420 dy2EndPlate);
421
422
423 double rotationAngle ;
424 double shiftCutPlate ;
425 int rotationSign = 1;
426 if (ModuleNcp > 50) rotationSign *= -1;
427 if ( neg ) rotationSign *= -1;
428
429
430 if ( ( ModuleNcp == 37 ) || ( ModuleNcp == 60 ) ) {
431 rotationAngle = (180.0 - 25.3125 )* Gaudi::Units::deg ; // ATLLEMS_0003 0004
432 shiftCutPlate = 38.7 * Gaudi::Units::mm;
433
434 cutOutTransformation =
435 GeoTrf::Translate3D(0,0, -heightEndPlate/2.) *
436 GeoTrf::RotateX3D( 90 * Gaudi::Units::deg ) *
437 GeoTrf::Translate3D(0.,0., -rotationSign * (dy2EndPlate + shiftCutPlate ) ) *
438 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
439
440 const GeoShape & endPlateShCutted3760 = (endPlateSh->subtract( (*endPlateShCut)<< cutOutTransformation ) ) ;
441 lvEndPlateSh = new GeoLogVol("EndPlateSh", &(endPlateShCutted3760) , matIron);
442
443 } else if ( ( ModuleNcp == 36 ) || ( ModuleNcp == 61 ) ) {
444 rotationAngle = - ( 116.4832 - 90. )* Gaudi::Units::deg ; // ATLLEMS_0005 0006
445 shiftCutPlate = ( ( m_dbManager->TILBrmax() - rminb )*Gaudi::Units::cm - 1448.4 * Gaudi::Units::mm);
446
447 cutOutTransformation =
448 GeoTrf::Translate3D( 0, 0, -heightEndPlate/2. ) *
449 GeoTrf::Translate3D( 0, 0, - (dy2EndPlate - shiftCutPlate + 0.5*dy2EndPlate*(1.- std::cos(rotationAngle*Gaudi::Units::rad))) ) *
450 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
451
452 const GeoShape & endPlateShCutted3661 = (endPlateSh->subtract( (*endPlateShCut)<< cutOutTransformation ) ) ;
453 lvEndPlateSh = new GeoLogVol("EndPlateSh", &(endPlateShCutted3661) , matIron);
454
455 } else if ( ( ModuleNcp == 35 ) || ( ModuleNcp == 62 ) ) {
456 rotationAngle = - ( 104.0625 - 90.0 )* Gaudi::Units::deg ; // ATLLEMS_0007 0008
457 shiftCutPlate = ( ( m_dbManager->TILBrmax() - rminb )*Gaudi::Units::cm - 1534.6 * Gaudi::Units::mm);
458
459 cutOutTransformation =
460 GeoTrf::Translate3D( 0, 0, -heightEndPlate/2. ) *
461 GeoTrf::Translate3D( 0, 0, - (dy2EndPlate - shiftCutPlate) ) *
462 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
463
464 const GeoShape & endPlateShCutted3562 = (endPlateSh->subtract( (*endPlateShCut)<< cutOutTransformation ) ) ;
465 lvEndPlateSh = new GeoLogVol("EndPlateSh", &(endPlateShCutted3562) , matIron);
466
467 } else {
468 //coverity[DEADCODE]
469 // logically cannot reach here --- but leave in place to guard
470 // against future changes.
471 (*m_log) << MSG::ERROR <<" TileGeoSectionBuilder::fillSection . Wrong Module in cut-out region. ModuleNcp= "<<ModuleNcp<< endmsg;
472 lvEndPlateSh = new GeoLogVol("EndPlateSh", endPlateSh , matIron);
473 }
474
475 } else {
476 lvEndPlateSh = new GeoLogVol("EndPlateSh", endPlateSh , matIron);
477 }
478
479
480
481
482 // const GeoShape & endPlateShFinal = (endPlateSh->subtract( (*CutB)<<TransCutL ) );
483 //subtract((*CutB)<<TransCutL);
484
485 PVLink pvEndPlateSh = new GeoPhysVol(lvEndPlateSh);
486
487 tfEndPlateSh = new GeoTransform(GeoTrf::Translate3D(
488 specialModuleZShift +
489 (m_dbManager->TILBdzend1() - m_dbManager->TILBdzmodul())*Gaudi::Units::cm/2, 0.,
490 (m_dbManager->TILBrmax() - tile_rmax)*Gaudi::Units::cm/2));
491
492 mother->add(tfEndPlateSh);
493 mother->add(pvEndPlateSh);
494
495 if (m_log->level()<=MSG::DEBUG)
496 (*m_log) << MSG::DEBUG <<" _fillSection: ext.barrel EndPlateSh Ok "<< endmsg;
497
498 } else {
499 //Ordinary endplate
500 dy1EndPlate = rminb * tan_delta_phi_2 * Gaudi::Units::cm;
501 dy2EndPlate = tile_rmax * tan_delta_phi_2 * Gaudi::Units::cm;
502 thicknessEndPlate = m_dbManager->TILBdzend1() * Gaudi::Units::cm;
503 heightEndPlate = (tile_rmax-rminb)*Gaudi::Units::cm;
504
505 GeoTrd* endPlate1 = new GeoTrd(thicknessEndPlate/2,
506 thicknessEndPlate/2,
507 dy1EndPlate,
508 dy2EndPlate,
509 heightEndPlate/2);
510
511 GeoLogVol* lvEndPlate1 = new GeoLogVol("EndPlate1",endPlate1,matIron);
512 PVLink pvEndPlate1 = new GeoPhysVol(lvEndPlate1);
513
514 //Position air hole
515 if (m_dbManager->TILBflangex() > 0.) {
516 GeoTrd* epHole1 = new GeoTrd (thicknessEndPlate/2,
517 thicknessEndPlate/2,
518 dyEPHole,
519 dyEPHole,
520 heightEPHole/2);
521
522 GeoLogVol* lvEPHole1 = new GeoLogVol("EPHole1",epHole1,matAir);
523 PVLink pvEPHole1 = new GeoPhysVol(lvEPHole1);
524 GeoTransform* tfEPHole1 = new GeoTransform(GeoTrf::Translate3D(0.,0.,
525 (m_dbManager->TILBflangey()-(tile_rmax + rminb)/2)*Gaudi::Units::cm));
526 pvEndPlate1->add(tfEPHole1);
527 pvEndPlate1->add(pvEPHole1);
528 }
529
530 GeoTransform* tfEndPlate1 = new GeoTransform(GeoTrf::Translate3D(
531 (m_dbManager->TILBdzend1() - m_dbManager->TILBdzmodul())*Gaudi::Units::cm/2, 0., 0.));
532 mother->add(tfEndPlate1);
533 mother->add(pvEndPlate1);
534
535 if (m_log->level()<=MSG::DEBUG)
536 (*m_log) << MSG::DEBUG <<" _fillSection: Ordinary EndPlateSh Ok "<< endmsg;
537 }
538 }
539
540 //second endplate
541 GeoIntrusivePtr<GeoTransform> tfEndPlate2{nullptr};
542
543 if (m_dbManager->TILBdzend2() > 0) {
544 //Short endplate Cut-outs
545 double radShift =lenPla;
546 double rminbT=rminb + radShift;
547
548 dy1EndPlate = rminb * tan_delta_phi_2 * Gaudi::Units::cm;
549 dy2EndPlate = tile_rmax * tan_delta_phi_2 * Gaudi::Units::cm;
550 thicknessEndPlate = m_dbManager->TILBdzend2() * Gaudi::Units::cm;
551 heightEndPlate = (tile_rmax-rminb) * Gaudi::Units::cm;
552
553
554 GeoLogVol* lvEndPlate2{nullptr};
555 GeoTrd* endPlate2 = new GeoTrd(thicknessEndPlate/2,
556 thicknessEndPlate/2,
557 dy1EndPlate,
558 dy2EndPlate,
559 heightEndPlate/2);
560
561 tfEndPlate2 = new GeoTransform(GeoTrf::Translate3D(
562 (-m_dbManager->TILBdzend2() + m_dbManager->TILBdzmodul())*Gaudi::Units::cm/2, 0., 0.));
563
564 if (sec_number==2 && ((ModuleNcp>=35 && ModuleNcp<=37)||(ModuleNcp>=60 && ModuleNcp<=62)) ) { // Short endplate Cut-outs
565
566 GeoTrd* endPlate2Cut = new GeoTrd(thicknessEndPlate,
567 thicknessEndPlate,
568 heightEndPlate/2.,
569 heightEndPlate/2.,
570 dy2EndPlate);
571 double rotationAngle ;
572 double shiftCutPlate ;
573 int rotationSign = 1;
574 if (ModuleNcp > 50) rotationSign *= -1;
575 if ( neg ) rotationSign *= -1;
576
577 if ( ( ModuleNcp == 37 ) || ( ModuleNcp == 60 ) ) {
578 rotationAngle = - ( 115.3125 - 90.0 )* Gaudi::Units::deg ; // ATLLEMS_0011 0012
579 shiftCutPlate = ( ( m_dbManager->TILBrmax() - rminb )*Gaudi::Units::cm - 1364.0 * Gaudi::Units::mm);
580
581 cutOutTransformation =
582 GeoTrf::Translate3D( 0, 0, -heightEndPlate/2. ) *
583 GeoTrf::Translate3D( 0, 0, - (dy2EndPlate - shiftCutPlate) ) *
584 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
585
586 const GeoShape & endPlate2Cutted3760 = (endPlate2->subtract( (*endPlate2Cut)<< cutOutTransformation ) ) ;
587 lvEndPlate2 = new GeoLogVol("EndPlate2", &(endPlate2Cutted3760) , matIron);
588
589 } else if ( ( ModuleNcp == 36 ) || ( ModuleNcp == 61 ) ) {
590 rotationAngle = - ( 109.6875 - 90.0 )* Gaudi::Units::deg ; // ATLLEMS_0009 0010
591 shiftCutPlate = ( ( m_dbManager->TILBrmax() - rminb )*Gaudi::Units::cm - 1464.0 * Gaudi::Units::mm);
592
593 cutOutTransformation =
594 GeoTrf::Translate3D( 0, 0, -heightEndPlate/2. ) *
595 GeoTrf::Translate3D( 0, 0, - (dy2EndPlate - shiftCutPlate) ) *
596 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
597
598 const GeoShape & endPlate2Cutted3661 = (endPlate2->subtract( (*endPlate2Cut)<< cutOutTransformation ) ) ;
599 lvEndPlate2 = new GeoLogVol("EndPlate2", &(endPlate2Cutted3661) , matIron);
600
601 } else if ( ( ModuleNcp == 35 ) || ( ModuleNcp == 62 ) ) {
602 rotationAngle = - ( 104.0625 - 90.0 )* Gaudi::Units::deg ; // ATLLEMS_0009 0010
603 shiftCutPlate = ( ( m_dbManager->TILBrmax() - rminb )*Gaudi::Units::cm - ( 1915.0 -385.0 )* Gaudi::Units::mm); // girder is subtracted (no drawing)
604
605 cutOutTransformation =
606 GeoTrf::Translate3D( 0, 0, -heightEndPlate/2. ) *
607 GeoTrf::Translate3D( 0, 0, - (dy2EndPlate - shiftCutPlate) ) *
608 GeoTrf::RotateX3D( rotationSign * rotationAngle ) ;
609
610 const GeoShape & endPlate2Cutted3562 = (endPlate2->subtract( (*endPlate2Cut)<< cutOutTransformation ) ) ;
611 lvEndPlate2 = new GeoLogVol("EndPlate2", &(endPlate2Cutted3562) , matIron);
612 }
613
614 // dy1EndPlate = rminbT * tan_delta_phi_2 * Gaudi::Units::cm;
615 // dy2EndPlate = tile_rmax * tan_delta_phi_2 * Gaudi::Units::cm;
616 // thicknessEndPlate = m_dbManager->TILBdzend2() * Gaudi::Units::cm;
617 // heightEndPlate = (tile_rmax - rminbT) * Gaudi::Units::cm;
618
619 // tfEndPlate2 = new GeoTransform(GeoTrf::Translate3D(
620 // (-m_dbManager->TILBdzend2() + m_dbManager->TILBdzmodul())*Gaudi::Units::cm/2, 0, radShift/2*Gaudi::Units::cm));
621
622 } else {
623 lvEndPlate2 = new GeoLogVol("EndPlate2",endPlate2,matIron);
624 }
625
626 PVLink pvEndPlate2 = new GeoPhysVol(lvEndPlate2);
627
628 //Position air hole
629 if (m_dbManager->TILBflangex() > 0) {
630 dyEPHole = m_dbManager->TILBflangex()*Gaudi::Units::cm/2;
631
632 GeoTrd* epHole2 = new GeoTrd (thicknessEndPlate/2,
633 thicknessEndPlate/2,
634 dyEPHole,
635 dyEPHole,
636 heightEPHole/2);
637
638 GeoLogVol* lvEPHole2 = new GeoLogVol("EPHole2",epHole2,matAir);
639 PVLink pvEPHole2 = new GeoPhysVol(lvEPHole2);
640 GeoTransform* tfEPHole2 = new GeoTransform(GeoTrf::Translate3D(0.,0.,
641 (m_dbManager->TILBflangey()-(tile_rmax + rminbT)/2)*Gaudi::Units::cm));
642 pvEndPlate2->add(tfEPHole2);
643 pvEndPlate2->add(pvEPHole2);
644 }
645
646 mother->add(tfEndPlate2);
647 mother->add(pvEndPlate2);
648
649 if (m_log->level()<=MSG::DEBUG)
650 (*m_log) << MSG::DEBUG <<" _fillSection: EndPlate2 Ok "<< endmsg;
651
652 } // End Plates
653
654 //---------------------------------------------------Absorber--------------------------------------------------------
655 double heightAbsorber = (m_dbManager->TILBrmax() - m_dbManager->TILBrmin())*Gaudi::Units::cm;
656 double thicknessAbsorber = (m_dbManager->TILBdzmodul() - m_dbManager->TILBdzend1() - m_dbManager->TILBdzend2())*Gaudi::Units::cm;
657 double dy1Absorber = (m_dbManager->TILBrmin()*tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
658 double dy2Absorber = (m_dbManager->TILBrmax()*tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
659
660 checking("Absorber", true, 3,
661 thicknessAbsorber/2,thicknessAbsorber/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
662
663 //----------------------------- Absorber -------------------------------------------------------------------
664 double thicknessPeriod =0, thicknessAbsorber1 =0, thicknessAbsorber2 =0, thicknessAbsorber3 =0;
665 double PosAbsor1 =0, PosAbsor2 =0, PosAbsor3 =0;
666 int nA1 =32, nA2 = 0, nA3 =16;
667
668 GeoTrd *absorber{nullptr}, *absorber1{nullptr}, *absorber3{nullptr};
669 GeoLogVol *lvAbsorber{nullptr}, *lvAbsorber1{nullptr}, *lvAbsorber3{nullptr};
670 PVLink pvAbsorber{nullptr}, pvAbsorber1{nullptr}, pvAbsorber3{nullptr},
671 pvTmp_Absorber1{nullptr}, pvTmp_Absorber3{nullptr};
672
673 // Perform different actions depending on sections
674 switch (sec_number) {
675 case 2:
676 {
677 //Extended barrel - consists of ordinary periods of type 1 only
678 thicknessPeriod = 2.*(m_dbManager->TILBdzmast() + m_dbManager->TILBdzspac() + 2.*dzglue)*Gaudi::Units::cm;
679
680 // The period number for middle absorber
681 nA2 = m_dbManager->TILBnperiod() - (nA1+nA3);
682
683 thicknessAbsorber1 = nA1*thicknessPeriod;
684 PosAbsor1 = thicknessAbsorber/2 - thicknessAbsorber1/2;
685
686 thicknessAbsorber2 = nA2*thicknessPeriod;
687 PosAbsor2 = thicknessAbsorber/2 - thicknessAbsorber1 - thicknessAbsorber2/2;
688
689 thicknessAbsorber3 = nA3*thicknessPeriod;
690 PosAbsor3 = thicknessAbsorber/2 - thicknessAbsorber1 - thicknessAbsorber2 - thicknessAbsorber3/2;
691
692 if (m_log->level()<=MSG::DEBUG)
693 (*m_log) << MSG::DEBUG <<" Number of periods per Module: N= "<<nA1+nA2+nA3
694 << " Middle absorber, numbers of periods = "<<nA2
695 << endmsg;
696
697 // First Cut-out part
698 absorber1 = new GeoTrd(thicknessAbsorber1/2, thicknessAbsorber1/2,
699 dy1Absorber, dy2Absorber,
700 heightAbsorber/2);
701
702 lvAbsorber1 = new GeoLogVol("Absorber",absorber1,matIron);
703 pvAbsorber1 = new GeoPhysVol(lvAbsorber1);
704
705 // absorber without Cut-out, middle part
706 absorber = new GeoTrd(thicknessAbsorber2/2, thicknessAbsorber2/2,
707 dy1Absorber, dy2Absorber,
708 heightAbsorber/2);
709
710 lvAbsorber = new GeoLogVol("Absorber",absorber,matIron);
711 pvAbsorber = new GeoPhysVol(lvAbsorber);
712
713 //
714 // Second Cut-out part
715 absorber3 = new GeoTrd(thicknessAbsorber3/2, thicknessAbsorber3/2,
716 dy1Absorber, dy2Absorber,
717 heightAbsorber/2);
718
719 lvAbsorber3 = new GeoLogVol("Absorber",absorber3,matIron);
720 pvAbsorber3 = new GeoPhysVol(lvAbsorber3);
721 //
722
723 if (m_log->level()<=MSG::DEBUG)
724 (*m_log) << MSG::DEBUG <<" _fillSection: Ex.Barrel pvAbsorber 1,3 Ok "<< endmsg;
725
726 break;
727 }
728 default:
729 {
730 absorber = new GeoTrd(thicknessAbsorber/2, thicknessAbsorber/2,
731 dy1Absorber, dy2Absorber,
732 heightAbsorber/2);
733
734 if (m_dbManager->TILBnperiod() > 1) {
735 lvAbsorber = new GeoLogVol("Absorber",absorber,matIron);
736 } else {
737 // make C10special/Gap/Crack absorber volume from Air, Aluminium will be in period
738 lvAbsorber = new GeoLogVol("Absorber",absorber,matAir);
739 }
740 pvAbsorber = new GeoPhysVol(lvAbsorber);
741
742 if (m_log->level()<=MSG::DEBUG) {
743 if (m_dbManager->TILBnperiod() > 1) {
744 (*m_log) << MSG::DEBUG <<" _fillSection: default pvAbsorber Ok "<< endmsg;
745 } else {
746 (*m_log) << MSG::DEBUG <<" _fillSection: special pvAbsorber made from Air Ok "<< endmsg;
747 }
748 }
749
750 break;
751 }
752 }
753 //----- ------ ------- PERIODS ------ ------ ------ PERIODS ----- ------- -------
754 double thicknessAbsorberChild;
755 Variable periodInd;
756
757 GeoTrd* period{nullptr};
758 GeoLogVol* lvPeriod{nullptr};
759 PVLink pvPeriod{nullptr};
760 GeoTransform* tfPeriod{nullptr};
761 GeoSerialTransformer* stPeriod{nullptr};
762
763 GeoTrd* absorberChild{nullptr};
764 GeoLogVol* lvAbsorberChild{nullptr};
765 PVLink pvAbsorberChild{nullptr};
766 GeoTransform* tfAbsorberChild{nullptr};
767
768 // Perform different actions depending on sections
769 switch (sec_number) {
770 case 1:
771 {
772 //Barrel section
773 //Divide absorber volume on two parts: first filled with
774 //nrOfPeriods-1 ordinary period and second with one special period of type 2
775
776 //First division
777 thicknessPeriod = 2.*(m_dbManager->TILBdzmast() + m_dbManager->TILBdzspac() + 2.*dzglue)*Gaudi::Units::cm;
778 MLOG(DEBUG) << "BARREL Section -- m_dbManager->TILBdzmast(): " << m_dbManager->TILBdzmast() << ", m_dbManager->TILBdzspac(): " << m_dbManager->TILBdzspac()
779 << ", dzglue: " << dzglue << " ==> thicknessPeriod: " << thicknessPeriod << endmsg;
780
781 m_barrelPeriodThickness = thicknessPeriod;
782 m_barrelGlue = dzglue*Gaudi::Units::cm;
783
784 checking("Period 0", false, 4,
785 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
786
787 period = new GeoTrd(thicknessPeriod/2,
788 thicknessPeriod/2,
789 dy1Absorber,
790 dy2Absorber,
791 heightAbsorber/2);
792
793 lvPeriod = new GeoLogVol("Period",period,matIron);
794 pvPeriod = new GeoPhysVol(lvPeriod);
795
796 fillPeriod(pvPeriod,
797 thicknessPeriod*(1./Gaudi::Units::cm),
798 dzglue,
799 tan_delta_phi_2,
800 1); // 1-period type
801
802
803 thicknessAbsorberChild = thicknessPeriod*(m_dbManager->TILBnperiod()-1);
804 absorberChild = new GeoTrd(thicknessAbsorberChild/2,
805 thicknessAbsorberChild/2,
806 dy1Absorber,
807 dy2Absorber,
808 heightAbsorber/2);
809 lvAbsorberChild = new GeoLogVol("AbsorberChild",absorberChild,matAir);
810 pvAbsorberChild = new GeoPhysVol(lvAbsorberChild);
811
812 // Place periods into Absorber Child like G4 replica
813 GENFUNCTION periodPos1 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorberChild)/2;
814 TRANSFUNCTION xfReplica1 = Pow(GeoTrf::TranslateX3D(1.),periodPos1);
815 if (m_verbose) checktransfunc(thicknessAbsorberChild,thicknessPeriod,m_dbManager->TILBnperiod()-1,
816 (thicknessAbsorberChild - thicknessAbsorber)/2);
817
818 stPeriod = new GeoSerialTransformer(pvPeriod,
819 &xfReplica1,
820 m_dbManager->TILBnperiod()-1);
821
822 pvAbsorberChild->add(new GeoSerialIdentifier(0));
823 pvAbsorberChild->add(stPeriod);
824
825 // Place absorber child
826 tfAbsorberChild = new GeoTransform(GeoTrf::Translate3D((thicknessAbsorberChild - thicknessAbsorber)/2,0.,0.));
827 pvAbsorber->add(tfAbsorberChild);
828 pvAbsorber->add(pvAbsorberChild);
829
830 //Second division
831 thicknessPeriod = (m_dbManager->TILBdzmast() + 2.*m_dbManager->TILBdzspac() + 2.*dzglue)*Gaudi::Units::cm;
832
833 checking("Period 1", false, 4,
834 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
835
836 period = new GeoTrd(thicknessPeriod/2,
837 thicknessPeriod/2,
838 dy1Absorber,
839 dy2Absorber,
840 heightAbsorber/2);
841 lvPeriod = new GeoLogVol("Period",period,matIron);
842 pvPeriod = new GeoPhysVol(lvPeriod);
843
844 fillPeriod(pvPeriod,
845 thicknessPeriod*(1./Gaudi::Units::cm),
846 dzglue,
847 tan_delta_phi_2,
848 2); // 2-period type
849
850
851 thicknessAbsorberChild = thicknessPeriod;
852 absorberChild = new GeoTrd(thicknessAbsorberChild/2,
853 thicknessAbsorberChild/2,
854 dy1Absorber,
855 dy2Absorber,
856 heightAbsorber/2);
857 lvAbsorberChild = new GeoLogVol("AbsorberChild",absorberChild,matAir);
858 pvAbsorberChild = new GeoPhysVol(lvAbsorberChild);
859
860 if (m_verbose) checktransfunc(thicknessAbsorberChild,thicknessPeriod,1,
861 (-thicknessAbsorberChild + thicknessAbsorber)/2);
862
863 // Place period in the absorber child
864 tfPeriod = new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
865
866 pvAbsorberChild->add(new GeoIdentifierTag(m_dbManager->TILBnperiod()-1));
867 pvAbsorberChild->add(tfPeriod);
868 pvAbsorberChild->add(pvPeriod);
869
870 // Place absorber child
871 tfAbsorberChild = new GeoTransform(GeoTrf::Translate3D((-thicknessAbsorberChild + thicknessAbsorber)/2,0.,0.));
872 pvAbsorber->add(tfAbsorberChild);
873 pvAbsorber->add(pvAbsorberChild);
874
875 break;
876 }
877 case 2:
878 {
879 //Extended barrel - consists of ordinary periods of type 1 only
880 thicknessPeriod = 2. * (m_dbManager->TILBdzmast() + m_dbManager->TILBdzspac() + 2.*dzglue) * Gaudi::Units::cm;
881 MLOG(DEBUG) << "EXTENDED BARREL Section -- m_dbManager->TILBdzmast(): " << m_dbManager->TILBdzmast() << ", m_dbManager->TILBdzspac(): " << m_dbManager->TILBdzspac()
882 << ", dzglue: " << dzglue << " ==> thicknessPeriod: " << thicknessPeriod << endmsg;
883
884 checking("Period 2", false, 4,
885 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
886
887 period = new GeoTrd(thicknessPeriod/2,
888 thicknessPeriod/2,
889 dy1Absorber,
890 dy2Absorber,
891 heightAbsorber/2);
892 lvPeriod = new GeoLogVol("Period",period,matIron);
893 pvPeriod = new GeoPhysVol(lvPeriod);
894
895 m_extendedPeriodThickness = thicknessPeriod;
896
897 fillPeriod(pvPeriod,
898 thicknessPeriod*(1./Gaudi::Units::cm),
899 dzglue,
900 tan_delta_phi_2,
901 1); // 1-period type
902
903 // Place periods into Absorber like G4 replica
904 // - first partr of absorber
905 //
906 GENFUNCTION periodPos1 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorber1)/2;
907 TRANSFUNCTION xfReplica1 = Pow(GeoTrf::TranslateX3D(1.),periodPos1);
908 if (m_verbose) checktransfunc(thicknessAbsorber1,thicknessPeriod,nA1,
909 (-thicknessAbsorber+thicknessAbsorber1)/2.);
910
911 stPeriod = new GeoSerialTransformer(pvPeriod,&xfReplica1,nA1); //m_dbManager->TILBnperiod());
912
913 pvAbsorber1->add(new GeoSerialIdentifier(0));
914 pvAbsorber1->add(stPeriod);
915 //
916
917 if (m_dbManager->BoolCuts()) {
918 if ((ModuleNcp>=35 && ModuleNcp<=37) || (ModuleNcp>=60 && ModuleNcp<=62)) {
919 // Cuting of (-)
920 GeoCutVolAction action1(*CutA, TransCut2);
921 pvAbsorber1->apply(&action1);
922 pvTmp_Absorber1 = action1.getPV();
923 //
924 if (m_log->level()<=MSG::DEBUG)
925 (*m_log) << MSG::DEBUG <<" _fillSection: CutA Ok "<< endmsg;
926 } // end special modules
927 } // end if, BoolCuts()
928 if (m_log->level()<=MSG::DEBUG)
929 (*m_log) << MSG::DEBUG <<" _fillSection: Absorber1 Ok "<< endmsg;
930
931 // middle partr of absorber
932 GENFUNCTION periodPos2 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorber2)/2;
933 TRANSFUNCTION xfReplica2 = Pow(GeoTrf::TranslateX3D(1.),periodPos2);
934 if (m_verbose) checktransfunc(thicknessAbsorber2,thicknessPeriod,nA2,
935 (-thicknessAbsorber+thicknessAbsorber2)/2.+thicknessAbsorber1);
936
937 stPeriod = new GeoSerialTransformer(pvPeriod,&xfReplica2,nA2); //m_dbManager->TILBnperiod());
938
939 pvAbsorber->add(new GeoSerialIdentifier(nA1));
940 pvAbsorber->add(stPeriod);
941
942 if (m_log->level()<=MSG::DEBUG)
943 (*m_log) << MSG::DEBUG <<" _fillSection: pvAbsorber Ok "<< endmsg;
944
945 // second partr of absorber
946 //
947 GENFUNCTION periodPos3 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorber3)/2;
948 TRANSFUNCTION xfReplica3 = Pow(GeoTrf::TranslateX3D(1.),periodPos3);
949 if (m_verbose) checktransfunc(thicknessAbsorber3,thicknessPeriod,nA3,
950 (-thicknessAbsorber+thicknessAbsorber3)/2.+thicknessAbsorber2+thicknessAbsorber1);
951
952 stPeriod = new GeoSerialTransformer(pvPeriod,&xfReplica3,nA3); //m_dbManager->TILBnperiod());
953
954 pvAbsorber3->add(new GeoSerialIdentifier(nA1+nA2));
955 pvAbsorber3->add(stPeriod);
956
957 if (m_dbManager->BoolCuts()) {
958 if (ModuleNcp>=60 && ModuleNcp<=62) {
959 // Cuting of pvEBarrelModuleMotherPos (Left)
960 //
961 GeoCutVolAction action2(*CutB, TransCutL);
962 pvAbsorber3->apply(&action2);
963 pvTmp_Absorber3 = action2.getPV();
964 if (m_log->level()<=MSG::DEBUG)
965 (*m_log) << MSG::DEBUG <<" _fillSection: CutB L Ok "<< endmsg;
966
967 } else if (ModuleNcp>=35 && ModuleNcp<=37) {
968 // Cuting of pvEBarrelModuleMotherPos (Right)
969 //
970 GeoCutVolAction action3(*CutB, TransCutR);
971 pvAbsorber3->apply(&action3);
972 pvTmp_Absorber3 = action3.getPV();
973 if (m_log->level()<=MSG::DEBUG)
974 (*m_log) << MSG::DEBUG <<" _fillSection: CutB R Ok "<< endmsg;
975 }
976 } // end if, BoolCuts()
977 if (m_log->level()<=MSG::DEBUG) {
978 (*m_log) << MSG::DEBUG <<" _fillSection: Absorber3 Ok "<< endmsg;
979 }
980
981 break;
982 }
983 case 3:
984 {
985 //Plug Section 1 - consists of ordinary periods of type 3
986 // ps plug1 special module
987 if ((m_dbManager->TILBsection() == 7)||(m_dbManager->TILBsection() == 8)) {
988 //Divide absorber volume on two parts: first filled with
989 //nrOfPeriods-1 ordinary period of type 1 and second with one special period of type 4
990
991 //First division
992 thicknessPeriod = 2.*(m_dbManager->TILBdzmast() + m_dbManager->TILBdzspac() + 2.*dzglue)*Gaudi::Units::cm;
993 MLOG(DEBUG) << "PLUG Section 1 -- m_dbManager->TILBdzmast(): " << m_dbManager->TILBdzmast() << ", m_dbManager->TILBdzspac(): " << m_dbManager->TILBdzspac()
994 << ", dzglue: " << dzglue << " ==> thicknessPeriod: " << thicknessPeriod << endmsg;
995
996 checking("Period 3 (ITC1 special)", true, 4,
997 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
998
999 period = new GeoTrd(thicknessPeriod/2,
1000 thicknessPeriod/2,
1001 dy1Absorber,
1002 dy2Absorber,
1003 heightAbsorber/2);
1004 lvPeriod = new GeoLogVol("Period",period,matIron);
1005 pvPeriod = new GeoPhysVol(lvPeriod);
1006
1007 fillPeriod(pvPeriod,
1008 thicknessPeriod*(1./Gaudi::Units::cm),
1009 dzglue,
1010 tan_delta_phi_2,
1011 1); // 1-period type
1012
1013 thicknessAbsorberChild = thicknessPeriod*(m_dbManager->TILBnperiod()-1);
1014
1015 absorberChild = new GeoTrd(thicknessAbsorberChild/2,
1016 thicknessAbsorberChild/2,
1017 dy1Absorber,
1018 dy2Absorber,
1019 heightAbsorber/2);
1020 lvAbsorberChild = new GeoLogVol("AbsorberChild",absorberChild,matAir);
1021 pvAbsorberChild = new GeoPhysVol(lvAbsorberChild);
1022
1023 // Place periods into Absorber Child like G4 replica
1024 GENFUNCTION periodPosITC1sp = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorberChild)/2;
1025 TRANSFUNCTION xfReplicaITC1sp = Pow(GeoTrf::TranslateX3D(1.),periodPosITC1sp);
1026 if (m_verbose) checktransfunc(thicknessAbsorberChild,thicknessPeriod,m_dbManager->TILBnperiod()-1,
1027 (thicknessAbsorberChild - thicknessAbsorber)/2);
1028
1029 stPeriod = new GeoSerialTransformer(pvPeriod,
1030 &xfReplicaITC1sp,
1031 m_dbManager->TILBnperiod()-1);
1032
1033 pvAbsorberChild->add(new GeoSerialIdentifier(0));
1034 pvAbsorberChild->add(stPeriod);
1035
1036 // Place absorber child
1037 tfAbsorberChild = new GeoTransform(GeoTrf::Translate3D((thicknessAbsorberChild - thicknessAbsorber)/2,0.,0.));
1038 pvAbsorber->add(tfAbsorberChild);
1039 pvAbsorber->add(pvAbsorberChild);
1040 //
1041 //Second division
1042 //
1043 thicknessPeriod = m_dbManager->TILBdzspac()*Gaudi::Units::cm;
1044
1045 checking("Period 5 (ITC1 special)", true, 4,
1046 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
1047
1048 period = new GeoTrd(thicknessPeriod/2,
1049 thicknessPeriod/2,
1050 dy1Absorber,
1051 dy2Absorber,
1052 heightAbsorber/2);
1053 lvPeriod = new GeoLogVol("Period",period,matIron);
1054 pvPeriod = new GeoPhysVol(lvPeriod);
1055
1056 fillPeriod(pvPeriod,
1057 thicknessPeriod*(1./Gaudi::Units::cm),
1058 dzglue,
1059 tan_delta_phi_2,
1060 4); // 4-period type
1061
1062 thicknessAbsorberChild = thicknessPeriod;
1063 absorberChild = new GeoTrd(thicknessAbsorberChild/2,
1064 thicknessAbsorberChild/2,
1065 dy1Absorber,
1066 dy2Absorber,
1067 heightAbsorber/2);
1068 lvAbsorberChild = new GeoLogVol("AbsorberChild",absorberChild,matAir);
1069 pvAbsorberChild = new GeoPhysVol(lvAbsorberChild);
1070
1071 if (m_verbose) checktransfunc(thicknessAbsorberChild,thicknessPeriod,1,
1072 (-thicknessAbsorberChild + thicknessAbsorber)/2);
1073
1074 // Place period in the absorber child
1075 tfPeriod = new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
1076 pvAbsorberChild->add(new GeoIdentifierTag(m_dbManager->TILBnperiod()-1));
1077 pvAbsorberChild->add(tfPeriod);
1078 pvAbsorberChild->add(pvPeriod);
1079
1080 // Place absorber child
1081 tfAbsorberChild = new GeoTransform(GeoTrf::Translate3D((-thicknessAbsorberChild + thicknessAbsorber)/2,0.,0.));
1082 pvAbsorber->add(tfAbsorberChild);
1083 pvAbsorber->add(pvAbsorberChild);
1084
1085 if (m_log->level()<=MSG::DEBUG)
1086 (*m_log) << MSG::DEBUG <<" _fillSection: Absorber (ITC plug special) Ok "<< endmsg;
1087
1088 } else {
1089 thicknessPeriod = 2.*(m_dbManager->TILBdzmast() + m_dbManager->TILBdzspac() + 2.*dzglue)*Gaudi::Units::cm;
1090
1091 checking("Period 3", true, 4,
1092 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
1093
1094 period = new GeoTrd(thicknessPeriod/2,
1095 thicknessPeriod/2,
1096 dy1Absorber,
1097 dy2Absorber,
1098 heightAbsorber/2);
1099 lvPeriod = new GeoLogVol("Period",period,matIron);
1100 pvPeriod = new GeoPhysVol(lvPeriod);
1101
1102 fillPeriod(pvPeriod,
1103 thicknessPeriod*(1./Gaudi::Units::cm),
1104 dzglue,
1105 tan_delta_phi_2,
1106 3); // 3-period type
1107
1108 // Place periods into Absorber like G4 replica
1109 GENFUNCTION periodPos3 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorber)/2;
1110 TRANSFUNCTION xfReplica3 = Pow(GeoTrf::TranslateX3D(1.),periodPos3);
1111 if (m_verbose) checktransfunc(thicknessAbsorber,thicknessPeriod,m_dbManager->TILBnperiod(),0.0);
1112
1113 //ps if ( (m_dbManager->TILBsection()==7 || m_dbManager->TILBsection()==8) && m_dbManager->SCNTitem()==302)
1114 // if ( m_dbManager->TILBsection()==7 && m_dbManager->SCNTitem() == 302)
1115 // NbPeriod = m_dbManager->TILBnperiod() - 1;
1116 // else
1117 NbPeriod = m_dbManager->TILBnperiod();
1118
1119 if (m_log->level()<=MSG::DEBUG)
1120 (*m_log) << MSG::DEBUG <<" SCNTitem= "<<m_dbManager->SCNTitem()<<" NbPeriod= "<<NbPeriod<< endmsg;
1121 stPeriod = new GeoSerialTransformer(pvPeriod,
1122 &xfReplica3,
1123 NbPeriod);//sbb
1124
1125 pvAbsorber->add(new GeoSerialIdentifier(0));
1126 pvAbsorber->add(stPeriod);
1127 if (m_log->level()<=MSG::DEBUG)
1128 (*m_log) << MSG::DEBUG <<" _fillSection: Absorber (case 3) Ok "<< endmsg;
1129 }
1130 break;
1131 }
1132 case 4:
1133 {
1134 //Plug Section 2
1135 //Divide absorber volume on two parts: first filled with
1136 //nrOfPeriods-1 ordinary period of type 1 and second with one special period of type 4
1137
1138 //First division
1139 thicknessPeriod = 2.*(m_dbManager->TILBdzmast() + m_dbManager->TILBdzspac() + 2.*dzglue)*Gaudi::Units::cm;
1140 MLOG(DEBUG) << "PLUG Section 2 -- m_dbManager->TILBdzmast(): " << m_dbManager->TILBdzmast() << ", m_dbManager->TILBdzspac(): " << m_dbManager->TILBdzspac()
1141 << ", dzglue: " << dzglue << " ==> thicknessPeriod: " << thicknessPeriod << endmsg;
1142
1143 checking("Period 4", true, 4,
1144 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
1145
1146 period = new GeoTrd(thicknessPeriod/2,
1147 thicknessPeriod/2,
1148 dy1Absorber,
1149 dy2Absorber,
1150 heightAbsorber/2);
1151 lvPeriod = new GeoLogVol("Period",period,matIron);
1152 pvPeriod = new GeoPhysVol(lvPeriod);
1153
1154 fillPeriod(pvPeriod,
1155 thicknessPeriod*(1./Gaudi::Units::cm),
1156 dzglue,
1157 tan_delta_phi_2,
1158 1); // 1-period type
1159
1160
1161 thicknessAbsorberChild = thicknessPeriod*(m_dbManager->TILBnperiod()-1);
1162 absorberChild = new GeoTrd(thicknessAbsorberChild/2,
1163 thicknessAbsorberChild/2,
1164 dy1Absorber,
1165 dy2Absorber,
1166 heightAbsorber/2);
1167 lvAbsorberChild = new GeoLogVol("AbsorberChild",absorberChild,matAir);
1168 pvAbsorberChild = new GeoPhysVol(lvAbsorberChild);
1169
1170 // Place periods into Absorber Child like G4 replica
1171 GENFUNCTION periodPos1 = (thicknessPeriod*(2*periodInd+1)-thicknessAbsorberChild)/2;
1172 TRANSFUNCTION xfReplica1 = Pow(GeoTrf::TranslateX3D(1.),periodPos1);
1173 if (m_verbose) checktransfunc(thicknessAbsorberChild,thicknessPeriod,m_dbManager->TILBnperiod()-1,
1174 (thicknessAbsorberChild - thicknessAbsorber)/2);
1175
1176 stPeriod = new GeoSerialTransformer(pvPeriod,
1177 &xfReplica1,
1178 m_dbManager->TILBnperiod()-1);
1179
1180 pvAbsorberChild->add(new GeoSerialIdentifier(0));
1181 pvAbsorberChild->add(stPeriod);
1182
1183 // Place absorber child
1184 tfAbsorberChild = new GeoTransform(GeoTrf::Translate3D((thicknessAbsorberChild - thicknessAbsorber)/2,0.,0.));
1185 pvAbsorber->add(tfAbsorberChild);
1186 pvAbsorber->add(pvAbsorberChild);
1187
1188 //Second division
1189 thicknessPeriod = m_dbManager->TILBdzspac()*Gaudi::Units::cm;
1190
1191 checking("Period 5", true, 4,
1192 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
1193
1194 period = new GeoTrd(thicknessPeriod/2,
1195 thicknessPeriod/2,
1196 dy1Absorber,
1197 dy2Absorber,
1198 heightAbsorber/2);
1199 lvPeriod = new GeoLogVol("Period",period,matIron);
1200 pvPeriod = new GeoPhysVol(lvPeriod);
1201
1202 fillPeriod(pvPeriod,
1203 thicknessPeriod*(1./Gaudi::Units::cm),
1204 dzglue,
1205 tan_delta_phi_2,
1206 4); // 4-period type
1207
1208 thicknessAbsorberChild = thicknessPeriod;
1209 absorberChild = new GeoTrd(thicknessAbsorberChild/2,
1210 thicknessAbsorberChild/2,
1211 dy1Absorber,
1212 dy2Absorber,
1213 heightAbsorber/2);
1214 lvAbsorberChild = new GeoLogVol("AbsorberChild",absorberChild,matAir);
1215 pvAbsorberChild = new GeoPhysVol(lvAbsorberChild);
1216
1217 if (m_verbose) checktransfunc(thicknessAbsorberChild,thicknessPeriod,1,
1218 (-thicknessAbsorberChild + thicknessAbsorber)/2);
1219
1220 // Place period in the absorber child
1221 tfPeriod = new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
1222 pvAbsorberChild->add(new GeoIdentifierTag(m_dbManager->TILBnperiod()-1));
1223 pvAbsorberChild->add(tfPeriod);
1224 pvAbsorberChild->add(pvPeriod);
1225
1226 // Place absorber child
1227 tfAbsorberChild = new GeoTransform(GeoTrf::Translate3D((-thicknessAbsorberChild + thicknessAbsorber)/2,0.,0.));
1228 pvAbsorber->add(tfAbsorberChild);
1229 pvAbsorber->add(pvAbsorberChild);
1230
1231 if (m_log->level()<=MSG::DEBUG)
1232 (*m_log) << MSG::DEBUG <<" _fillSection: Absorber (case 4) Ok "<< endmsg;
1233 break;
1234 }
1235 default:
1236 {
1237 // C10_missing/Gap/Crack 5,6,14,15,16
1238
1239 if ((m_dbManager->TILBsection()==5)||(m_dbManager->TILBsection()==6)) { // Gap/Crack
1240 m_dbManager->SetCurrentScin(100*m_dbManager->TILBsection() + 1);
1241
1242 } else if ((m_dbManager->TILBsection()==14) || (m_dbManager->TILBsection()==15) || (m_dbManager->TILBsection()==16)) {
1243 m_dbManager->SetCurrentScin(m_dbManager->TILBcurscint());
1244
1245 } else {
1246 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::fillSection: Unexpected section = "
1247 << m_dbManager->TILBsection() << " for Gap/Crack" << endmsg;
1248 return;
1249 }
1250
1251 thicknessPeriod = thicknessAbsorber; // the same as absorber, but made from Aluminium
1252 MLOG(DEBUG) << "DEFAULT Section -- thicknessAbsorber: " << thicknessAbsorber << " ==> thicknessPeriod: " << thicknessPeriod << endmsg;
1253
1254 checking("Period 6", true, 4,
1255 thicknessPeriod/2,thicknessPeriod/2,dy1Absorber,dy2Absorber,heightAbsorber/2);
1256
1257 double dy1Period = m_dbManager->TILBflangex()/2.*Gaudi::Units::cm; // correct size from the drawings
1258 double dy2Period = m_dbManager->TILBflangey()/2.*Gaudi::Units::cm; // correct size from the drawings
1259 if (dy1Period <= 0.0 || dy2Period <= 0.0 || dy1Period > dy1Absorber || dy2Period > dy2Absorber || dy1Period >= dy2Period ) {
1260 dy1Period = dy1Absorber;
1261 dy2Period = dy2Absorber;
1262 }
1263
1264 period = new GeoTrd(thicknessPeriod/2,
1265 thicknessPeriod/2,
1266 dy1Period,
1267 dy2Period,
1268 heightAbsorber/2);
1269 if (!matAluminium) matAluminium = m_theMaterialManager->getMaterial("std::Aluminium");
1270 lvPeriod = new GeoLogVol("Period",period,matAluminium); // note - aluminium period inside air absorber here
1271 pvPeriod = new GeoPhysVol(lvPeriod);
1272
1273 fillPeriod(pvPeriod,
1274 thicknessPeriod*(1./Gaudi::Units::cm),
1275 dzglue,
1276 tan_delta_phi_2,
1277 5, period);
1278
1279 if (m_verbose) checktransfunc(thicknessAbsorber,thicknessPeriod,1,0.0);
1280
1281 // Place period in the absorber
1282 tfPeriod = new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
1283 pvAbsorber->add(new GeoIdentifierTag(0));
1284 pvAbsorber->add(tfPeriod);
1285 pvAbsorber->add(pvPeriod);
1286
1287 if (m_log->level()<=MSG::DEBUG)
1288 (*m_log) << MSG::DEBUG <<" _fillSection: Absorber (case default) Ok "<< endmsg;
1289 break;
1290 }
1291 }
1292
1293 // Place absorber in the module mother
1294 GeoTransform *tfAbsorber{nullptr}, *tfAbsorber1{nullptr}, *tfAbsorber3{nullptr};
1295
1296 double dXAbsorber = (m_dbManager->TILBdzend1() - m_dbManager->TILBdzend2());
1297 double dZAbsorber = (m_dbManager->TILBrmax() - tile_rmax);
1298
1299 if (sec_number==3) {
1300 // ps specialModuleZShift
1301 tfAbsorber = new GeoTransform(GeoTrf::Translate3D( specialModuleZShift + dXAbsorber*Gaudi::Units::cm/2, 0., dZAbsorber*Gaudi::Units::cm/2));
1302 mother->add(tfAbsorber);
1303 mother->add(pvAbsorber);
1304
1305 } else if (sec_number==2) {
1306 if (m_log->level()<=MSG::DEBUG)
1307 (*m_log) << MSG::DEBUG << " _fillsection Ex.barrel in "<< endmsg;
1308
1309 tfAbsorber1 = new GeoTransform(GeoTrf::Translate3D(dXAbsorber*Gaudi::Units::cm/2 - PosAbsor1, 0.,
1310 (dZAbsorber + m_dbManager->TILBrmin() - rminb)*Gaudi::Units::cm/2));
1311 mother->add(tfAbsorber1);
1312 if (m_dbManager->BoolCuts() && ((ModuleNcp>=35 && ModuleNcp<=37) || (ModuleNcp>=60 && ModuleNcp<=62)) ) {
1313 mother->add(pvTmp_Absorber1);
1314 } else {
1315 mother->add(pvAbsorber1);
1316 }
1317
1318 if (m_log->level()<=MSG::DEBUG)
1319 (*m_log) << MSG::DEBUG << " _fillsection ext.barrel pvAbsorber1 Ok"<< endmsg;
1320
1321 tfAbsorber = new GeoTransform(GeoTrf::Translate3D(dXAbsorber*Gaudi::Units::cm/2 - PosAbsor2, 0.,
1322 (dZAbsorber + m_dbManager->TILBrmin() - rminb)*Gaudi::Units::cm/2));
1323 mother->add(tfAbsorber);
1324 mother->add(pvAbsorber);
1325
1326 if (m_log->level()<=MSG::DEBUG)
1327 (*m_log) << MSG::DEBUG << " _fillsection ext.barrel pvAbsorber Ok"<< endmsg;
1328
1329 tfAbsorber3 = new GeoTransform(GeoTrf::Translate3D(dXAbsorber*Gaudi::Units::cm/2 - PosAbsor3, 0.,
1330 (dZAbsorber + m_dbManager->TILBrmin() - rminb)*Gaudi::Units::cm/2));
1331 mother->add(tfAbsorber3);
1332 if (m_dbManager->BoolCuts() && ((ModuleNcp>=35 && ModuleNcp<=37) || (ModuleNcp>=60 && ModuleNcp<=62)) ) {
1333 mother->add(pvTmp_Absorber3);
1334 } else {
1335 mother->add(pvAbsorber3);
1336 }
1337
1338 if (m_log->level()<=MSG::DEBUG)
1339 (*m_log) << MSG::DEBUG << " _fillsection ext.barrel pvAbsorber3 Ok"<< endmsg;
1340
1341 } else {
1342 tfAbsorber = new GeoTransform(GeoTrf::Translate3D(dXAbsorber*Gaudi::Units::cm/2, 0.,
1343 (dZAbsorber + m_dbManager->TILBrmin() - rminb)*Gaudi::Units::cm/2));
1344 mother->add(tfAbsorber);
1345 mother->add(pvAbsorber);
1346 if (m_log->level()<=MSG::DEBUG)
1347 (*m_log) << MSG::DEBUG << " _fillsection other pvAbsorber Ok"<< endmsg;
1348 }
1349
1350
1351}
1352
1353
1355 double tile_rmax,
1356 double tilb_rmax,
1357 double tan_delta_phi_2,
1358 double thickness)
1359{
1360 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1361 // Obtain required materials - Iron, Aluminium and electronic boards
1362
1363 const GeoMaterial* matIron = (m_switches.steel) ? m_theMaterialManager->getMaterial("tile::Steel")
1364 : m_theMaterialManager->getMaterial("std::Iron");
1365 const GeoMaterial* matAluminium = m_theMaterialManager->getMaterial("std::Aluminium");
1366 const GeoMaterial* matElBoard = m_theMaterialManager->getMaterial("tile::SiO2CondEpox");
1367
1368 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1369
1370 GeoTrd* girderElement{nullptr};
1371 GeoLogVol* lvGirderElement{nullptr};
1372 PVLink pvGirderElement{nullptr};
1373 GeoTransform* tfGirderElement{nullptr};
1374
1375 int CurrentGird = 1;
1376 int j;
1377
1378 //if (m_dbManager->TILBsection()==8)
1379 // CurrentGird = 801; //Prototype module
1380 // ps commented out old geometry
1381
1382 for (j = CurrentGird; j < (CurrentGird + m_dbManager->TILBngirder()); j++) {
1383 m_dbManager->SetCurrentGird(j);
1384 double elementRC = m_dbManager->TIGRrc();
1385 double elementSizeInR = m_dbManager->TIGRdr();
1386 double elementSizeInY = m_dbManager->TIGRdw();
1387 double elementOffsetInY = m_dbManager->TIGRoff();
1388
1389 double dy1GirderElement, dy2GirderElement;
1390 if (elementSizeInY >0) {
1391 dy1GirderElement = elementSizeInY/2;
1392 dy2GirderElement = elementSizeInY/2;
1393 } else {
1394 dy1GirderElement = (elementRC - elementSizeInR/2) * tan_delta_phi_2;
1395 dy2GirderElement = (elementRC + elementSizeInR/2) * tan_delta_phi_2;
1396 }
1397
1398 girderElement = new GeoTrd(thickness/2*Gaudi::Units::cm,
1399 thickness/2*Gaudi::Units::cm,
1400 dy1GirderElement*Gaudi::Units::cm,
1401 dy2GirderElement*Gaudi::Units::cm,
1402 elementSizeInR/2*Gaudi::Units::cm);
1403
1404 switch(m_dbManager->TIGRmaterial()) {
1405 case 1: //Iron
1406 {
1407 lvGirderElement = new GeoLogVol("GirderIron",girderElement,matIron);
1408 break;
1409 }
1410 case 2: //Aluminium
1411 {
1412 lvGirderElement = new GeoLogVol("GirderAluminium",girderElement,matAluminium);
1413 break;
1414 }
1415 case 3: //Electronics
1416 {
1417 lvGirderElement = new GeoLogVol("GirderElectronics",girderElement,matElBoard);
1418 break;
1419 }
1420 default:
1421 {
1422 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::FillGirder: unknown material = "
1423 << m_dbManager->TIGRmaterial() << endmsg;
1424 return;
1425 }
1426 }
1427
1428 pvGirderElement = new GeoPhysVol(lvGirderElement);
1429 tfGirderElement = new GeoTransform(GeoTrf::Translate3D(0.,
1430 elementOffsetInY*Gaudi::Units::cm,
1431 (elementRC-(tilb_rmax + tile_rmax)/2)*Gaudi::Units::cm));
1432 mother->add(tfGirderElement);
1433 mother->add(pvGirderElement);
1434 }
1435}
1436
1437
1439 int sec_number,
1440 double tile_rmax,
1441 double tilb_rmax,
1442 double /* delta_phi */,
1443 bool testbeam,
1444 int ModuleNcp,
1445 double corrected_dz)
1446{
1447 bool boolNeg = false;
1448
1449 if (ModuleNcp > 99) {
1450 ModuleNcp = ModuleNcp/100;
1451 boolNeg = true;
1452 }
1453
1454 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1455 // Obtain required materials - Iron, Aluminium and electronic boards
1456
1457 const GeoMaterial* matIron = (m_switches.steel) ? m_theMaterialManager->getMaterial("tile::Steel")
1458 : m_theMaterialManager->getMaterial("std::Iron");
1459 const GeoMaterial* matAluminium = m_theMaterialManager->getMaterial("std::Aluminium");
1460 const GeoMaterial* matElBoard = m_theMaterialManager->getMaterial("tile::SiO2CondEpox");
1461
1462 // Get required elements
1463 //const GeoElement* oxygen = m_theMaterialManager->getElement("Oxygen");
1464 //const GeoElement* hydrogen = m_theMaterialManager->getElement("Hydrogen");
1465 const GeoElement* copper = m_theMaterialManager->getElement("Copper");
1466
1467 // Get some standard materials
1468 const GeoMaterial *air = m_theMaterialManager->getMaterial("std::Air");
1469 const GeoMaterial *iron = m_theMaterialManager->getMaterial("std::Iron");
1470 const GeoMaterial *shieldSteel = m_theMaterialManager->getMaterial("shield::ShieldSteel");
1471 const GeoMaterial *matRubber = m_theMaterialManager->getMaterial("std::Rubber")!=nullptr
1472 ? m_theMaterialManager->getMaterial("std::Rubber")
1473 : m_theMaterialManager->getMaterial("sct::Rubber");
1474
1475 // m_matLArServices
1476 if (!m_matLArServices) {
1477 m_matLArServices = new GeoMaterial("LArServices", 2.5*GeoModelKernelUnits::gram/Gaudi::Units::cm3);
1478 m_matLArServices->add(shieldSteel, 0.20);
1479 m_matLArServices->add(copper, 0.60);
1480 m_matLArServices->add(matRubber, 0.10);
1481 m_matLArServices->add(air, 0.10);
1482 m_matLArServices->lock();
1483 }
1484
1485 // m_matIronHalfDens
1486 if (!m_matIronHalfDens) {
1487 m_matIronHalfDens = new GeoMaterial("LArIronBox", 4.5*GeoModelKernelUnits::gram/Gaudi::Units::cm3);
1488 m_matIronHalfDens->add(shieldSteel, 0.80);
1489 m_matIronHalfDens->add(matRubber, 0.10);
1490 m_matIronHalfDens->add(copper, 0.10);
1491 m_matIronHalfDens->lock();
1492 }
1493
1494 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1495
1496 GeoTrd* fingerElementTrd{nullptr};
1497 GeoTrap* fingerElementTrap{nullptr};
1498
1499 GeoBox *fingerCablesL{nullptr}, *fingerCablesR{nullptr};
1500 PVLink pvFingerElement{nullptr}, pvFingerCablesL{nullptr}, pvFingerCablesR{nullptr};
1501 GeoLogVol *lvFingerElement{nullptr}, *lvFingerCablesL{nullptr}, *lvFingerCablesR{nullptr};
1502 GeoTransform* tfFingerElement{nullptr}, *tfFingerCables{nullptr};
1503
1504 GeoTransform* ZrotateMod{nullptr};
1505 GeoTransform* yrotateMod{nullptr};
1506 GeoTransform* zrotateMod{nullptr};
1507
1508 const GeoMaterial *currentMaterial{nullptr}, *leftMaterial{nullptr}, *rightMaterial{nullptr};
1509 std::string currentName, leftName, rightName;
1510
1511 int CurrentTicg = 100*sec_number + 1;
1512 int j;
1513 double AirVolumeShift = 0.0;
1514 double AirVolumeSize = corrected_dz;
1515
1516 for (j = CurrentTicg; j < (CurrentTicg + m_dbManager->TIFGnelem()); j++) {
1517 m_dbManager->SetCurrentTicg(j);
1518 double elementRC = m_dbManager->TICGrc();
1519 double elementHeight = m_dbManager->TICGdr();
1520 double elementDy1 = m_dbManager->TICGdx1();
1521 double elementDy2 = m_dbManager->TICGdx2();
1522 double elementOffset = m_dbManager->TICGoff();
1523 double elementDz = m_dbManager->TICGdz();
1524 double elementZPozition = m_dbManager->TICGzc();
1525
1526 if (corrected_dz > 0.) {
1527 if (j-CurrentTicg==0) { // take air volume size from first element
1528 AirVolumeShift = (elementDz-corrected_dz)/2 - elementZPozition;
1529 AirVolumeSize = elementDz;
1530 if (m_log->level()<=MSG::DEBUG) {
1531 (*m_log) << MSG::DEBUG << "TileFinger: OldAirVolumeCenter ="<<elementZPozition << endmsg;
1532 (*m_log) << MSG::DEBUG << "TileFinger: NewAirVolumeCenter ="<<elementZPozition+AirVolumeShift << endmsg;
1533 (*m_log) << MSG::DEBUG << "TileFinger: AirVolumeShift ="<< AirVolumeShift << endmsg;
1534 (*m_log) << MSG::DEBUG << "TileFinger: AirVolumeSize ="<< AirVolumeSize << endmsg;
1535 }
1536 }
1537
1538 if (elementZPozition*2-AirVolumeSize<-0.01) { // compare with zero with 0.1 Gaudi::Units::mm precision
1539 elementZPozition += AirVolumeShift; // shift all volumes keeping size
1540
1541 } else { // resize finger cover with shims attached to it
1542 if (m_log->level()<=MSG::DEBUG)
1543 (*m_log) << MSG::DEBUG << "TileFinger: OldCoverThickness ="<<elementDz << endmsg;
1544 elementDz = corrected_dz - AirVolumeSize;
1545 if (m_log->level()<=MSG::DEBUG) {
1546 (*m_log) << MSG::DEBUG << "TileFinger: NewCoverThickness ="<<elementDz << endmsg;
1547 (*m_log) << MSG::DEBUG << "TileFinger: OldCoverCenter ="<<elementZPozition << endmsg;
1548 }
1549 elementZPozition = (corrected_dz-elementDz)/2;
1550 if (m_log->level()<=MSG::DEBUG)
1551 (*m_log) << MSG::DEBUG << "TileFinger: NewCoverCenter ="<<elementZPozition << endmsg;
1552 }
1553 }
1554
1555 switch(m_dbManager->TICGmaterial()) {
1556 case 1:
1557 {
1558 currentMaterial = matIron;
1559 currentName = "FingerIron";
1560 break;
1561 }
1562 case 2:
1563 {
1564 currentMaterial = matAluminium;
1565 currentName = "FingerAluminum";
1566 break;
1567 }
1568 case 3:
1569 {
1570 currentMaterial = matElBoard;
1571 currentName = "FingerElectronics";
1572 break;
1573 }
1574 default:
1575 {
1576 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::fillFinger: unexpected material = "
1577 << m_dbManager->TICGmaterial() << " for finger element" << endmsg;
1578 return;
1579 }
1580 }
1581
1582 if (m_dbManager->TICGshape()==1) {
1583 fingerElementTrd = new GeoTrd(elementDz/2*Gaudi::Units::cm,
1584 elementDz/2*Gaudi::Units::cm,
1585 elementDy1/2*Gaudi::Units::cm,
1586 elementDy2/2*Gaudi::Units::cm,
1587 elementHeight/2*Gaudi::Units::cm);
1588 lvFingerElement = new GeoLogVol(currentName,fingerElementTrd,currentMaterial);
1589
1590 } else if (m_dbManager->TICGshape()==2) {
1591
1592 fingerElementTrap = new GeoTrap(elementDz/2*Gaudi::Units::cm,
1593 0.,
1594 0.,
1595 elementHeight/2*Gaudi::Units::cm,
1596 elementDy2/2*Gaudi::Units::cm,
1597 elementDy1/2*Gaudi::Units::cm,
1598 std::atan((elementDy1-elementDy2)/(2.*elementHeight)),
1599 elementHeight/2*Gaudi::Units::cm,
1600 elementDy2/2*Gaudi::Units::cm,
1601 elementDy1/2*Gaudi::Units::cm,
1602 std::atan((elementDy1-elementDy2)/(2.*elementHeight)));
1603
1604 lvFingerElement = new GeoLogVol(currentName,fingerElementTrap,currentMaterial);
1605
1606 } else {
1607 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::fillFinger: unexpected shape = "
1608 << m_dbManager->TICGshape() << " for finger element" << endmsg;
1609 return;
1610 }
1611
1612
1613 pvFingerElement = new GeoPhysVol(lvFingerElement);
1614 tfFingerElement = new GeoTransform(GeoTrf::Translate3D(elementZPozition*Gaudi::Units::cm,
1615 elementOffset*Gaudi::Units::cm,
1616 (elementRC-(tilb_rmax + tile_rmax)/2)*Gaudi::Units::cm));
1617
1618 mother->add(tfFingerElement);
1619 if (m_dbManager->TICGshape()==2) {
1620 if (elementOffset<0) {
1621 ZrotateMod = new GeoTransform(GeoTrf::RotateZ3D(180*Gaudi::Units::deg));
1622 mother->add(ZrotateMod);
1623 }
1624
1625 zrotateMod = new GeoTransform(GeoTrf::RotateZ3D(90*Gaudi::Units::deg));
1626 yrotateMod = new GeoTransform(GeoTrf::RotateY3D(-90*Gaudi::Units::deg));
1627 mother->add(yrotateMod);
1628 mother->add(zrotateMod);
1629 }
1630
1631 mother->add(new GeoIdentifierTag(ModuleNcp));
1632 mother->add(pvFingerElement);
1633 }
1634
1635 if (testbeam) return; // no cables between fingers at the testbeam
1636
1637 // Cables space
1638
1639 int Isector =0, LRflag =0;
1640
1641 if ((ModuleNcp/4 - (float)ModuleNcp/4) != 0) {
1642 Isector = (int)ModuleNcp/4;
1643 } else {
1644 Isector = (int)ModuleNcp/4-1;
1645 }
1646 LRflag = ModuleNcp-4*Isector;
1647
1648 m_dbManager->SetCurrentTicg(CurrentTicg);
1649
1650 double elementRC = m_dbManager->TICGrc();
1651 double elementOffset = m_dbManager->TICGoff();
1652 double elementDz = m_dbManager->TICGdz();
1653 double elementZPozition = m_dbManager->TICGzc();
1654
1655 double dXleft =35., dXright = 35.;
1656 double dZleft = elementDz/2, dZright = dZleft;
1657 double dZsaddleL = elementDz/4, dZsaddleR = dZsaddleL;
1658 double dY = 7.5;
1659
1660 rightMaterial = leftMaterial = m_matLArServices;
1661 rightName = leftName = "LArCables";
1662
1663 if (LRflag == 1) {
1664 dZright = elementDz, dXright = 35;
1665 dZsaddleR = 0;
1666 rightMaterial = m_matIronHalfDens;
1667 rightName = "LArService";
1668
1669 } else if (LRflag == 4) {
1670 dZleft = elementDz, dXleft = 35;
1671 dZsaddleL = 0;
1672 leftMaterial = m_matIronHalfDens;
1673 leftName = "LArService";
1674 }
1675
1676 if (sec_number == 1) {
1677 if ( (ModuleNcp >=40 && ModuleNcp <=41) || (ModuleNcp >=56 && ModuleNcp <=57) ) {
1678 dZright = dZleft = 8.5;
1679 dZsaddleL = dZsaddleR = 13.7;
1680 rightMaterial = leftMaterial = iron;
1681 rightName = leftName = "BarrelSaddleSupport";
1682 }
1683
1684 } else {
1685 if ( (ModuleNcp >=39 && ModuleNcp <=42) || (ModuleNcp >=55 && ModuleNcp <=58) ) {
1686 dZright = dZleft = 8.5;
1687 dZsaddleR = dZsaddleL = 13.7;
1688 rightMaterial = leftMaterial = iron;
1689 rightName = leftName = "ExtBarrelSaddleSupport";
1690 }
1691 }
1692
1693 if (m_log->level()<=MSG::DEBUG)
1694 (*m_log) << MSG::DEBUG << " Finger : number= "<<sec_number<<" ModuleNcp = " <<ModuleNcp<< " Sector= "<< Isector
1695 << " LRflag= " << LRflag <<" Neg "<< boolNeg
1696 << endmsg;
1697
1698 GeoTransform *rotateY = new GeoTransform(GeoTrf::RotateY3D(90*Gaudi::Units::deg));
1699 GeoTransform *rotateZ = new GeoTransform(GeoTrf::RotateZ3D(3*Gaudi::Units::deg));
1700 GeoTransform *rotateZm = new GeoTransform(GeoTrf::RotateZ3D(-3*Gaudi::Units::deg));
1701
1702 // Left (+phi)
1703 fingerCablesL = new GeoBox(dXleft/2*Gaudi::Units::cm, dY/2*Gaudi::Units::cm, dZleft/2*Gaudi::Units::cm);
1704 lvFingerCablesL = new GeoLogVol(leftName,fingerCablesL,leftMaterial);
1705 pvFingerCablesL = new GeoPhysVol(lvFingerCablesL);
1706
1707 // Right (-phi)
1708 fingerCablesR = new GeoBox(dXright/2*Gaudi::Units::cm, dY/2*Gaudi::Units::cm, dZright/2*Gaudi::Units::cm);
1709 lvFingerCablesR = new GeoLogVol(rightName,fingerCablesR,rightMaterial);
1710 pvFingerCablesR = new GeoPhysVol(lvFingerCablesR);
1711
1712 double YpoFinger =0;
1713
1714 if (boolNeg) {
1715 YpoFinger = -elementOffset+5.4;
1716 } else {
1717 YpoFinger = elementOffset-5.4;
1718 }
1719
1720 tfFingerCables = new GeoTransform(GeoTrf::Translate3D(elementZPozition*Gaudi::Units::cm +0.5*Gaudi::Units::cm -dZsaddleL*Gaudi::Units::cm,
1721 YpoFinger*Gaudi::Units::cm,
1722 (elementRC-(tilb_rmax + tile_rmax)/2)*Gaudi::Units::cm));
1723 mother->add(tfFingerCables);
1724
1725 // inversion for negativ fingers, Left
1726 if (boolNeg) {
1727 mother->add(rotateY);
1728 mother->add(rotateZm);
1729 } else {
1730 mother->add(rotateY);
1731 mother->add(rotateZ);
1732 }
1733
1734 mother->add(new GeoIdentifierTag(ModuleNcp));
1735 mother->add(pvFingerCablesL);
1736
1737 if (boolNeg) {
1738 YpoFinger = elementOffset-5.4;
1739 } else {
1740 YpoFinger = -elementOffset+5.4;
1741 }
1742
1743 tfFingerCables = new GeoTransform(GeoTrf::Translate3D(elementZPozition*Gaudi::Units::cm +0.5*Gaudi::Units::cm -dZsaddleR*Gaudi::Units::cm,
1744 YpoFinger*Gaudi::Units::cm,
1745 (elementRC-(tilb_rmax + tile_rmax)/2)*Gaudi::Units::cm));
1746 mother->add(tfFingerCables);
1747
1748 // inversion for negativ fingers, Right
1749 if (boolNeg) {
1750 mother->add(rotateY);
1751 mother->add(rotateZ);
1752 } else {
1753 mother->add(rotateY);
1754 mother->add(rotateZm);
1755 }
1756
1757 mother->add(new GeoIdentifierTag(ModuleNcp));
1758 mother->add(pvFingerCablesR);
1759}
1760
1761
1763 double thickness,
1764 double dzglue,
1765 double tan_delta_phi_2,
1766 int period_type,
1767 GeoTrd * period)
1768{
1769 int j;
1770 int CurrentScin = 0;
1771 const GeoShape* glue{nullptr};
1772 GeoLogVol* lvGlue{nullptr};
1773 PVLink pvGlue{nullptr};
1774 GeoTransform* tfGlue{nullptr};
1775
1776 double scintiWrapInZ, scintiWrapInR, scintiThickness, scintiDeltaInPhi;
1777 double scintiHeight, scintiRC, scintiZPos, dy1Scintillator, dy2Scintillator;
1778 const GeoShape* scintillator{nullptr};
1779 GeoLogVol* lvScintillator{nullptr};
1780 PVLink pvScintillator{nullptr};
1781 GeoTransform* tfScintillator{nullptr};
1782
1783 double thicknessWrapper, heightWrapper, dy1Wrapper, dy2Wrapper;
1784 const GeoShape* wrapper{nullptr};
1785 GeoLogVol* lvWrapper{nullptr};
1786 PVLink pvWrapper{nullptr};
1787 GeoTransform* tfWrapper{nullptr};
1788
1789 (*m_log) << MSG::VERBOSE <<" TileGeoSectionBuilder::fillPeriod"<< endmsg;
1790
1791 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1792
1793 // Determine the number of first scintillator depending on the section type
1794 if (m_dbManager->TILBsection() >= 7 && m_dbManager->TILBcurscint() == 0) {
1795 CurrentScin = 101; //special modules for testbeam identical to normal barrel module
1796 } else {
1797 if (m_dbManager->TILBcurscint()>0) {
1798 CurrentScin = m_dbManager->TILBcurscint();
1799 } else {
1800 CurrentScin = 100*m_dbManager->TILBsection()+1;
1801 }
1802 }
1803
1804 // special EB modules with cut-outs
1805 if (m_dbManager->TILBsection()>=26 && m_dbManager->TILBsection()<=38 && m_dbManager->TILBcurscint() == 0) {
1806 //ps shortcut. Should be read from DB later on.
1807 CurrentScin = 100*2 + 1;
1808 }
1809
1810 int zpShift = 1;
1811 // special EB modules with small D4 cell
1812 if (m_dbManager->TILBsection()>=7 && m_dbManager->TILBsection()<=8 && m_dbManager->TILBcurscint() == 301) {
1813 //ps fix. Should put curscint = 1301 in DB and zpShift will not be needed
1814 zpShift = -1;
1815 }
1816
1817 (*m_log) << MSG::VERBOSE <<" TILBsection= "<<m_dbManager->TILBsection()<<endmsg;
1818 (*m_log) << MSG::VERBOSE <<" CurrentScin= "<<CurrentScin<<" TILBcurscint= "<<m_dbManager->TILBcurscint()
1819 << " - " << m_dbManager->TILBcurscint()+m_dbManager->TILBnscin()-1 <<endmsg;
1820 (*m_log) << MSG::VERBOSE <<" period_type= "<<period_type <<endmsg;
1821
1822 // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
1823 // Obtain required materials - Air, Glue, Scintillator
1824
1825 const GeoMaterial* matAir = m_theMaterialManager->getMaterial("std::Air");
1826 const GeoMaterial* matScin = nullptr;
1827 if (m_switches.pvt) {
1828 if (m_switches.testBeam || // choose PVT for all scintillators in testbeam setup
1829 ( period_type>4 && // choose PVT for crack scintillators (defined starting from RUN3)
1830 (m_dbManager->TILBsection() == 6 || m_dbManager->TILBsection() == 16) ) ) {
1831 // different material for crack scintillators
1832 matScin = m_theMaterialManager->getMaterial("tile::Polyvinyltoluene");
1833 if (matScin != nullptr) {
1834 (*m_log) << MSG::VERBOSE << "Using Polyvinyltoluene for section = " << m_dbManager->TILBsection() << endmsg;
1835 } else {
1836 (*m_log) << MSG::VERBOSE << "Using Polystyrene for section = " << m_dbManager->TILBsection() << endmsg;
1837 }
1838 }
1839 }
1840 if (matScin == nullptr) matScin = m_theMaterialManager->getMaterial("tile::Scintillator");
1841
1842 //Cs hole parameters
1843 double csHoleR = 0.45 * Gaudi::Units::cm;
1844 double csTubeOuterR = 0.4 * Gaudi::Units::cm;
1845 double csTubeInnerR = 0.3 * Gaudi::Units::cm;
1846 double csTubeOffCorr = 1.35 * Gaudi::Units::cm;
1847
1848 double thicknessMother2 = thickness/2.*Gaudi::Units::cm;
1849 double heightMother2 = (m_dbManager->TILBrmax() - m_dbManager->TILBrmin())*Gaudi::Units::cm/2.;
1850
1851 const bool removeGlue = (m_switches.glue == 0 || m_switches.glue == 2);
1852
1853 //Glue layer
1854 if (dzglue>0.0 && period_type<4 && !removeGlue) {
1855 const GeoMaterial* matGlue = m_theMaterialManager->getMaterial("tile::Glue");
1856
1857 double dzglue2 = dzglue/2*Gaudi::Units::cm;
1858 dzglue2 = floor(dzglue2*1.0e+10)*1.0e-10;
1859
1860 if (m_verbose) {
1861 printdouble(" period thickness/2 = ",thickness/2*Gaudi::Units::cm);
1862 printdouble(" glue thickness/2 = ",dzglue/2*Gaudi::Units::cm);
1863 printdouble("rounded thickness/2 = ",dzglue2);
1864 }
1865
1866 double dy1Glue = (m_dbManager->TILBrmin() * tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
1867 double dy2Glue = (m_dbManager->TILBrmax() * tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
1868 double heightGlue2 = (m_dbManager->TILBrmax() - m_dbManager->TILBrmin())*Gaudi::Units::cm/2.;
1869
1870 checking("Glue 0", false, 4,
1871 dzglue2,dzglue2,dy1Glue,dy2Glue,heightGlue2);
1872
1873 glue = new GeoTrd(dzglue2,dzglue2,dy1Glue,dy2Glue,heightGlue2);
1874
1875 //Cs tubes in mother volume and holes in glue
1876 if (m_switches.csTube) {
1877 for (j = CurrentScin; j < (CurrentScin + m_dbManager->TILBnscin()); j++) {
1878 m_dbManager->SetCurrentScin(j);
1879
1880 double off0 = m_dbManager->SCNTrc()*Gaudi::Units::cm - heightMother2;
1881 double off = m_dbManager->SCNTdr()/2.*Gaudi::Units::cm - csTubeOffCorr;
1882
1883 GeoTrf::Transform3D tfHole1 = GeoTrf::Translate3D(0.,0.,(off0-off)) * GeoTrf::RotateY3D(-90*Gaudi::Units::deg);
1884 GeoTrf::Transform3D tfHole2 = GeoTrf::Translate3D(0.,0.,(off0+off)) * GeoTrf::RotateY3D(-90*Gaudi::Units::deg);
1885
1886 // air around iron rod, around Cs tube and inside Cs tube
1887 GeoShape *air1 = new GeoTubs(csTubeOuterR, csHoleR, thicknessMother2, 0.,360.0 * Gaudi::Units::deg);
1888 GeoShape *air2 = new GeoTubs(csTubeOuterR, csHoleR, thicknessMother2, 0.,360.0 * Gaudi::Units::deg);
1889 GeoShape *air3 = new GeoTubs(0., csTubeInnerR, thicknessMother2, 0.,360.0 * Gaudi::Units::deg);
1890
1891 GeoLogVol * lvAir1 = new GeoLogVol("CsTubeAir1",air1,matAir);
1892 GeoLogVol * lvAir2 = new GeoLogVol("CsTubeAir2",air2,matAir);
1893 GeoLogVol * lvAir3 = new GeoLogVol("CsTubeAir3",air3,matAir);
1894 GeoPhysVol * pvAir1 = new GeoPhysVol(lvAir1);
1895 GeoPhysVol * pvAir2 = new GeoPhysVol(lvAir2);
1896 GeoPhysVol * pvAir3 = new GeoPhysVol(lvAir3);
1897
1898 GeoTransform* tftube1 = new GeoTransform(tfHole1);
1899 GeoTransform* tftube2 = new GeoTransform(tfHole2);
1900 GeoTransform* tftube3 = new GeoTransform(tfHole2);
1901
1902 mother->add(tftube1);
1903 mother->add(pvAir1);
1904 mother->add(tftube2);
1905 mother->add(pvAir2);
1906 mother->add(tftube3);
1907 mother->add(pvAir3);
1908
1909 //Holes in Glue
1910 if (glue) {
1911 glue = makeHoles(glue, csHoleR, dzglue2, off, off0);
1912 }
1913 }
1914 }
1915 lvGlue = new GeoLogVol("Glue",glue,matGlue);
1916 pvGlue = new GeoPhysVol(lvGlue);
1917 }
1918
1919 switch(period_type) {
1920 case 1:
1921 {
1922 //Ordinary period in Barrel and Extended barrel - /spacer/glue/master/glue/spacer/glue/master/glue
1923
1924 //Glue layer
1925 if (glue) {
1926 if (m_verbose)
1927 printdouble(" glue position = ",(-3.*dzglue/2-m_dbManager->TILBdzmast())*Gaudi::Units::cm);
1928 tfGlue = new GeoTransform(GeoTrf::Translate3D((-3.*dzglue/2-m_dbManager->TILBdzmast())*Gaudi::Units::cm,0.,0.));
1929 mother->add(tfGlue);
1930 mother->add(pvGlue);
1931
1932 if (m_verbose)
1933 printdouble(" glue position = ",-dzglue/2*Gaudi::Units::cm);
1934 tfGlue = new GeoTransform(GeoTrf::Translate3D(-dzglue/2*Gaudi::Units::cm,0.,0.));
1935 mother->add(tfGlue);
1936 mother->add(pvGlue);
1937
1938 if (m_verbose)
1939 printdouble(" glue position = ",(dzglue/2+m_dbManager->TILBdzspac())*Gaudi::Units::cm);
1940 tfGlue = new GeoTransform(GeoTrf::Translate3D((dzglue/2+m_dbManager->TILBdzspac())*Gaudi::Units::cm,0.,0.));
1941 mother->add(tfGlue);
1942 mother->add(pvGlue);
1943
1944 if (m_verbose)
1945 printdouble(" glue position = ",(thickness-dzglue)/2*Gaudi::Units::cm);
1946 tfGlue = new GeoTransform(GeoTrf::Translate3D((thickness-dzglue)/2*Gaudi::Units::cm,0.,0.));
1947 mother->add(tfGlue);
1948 mother->add(pvGlue);
1949 }
1950
1951 for (j = CurrentScin; j < (CurrentScin + m_dbManager->TILBnscin()); j++) {
1952 GeoIdentifierTag* idTag = new GeoIdentifierTag(j-CurrentScin);
1953 m_dbManager->SetCurrentScin(j);
1954
1955 scintiHeight = m_dbManager->SCNTdr();
1956 scintiRC = m_dbManager->SCNTrc();
1957 scintiZPos = zpShift * m_dbManager->SCNTzp(); // ps special module inversion
1958 scintiThickness = m_dbManager->SCNTdt();
1959 scintiWrapInZ = m_dbManager->SCNTdtw();
1960 scintiWrapInR = m_dbManager->SCNTdrw();
1961 scintiDeltaInPhi = (m_switches.uShape > 0) ? 0.0 : m_dbManager->SCNTdphi();
1962
1963 thicknessWrapper = (m_dbManager->TILBdzspac() <= (scintiThickness + 2*scintiWrapInZ)) ?
1964 (scintiThickness + 2*scintiWrapInZ)*Gaudi::Units::cm: m_dbManager->TILBdzspac()*Gaudi::Units::cm;
1965 if (m_switches.glue == 2) thicknessWrapper = std::max(thicknessWrapper - m_additionalIronLayer, scintiThickness);
1966
1967 // create wrapper
1968 heightWrapper = (scintiHeight + 2*scintiWrapInR)*Gaudi::Units::cm;
1969 dy1Wrapper = ((scintiRC - scintiHeight/2 - scintiWrapInR + m_dbManager->TILBrmin()) *
1970 tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
1971 dy2Wrapper = ((scintiRC + scintiHeight/2 + scintiWrapInR + m_dbManager->TILBrmin()) *
1972 tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
1973
1974 checking("Wrapper 0", true, 5,
1975 thicknessWrapper/2,thicknessWrapper/2,dy1Wrapper,dy2Wrapper,heightWrapper/2);
1976
1977 wrapper = new GeoTrd(thicknessWrapper/2,
1978 thicknessWrapper/2,
1979 dy1Wrapper,
1980 dy2Wrapper,
1981 heightWrapper/2);
1982
1983 if (m_switches.csTube) {
1984 wrapper = makeHoles(wrapper, csHoleR, thicknessWrapper/2, scintiHeight/2.*Gaudi::Units::cm - csTubeOffCorr);
1985 }
1986 lvWrapper = new GeoLogVol("Wrapper",wrapper,matAir);
1987 pvWrapper = new GeoPhysVol(lvWrapper);
1988
1989 // create scintillator
1990 dy1Scintillator = ((scintiRC - scintiHeight/2 + m_dbManager->TILBrmin()) *
1991 tan_delta_phi_2 - m_dbManager->TILBphigap()/2 - scintiDeltaInPhi)*Gaudi::Units::cm;
1992 dy2Scintillator = ((scintiRC + scintiHeight/2 + m_dbManager->TILBrmin()) *
1993 tan_delta_phi_2 - m_dbManager->TILBphigap()/2 - scintiDeltaInPhi)*Gaudi::Units::cm;
1994
1995 checking("Scintillator 0", true, 6,
1996 scintiThickness/2*Gaudi::Units::cm,scintiThickness/2*Gaudi::Units::cm,dy1Scintillator,dy2Scintillator,scintiHeight/2*Gaudi::Units::cm);
1997
1998 scintillator = new GeoTrd(scintiThickness/2*Gaudi::Units::cm,
1999 scintiThickness/2*Gaudi::Units::cm,
2000 dy1Scintillator,
2001 dy2Scintillator,
2002 scintiHeight/2*Gaudi::Units::cm);
2003
2004 if (m_switches.csTube) {
2005 scintillator = makeHolesScint(scintillator, csHoleR, scintiThickness/2 * Gaudi::Units::cm, scintiHeight/2.*Gaudi::Units::cm - csTubeOffCorr);
2006 }
2007 lvScintillator = new GeoLogVol("Scintillator",scintillator,matScin);
2008 pvScintillator = new GeoPhysVol(lvScintillator);
2009
2010 // place scintillator in wrapper
2011 tfScintillator = new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
2012 pvWrapper->add(idTag);
2013 pvWrapper->add(tfScintillator);
2014 pvWrapper->add(pvScintillator);
2015
2016 //place wrapper in period
2017 if (m_verbose) {
2018 (*m_log) << MSG::VERBOSE <<" X scintiZPos= "<<scintiZPos;
2019 printdouble(" ==> ",(scintiZPos*thickness+m_dbManager->TILBdzspac()/2)*Gaudi::Units::cm);
2020 (*m_log) << MSG::VERBOSE <<" Y scintiRC= "<<scintiRC <<endmsg;
2021 }
2022
2023 tfWrapper = new GeoTransform(GeoTrf::Translate3D((scintiZPos*thickness+m_dbManager->TILBdzspac()/2)*Gaudi::Units::cm,
2024 0.,
2025 (scintiRC-(m_dbManager->TILBrmax()-m_dbManager->TILBrmin())/2)*Gaudi::Units::cm));
2026 mother->add(idTag);
2027 mother->add(tfWrapper);
2028 mother->add(pvWrapper);
2029 }
2030 break;
2031 }
2032 case 2:
2033 {
2034 //Special period in the barrel - /spacer/glue/master/glue/spacer
2035
2036 //Glue layer
2037 if (glue) {
2038 if (m_verbose)
2039 printdouble(" glue position = ",(dzglue + m_dbManager->TILBdzmast())*Gaudi::Units::cm/2);
2040 tfGlue = new GeoTransform(GeoTrf::Translate3D((dzglue + m_dbManager->TILBdzmast())*Gaudi::Units::cm/2,0.,0.));
2041 mother->add(tfGlue);
2042 mother->add(pvGlue);
2043
2044 if (m_verbose)
2045 printdouble(" glue position = ",-(dzglue + m_dbManager->TILBdzmast())*Gaudi::Units::cm/2);
2046 tfGlue = new GeoTransform(GeoTrf::Translate3D(-(dzglue + m_dbManager->TILBdzmast())*Gaudi::Units::cm/2,0.,0.));
2047 mother->add(tfGlue);
2048 mother->add(pvGlue);
2049 }
2050
2051 for (j = CurrentScin; j < (CurrentScin + m_dbManager->TILBnscin()); j++) {
2052 GeoIdentifierTag* idTag = new GeoIdentifierTag(j-CurrentScin);
2053 m_dbManager->SetCurrentScin(j);
2054
2055 scintiHeight = m_dbManager->SCNTdr();
2056 scintiRC = m_dbManager->SCNTrc();
2057 scintiZPos = m_dbManager->SCNTzp();
2058 scintiThickness = m_dbManager->SCNTdt();
2059 scintiWrapInZ = m_dbManager->SCNTdtw();
2060 scintiWrapInR = m_dbManager->SCNTdrw();
2061 scintiDeltaInPhi = (m_switches.uShape > 0) ? 0.0 : m_dbManager->SCNTdphi();
2062
2063 thicknessWrapper = (m_dbManager->TILBdzspac() <= (scintiThickness + 2*scintiWrapInZ)) ?
2064 (scintiThickness + 2*scintiWrapInZ)*Gaudi::Units::cm: m_dbManager->TILBdzspac()*Gaudi::Units::cm;
2065 if (m_switches.glue == 2) thicknessWrapper = std::max(thicknessWrapper - m_additionalIronLayer, scintiThickness);
2066
2067 // create wrapper
2068 heightWrapper = (scintiHeight + 2*scintiWrapInR)*Gaudi::Units::cm;
2069 dy1Wrapper = ((scintiRC - scintiHeight/2 - scintiWrapInR + m_dbManager->TILBrmin()) *
2070 tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
2071 dy2Wrapper = ((scintiRC + scintiHeight/2 + scintiWrapInR + m_dbManager->TILBrmin()) *
2072 tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
2073
2074 checking("Wrapper 1", true, 5,
2075 thicknessWrapper/2,thicknessWrapper/2,dy1Wrapper,dy2Wrapper,heightWrapper/2);
2076
2077 wrapper = new GeoTrd(thicknessWrapper/2,
2078 thicknessWrapper/2,
2079 dy1Wrapper,
2080 dy2Wrapper,
2081 heightWrapper/2);
2082
2083 if (m_switches.csTube) {
2084 wrapper = makeHoles(wrapper, csHoleR, thicknessWrapper/2, scintiHeight/2.*Gaudi::Units::cm - csTubeOffCorr);
2085 }
2086 lvWrapper = new GeoLogVol("Wrapper",wrapper,matAir);
2087 pvWrapper = new GeoPhysVol(lvWrapper);
2088
2089 // create scintillator
2090 dy1Scintillator = ((scintiRC - scintiHeight/2 + m_dbManager->TILBrmin()) *
2091 tan_delta_phi_2 - m_dbManager->TILBphigap()/2 - scintiDeltaInPhi)*Gaudi::Units::cm;
2092 dy2Scintillator = ((scintiRC + scintiHeight/2 + m_dbManager->TILBrmin()) *
2093 tan_delta_phi_2 - m_dbManager->TILBphigap()/2 - scintiDeltaInPhi)*Gaudi::Units::cm;
2094
2095 checking("Scintillator 1", true, 6,
2096 scintiThickness/2*Gaudi::Units::cm,scintiThickness/2*Gaudi::Units::cm,dy1Scintillator,dy2Scintillator,scintiHeight/2*Gaudi::Units::cm);
2097
2098 scintillator = new GeoTrd(scintiThickness/2*Gaudi::Units::cm,
2099 scintiThickness/2*Gaudi::Units::cm,
2100 dy1Scintillator,
2101 dy2Scintillator,
2102 scintiHeight/2*Gaudi::Units::cm);
2103
2104 if (m_switches.csTube) {
2105 scintillator = makeHolesScint(scintillator, csHoleR, scintiThickness/2 * Gaudi::Units::cm, scintiHeight/2.*Gaudi::Units::cm - csTubeOffCorr);
2106 }
2107 lvScintillator = new GeoLogVol("Scintillator",scintillator,matScin);
2108 pvScintillator = new GeoPhysVol(lvScintillator);
2109
2110 // place scintillator in wrapper
2111 tfScintillator = new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
2112 pvWrapper->add(idTag);
2113 pvWrapper->add(tfScintillator);
2114 pvWrapper->add(pvScintillator);
2115
2116 //place wrapper in period
2117 if (m_verbose) {
2118 (*m_log) << MSG::VERBOSE <<" X scintiZPos= "<<scintiZPos;
2119 printdouble(" ==> ",(2*scintiZPos+0.5)*(thickness-m_dbManager->TILBdzspac())*Gaudi::Units::cm);
2120 (*m_log) << MSG::VERBOSE <<" Y scintiRC= "<<scintiRC <<endmsg;
2121 }
2122
2123 tfWrapper = new GeoTransform(GeoTrf::Translate3D((2*scintiZPos+0.5)*(thickness-m_dbManager->TILBdzspac())*Gaudi::Units::cm,
2124 0.,
2125 (scintiRC-(m_dbManager->TILBrmax()-m_dbManager->TILBrmin())/2)*Gaudi::Units::cm));
2126 mother->add(idTag);
2127 mother->add(tfWrapper);
2128 mother->add(pvWrapper);
2129 }
2130 break;
2131 }
2132 case 3:
2133 {
2134 //Ordinary period in Plug Section 1 - /glue/master/glue/spacer/glue/master/glue/spacer
2135
2136 //Glue layer
2137 if (glue) {
2138 if (m_verbose)
2139 printdouble(" glue position = ",(-thickness + dzglue)*Gaudi::Units::cm/2);
2140 tfGlue = new GeoTransform(GeoTrf::Translate3D((-thickness + dzglue)*Gaudi::Units::cm/2,0.,0.));
2141 mother->add(tfGlue);
2142 mother->add(pvGlue);
2143
2144 if (m_verbose)
2145 printdouble(" glue position = ",((-thickness + 3*dzglue)+m_dbManager->TILBdzmast())/2*Gaudi::Units::cm);
2146 tfGlue = new GeoTransform(GeoTrf::Translate3D(((-thickness + 3*dzglue)+m_dbManager->TILBdzmast())/2*Gaudi::Units::cm,0.,0.));
2147 mother->add(tfGlue);
2148 mother->add(pvGlue);
2149
2150 if (m_verbose)
2151 printdouble(" glue position = ",dzglue/2*Gaudi::Units::cm);
2152 tfGlue = new GeoTransform(GeoTrf::Translate3D(dzglue/2*Gaudi::Units::cm,0.,0.));
2153 mother->add(tfGlue);
2154 mother->add(pvGlue);
2155
2156 if (m_verbose)
2157 printdouble(" glue position = ",(3.*dzglue/2 + m_dbManager->TILBdzmast())*Gaudi::Units::cm);
2158 tfGlue = new GeoTransform(GeoTrf::Translate3D((3.*dzglue/2 + m_dbManager->TILBdzmast())*Gaudi::Units::cm,0.,0.));
2159 mother->add(tfGlue);
2160 mother->add(pvGlue);
2161 }
2162
2163 for (j = CurrentScin; j < (CurrentScin + m_dbManager->TILBnscin()); j++) {
2164 GeoIdentifierTag* idTag = new GeoIdentifierTag(j-CurrentScin);
2165 m_dbManager->SetCurrentScin(j);
2166
2167 scintiHeight = m_dbManager->SCNTdr();
2168 scintiRC = m_dbManager->SCNTrc();
2169 scintiZPos = m_dbManager->SCNTzp();
2170 scintiThickness = m_dbManager->SCNTdt();
2171 scintiWrapInZ = m_dbManager->SCNTdtw();
2172 scintiWrapInR = m_dbManager->SCNTdrw();
2173 scintiDeltaInPhi = (m_switches.uShape > 0) ? 0. : m_dbManager->SCNTdphi();
2174
2175 thicknessWrapper = (m_dbManager->TILBdzspac() <= (scintiThickness + 2*scintiWrapInZ)) ?
2176 (scintiThickness + 2*scintiWrapInZ)*Gaudi::Units::cm: m_dbManager->TILBdzspac()*Gaudi::Units::cm;
2177 if (m_switches.glue == 2) thicknessWrapper = std::max(thicknessWrapper - m_additionalIronLayer, scintiThickness);
2178
2179 // create wrapper
2180 heightWrapper = (scintiHeight + 2*scintiWrapInR)*Gaudi::Units::cm;
2181
2182 dy1Wrapper = ((scintiRC - scintiHeight/2 - scintiWrapInR + m_dbManager->TILBrmin()) *
2183 tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
2184 dy2Wrapper = ((scintiRC + scintiHeight/2 + scintiWrapInR + m_dbManager->TILBrmin()) *
2185 tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
2186
2187 checking("Wrapper 2", true, 5,
2188 thicknessWrapper/2,thicknessWrapper/2,dy1Wrapper,dy2Wrapper,heightWrapper/2);
2189
2190 wrapper = new GeoTrd(thicknessWrapper/2,
2191 thicknessWrapper/2,
2192 dy1Wrapper,
2193 dy2Wrapper,
2194 heightWrapper/2);
2195
2196 if (m_switches.csTube) {
2197 wrapper = makeHoles(wrapper, csHoleR, thicknessWrapper/2, scintiHeight/2.*Gaudi::Units::cm - csTubeOffCorr);
2198 }
2199 lvWrapper = new GeoLogVol("Wrapper",wrapper,matAir);
2200 pvWrapper = new GeoPhysVol(lvWrapper);
2201
2202 // create scintillator
2203 dy1Scintillator = ((scintiRC - scintiHeight/2 + m_dbManager->TILBrmin()) *
2204 tan_delta_phi_2 - m_dbManager->TILBphigap()/2 - scintiDeltaInPhi)*Gaudi::Units::cm;
2205 dy2Scintillator = ((scintiRC + scintiHeight/2 + m_dbManager->TILBrmin()) *
2206 tan_delta_phi_2 - m_dbManager->TILBphigap()/2 - scintiDeltaInPhi)*Gaudi::Units::cm;
2207
2208 checking("Scintillator 2", true, 6,
2209 scintiThickness/2*Gaudi::Units::cm,scintiThickness/2*Gaudi::Units::cm,dy1Scintillator,dy2Scintillator,scintiHeight/2*Gaudi::Units::cm);
2210
2211 scintillator = new GeoTrd(scintiThickness/2*Gaudi::Units::cm,
2212 scintiThickness/2*Gaudi::Units::cm,
2213 dy1Scintillator,
2214 dy2Scintillator,
2215 scintiHeight/2*Gaudi::Units::cm);
2216
2217 if (m_switches.csTube) {
2218 scintillator = makeHolesScint(scintillator, csHoleR, scintiThickness/2 * Gaudi::Units::cm, scintiHeight/2.*Gaudi::Units::cm - csTubeOffCorr);
2219 }
2220 lvScintillator = new GeoLogVol("Scintillator",scintillator,matScin);
2221 pvScintillator = new GeoPhysVol(lvScintillator);
2222
2223 // place scintillator in wrapper
2224 tfScintillator = new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
2225 pvWrapper->add(idTag);
2226 pvWrapper->add(tfScintillator);
2227 pvWrapper->add(pvScintillator);
2228
2229 //place wrapper in period
2230 if (m_verbose) {
2231 (*m_log) << MSG::VERBOSE <<" X scintiZPos= "<<scintiZPos;
2232 printdouble(" ==> ",(scintiZPos*thickness-m_dbManager->TILBdzspac()/2)*Gaudi::Units::cm);
2233 (*m_log) << MSG::VERBOSE <<" Y scintiRC= "<<scintiRC <<endmsg;
2234 }
2235
2236 tfWrapper = new GeoTransform(GeoTrf::Translate3D((scintiZPos*thickness-m_dbManager->TILBdzspac()/2)*Gaudi::Units::cm,
2237 0.,
2238 (scintiRC-(m_dbManager->TILBrmax()-m_dbManager->TILBrmin())/2)*Gaudi::Units::cm));
2239 mother->add(idTag);
2240 mother->add(tfWrapper);
2241 mother->add(pvWrapper);
2242 }
2243 break;
2244 }
2245 case 4:
2246 {
2247 //Special period in Plug Section - /spacer
2248
2249 for (j = CurrentScin; j < (CurrentScin + m_dbManager->TILBnscin()); j++) {
2250 m_dbManager->SetCurrentScin(j);
2251
2252 scintiHeight = m_dbManager->SCNTdr();
2253 scintiRC = m_dbManager->SCNTrc();
2254 scintiZPos = zpShift * m_dbManager->SCNTzp(); // ps special module inversion
2255 scintiThickness = m_dbManager->SCNTdt();
2256 scintiWrapInZ = m_dbManager->SCNTdtw();
2257 scintiWrapInR = m_dbManager->SCNTdrw();
2258 scintiDeltaInPhi = (m_switches.uShape > 0) ? 0.0 : m_dbManager->SCNTdphi();
2259
2260 thicknessWrapper = (m_dbManager->TILBdzspac() <= (scintiThickness + 2*scintiWrapInZ)) ?
2261 (scintiThickness + 2*scintiWrapInZ)*Gaudi::Units::cm: m_dbManager->TILBdzspac()*Gaudi::Units::cm;
2262 if (m_switches.glue == 2) thicknessWrapper = std::max(thicknessWrapper - m_additionalIronLayer, scintiThickness);
2263
2264 if (scintiZPos<0) {
2265 GeoIdentifierTag* idTag = new GeoIdentifierTag(j-CurrentScin);
2266 // create wrapper
2267 heightWrapper = (scintiHeight + 2*scintiWrapInR)*Gaudi::Units::cm;
2268 dy1Wrapper = ((scintiRC - scintiHeight/2 - scintiWrapInR + m_dbManager->TILBrmin()) *
2269 tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
2270 dy2Wrapper = ((scintiRC + scintiHeight/2 + scintiWrapInR + m_dbManager->TILBrmin()) *
2271 tan_delta_phi_2 - m_dbManager->TILBphigap()/2)*Gaudi::Units::cm;
2272
2273 checking("Wrapper 3", true, 5,
2274 thicknessWrapper/2,thicknessWrapper/2,dy1Wrapper,dy2Wrapper,heightWrapper/2);
2275
2276 wrapper = new GeoTrd(thicknessWrapper/2,
2277 thicknessWrapper/2,
2278 dy1Wrapper,
2279 dy2Wrapper,
2280 heightWrapper/2);
2281
2282 if (m_switches.csTube) {
2283 wrapper = makeHoles(wrapper, csHoleR, thicknessWrapper/2, scintiHeight/2.*Gaudi::Units::cm - csTubeOffCorr);
2284 }
2285 lvWrapper = new GeoLogVol("Wrapper",wrapper,matAir);
2286 pvWrapper = new GeoPhysVol(lvWrapper);
2287
2288 // create scintillator
2289 dy1Scintillator = ((scintiRC - scintiHeight/2 + m_dbManager->TILBrmin()) *
2290 tan_delta_phi_2 - m_dbManager->TILBphigap()/2 - scintiDeltaInPhi)*Gaudi::Units::cm;
2291 dy2Scintillator = ((scintiRC + scintiHeight/2 + m_dbManager->TILBrmin()) *
2292 tan_delta_phi_2 - m_dbManager->TILBphigap()/2 - scintiDeltaInPhi)*Gaudi::Units::cm;
2293
2294 checking("Scintillator 3", true, 6,
2295 scintiThickness/2*Gaudi::Units::cm,scintiThickness/2*Gaudi::Units::cm,dy1Scintillator,dy2Scintillator,scintiHeight/2*Gaudi::Units::cm);
2296
2297 scintillator = new GeoTrd(scintiThickness/2*Gaudi::Units::cm,
2298 scintiThickness/2*Gaudi::Units::cm,
2299 dy1Scintillator,
2300 dy2Scintillator,
2301 scintiHeight/2*Gaudi::Units::cm);
2302
2303 if (m_switches.csTube) {
2304 scintillator = makeHolesScint(scintillator, csHoleR, scintiThickness/2 * Gaudi::Units::cm, scintiHeight/2.*Gaudi::Units::cm - csTubeOffCorr);
2305 }
2306 lvScintillator = new GeoLogVol("Scintillator",scintillator,matScin);
2307 pvScintillator = new GeoPhysVol(lvScintillator);
2308
2309 // place scintillator in wrapper
2310 tfScintillator = new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
2311 pvWrapper->add(idTag);
2312 pvWrapper->add(tfScintillator);
2313 pvWrapper->add(pvScintillator);
2314
2315 //place wrapper in period
2316 if (m_verbose) {
2317 (*m_log) << MSG::VERBOSE <<" X scintiZPos= "<<0.0 <<endmsg;
2318 (*m_log) << MSG::VERBOSE <<" Y scintiRC= "<<scintiRC <<endmsg;
2319 }
2320
2321 tfWrapper = new GeoTransform(GeoTrf::Translate3D(0.,
2322 0.,
2323 (scintiRC-(m_dbManager->TILBrmax()-m_dbManager->TILBrmin())/2)*Gaudi::Units::cm));
2324 mother->add(idTag);
2325 mother->add(tfWrapper);
2326 mother->add(pvWrapper);
2327 }
2328 }
2329 break;
2330 }
2331 default:
2332 {
2333 //Scintillator layers in Plug Sections 3 and 4
2334
2335 // checking shape of mother volume.
2336 double dy1Period = period->getYHalfLength1();
2337 double tanphi = (period->getYHalfLength2()-dy1Period)/period->getZHalfLength()/2.;
2338 if (m_log->level()<=MSG::DEBUG)
2339 if (std::abs(tanphi-tan_delta_phi_2) > 1.e-5)
2340 (*m_log) << MSG::DEBUG <<"Different tan_delta_phi_2 " << tanphi << " " << tan_delta_phi_2 <<endmsg;
2341
2342 for (j = CurrentScin; j < (CurrentScin + m_dbManager->TILBnscin()); j++) {
2343 GeoIdentifierTag* idTag = new GeoIdentifierTag(j-CurrentScin);
2344 m_dbManager->SetCurrentScin(j);
2345
2346 scintiHeight = m_dbManager->SCNTdr();
2347 scintiRC = m_dbManager->SCNTrc();
2348 scintiZPos = m_dbManager->SCNTzp();
2349 scintiThickness = m_dbManager->SCNTdt();
2350 scintiWrapInZ = m_dbManager->SCNTdtw();
2351 scintiWrapInR = m_dbManager->SCNTdrw();
2352 scintiDeltaInPhi = m_dbManager->SCNTdphi(); // don't need to check m_uShape for single scintillator
2353
2354 // create wrapper
2355 heightWrapper = (scintiHeight + 2*scintiWrapInR)*Gaudi::Units::cm;
2356 thicknessWrapper = (scintiThickness + 2*scintiWrapInZ)*Gaudi::Units::cm;
2357 if (m_switches.glue == 2) thicknessWrapper = std::max(thicknessWrapper - m_additionalIronLayer, scintiThickness);
2358
2359 double thicknessEnvelope = (m_dbManager->TILBdzmodul()*Gaudi::Units::cm - thicknessWrapper); // along phi thickness is twice bigger than along Z
2360 dy1Wrapper = dy1Period - thicknessEnvelope + ((scintiRC - scintiHeight/2. - scintiWrapInR)*tanphi)*Gaudi::Units::cm;
2361 dy2Wrapper = dy1Period - thicknessEnvelope + ((scintiRC + scintiHeight/2. + scintiWrapInR)*tanphi)*Gaudi::Units::cm;
2362
2363 if (m_log->level()<=MSG::DEBUG)
2364 (*m_log) << MSG::DEBUG <<"Envelope thickness is " << thicknessEnvelope <<endmsg;
2365 checking("Wrapper 4", true, 5,
2366 thicknessWrapper/2,thicknessWrapper/2,dy1Wrapper,dy2Wrapper,heightWrapper/2);
2367
2368 wrapper = new GeoTrd(thicknessWrapper/2,
2369 thicknessWrapper/2,
2370 dy1Wrapper,
2371 dy2Wrapper,
2372 heightWrapper/2);
2373 lvWrapper = new GeoLogVol("Wrapper",wrapper,matAir);
2374 pvWrapper = new GeoPhysVol(lvWrapper);
2375
2376 // create scintillator
2377 dy1Scintillator = dy1Period - thicknessEnvelope + ((scintiRC - scintiHeight/2.)*tanphi - scintiDeltaInPhi)*Gaudi::Units::cm;
2378 dy2Scintillator = dy1Period - thicknessEnvelope + ((scintiRC + scintiHeight/2.)*tanphi - scintiDeltaInPhi)*Gaudi::Units::cm;
2379
2380 checking("Scintillator 4", true, 6,
2381 scintiThickness/2*Gaudi::Units::cm,scintiThickness/2*Gaudi::Units::cm,dy1Scintillator,dy2Scintillator,scintiHeight/2*Gaudi::Units::cm);
2382
2383 scintillator = new GeoTrd(scintiThickness/2*Gaudi::Units::cm,
2384 scintiThickness/2*Gaudi::Units::cm,
2385 dy1Scintillator,
2386 dy2Scintillator,
2387 scintiHeight/2*Gaudi::Units::cm);
2388 lvScintillator = new GeoLogVol("Scintillator",scintillator,matScin);
2389 pvScintillator = new GeoPhysVol(lvScintillator);
2390
2391 // place scintillator in wrapper
2392 tfScintillator = new GeoTransform(GeoTrf::Translate3D(0.,0.,0.));
2393 pvWrapper->add(idTag);
2394 pvWrapper->add(tfScintillator);
2395 pvWrapper->add(pvScintillator);
2396
2397 //place wrapper in period
2398 if (m_verbose) {
2399 (*m_log) << MSG::VERBOSE <<" X scintiZPos= "<<0.0 <<endmsg;
2400 (*m_log) << MSG::VERBOSE <<" Y scintiRC= "<<scintiRC <<endmsg;
2401 }
2402
2403 tfWrapper = new GeoTransform(GeoTrf::Translate3D(0.,
2404 0.,
2405 (scintiRC-(m_dbManager->TILBrmax()-m_dbManager->TILBrmin())/2)*Gaudi::Units::cm));
2406 mother->add(idTag);
2407 mother->add(tfWrapper);
2408 mother->add(pvWrapper);
2409 }
2410 break;
2411 }
2412 }
2413}
2414
2415
2416// Checking geometry dimensions for all directions
2417
2418void TileGeoSectionBuilder::checking(const std::string& Name, bool print, int level,
2419 double X1, double X2, double Y1, double Y2, double Z)
2420{
2421 double rless = .005; //5 [mkm]
2422 std::string Step[8] = {" ",
2423 " ",
2424 " ",
2425 " ",
2426 " ",
2427 " ",
2428 " ",
2429 " "};
2430 if (print) {
2431 if (m_log->level()<=MSG::DEBUG)
2432 (*m_log) << MSG::DEBUG <<Step[level]<<Name<<" -"<<level
2433 << std::setiosflags(std::ios::fixed) << std::setw(9) << std::setprecision(4)
2434 <<" dX1,dX2= "<<X1<<" "<<X2
2435 <<" dY1,dY2= "<<Y1<<" "<<Y2
2436 <<" dZ= "<<Z
2437 << std::resetiosflags(std::ios::fixed)
2438 <<endmsg;
2439 }
2440 if (X1 < rless && X2 < rless) {
2441 (*m_log) << MSG::WARNING <<" volume "<<Name<<" is empty, X1 or X2<0 "<<endmsg;
2442 }
2443 if (Y1 < rless && Y2 < rless) {
2444 (*m_log) << MSG::WARNING <<" volume "<<Name<<" is empty, Y1 or Y2<0 "<<endmsg;
2445 }
2446 if (Z < rless) {
2447 (*m_log) << MSG::WARNING <<" volume "<<Name<<" is empty, Z<0 "<<endmsg;
2448 }
2449}
2450
2451
2452// -- Readout
2453
2455 unsigned int detector,
2456 int side,
2457 bool testbeam,
2458 bool addPlates,
2459 unsigned int nphi,
2460 float zshift)
2461{
2462 // auxillary variables
2463 unsigned int index;
2464 int currentSample, etaIndex, nsamp;
2465 std::vector<int> samples; // samples of a given region
2466 std::vector<int> firstScin; // first scintillator for samples of a given region
2467 std::vector<int> lastScin; // last scintillator for samples of a given region
2468
2469 // -- default values for all regions
2470 // they are overwritten later in calculateR() by actual values taken from DB
2471 float phi_min, phi_max;
2472 float dphi = 2.0f*M_PI/64;
2473
2474 if (testbeam) { // put modules symmetricaly
2475 phi_max = nphi*dphi/2;
2476 phi_min = -phi_max;
2477 } else { // put edge of very first module on horizontal plane
2478 phi_min = 0.;
2479 phi_max = nphi * dphi;
2480 }
2481
2482 // Hardcoded values for R/dR
2483 float rBarrel[] = {2450., 3020., 3630.};
2484 float drBarrel[] = {300., 840., 380.};
2485
2486 float rExtended[] = {2450., 2870., 3480.};
2487 float drExtended[] = {300., 540., 680.};
2488
2489 float rGap[] = {3215., 3630., 2802.5, 2475.5, 2066., 1646.};
2490 float drGap[] = {450., 380., 313., 341., 478., 362.};
2491
2492 if (addPlates) {
2493 rBarrel[0] -= 10*Gaudi::Units::mm/2;
2494 rBarrel[2] += 40*Gaudi::Units::mm/2;
2495 drBarrel[0] += 10*Gaudi::Units::mm;
2496 drBarrel[2] += 40*Gaudi::Units::mm;
2497 rExtended[0] -= 10*Gaudi::Units::mm/2;
2498 rExtended[2] += 40*Gaudi::Units::mm/2;
2499 drExtended[0] += 10*Gaudi::Units::mm;
2500 drExtended[2] += 40*Gaudi::Units::mm;
2501 rGap[1] += 40*Gaudi::Units::mm/2;
2502 drGap[1] += 40*Gaudi::Units::mm;
2503 }
2504
2505 int indHardcoded = 0;
2506
2507 // --------------------------------
2508
2509 // -- initialize all necessary arrays with 0.
2510 std::vector<float> eta_min (MAX_N_SAMP_TILEDD, 0.);
2511 std::vector<float> eta_max (MAX_N_SAMP_TILEDD, 0.);
2512 std::vector<float> deta (MAX_N_SAMP_TILEDD, 0.);
2513 std::vector<unsigned int> neta (size_t(MAX_N_SAMP_TILEDD), 0U);
2514 std::vector<float> rcenter (MAX_N_SAMP_TILEDD, 0.);
2515 std::vector<float> dr (MAX_N_SAMP_TILEDD, 0.);
2516 std::vector<float> zcenter (MAX_N_SAMP_TILEDD, 0.);
2517 std::vector<float> dz (MAX_N_SAMP_TILEDD, 0.);
2518
2519 // ---------------------------------
2520
2521 // Set side
2522 int sign_eta = (side>0) ? 1 : -1;
2523
2524
2525 // iterate over all samples of the region and fill corresponding eta values.
2526 // this works for Central and Extended Barrel regions only!
2527 if (detector==TILE_REGION_CENTRAL || detector == TILE_REGION_EXTENDED) {
2528 // -- Calculate number of samples for the region
2529 // find first TICL for the given detector
2530 if (m_dbManager->SetFirstTiclInDet(detector)) {
2531 // for the central barrel region take care of the side
2532 if (detector == TILE_REGION_CENTRAL) {
2533 while (sign_eta * m_dbManager->TICLncell() < 0) {
2534 if (!(m_dbManager->SetNextTiclInDet())) {
2535 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::fillDescriptor: No TICL structures for detector: "
2536 << detector << " and side: " << sign_eta << endmsg;
2537 return;
2538 }
2539 }
2540 }
2541
2542 samples.push_back((int)m_dbManager->TICLsample());
2543 firstScin.push_back((int)m_dbManager->TICLfirstrow());
2544 lastScin.push_back((int)m_dbManager->TICLlastrow());
2545
2546 // iterate over all other TICLs in the detector
2547 while (m_dbManager->SetNextTiclInDet()) {
2548 if (!((detector == TILE_REGION_CENTRAL)&&(sign_eta * m_dbManager->TICLncell() < 0))) {
2549 // find if the sample of the cell is already in the samples vector
2550 // and if not then add it
2551 currentSample = (int)m_dbManager->TICLsample();
2552 for (index=0; index<samples.size(); index++)
2553 if (currentSample==samples[index]) break;
2554 if (index==samples.size()) {
2555 samples.push_back(currentSample);
2556 firstScin.push_back((int)m_dbManager->TICLfirstrow());
2557 lastScin.push_back((int)m_dbManager->TICLlastrow());
2558 }
2559 }
2560 }
2561
2562 } else {
2563 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::fillDescriptor: No TICL structures for the detector: "
2564 << detector << endmsg;
2565 return;
2566 }
2567
2568 nsamp = 0;
2569 for (index=0; index<samples.size(); index++, indHardcoded++) {
2570 etaIndex = samples[index];
2571 if (etaIndex > nsamp) nsamp = etaIndex;
2572 calculateEta(detector,
2573 side,
2574 etaIndex,
2575 eta_min[etaIndex-1], // In TICL structures samples are numbered from 1
2576 eta_max[etaIndex-1],
2577 deta[etaIndex-1],
2578 neta[etaIndex-1]);
2579 calculateZ(detector,
2580 side,
2581 etaIndex,
2582 zshift,
2583 zcenter[etaIndex-1],
2584 dz[etaIndex-1]);
2585
2586 // Fill in the hardcoded values
2587 if (detector == TILE_REGION_CENTRAL) {
2588 rcenter[etaIndex-1] = rBarrel[indHardcoded];
2589 dr[etaIndex-1] = drBarrel[indHardcoded];
2590 } else {
2591 rcenter[etaIndex-1] = rExtended[indHardcoded];
2592 dr[etaIndex-1] = drExtended[indHardcoded];
2593 }
2594 calculateR(detector,
2595 etaIndex,
2596 addPlates,
2597 firstScin[index],
2598 lastScin[index],
2599 rcenter[etaIndex-1],
2600 dr[etaIndex-1]);
2601 }
2602
2603 } else if (detector == TILE_REGION_GAP) {
2604 // We are in GAP detectors (detector = 3 & 4)
2605 // Loop over all TICL structures of these detectors
2606 // Determine eta_min, eta_max, deta
2607 // neta = 1 for all
2608 //
2609 // !!! For DETECTOR=4 INDEX is set by TOWER and NOT SAMPLE !!!
2610 //
2611
2612 nsamp = 0;
2613 for (unsigned int det = detector; det < detector+2; det++)
2614 for (int status=m_dbManager->SetFirstTiclInDet(det); status>0; status=m_dbManager->SetNextTiclInDet()) {
2615 if ((int)m_dbManager->TICLtower()>16) continue;
2616 if (det==detector)
2617 etaIndex = (int)m_dbManager->TICLsample();
2618 else
2619 etaIndex = (int)m_dbManager->TICLtower();
2620 if (etaIndex > nsamp) nsamp = etaIndex;
2621 // simple calculations of eta for one cell
2622 neta[etaIndex-1] = 1;
2623 deta[etaIndex-1] = m_dbManager->TICLdeta();
2624 eta_min[etaIndex-1] = m_dbManager->TICLeta() - m_dbManager->TICLdeta()/2;
2625 eta_max[etaIndex-1] = m_dbManager->TICLeta() + m_dbManager->TICLdeta()/2;
2626 calculateZ(detector,
2627 side,
2628 etaIndex,
2629 zshift,
2630 zcenter[etaIndex-1],
2631 dz[etaIndex-1]);
2632
2633 // Fill in the hardcoded values
2634 rcenter[etaIndex-1] = rGap[indHardcoded];
2635 dr[etaIndex-1] = drGap[indHardcoded];
2636 indHardcoded++;
2637 calculateR(detector,
2638 etaIndex,
2639 addPlates,
2640 m_dbManager->TICLfirstrow(),
2641 m_dbManager->TICLlastrow(),
2642 rcenter[etaIndex-1],
2643 dr[etaIndex-1]);
2644 }
2645
2646 } else {
2647 // MBSCIN case
2648 // - should not arrive to this place !!!
2649 // TileDetDescrManager do not expect MBSCIN at all
2650 // it is kept here just in case we'll want to describe
2651 // them as a separate region
2652 //
2653 assert (detector <= TILE_REGION_GAP);
2654
2655 // diameter: 276 - 740 - 1964
2656 // radius: 138 - 370 - 982
2657 float rMB[] = { 676., 254. };
2658 float drMB[] = { 306., 116. };
2659 float zMB = 3500;
2660 float dzMB = 30;
2661
2662 for (int ind=0; ind<2; ++ind) {
2663 neta[ind] = 1;
2664 deta[ind] = 1.;
2665 eta_min[ind] = 2. + ind;
2666 eta_max[ind] = 3. + ind;
2667 zcenter[ind] = zMB;
2668 dz[ind] = dzMB;
2669 rcenter[ind] = rMB[ind];
2670 dr[ind] = drMB[ind];
2671 }
2672 nsamp = 2;
2673 nphi = 8;
2674 dphi = M_PI_4;
2675 phi_min = -dphi/2;
2676 phi_max = nphi * dphi + phi_min;
2677 }
2678
2679 descriptor->set(&*eta_min.begin(),
2680 &*eta_max.begin(),
2681 &*deta.begin(),
2682 phi_min,
2683 phi_max,
2684 dphi,
2685 zshift,
2686 &*rcenter.begin(),
2687 &*dr.begin(),
2688 &*zcenter.begin(),
2689 &*dz.begin(),
2690 nsamp,
2691 &*neta.begin(),
2692 nphi,
2693 sign_eta);
2694
2695
2696 // debug print
2697 if (m_verbose)
2698 descriptor->print();
2699
2700}
2701
2702
2708
2710 int detector,
2711 bool addPlates,
2712 float zShiftPos,
2713 float zShiftNeg)
2714{
2715 MLOG(DEBUG) << "TileGeoSectionBuilder::computeCellDim for detector="
2716 << detector << endmsg;
2717
2719 std::vector<double> rmins;
2720 std::vector<double> rmaxs;
2721 std::vector<double> zmins;
2722 std::vector<double> zmaxs;
2723
2725 int currentSample;
2726 std::vector<int> samples;
2727
2729 unsigned int index;
2730 unsigned int CurrentScin;
2731
2732 int nSide, nTower, nSample=0;
2733 unsigned int nFirstRow, nLastRow, nRows;
2734
2735 double dzCell, dzPeriod;
2736 double rMin, rMax;
2737 double zEnd1 =0,zEnd2 =0,zEnd1Lim =0,zEnd2Lim =0;
2738
2739 bool isSquare;
2740 float minTilesInRow;
2741 TileCellDim *cellDim =0, *cellDimNeg =0;
2742 // -------- Auxiliary variables ----------
2743
2744 MLOG(DEBUG) << "Auxiliary variables..." << endmsg;
2745
2746 // Barrel/Extended barrel regions
2747 if (detector != TILE_REGION_GAP ) {
2748 MLOG(DEBUG) << "Barrel/ExtendedBarrel regions..." << endmsg;
2749
2750 if (detector == TILE_REGION_CENTRAL) {
2751 m_dbManager->SetCurrentSection(TileDddbManager::TILE_BARREL);
2752 dzPeriod = m_barrelPeriodThickness;
2753 } else {
2754 m_dbManager->SetCurrentSection(TileDddbManager::TILE_EBARREL);
2755 dzPeriod = m_extendedPeriodThickness;
2756 }
2757 MLOG(DEBUG) << "dzPeriod: " << dzPeriod << "\n" << endmsg;
2758
2759
2760 rMin = m_dbManager->TILBrmin() *Gaudi::Units::cm;
2761 if (addPlates) rMin -= m_dbManager->TILBdrfront() *Gaudi::Units::cm;
2762 int section = m_dbManager->TILBsection();
2763 if (section < 0) {
2764 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::computeCellDim: Error return from TileDddbManager::TILBsection() " << endmsg;
2765 return;
2766 }
2767 CurrentScin = 100*section + 1;
2768 //dzMaster = m_dbManager->TILBdzmast()*Gaudi::Units::cm;
2769
2774 for (unsigned int j = CurrentScin; j < (CurrentScin + m_dbManager->TILBnscin()); j++) {
2775 m_dbManager->SetCurrentScin(j);
2776
2777 if ( (j == CurrentScin + m_dbManager->TILBnscin() - 1) && addPlates ) {
2778 // use end of the master as end of last cell
2779 rMax = m_dbManager->TILBrmax()*Gaudi::Units::cm;
2780
2781 } else {
2782 double tileSize=m_dbManager->SCNTdr();
2783 if (m_dbManager->SCNTdrw() > 0)
2784 // round to integer for all tiles except gap scin
2785 tileSize=round(tileSize);
2786 rMax = (m_dbManager->TILBrmin() + m_dbManager->SCNTrc() + tileSize/2)*Gaudi::Units::cm;
2787 }
2788
2789 rmins.push_back(rMin);
2790 rmaxs.push_back(rMax);
2791 rMin = rMax;
2792
2793 if (detector == TILE_REGION_CENTRAL) {
2794 zmins.push_back((-m_dbManager->TILBdzmast()/2 - m_barrelGlue*(1./Gaudi::Units::cm)
2795 -(m_dbManager->TILBdzmodul()/2-m_dbManager->TILBdzend1()))*Gaudi::Units::cm);
2796 zEnd1Lim = (-m_dbManager->TILBdzmodul()/2+m_dbManager->TILBdzend1())*Gaudi::Units::cm;
2797 zEnd2Lim = ( m_dbManager->TILBdzmodul()/2-m_dbManager->TILBdzend2())*Gaudi::Units::cm;
2798 zEnd1 = (-m_dbManager->TILBdzmodul()/2)*Gaudi::Units::cm;
2799 zEnd2 = ( m_dbManager->TILBdzmodul()/2)*Gaudi::Units::cm;
2800
2801 } else {
2802 zmins.push_back((m_dbManager->TILBzoffset() - m_dbManager->TILBdzmodul()/2 + m_dbManager->TILBdzend1())*Gaudi::Units::cm);
2803 zEnd1Lim = (m_dbManager->TILBzoffset() - m_dbManager->TILBdzmodul()/2+m_dbManager->TILBdzend1()+0.001)*Gaudi::Units::cm;
2804 zEnd2Lim = (m_dbManager->TILBzoffset() + m_dbManager->TILBdzmodul()/2-m_dbManager->TILBdzend2()-0.001)*Gaudi::Units::cm;
2805 zEnd1 = (m_dbManager->TILBzoffset() - m_dbManager->TILBdzmodul()/2)*Gaudi::Units::cm;
2806 zEnd2 = (m_dbManager->TILBzoffset() + m_dbManager->TILBdzmodul()/2)*Gaudi::Units::cm;
2807 }
2808
2809 // init all zmaxs to 0.
2810 zmaxs.push_back(0.);
2811 }
2812
2813 // Iterate through region cells and fill in the Samples vector
2814 if (m_dbManager->SetFirstTiclInDet(detector)) {
2815 samples.push_back((int)m_dbManager->TICLsample());
2816
2817 // iterate over all other TICLs in the detector
2818 while (m_dbManager->SetNextTiclInDet()) {
2820 currentSample = (int)m_dbManager->TICLsample();
2821 for (index=0; index<samples.size(); index++)
2822 if (currentSample==samples[index]) break;
2823 if (index==samples.size()) samples.push_back(currentSample);
2824 }
2825
2826 } else {
2827 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::computeCellDim: No TICL structures for the detector: "
2828 << detector << endmsg;
2829 return;
2830 }
2831
2833 for (index=0; index<samples.size(); index++) {
2834 currentSample = samples[index];
2835
2836 if (m_dbManager->SetFirstTiclInDetSamp(detector, currentSample)) {
2837 nFirstRow = (int)m_dbManager->TICLfirstrow();
2838 // BC sample
2839 if (m_dbManager->TICLsample()==2 && detector == TILE_REGION_CENTRAL)
2840 nLastRow = nFirstRow + 2;
2841 else
2842 nLastRow = (int)m_dbManager->TICLlastrow();
2843
2844 nRows = nLastRow - nFirstRow + 1;
2845
2846 do {
2847 isSquare = true;
2848 minTilesInRow = m_dbManager->TICLntilesrow(0);
2849 for (unsigned int jj=1; jj<nRows; jj++) {
2850 if (m_dbManager->TICLntilesrow(jj)!=minTilesInRow)
2851 isSquare = false;
2852 if (m_dbManager->TICLntilesrow(jj)<minTilesInRow)
2853 minTilesInRow = m_dbManager->TICLntilesrow(jj);
2854 }
2855
2856 if (isSquare)
2857 dzCell = minTilesInRow * dzPeriod;
2858 else
2859 dzCell = (minTilesInRow + 0.5) * dzPeriod;
2860
2861 MLOG(DEBUG) << "dzCell: " << dzCell << " minTilesInRow: " << minTilesInRow << " isSquare: " << isSquare << " dzPeriod: " << dzPeriod << endmsg;
2862
2863 for (unsigned int jj=nFirstRow; jj<=nLastRow; jj++)
2864 zmaxs[jj-1] = zmins[jj-1] + dzCell;
2865
2866
2868 bool BCcell = (m_dbManager->TICLsample()==2 && detector == TILE_REGION_CENTRAL);
2869 if (BCcell) {
2870 isSquare = true;
2871 int firstC = nLastRow + 1;
2872 nLastRow +=3;
2873
2874 minTilesInRow = m_dbManager->TICLntilesrow(firstC-nFirstRow);
2875
2876 for (unsigned int jj=firstC-nFirstRow+1; jj<=nLastRow-nFirstRow; jj++) {
2877 if (m_dbManager->TICLntilesrow(jj)!=minTilesInRow)
2878 isSquare = false;
2879 if (m_dbManager->TICLntilesrow(jj)<minTilesInRow)
2880 minTilesInRow = m_dbManager->TICLntilesrow(jj);
2881 }
2882
2883 if (isSquare)
2884 dzCell = minTilesInRow*dzPeriod;
2885 else
2886 dzCell = (minTilesInRow + 0.5)*dzPeriod;
2887
2888
2889 MLOG(DEBUG) << "BC - dzCell: " << dzCell << " minTilesInRow: " << minTilesInRow << " isSquare: " << isSquare << endmsg;
2890
2891 for (unsigned int jj=firstC; jj<=nLastRow; jj++)
2892 zmaxs[jj-1] = zmins[jj-1] + dzCell;
2893 }
2894
2896 if (m_dbManager->TICLsample()==2 && detector == TILE_REGION_CENTRAL)
2897 cellDim = new TileCellDim(2*nRows);
2898 else
2899 cellDim = new TileCellDim(nRows);
2900
2901 if (detector != TILE_REGION_CENTRAL)
2902 cellDimNeg = new TileCellDim(nRows);
2903
2904 for (unsigned int jj=nFirstRow; jj<=nLastRow; jj++) {
2905 double Zmin=zmins[jj-1];
2906 double Zmax=zmaxs[jj-1];
2907 if (addPlates) {
2908 if (Zmin<zEnd1Lim) Zmin=zEnd1;
2909 else if (Zmin>zEnd2Lim) Zmin=zEnd2;
2910 if (Zmax<zEnd1Lim) Zmax=zEnd1;
2911 else if (Zmax>zEnd2Lim) Zmax=zEnd2;
2912 }
2913
2914 cellDim->addRMin(rmins[jj-1]);
2915 cellDim->addRMax(rmaxs[jj-1]);
2916 cellDim->addZMin(Zmin+zShiftPos);
2917 cellDim->addZMax(Zmax+zShiftPos);
2918
2919 if (detector != TILE_REGION_CENTRAL) {
2920 cellDimNeg->addRMin(rmins[jj-1]);
2921 cellDimNeg->addRMax(rmaxs[jj-1]);
2922 cellDimNeg->addZMin(-Zmax-zShiftNeg);
2923 cellDimNeg->addZMax(-Zmin-zShiftNeg);
2924 if (jj==nFirstRow)
2925 MLOG(DEBUG) << "Zmin: " << Zmin << " Zmax: " << Zmax << " zShiftPos: " << zShiftPos << " zShiftNeg: " << zShiftNeg << endmsg;
2926
2927 } else {
2928 if (jj==nFirstRow || (BCcell && jj==nLastRow))
2929 MLOG(DEBUG) << "Zmin: " << Zmin << " Zmax: " << Zmax << " zShift: " << zShiftPos << endmsg;
2930 }
2931 }
2932
2933 for (unsigned int jj=nFirstRow; jj<=nLastRow; jj++)
2934 zmins[jj-1] = zmaxs[jj-1];
2935
2936 if (m_dbManager->TICLncell()<0)
2937 nSide = -1;
2938 else
2939 nSide = 1;
2940
2941 nTower = abs((int)m_dbManager->TICLtower())-1;
2942 nSample = currentSample - 1;
2943
2944 if (detector == TILE_REGION_CENTRAL) {
2945 cellDim->computeVolume();
2946 manager->add_cellDim(detector, nSide, nTower, nSample, cellDim);
2947
2948 } else {
2949 cellDim->computeVolume();
2950 cellDimNeg->computeVolume();
2951 manager->add_cellDim(detector, 1, nTower, nSample, cellDim);
2952 manager->add_cellDim(detector, -1, nTower, nSample, cellDimNeg);
2953 }
2954
2955 if (m_dbManager->TICLsample()==2 && detector == TILE_REGION_CENTRAL) nLastRow -=3;
2956
2957 /* -------- DEBUG printouts -------------- */
2958
2959 if (m_verbose) {
2960 std::cout << std::setiosflags(std::ios::fixed)
2961 << std::setw(9) << std::setprecision(2);
2962 std::cout << "\n **** Cell dimensions computed for : ";
2963 std::cout << "(" << detector << ", "
2964 << nSide << ", "
2965 << nTower << ", "
2966 << nSample << ")\n";
2967 std::cout << " >> CellDim contains " << cellDim->getNRows() << " rows\n";
2968 for (unsigned int jj=0; jj<cellDim->getNRows(); jj++)
2969 std::cout << cellDim->getRMin(jj) << " "
2970 << cellDim->getRMax(jj) << " "
2971 << cellDim->getZMin(jj) << " "
2972 << cellDim->getZMax(jj) << "\n";
2973 std::cout << " >> Cell Volume is " << cellDim->getVolume()*(1./Gaudi::Units::cm3) << " cm^3\n";
2974
2975 if (detector != TILE_REGION_CENTRAL) {
2976 std::cout << " >> CellDimNeg contains " << cellDimNeg->getNRows() << " rows\n";
2977 for (unsigned int jj=0; jj<cellDimNeg->getNRows(); jj++)
2978 std::cout << cellDimNeg->getRMin(jj) << " "
2979 << cellDimNeg->getRMax(jj) << " "
2980 << cellDimNeg->getZMin(jj) << " "
2981 << cellDimNeg->getZMax(jj) << "\n";
2982 std::cout << " >> CellNeg Volume is " << cellDimNeg->getVolume()*(1./Gaudi::Units::cm3) << " cm^3\n";
2983 }
2984 std::cout << "\n" << std::resetiosflags(std::ios::fixed);
2985 }
2986 /* ------------------------------------------------------------------------------------------------ */
2987 }
2988 while (m_dbManager->SetNextTiclInDetSamp());
2989
2990 } else {
2991 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::computeCellDim: No TICL structures in detector: "
2992 << detector << " for sample: " << nSample << endmsg;
2993 return;
2994 }
2995 }
2996
2997 } else { // ITC/GAP/CRACK
2998 MLOG(DEBUG) << "ITC/GAP/CRACK regions...\n" << endmsg;
2999 nSide = 1;
3000 // Deal with ITC
3001 for (unsigned int sec=0; sec<2; sec++) { // PLUG1 & PLUG2
3002 rmins.clear();
3003 rmaxs.clear();
3004 zmins.clear();
3005 zmaxs.clear();
3006
3007 m_dbManager->SetFirstTiclInDet(detector);
3008
3009 if (sec) {
3010 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG2);
3011 } else {
3012 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG1);
3013 m_dbManager->SetNextTiclInDet();
3014 }
3015
3016 rMin = m_dbManager->TILBrmin()*Gaudi::Units::cm;
3017 if (addPlates) rMin -= m_dbManager->TILBdrfront() *Gaudi::Units::cm;
3018 CurrentScin = 100*m_dbManager->TILBsection() + 1;
3019
3020 for (unsigned int j = CurrentScin; j < (CurrentScin + m_dbManager->TILBnscin()); j++) {
3021 m_dbManager->SetCurrentScin(j);
3022
3023 if ( (j == CurrentScin + m_dbManager->TILBnscin() - 1) && addPlates ) {
3025 rMax = m_dbManager->TILBrmax()*Gaudi::Units::cm;
3027 if (addPlates && sec)
3028 rMax -= m_dbManager->TILBdrfront()*Gaudi::Units::cm;
3029
3030 } else {
3031 double tileSize=m_dbManager->SCNTdr();
3032 if (m_dbManager->SCNTdrw() > 0)
3034 tileSize=round(tileSize);
3035 rMax = (m_dbManager->TILBrmin() + m_dbManager->SCNTrc() + tileSize/2)*Gaudi::Units::cm;
3036 }
3037
3038 rmins.push_back(rMin);
3039 rmaxs.push_back(rMax);
3040 rMin = rMax;
3041
3042 zEnd1Lim = (m_dbManager->TILBzoffset() - m_dbManager->TILBdzmodul()/2+m_dbManager->TILBdzend1()+0.001)*Gaudi::Units::cm;
3043 zEnd2Lim = (m_dbManager->TILBzoffset() + m_dbManager->TILBdzmodul()/2-m_dbManager->TILBdzend2()-0.001)*Gaudi::Units::cm;
3044 zEnd1 = (m_dbManager->TILBzoffset() - m_dbManager->TILBdzmodul()/2)*Gaudi::Units::cm;
3045 zEnd2 = (m_dbManager->TILBzoffset() + m_dbManager->TILBdzmodul()/2)*Gaudi::Units::cm;
3046
3047 if ( addPlates ) {
3048 zmins.push_back((m_dbManager->TILBzoffset() - m_dbManager->TILBdzmodul()/2)*Gaudi::Units::cm);
3049 zmaxs.push_back((m_dbManager->TILBzoffset() + m_dbManager->TILBdzmodul()/2)*Gaudi::Units::cm);
3050 } else {
3051 zmins.push_back((m_dbManager->TILBzoffset() - m_dbManager->TILBdzmodul()/2 + m_dbManager->TILBdzend1())*Gaudi::Units::cm);
3052 zmaxs.push_back((m_dbManager->TILBzoffset() + m_dbManager->TILBdzmodul()/2 - m_dbManager->TILBdzend2())*Gaudi::Units::cm);
3053 }
3054 }
3055
3056 // Create TileCellDim objects
3057 if (m_dbManager->TILBnscin() < 0) {
3058 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::computeCellDim: Bad return from TILBnscin" << endmsg;
3059 return;
3060 }
3061 unsigned int nscin = static_cast<unsigned int>(m_dbManager->TILBnscin());
3062 cellDim = new TileCellDim(nscin);
3063 cellDimNeg = new TileCellDim(nscin);
3064
3065 for (unsigned int jj=0; jj<nscin; jj++) {
3066 cellDim->addRMin(rmins[jj]);
3067 cellDim->addRMax(rmaxs[jj]);
3068 cellDim->addZMin(zmins[jj]+zShiftPos);
3069 cellDim->addZMax(zmaxs[jj]+zShiftPos);
3070
3071 cellDimNeg->addRMin(rmins[jj]);
3072 cellDimNeg->addRMax(rmaxs[jj]);
3073 cellDimNeg->addZMin(-zmaxs[jj]-zShiftNeg);
3074 cellDimNeg->addZMax(-zmins[jj]-zShiftNeg);
3075 }
3076 MLOG(DEBUG) << "Zmin: " << zmins[0] << " Zmax: " << zmaxs[0] << " zShiftPos: " << zShiftPos << " zShiftNeg: " << zShiftNeg << endmsg;
3077
3078 nTower = (int)m_dbManager->TICLtower()-1;
3079 nSample = (int)m_dbManager->TICLsample()-1;
3080
3081 cellDim->computeVolume();
3082 cellDimNeg->computeVolume();
3083 manager->add_cellDim(detector, 1, nTower, nSample, cellDim);
3084 manager->add_cellDim(detector, -1, nTower, nSample, cellDimNeg);
3085
3086/* -------- DEBUG printouts -------------- */
3087 if (m_verbose) {
3088 std::cout << std::setiosflags(std::ios::fixed)
3089 << std::setw(9) << std::setprecision(2);
3090 std::cout << "\n **** Cell dimension computed for : ";
3091 std::cout << "(" << detector << ", "
3092 << nSide << ", "
3093 << nTower << ", "
3094 << nSample << ")\n";
3095 std::cout << " >> CellDim contains " << cellDim->getNRows() << " rows\n";
3096 for (unsigned int jj=0; jj<cellDim->getNRows(); jj++)
3097 std::cout << cellDim->getRMin(jj) << " "
3098 << cellDim->getRMax(jj) << " "
3099 << cellDim->getZMin(jj) << " "
3100 << cellDim->getZMax(jj) << "\n";
3101 std::cout<< " >> Cell Volume is " << cellDim->getVolume()*(1./Gaudi::Units::cm3) << " cm^3\n";
3102
3103 std::cout << " >> CellDimNeg contains " << cellDimNeg->getNRows() << " rows\n";
3104 for (unsigned int jj=0; jj<cellDimNeg->getNRows(); jj++)
3105 std::cout << cellDimNeg->getRMin(jj) << " "
3106 << cellDimNeg->getRMax(jj) << " "
3107 << cellDimNeg->getZMin(jj) << " "
3108 << cellDimNeg->getZMax(jj) << "\n";
3109 std::cout << " >> CellNeg Volume is " << cellDimNeg->getVolume()*(1./Gaudi::Units::cm3) << " cm^3\n";
3110 std::cout << "\n" << std::resetiosflags(std::ios::fixed);
3111 }
3112/* -------------------------------------------- */
3113 }
3114
3115 for (unsigned int sec=0; sec<2; sec++) { // GAP & CRACK
3116 rmins.clear();
3117 rmaxs.clear();
3118 zmins.clear();
3119 zmaxs.clear();
3120
3121 if (sec) {
3122 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG4);
3123 CurrentScin = 100*m_dbManager->TILBsection()+1;
3124 } else {
3125 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG3);
3126 CurrentScin = 100*m_dbManager->TILBsection()+1;
3127 }
3128
3129 double rMIN = m_dbManager->TILBrmin()*Gaudi::Units::cm;
3130 double rMAX = m_dbManager->TILBrmax()*Gaudi::Units::cm;
3131
3132 // Initialize rMin, rMax, zMin, zMax vectors
3133 for (unsigned int j = CurrentScin; j < (CurrentScin + m_dbManager->TILBnscin()); j++) {
3134 m_dbManager->SetCurrentScin(j);
3135
3136 double rCenter = rMIN + m_dbManager->SCNTrc()*Gaudi::Units::cm;
3137 double dR2 = (0.5 * m_dbManager->SCNTdr() + m_dbManager->SCNTdrw()) *Gaudi::Units::cm;
3138 if (addPlates) {
3139 if (j==CurrentScin) { // cells E2, E4 - use rMin of mother volume, calculate rMax
3140 rMin = rMIN;
3141 rMax = rCenter + dR2;
3142 } else { // cells E1, E3 - use rMax of mother volume, calculate rMin
3143 rMin = rCenter - dR2;
3144 rMax = rMAX;
3145 }
3146 } else {
3147 rMin = rCenter - dR2;
3148 rMax = rCenter + dR2;
3149 }
3150
3151 rmins.push_back(rMin);
3152 rmaxs.push_back(rMax);
3153
3154 zmins.push_back((m_dbManager->TILBzoffset() - m_dbManager->TILBdzmodul()/2)*Gaudi::Units::cm);
3155 zmaxs.push_back((m_dbManager->TILBzoffset() + m_dbManager->TILBdzmodul()/2)*Gaudi::Units::cm);
3156 }
3157
3158 // Iterate through scintillators and create corresponding TileCellDim objects (+/-)
3159 for (unsigned int jj = 0; jj < (unsigned int)m_dbManager->TILBnscin(); jj++) {
3160 if (sec==0 && jj==0)
3161 m_dbManager->SetFirstTiclInDet(detector+1);
3162 else
3163 m_dbManager->SetNextTiclInDet();
3164 if ((int)m_dbManager->TICLtower()>16) continue;
3165
3166 cellDim = new TileCellDim(1);
3167 cellDimNeg = new TileCellDim(1);
3168
3169 cellDim->addRMin(rmins[m_dbManager->TILBnscin() - jj - 1]);
3170 cellDim->addRMax(rmaxs[m_dbManager->TILBnscin() - jj - 1]);
3171 cellDim->addZMin(zmins[m_dbManager->TILBnscin() - jj - 1]+zShiftPos);
3172 cellDim->addZMax(zmaxs[m_dbManager->TILBnscin() - jj - 1]+zShiftPos);
3173
3174 cellDimNeg->addRMin(rmins[m_dbManager->TILBnscin() - jj - 1]);
3175 cellDimNeg->addRMax(rmaxs[m_dbManager->TILBnscin() - jj - 1]);
3176 cellDimNeg->addZMin(-zmaxs[m_dbManager->TILBnscin() - jj - 1]-zShiftNeg);
3177 cellDimNeg->addZMax(-zmins[m_dbManager->TILBnscin() - jj - 1]-zShiftNeg);
3178
3179 MLOG(DEBUG) << "Zmin: " << zmins[m_dbManager->TILBnscin() - jj - 1] << " Zmax: " << zmaxs[m_dbManager->TILBnscin() - jj - 1] << " zShiftPos: " << zShiftPos << " zShiftNeg: " << zShiftNeg << endmsg;
3180
3181 nTower = (int)m_dbManager->TICLtower()-1;
3182 nSample = (int)m_dbManager->TICLsample()-1;
3183
3184 cellDim->computeVolume();
3185 cellDimNeg->computeVolume();
3186 manager->add_cellDim(detector, 1, nTower, nSample, cellDim);
3187 manager->add_cellDim(detector, -1, nTower, nSample, cellDimNeg);
3188
3189/* -------- DEBUG printouts -------------- */
3190 if (m_verbose) {
3191 boost::io::ios_base_all_saver coutsave (std::cout);
3192 std::cout << std::setiosflags(std::ios::fixed)
3193 << std::setw(9) << std::setprecision(2);
3194 std::cout << "\n **** Cell dimension computed for : ";
3195 std::cout << "(" << detector << ", "
3196 << nSide << ", "
3197 << nTower << ", "
3198 << nSample << ")\n";
3199 std::cout << " >> CellDim contains " << cellDim->getNRows() << " rows\n";
3200 for (unsigned int jj=0; jj<cellDim->getNRows(); jj++)
3201 std::cout << cellDim->getRMin(jj) << " "
3202 << cellDim->getRMax(jj) << " "
3203 << cellDim->getZMin(jj) << " "
3204 << cellDim->getZMax(jj) << "\n";
3205 std::cout << " >> Cell Volume is " << cellDim->getVolume()*(1./Gaudi::Units::cm3) << " cm^3\n";
3206
3207 std::cout << " >> CellDimNeg contains " << cellDimNeg->getNRows() << " rows\n";
3208 for (unsigned int jj=0; jj<cellDimNeg->getNRows(); jj++)
3209 std::cout << cellDimNeg->getRMin(jj) << " "
3210 << cellDimNeg->getRMax(jj) << " "
3211 << cellDimNeg->getZMin(jj) << " "
3212 << cellDimNeg->getZMax(jj) << "\n";
3213 std::cout << " >> CellNeg Volume is " << cellDimNeg->getVolume()*(1./Gaudi::Units::cm3) << " cm^3\n";
3214 }
3215/* -------------------------------------------- */
3216 }
3217 }
3218 }
3219}
3220
3221
3223 int side,
3224 int sample,
3225 float zshift,
3226 float& zcenter,
3227 float& dz)
3228{
3229 switch(detector) {
3231 m_dbManager->SetCurrentSection(TileDddbManager::TILE_BARREL);
3232 break;
3234 m_dbManager->SetCurrentSection(TileDddbManager::TILE_EBARREL);
3235 break;
3236 case TILE_REGION_GAP:
3237 if (sample==3) { // D4
3238 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG1);
3239 } else if (sample==2) { // C10
3240 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG2);
3241 } else if (sample<13) { // E1-E2
3242 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG3);
3243 } else { // E3-E4
3244 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG4);
3245 }
3246 break;
3247 default:
3248 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::calculateZ: Unexpected detector: "
3249 << detector << endmsg;
3250 return;
3251 }
3252
3253 // first - find position in ideal world before Z-shift and misalignment
3254 if (detector == TILE_REGION_CENTRAL) {
3255 // need to split one cylinder in pos/neg halves
3256 float zmin=m_dbManager->TILBzoffset()/2 * Gaudi::Units::cm ;
3257 float zmax=zmin+m_dbManager->TILBdzmodul()/2 * Gaudi::Units::cm ;
3258 if (sample==3) { // fix for D0 cell
3259 float D0size = 560.58/307*40 * Gaudi::Units::cm; // size of D0 along Z in Gaudi::Units::cm
3260 // FIXME:: should be taken from DB
3261 if (side>0) // positive
3262 zmin = - D0size/2;
3263 else
3264 zmin = D0size/2;
3265 }
3266 zcenter = (zmin+zmax)/2;
3267 dz = (zmax-zmin);
3268
3269 } else if (detector == TILE_REGION_GAP && (sample > 9) ) {
3270 zcenter=m_dbManager->TILBzoffset() * Gaudi::Units::cm ;
3271 int section = m_dbManager->TILBsection();
3272 if (section < 0) {
3273 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::calculateZ: Error return from TileDddbManager::TILBsection() " << endmsg;
3274 return;
3275 }
3276 m_dbManager->SetCurrentScin(100*section + 1 );
3277 dz = m_dbManager->SCNTdt()*Gaudi::Units::cm;
3278
3279 } else {
3280 zcenter=m_dbManager->TILBzoffset() * Gaudi::Units::cm ;
3281 dz=m_dbManager->TILBdzmodul() * Gaudi::Units::cm ;
3282 }
3283
3284 // apply zshift from ideal pseudo-projective eta (which includes alignment also!)
3285 zcenter += zshift;
3286 // inversion for negative side
3287 if (side<1) zcenter *= -1;
3288
3289 return;
3290}
3291
3292
3294 int sample,
3295 bool addPlates,
3296 int firstScin,
3297 int lastScin,
3298 float& rcenter,
3299 float& dr)
3300{
3301 int cell = 0;
3302 switch(detector) {
3304 m_dbManager->SetCurrentSection(TileDddbManager::TILE_BARREL);
3305 break;
3307 m_dbManager->SetCurrentSection(TileDddbManager::TILE_EBARREL);
3308 break;
3309 case TILE_REGION_GAP:
3310 if (sample==3) { // D4
3311 cell = -2;
3312 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG1);
3313 } else if (sample==2) { // C10
3314 cell = -1;
3315 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG2);
3316 } else if (sample<13) { // E1-E2
3317 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG3);
3318 cell = firstScin - 2; // E2 has index 1, E1 has index 2
3319 } else { // E3-E4
3320 m_dbManager->SetCurrentSection(TileDddbManager::TILE_PLUG4);
3321 cell = firstScin; // E4 has index 1, E3 has index 2
3322 }
3323 break;
3324 default:
3325 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::calculateR: Unexpected detector: "
3326 << detector << endmsg;
3327 return;
3328 }
3329
3330 float oldrc = rcenter;
3331 float olddr = dr;
3332
3333 float rMin = m_dbManager->TILBrmin();
3334 float rMax = m_dbManager->TILBrmax();
3335
3336 if (cell>0) { // single gap/crack scintillator
3337 int section = m_dbManager->TILBsection();
3338 if (section < 0) {
3339 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::calculateR: Error return from TileDddbManager::TILBsection() " << endmsg;
3340 return;
3341 }
3342 m_dbManager->SetCurrentScin(100*section+cell);
3343 rcenter = (rMin + m_dbManager->SCNTrc());
3344 dr = m_dbManager->SCNTdr() + 2. * m_dbManager->SCNTdrw();
3345 if (addPlates) {
3346 if (cell==1) { // cells E4, E2 - use rMin of mother volume, recalculate rMax
3347 rMax = rcenter + dr * 0.5;
3348 } else { // cells E3, E1 - use rMax of mother volume, recalculate rMin
3349 rMin = rcenter - dr * 0.5;
3350 }
3351 rcenter = (rMax+rMin) * 0.5;
3352 dr = (rMax-rMin);
3353 }
3354
3355 } else {
3356 int first = 100*m_dbManager->TILBsection()+firstScin;
3357 int last = 100*m_dbManager->TILBsection()+lastScin;
3358 if (m_dbManager->TILBcurscint() != 0) { // for cells C10 and D4 first/last should be different
3359 first = m_dbManager->TILBcurscint();
3360 last = first + m_dbManager->TILBnscin()-1;
3361 }
3362 if (addPlates) {
3363 if (cell == -1) { // adjust size for cell C10
3364 rMin -= m_dbManager->TILBdrfront(); // add front plate at inner radius
3365 rMax -= m_dbManager->TILBdrfront(); // decrease outer radius by thickness of front plate of cell D4
3366 } else if (cell == -2) { // adjust size for cell D4, use rMax of mother volume
3367 rMin -= m_dbManager->TILBdrfront(); // add front plate at inner radius
3368 } else if (firstScin == 1) { // decrease rMin by thickness of front plate, calculate rMax for layer A
3369 m_dbManager->SetCurrentScin(last);
3370 rMax = rMin + m_dbManager->SCNTrc() + round(m_dbManager->SCNTdr())*0.5;
3371 rMin -= m_dbManager->TILBdrfront();
3372 } else if (lastScin == m_dbManager->TILBnscin()) { // use rMax of mother volume, calculate rMin for layer D
3373 m_dbManager->SetCurrentScin(first);
3374 rMin += m_dbManager->SCNTrc() - round(m_dbManager->SCNTdr())*0.5;
3375 } else { // calculate both rMin and rMax for layer BC and B
3376 m_dbManager->SetCurrentScin(last);
3377 rMax = rMin + m_dbManager->SCNTrc() + round(m_dbManager->SCNTdr())*0.5;
3378 m_dbManager->SetCurrentScin(first);
3379 rMin += m_dbManager->SCNTrc() - round(m_dbManager->SCNTdr())*0.5;
3380 }
3381
3382 } else { // keep only sensitive part of the cell without front/back planes
3383 m_dbManager->SetCurrentScin(last);
3384 rMax = rMin + m_dbManager->SCNTrc() + round(m_dbManager->SCNTdr())*0.5;
3385 m_dbManager->SetCurrentScin(first);
3386 rMin += m_dbManager->SCNTrc() - round(m_dbManager->SCNTdr())*0.5;
3387 }
3388
3389 rcenter = (rMax+rMin)*0.5;
3390 dr = (rMax-rMin);
3391 }
3392
3393 rcenter *= Gaudi::Units::cm;
3394 dr *= Gaudi::Units::cm;
3395
3396/* -------- DEBUG printouts -------------- */
3397 if (m_verbose) {
3398 boost::io::ios_base_all_saver coutsave (std::cout);
3399 std::cout << std::setiosflags(std::ios::fixed) << std::setw(9) << std::setprecision(2);
3400 std::cout << "Detector " << detector << " sample " << sample << " old r/dr " << oldrc << " " << olddr << std::endl;
3401 std::cout << "Detector " << detector << " sample " << sample << " new r/dr " << rcenter << " " << dr << " delta r/dr " << rcenter-oldrc << " " << dr-olddr << std::endl;
3402 }
3403
3404 return;
3405}
3406
3407
3409 int side,
3410 int sample,
3411 float& etamin,
3412 float& etamax,
3413 float& deta,
3414 unsigned int& neta)
3415{
3424
3425 int sign_eta = 1;
3426 if ((detector == TILE_REGION_CENTRAL) && (side<1)) sign_eta = -1;
3427
3428 switch(detector) {
3429 case TILE_REGION_CENTRAL: // Central Barrel
3430 case TILE_REGION_EXTENDED: // Extended Barrel
3431 {
3432 if (m_dbManager->SetFirstTiclInDetSamp(detector, sample)) {
3433 // --- A ---
3434 while (sign_eta * m_dbManager->TICLncell() < 0)
3435 if (!(m_dbManager->SetNextTiclInDetSamp())) {
3436 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::calculateEta: No TICL structures of positive side "
3437 << "in Central Barrel for sample: " << sample << endmsg;
3438 return;
3439 }
3440
3441 // --- B ---
3442 neta = 1;
3443 deta = m_dbManager->TICLdeta();
3444 etamin = m_dbManager->TICLeta()*sign_eta - m_dbManager->TICLdeta()/2;
3445 etamax = m_dbManager->TICLeta()*sign_eta + m_dbManager->TICLdeta()/2;
3446
3447 // --- C ---
3448 while (m_dbManager->SetNextTiclInDetSamp()) {
3449 if (!((detector == TILE_REGION_CENTRAL)&&(sign_eta * m_dbManager->TICLncell() <= 0))) {
3450 neta++;
3451 if (etamax < m_dbManager->TICLeta()*sign_eta + m_dbManager->TICLdeta()/2)
3452 etamax = m_dbManager->TICLeta()*sign_eta + m_dbManager->TICLdeta()/2;
3453 if (etamin > m_dbManager->TICLeta()*sign_eta - m_dbManager->TICLdeta()/2)
3454 etamin = m_dbManager->TICLeta()*sign_eta - m_dbManager->TICLdeta()/2;
3455 }
3456 }
3457
3458 } else {
3459 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::calculateEta: No TICL structures in detector: "
3460 << detector << " for sample: " << sample << endmsg;
3461 return;
3462 }
3463 break;
3464 }
3465 default:
3466 {
3467 (*m_log) << MSG::ERROR << "TileGeoSectionBuilder::calculateEta: Unexpected detector: "
3468 << detector << endmsg;
3469 return;
3470 }
3471 }
3472}
3473
3474
3479
3480
3482{
3483 m_barrelGlue = val;
3484}
3485
3486
3491
3492
3493void TileGeoSectionBuilder::checktransfunc(double absorber, double period, int np, double center)
3494{
3495 if (np<0){
3496 (*m_log) << MSG::WARNING << "TileGeoSectionBuilder::checktransfunc: np is negative!"<<endmsg;
3497 return;
3498 }
3499 (*m_log) << MSG::VERBOSE
3500 << std::setprecision (std::numeric_limits<double>::digits10 + 1)
3501 << " Absorber center = " << center
3502 << " length = " << absorber
3503 << " period = " << period
3504 << " nperiods = " << np
3505 << endmsg;
3506 double zC,dZ,z1,z2=-absorber/2.+center;
3507 for (int i=0; i<np; ++i) {
3508 zC = (period*(2*i+1)-absorber)/2. + center;
3509 z1 = zC - period/2.;
3510 dZ = z1 - z2;
3511 z2 = zC + period/2.;
3512 (*m_log) << MSG::VERBOSE << std::setw(4)
3513 << i << " z1= " << z1 << " z2= " << z2
3514 << " dist from previous= " << dZ << endmsg;
3515 }
3516}
3517
3518
3519void TileGeoSectionBuilder::printdouble(const char * name, double val)
3520{
3521 (*m_log) << MSG::VERBOSE << std::setprecision (std::numeric_limits<double>::digits10 + 1)
3522 << name << val << endmsg;
3523}
3524
3525
3526const GeoShape * TileGeoSectionBuilder::makeHolesScint(const GeoShape * mother, double R, double H2, double off, double off0) {
3527 GeoShape *hole = new GeoTubs(0., R, H2, 0., 360.0 * Gaudi::Units::deg);
3528 const GeoShapeUnion& scintUnion = hole->add( *hole << GeoTrf::Translate3D((off0-off*2.0),0.,0.));
3529 GeoTrf::Transform3D tfHole = GeoTrf::Translate3D(0.,0.,(off0-off)) * GeoTrf::RotateY3D(90*Gaudi::Units::deg);
3530 const GeoShape & motherWithHoles = (mother->subtract(scintUnion<<tfHole));
3531 return &motherWithHoles;
3532}
3533
3534
3535const GeoShape * TileGeoSectionBuilder::makeHoles(const GeoShape * mother, double R, double H2, double off, double off0) {
3536 GeoShape *hole1 = new GeoTubs(0., R, H2, 0., 360.0 * Gaudi::Units::deg);
3537 GeoShape *hole2 = new GeoTubs(0., R, H2, 0., 360.0 * Gaudi::Units::deg);
3538 GeoTrf::Transform3D tfHole1 = GeoTrf::Translate3D(0.,0.,(off0-off)) * GeoTrf::RotateY3D(-90*Gaudi::Units::deg);
3539 GeoTrf::Transform3D tfHole2 = GeoTrf::Translate3D(0.,0.,(off0+off)) * GeoTrf::RotateY3D(-90*Gaudi::Units::deg);
3540 const GeoShape & motherWithHoles = (mother->subtract((*hole1)<<tfHole1).subtract((*hole2)<<tfHole2));
3541 return &motherWithHoles;
3542}
#define M_PI
Scalar phi() const
phi method
#define endmsg
JetDumper::Name Name
Definition JetDumper.cxx:19
#define H2(x, y, z)
Definition MD5.cxx:115
void print(char *figname, TCanvas *c1)
void section(const std::string &sec)
#define MLOG(x)
#define MAX_N_SAMP_TILEDD
Definition of TileGeoSectionBuilder class.
#define TILE_REGION_GAP
#define TILE_REGION_CENTRAL
#define TILE_REGION_EXTENDED
This class holds one or more material managers and makes them storeable, under StoreGate.
double getZMax(unsigned int index) const
void addRMax(double rMax)
void addZMin(double zMin)
unsigned int getNRows() const
Definition TileCellDim.h:25
double getVolume() const
Definition TileCellDim.h:26
void addZMax(double zMax)
double getRMax(unsigned int index) const
double getZMin(unsigned int index) const
void addRMin(double rMin)
void computeVolume()
double getRMin(unsigned int index) const
This class provides access to constants in the Geometry DB.
void set(const Identifier &id)
void fillFinger(PVLink &mother, int sec_number, double tile_rmax, double tilb_rmax, double delta_phi_not_used, bool testbeam, int ModuleNcp=0, double corrected_dz=0.)
Finger parameters are the following:
bool m_verbose
Flag for activation verbose level for debugging.
double m_additionalIronLayer
Makes iron layer a little bit wider to obtain the same sampling fraction for simulation without a glu...
GeoIntrusivePtr< GeoMaterial > m_matLArServices
void fillPeriod(PVLink &mother, double thickness, double dzglue, double tan_delta_phi_2, int period_type, GeoTrd *period=nullptr)
Period parameters are the following:
void setBarrelPeriodThickness(double val)
const GeoShape * makeHolesScint(const GeoShape *mother, double R, double H2, double off, double off0=0.)
void calculateEta(int detector, int side, int sample, float &etamin, float &etamax, float &deta, unsigned int &neta)
calculateEta function calculates are the following parameters given sample in region (detector)
void printdouble(const char *name, double val)
StoredMaterialManager * m_theMaterialManager
void fillDescriptor(TileDetDescriptor *&descriptor, unsigned int detector, int side, bool testbeam, bool addPlates, unsigned int nphi, float zshift)
Readout Descriptor parameters are the following:
void checking(const std::string &VolumeName, bool print, int level, double X1, double X2, double Y1, double Y2, double Z)
Function for checking empty volumes:
const GeoShape * makeHoles(const GeoShape *mother, double R, double H2, double off, double off0=0.)
TileGeoSectionBuilder(StoredMaterialManager *matManager, TileDddbManager *pDbManager, const TileSwitches &switches, MsgStream *log)
Constructor.
void computeCellDim(TileDetDescrManager *&manager, int detector, bool addPlates, float zShiftPos, float zShiftNeg)
Cell dimension parameters are the following:
void calculateZ(int detector, int side, int sample, float zshift, float &zcenter, float &dz)
Calculator of Z position given sample in region (detector):
void calculateR(int detector, int sample, bool addPlates, int firstScin, int lastScin, float &rcenter, float &dr)
Calculator of R position given sample in region (detector):
void setExtendedPeriodThickness(double val)
void fillGirder(PVLink &mother, double tile_rmax, double tilb_rmax, double tan_delta_phi_2, double thickness)
Girder parameters are the following:
~TileGeoSectionBuilder()
Destructor.
GeoIntrusivePtr< GeoMaterial > m_matIronHalfDens
void fillSection(PVLink &mother, int sec_number, double tile_rmax, double rminb, double dzglue, double delta_phi, int ModuleNcp=0, double zlen_itc2=0., bool neg=false)
Section parameters are the following:
void checktransfunc(double absorber, double period, int np, double center)
Wrapper around a histogram which allows for some additional filling patterns and data manipulation.
Definition MsgLevel.h:28
Definition index.py:1
#define DEBUG
Definition page_access.h:11