66{
67 (*m_log) << MSG::INFO <<
" Entering TileTBFactory::create()" <<
endmsg;
68
69
70 StoredMaterialManager* theMaterialManager = nullptr;
71 if (StatusCode::SUCCESS !=
m_detectorStore->retrieve(theMaterialManager,
"MATERIALS")) {
72 (*m_log) << MSG::ERROR <<
"Could not find Material Manager MATERIALS" <<
endmsg;
73 return;
74 }
75 const GeoMaterial* matAir = theMaterialManager->
getMaterial(
"std::Air");
76
77
79 TileGeoSectionBuilder* sectionBuilder =
new TileGeoSectionBuilder(theMaterialManager,dbManager,
m_switches,
m_log);
80
81
82
83
84
85
86 double rMinITC = 0;
87 double dzITC2 = 0;
88
89 double thicknessWedgeMother, heightWedgeMother, dy1WedgeMother, dy2WedgeMother;
90 double dzGlue;
91
92
93
95
98 double RInMin = 999999.9;
99 double ROutMax = 0;
100 bool IfB = false;
101 bool IfEBNeg = false;
102 bool IfEBPos = false;
103 double tileTBEnvThickness = 0;
104 double ZLengthEBarrelNeg =0, ZLengthEBarrelPos =0;
105 int ModuleNcp =0;
106
107
109 double EBFingerLength = dbManager->
TIFGdz();
111 double BFingerLength = dbManager->
TIFGdz();
112
113
115 double FingerRmin = dbManager->
TILBrmax();
116
118 for (
int i = 0;
i < n_env ; ++
i) {
122 IfB = true;
123
124 }
126 IfEBNeg = true;
128 }
130 IfEBPos = true;
132 }
135 RInMin = std::min(RInMin, dbManager->
GetEnvRin());
136 ROutMax= std::max(ROutMax, dbManager->
GetEnvRout());
137 }
138
139 (*m_log) << MSG::DEBUG <<
"tileTBEnvThickness 1 " << tileTBEnvThickness <<
endmsg;
140
141
142 if (IfEBPos) {
145 }
146
147 (*m_log) << MSG::DEBUG <<
"tileTBEnvThickness 2 " << tileTBEnvThickness <<
endmsg;
148
149
150 if (IfEBNeg) {
153 }
154
155 (*m_log) << MSG::DEBUG <<
"tileTBEnvThickness 3 " << tileTBEnvThickness <<
endmsg;
156
157
158
159 if ((!IfEBNeg)&&(!IfEBPos)) {
161 tileTBEnvThickness += 2 * fabs(dbManager->
GetEnvDZ());
162 }
163
164 (*m_log) << MSG::DEBUG <<
"Presence of barrel " << ((IfB) ?
"true" :
"false") <<
endmsg;
165 (*m_log) << MSG::DEBUG <<
"Presence of positive ext.barrel " << ((IfEBPos) ?
"true" :
"false") <<
endmsg;
166 (*m_log) << MSG::DEBUG <<
"Presence of negative ext.barrel " << ((IfEBNeg) ?
"true" :
"false") <<
endmsg;
167
168 (*m_log) << MSG::DEBUG <<
"tileTBEnvThickness " << tileTBEnvThickness <<
endmsg;
169
170
171
172
173
174
175
176 GeoTubs* tileTBEnv = new GeoTubs(RInMin * Gaudi::Units::cm,
177 ROutMax * Gaudi::Units::cm,
178 tileTBEnvThickness/2.0 * Gaudi::Units::cm,
179 PhiMin*Gaudi::Units::deg,
180 (PhiMax - PhiMin)*Gaudi::Units::deg);
181
182 (*m_log) << MSG::DEBUG << "TileTB envelope parameters: "
183 << " length=" << tileTBEnvThickness << " cm"
184 << " Rmin=" << RInMin << " cm"
185 << " Rmax=" << ROutMax << " cm"
186 <<
" PhiMin=" <<
PhiMin <<
" deg"
187 <<
" PhiMax=" <<
PhiMax <<
" deg"
189
190 GeoLogVol* lvTileTBEnv = new GeoLogVol("TileTBEnv",tileTBEnv,matAir);
191 GeoFullPhysVol* pvTileTBEnv = new GeoFullPhysVol(lvTileTBEnv);
192
193 GeoFullPhysVol *pvBarrelMother =0;
194 GeoFullPhysVol *pvEBarrelMotherNeg =0, *pvEBarrelMotherPos =0;
195 GeoFullPhysVol *pvFingerMotherNeg =0, *pvFingerMotherPos =0;
196 GeoFullPhysVol *pvEFingerMotherNeg =0, *pvEFingerMotherPos =0;
197 GeoFullPhysVol *pvITCMotherPos =0, *pvITCMotherNeg =0;
198
200 for (int EnvCounter = 0; EnvCounter < NumberOfEnv; ++EnvCounter) {
204
205
206
207
208
209
210
211
212
213
214 if (EnvType == 1) {
215
216 GeoTubs* GeneralMother =
new GeoTubs((dbManager->
GetEnvRin()) * Gaudi::Units::cm,
218 (dbManager->
GetEnvZLength() - 2 * BFingerLength)/2.0 * Gaudi::Units::cm,
219 0.0 * Gaudi::Units::deg,
220 NumberOfMod*
deltaPhi*Gaudi::Units::deg);
221
222 GeoTubs* barrelMother = GeneralMother;
223 GeoLogVol* lvBarrelMother = new GeoLogVol("Barrel",barrelMother,matAir);
224 pvBarrelMother = new GeoFullPhysVol(lvBarrelMother);
225
226 (*m_log) << MSG::DEBUG << "Barrel envelope parameters: "
227 <<
" length=" << (dbManager->
GetEnvZLength() - 2 * BFingerLength) <<
" cm"
228 <<
" Rmin=" << (dbManager->
GetEnvRin()) <<
" cm"
229 <<
" Rmax=" << (dbManager->
GetEnvRout()) <<
" cm"
230 << " nMod=" << NumberOfMod
232
233
235
236 GeoTubs* fingerMother = new GeoTubs(FingerRmin*Gaudi::Units::cm,
238 BFingerLength/2.*Gaudi::Units::cm,
239 0.0 * Gaudi::Units::deg,
240 NumberOfMod*
deltaPhi*Gaudi::Units::deg);
241
242 GeoLogVol* lvFingerMother = new GeoLogVol("Finger",fingerMother,matAir);
243 pvFingerMotherPos = new GeoFullPhysVol(lvFingerMother);
244 pvFingerMotherNeg = new GeoFullPhysVol(lvFingerMother);
245
246 (*m_log) << MSG::DEBUG << "Barrel finger envelope parameters: "
247 << " length=" << BFingerLength << " cm"
248 << " Rmin=" << FingerRmin << " cm"
249 <<
" Rmax=" << (dbManager->
GetEnvRout()) <<
" cm"
250 << " nMod=" << NumberOfMod
252 }
253
254 if (EnvType == 3) {
255 GeoTubs* GeneralMother =
new GeoTubs((dbManager->
GetEnvRin()) * Gaudi::Units::cm,
257 (dbManager->
GetEnvZLength() - EBFingerLength)/2.0 * Gaudi::Units::cm,
258 0.0 * Gaudi::Units::deg,
259 NumberOfMod*
deltaPhi*Gaudi::Units::deg);
260
261 GeoTubs* ebarrelMotherPos = GeneralMother;
262 GeoLogVol* lvEBarrelMotherPos = new GeoLogVol("EBarrel",ebarrelMotherPos,matAir);
263 pvEBarrelMotherPos = new GeoFullPhysVol(lvEBarrelMotherPos);
264
265 (*m_log) << MSG::DEBUG << "Positive ext.barrel envelope parameters: "
266 <<
" length=" << (dbManager->
GetEnvZLength() - EBFingerLength) <<
" cm"
267 <<
" Rmin=" << (dbManager->
GetEnvRin()) <<
" cm"
268 <<
" Rmax=" << (dbManager->
GetEnvRout()) <<
" cm"
269 << " nMod=" << NumberOfMod
271
272
273 GeoTubs* fingerMother = new GeoTubs(FingerRmin*Gaudi::Units::cm,
275 EBFingerLength/2.*Gaudi::Units::cm,
276 0.0 * Gaudi::Units::deg,
277 NumberOfMod*
deltaPhi*Gaudi::Units::deg);
278
279 GeoLogVol* lvEFingerMother = new GeoLogVol("EFinger",fingerMother,matAir);
280 pvEFingerMotherPos = new GeoFullPhysVol(lvEFingerMother);
281
282 (*m_log) << MSG::DEBUG << "Positive ext.barrel finger envelope parameters: "
283 << " length=" << EBFingerLength << " cm"
284 << " Rmin=" << FingerRmin << " cm"
285 <<
" Rmax=" << (dbManager->
GetEnvRout()) <<
" cm"
286 << " nMod=" << NumberOfMod
288 }
289
290 if (EnvType == 2) {
291 GeoTubs* GeneralMother =
new GeoTubs((dbManager->
GetEnvRin()) * Gaudi::Units::cm,
293 (dbManager->
GetEnvZLength() - EBFingerLength)/2.0 * Gaudi::Units::cm,
294 0.0 * Gaudi::Units::deg,
295 NumberOfMod*
deltaPhi*Gaudi::Units::deg);
296 GeoTubs* ebarrelMotherNeg = GeneralMother;
297 GeoLogVol* lvEBarrelMotherNeg = new GeoLogVol("EBarrel",ebarrelMotherNeg,matAir);
298 pvEBarrelMotherNeg = new GeoFullPhysVol(lvEBarrelMotherNeg);
299
300 (*m_log) << MSG::DEBUG << "Negative ext.barrel envelope parameters: "
301 <<
" length=" << (dbManager->
GetEnvZLength() - EBFingerLength) <<
" cm"
302 <<
" Rmin=" << (dbManager->
GetEnvRin()) <<
" cm"
303 <<
" Rmax=" << (dbManager->
GetEnvRout()) <<
" cm"
304 << " nMod=" << NumberOfMod
306
307
308 GeoTubs* fingerMother = new GeoTubs(FingerRmin*Gaudi::Units::cm,
310 EBFingerLength/2.*Gaudi::Units::cm,
311 0.0 * Gaudi::Units::deg,
312 NumberOfMod*
deltaPhi*Gaudi::Units::deg);
313
314 GeoLogVol* lvEFingerMother = new GeoLogVol("EFinger",fingerMother,matAir);
315 pvEFingerMotherNeg = new GeoFullPhysVol(lvEFingerMother);
316
317 (*m_log) << MSG::DEBUG << "Negative ext.barrel finger envelope parameters: "
318 << " length=" << EBFingerLength << " cm"
319 << " Rmin=" << FingerRmin << " cm"
320 <<
" Rmax=" << (dbManager->
GetEnvRout()) <<
" cm"
321 << " nMod=" << NumberOfMod
323 }
324
325 if (EnvType == 5) {
326 GeoTubs* GeneralMother =
new GeoTubs((dbManager->
GetEnvRin()) * Gaudi::Units::cm,
329 0.0 * Gaudi::Units::deg,
330 NumberOfMod*
deltaPhi*Gaudi::Units::deg);
331
332 GeoTubs* itcMother = GeneralMother;
333 GeoLogVol* lvITCMother = new GeoLogVol("ITC",itcMother,matAir);
334 pvITCMotherPos = new GeoFullPhysVol(lvITCMother);
335
336 (*m_log) << MSG::DEBUG << "Positive ITC envelope parameters: "
338 <<
" Rmin=" << (dbManager->
GetEnvRin()) <<
" cm"
339 <<
" Rmax=" << (dbManager->
GetEnvRout()) <<
" cm"
340 << " nMod=" << NumberOfMod
342 }
343
344 if (EnvType == 4) {
345 GeoTubs* GeneralMother =
new GeoTubs((dbManager->
GetEnvRin()) * Gaudi::Units::cm,
348 0.0 * Gaudi::Units::deg,
349 NumberOfMod*
deltaPhi*Gaudi::Units::deg);
350
351 GeoTubs* itcMotherNeg = GeneralMother;
352 GeoLogVol* lvITCMotherNeg = new GeoLogVol("ITC",itcMotherNeg,matAir);
353 pvITCMotherNeg = new GeoFullPhysVol(lvITCMotherNeg);
354
355 (*m_log) << MSG::DEBUG << "Negative ITC envelope parameters: "
357 <<
" Rmin=" << (dbManager->
GetEnvRin()) <<
" cm"
358 <<
" Rmax=" << (dbManager->
GetEnvRout()) <<
" cm"
359 << " nMod=" << NumberOfMod
361 }
362
363
364
365
366
367
368
369
370 for (int ModCounter = 0; ModCounter < NumberOfMod; ModCounter+=NumberOfMod) {
374 (*m_log) << MSG::DEBUG
375 << "ModCounter is " << ModCounter
376 << " ModType is " << ModType
377 << " ModPositionNumber is " << ModPositionNumber
379
380 Variable varInd;
381 GENFUNCTION phiInd =
deltaPhi*(varInd + ModCounter + 0.5) * Gaudi::Units::deg;
382
383
384
385
386 if ( EnvType == 1 || EnvType == 0 ) {
388 thicknessWedgeMother = dbManager->
TILBdzmodul() * Gaudi::Units::cm;
392
394
395 GeoTrd* barrelModuleMother = new GeoTrd(thicknessWedgeMother/2.,
396 thicknessWedgeMother/2.,
397 dy1WedgeMother,
398 dy2WedgeMother,
399 heightWedgeMother/2.);
400
401 GeoLogVol* lvBarrelModuleMother = new GeoLogVol("BarrelModule",barrelModuleMother,matAir);
402 PVLink pvBarrelModuleMother = new GeoPhysVol(lvBarrelModuleMother);
403
404
406 1,
409 dzGlue,
411
412 TRANSFUNCTION xfBarrelModuleMother = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateX3D((dbManager->
TILBrmaximal()+dbManager->
TILBrminimal())/2.*Gaudi::Units::cm)*GeoTrf::RotateX3D(180*Gaudi::Units::deg)*GeoTrf::RotateY3D(90*Gaudi::Units::deg);
413
414 GeoSerialTransformer* stBarrelModuleMother = new GeoSerialTransformer(pvBarrelModuleMother,
415 &xfBarrelModuleMother,
416 NumberOfMod);
417 if (pvBarrelMother){
418 pvBarrelMother->add(new GeoSerialIdentifier(ModPositionNumber));
419 pvBarrelMother->add(stBarrelModuleMother);
420 } else {
421 (*m_log) << MSG::ERROR <<
"pvBarrelMother is null in " << __func__ <<
endmsg;
422 }
423
424
425
426
428
429
430
431
432 thicknessWedgeMother = dbManager->
TIFGdz() * Gaudi::Units::cm;
433 heightWedgeMother = (dbManager->
TILErmax() - dbManager->
TILBrmax()) * Gaudi::Units::cm;
434 dy1WedgeMother = dbManager->
TILBrmax() *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
435 dy2WedgeMother = dbManager->
TILErmax() *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
436
437 GeoTrd* fingerModuleMother = new GeoTrd(thicknessWedgeMother/2.,
438 thicknessWedgeMother/2.,
439 dy1WedgeMother,
440 dy2WedgeMother,
441 heightWedgeMother/2.);
442
443 GeoLogVol* lvFingerModuleMother = new GeoLogVol("FingerModule",fingerModuleMother,matAir);
444 PVLink pvFingerModuleMother = new GeoPhysVol(lvFingerModuleMother);
445
446
447 sectionBuilder->
fillFinger(pvFingerModuleMother, 1,
452 ModuleNcp,
453 thicknessWedgeMother*(1./Gaudi::Units::cm));
454
455
456 TRANSFUNCTION xfFingerModuleMotherPos = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateX3D((dbManager->
TILErmax()+dbManager->
TILBrmax())/2.*Gaudi::Units::cm)*GeoTrf::RotateX3D(180*Gaudi::Units::deg)*GeoTrf::RotateY3D(90*Gaudi::Units::deg);
457
458 GeoSerialTransformer* stFingerModuleMotherPos = new GeoSerialTransformer(pvFingerModuleMother,
459 &xfFingerModuleMotherPos,
460 NumberOfMod);
461 pvFingerMotherPos->add(new GeoSerialIdentifier(ModPositionNumber));
462 pvFingerMotherPos->add(stFingerModuleMotherPos);
463
464 TRANSFUNCTION xfFingerModuleMotherNeg = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateX3D((dbManager->
TILErmax()+dbManager->
TILBrmax())/2.*Gaudi::Units::cm)*GeoTrf::RotateY3D(90*Gaudi::Units::deg);
465
466 GeoSerialTransformer* stFingerModuleMotherNeg = new GeoSerialTransformer(pvFingerModuleMother,
467 &xfFingerModuleMotherNeg,
468 NumberOfMod);
469 pvFingerMotherNeg->add(new GeoSerialIdentifier(ModPositionNumber));
470 pvFingerMotherNeg->add(stFingerModuleMotherNeg);
471 }
472
473
474
475
476 if ((ModType == 2)&&(EnvType == 3)) {
478
479 thicknessWedgeMother = dbManager->
TILBdzmodul() * Gaudi::Units::cm;
483
485
486 GeoTrd* ebarrelModuleMotherPos = new GeoTrd(thicknessWedgeMother/2.,
487 thicknessWedgeMother/2.,
488 dy1WedgeMother,
489 dy2WedgeMother,
490 heightWedgeMother/2.);
491
492 GeoLogVol* lvEBarrelModuleMotherPos = new GeoLogVol("EBarrelModule",ebarrelModuleMotherPos,matAir);
493 PVLink pvEBarrelModuleMotherPos = new GeoPhysVol(lvEBarrelModuleMotherPos);
494
495
496 sectionBuilder->
fillSection(pvEBarrelModuleMotherPos,
497 2,
500 dzGlue,
502
503 TRANSFUNCTION xfEBarrelModuleMotherPos = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateX3D((dbManager->
TILBrmaximal()+dbManager->
TILBrminimal())/2.*Gaudi::Units::cm)*GeoTrf::RotateX3D(180*Gaudi::Units::deg)*GeoTrf::RotateY3D(90*Gaudi::Units::deg);
504
505 GeoSerialTransformer* stEBarrelModuleMotherPos = new GeoSerialTransformer(pvEBarrelModuleMotherPos,
506 &xfEBarrelModuleMotherPos,
507 NumberOfMod);
508 pvEBarrelMotherPos->add(new GeoSerialIdentifier(ModPositionNumber));
509 pvEBarrelMotherPos->add(stEBarrelModuleMotherPos);
510
511
512
513
515
516
517 thicknessWedgeMother = dbManager->
TIFGdz() * Gaudi::Units::cm;
518 heightWedgeMother = (dbManager->
TILErmax() - dbManager->
TILBrmax()) * Gaudi::Units::cm;
519 dy1WedgeMother = dbManager->
TILBrmax() *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
520 dy2WedgeMother = dbManager->
TILErmax() *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
521
522 GeoTrd* efingerModuleMother = new GeoTrd(thicknessWedgeMother/2.,
523 thicknessWedgeMother/2.,
524 dy1WedgeMother,
525 dy2WedgeMother,
526 heightWedgeMother/2.);
527
528 GeoLogVol* lvEFingerModuleMother = new GeoLogVol("EFingerModule",efingerModuleMother,matAir);
529 PVLink pvEFingerModuleMother = new GeoPhysVol(lvEFingerModuleMother);
530
531
532 sectionBuilder->
fillFinger(pvEFingerModuleMother,
533 2,
538
539
540
541 TRANSFUNCTION xfEFingerModuleMotherPos = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateX3D((dbManager->
TILErmax()+dbManager->
TILBrmax())/2.*Gaudi::Units::cm)*GeoTrf::RotateX3D(180*Gaudi::Units::deg)*GeoTrf::RotateY3D(90*Gaudi::Units::deg);
542
543 GeoSerialTransformer* stEFingerModuleMotherPos = new GeoSerialTransformer(pvEFingerModuleMother,
544 &xfEFingerModuleMotherPos,
545 NumberOfMod);
546 pvEFingerMotherPos->add(new GeoSerialIdentifier(ModPositionNumber));
547 pvEFingerMotherPos->add(stEFingerModuleMotherPos);
548 }
549
550
551
552
553 if ((ModType == 2)&&(EnvType == 2)) {
555
556 thicknessWedgeMother = dbManager->
TILBdzmodul() * Gaudi::Units::cm;
560
562
563 GeoTrd* ebarrelModuleMotherNeg = new GeoTrd(thicknessWedgeMother/2.,
564 thicknessWedgeMother/2.,
565 dy1WedgeMother,
566 dy2WedgeMother,
567 heightWedgeMother/2.);
568
569 GeoLogVol* lvEBarrelModuleMotherNeg = new GeoLogVol("EBarrelModule",ebarrelModuleMotherNeg,matAir);
570 PVLink pvEBarrelModuleMotherNeg = new GeoPhysVol(lvEBarrelModuleMotherNeg);
571
572
573 sectionBuilder->
fillSection(pvEBarrelModuleMotherNeg,
574 2,
577 dzGlue,
579
580 TRANSFUNCTION xfEBarrelModuleMotherNeg = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateX3D((dbManager->
TILBrmaximal()+dbManager->
TILBrminimal())/2.*Gaudi::Units::cm)*GeoTrf::RotateY3D(90*Gaudi::Units::deg);
581
582 GeoSerialTransformer* stEBarrelModuleMotherNeg = new GeoSerialTransformer(pvEBarrelModuleMotherNeg,
583 &xfEBarrelModuleMotherNeg,
584 NumberOfMod);
585 pvEBarrelMotherNeg->add(new GeoSerialIdentifier(ModPositionNumber));
586 pvEBarrelMotherNeg->add(stEBarrelModuleMotherNeg);
587
588
589
590
592
593
594
595 thicknessWedgeMother = dbManager->
TIFGdz() * Gaudi::Units::cm;
596 heightWedgeMother = (dbManager->
TILErmax() - dbManager->
TILBrmax()) * Gaudi::Units::cm;
597 dy1WedgeMother = dbManager->
TILBrmax() *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
598 dy2WedgeMother = dbManager->
TILErmax() *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
599
600 GeoTrd* efingerModuleMother = new GeoTrd(thicknessWedgeMother/2.,
601 thicknessWedgeMother/2.,
602 dy1WedgeMother,
603 dy2WedgeMother,
604 heightWedgeMother/2.);
605
606 GeoLogVol* lvEFingerModuleMother = new GeoLogVol("EFingerModule",efingerModuleMother,matAir);
607 PVLink pvEFingerModuleMother = new GeoPhysVol(lvEFingerModuleMother);
608
609
610 sectionBuilder->
fillFinger(pvEFingerModuleMother,
611 2,
616
617 TRANSFUNCTION xfEFingerModuleMotherNeg = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateX3D((dbManager->
TILErmax()+dbManager->
TILBrmax())/2.*Gaudi::Units::cm)*GeoTrf::RotateY3D(90*Gaudi::Units::deg);
618
619 GeoSerialTransformer* stEFingerModuleMotherNeg = new GeoSerialTransformer(pvEFingerModuleMother,
620 &xfEFingerModuleMotherNeg,
621 NumberOfMod);
622 pvEFingerMotherNeg->add(new GeoSerialIdentifier(ModPositionNumber));
623 pvEFingerMotherNeg->add(stEFingerModuleMotherNeg);
624 }
625
626
627
628
629 if (((ModType == 6050403)||(ModType == 403))&&(EnvType == 5)) {
630
635
636
637 thicknessWedgeMother = dbManager->
TILBdzmodul() * Gaudi::Units::cm;
638 heightWedgeMother = (dbManager->
TILBrmaximal() - rMinITC) * Gaudi::Units::cm;
639 dy1WedgeMother = rMinITC *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
641
642 GeoTrd* itcModuleMotherPos = new GeoTrd(thicknessWedgeMother/2.,
643 thicknessWedgeMother/2.,
644 dy1WedgeMother,
645 dy2WedgeMother,
646 heightWedgeMother/2.);
647
648 GeoLogVol* lvITCModuleMotherPos = new GeoLogVol("ITCModule",itcModuleMotherPos,matAir);
649 PVLink pvITCModuleMotherPos = new GeoPhysVol(lvITCModuleMotherPos);
650
651
652
653
654
655
656
657 thicknessWedgeMother = dbManager->
TILBdzmodul() * Gaudi::Units::cm;
659 dy1WedgeMother = dbManager->
TILBrmin() *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
661
663
664 GeoTrd* plug1SubMother = new GeoTrd(thicknessWedgeMother/2.,
665 thicknessWedgeMother/2.,
666 dy1WedgeMother,
667 dy2WedgeMother,
668 heightWedgeMother/2.);
669
670
671 thicknessWedgeMother = (dbManager->
TILBdzmodul() - dzITC2) * Gaudi::Units::cm;
674 dy2WedgeMother = dbManager->
TILBrmin() *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
675 GeoTrd* plug2SubMother = new GeoTrd(thicknessWedgeMother/2.,
676 thicknessWedgeMother/2.,
677 dy1WedgeMother,
678 dy2WedgeMother,
679 heightWedgeMother/2.);
680
681 GeoTrf::Translate3D plug1SubOffset(-dzITC2*Gaudi::Units::cm/2.,
682 0.,
684
685 const GeoShapeUnion& plug1ModuleMother = plug1SubMother->add(*plug2SubMother<<plug1SubOffset);
686 GeoLogVol* lvPlug1ModuleMother = new GeoLogVol("Plug1Module",&plug1ModuleMother,matAir);
687 PVLink pvPlug1ModuleMother = new GeoPhysVol(lvPlug1ModuleMother);
688
689
690 sectionBuilder->
fillSection(pvPlug1ModuleMother, 3,
693 dzGlue,
695 ModuleNcp,
696 dzITC2);
697
698 GeoTransform* tfPlug1ModuleMother = new GeoTransform(GeoTrf::Translate3D(0.,
699 0.,
700 (dbManager->
TILBrmin()-rMinITC)*Gaudi::Units::cm/2.));
701
702
703 pvITCModuleMotherPos->add(tfPlug1ModuleMother);
704 pvITCModuleMotherPos->add(pvPlug1ModuleMother);
705
706
708 thicknessWedgeMother = dbManager->
TILBdzmodul() * Gaudi::Units::cm;
713
714 GeoTrd* plug2ModuleMother = new GeoTrd(thicknessWedgeMother/2.,
715 thicknessWedgeMother/2.,
716 dy1WedgeMother,
717 dy2WedgeMother,
718 heightWedgeMother/2.);
719
720 GeoLogVol* lvPlug2ModuleMother = new GeoLogVol("Plug2Module",plug2ModuleMother,matAir);
721 PVLink pvPlug2ModuleMother = new GeoPhysVol(lvPlug2ModuleMother);
722
723
725 4,
728 dzGlue,
730
731
733 GeoTransform* tfPlug2ModuleMother =
new GeoTransform(GeoTrf::Translate3D((dbManager->
TILBdzmodul() - dzITC2)*Gaudi::Units::cm/2.,
734 0.,
736 pvITCModuleMotherPos->add(tfPlug2ModuleMother);
737 pvITCModuleMotherPos->add(pvPlug2ModuleMother);
738
739 TRANSFUNCTION xfITCModuleMotherPos = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateX3D((dbManager->
TILBrmaximal()+rMinITC)/2.*Gaudi::Units::cm)*GeoTrf::RotateX3D(180*Gaudi::Units::deg)*GeoTrf::RotateY3D(90*Gaudi::Units::deg);
740
741 GeoSerialTransformer* stITCModuleMotherPos = new GeoSerialTransformer(pvITCModuleMotherPos,
742 &xfITCModuleMotherPos,
743 NumberOfMod);
744 pvITCMotherPos->add(new GeoSerialIdentifier(ModPositionNumber));
745 pvITCMotherPos->add(stITCModuleMotherPos);
746 }
747
748
749
750
751 if (((ModType == 6050403)||(ModType == 403))&&(EnvType == 4)) {
752
757
758
759 thicknessWedgeMother = dbManager->
TILBdzmodul() * Gaudi::Units::cm;
760 heightWedgeMother = (dbManager->
TILBrmaximal() - rMinITC) * Gaudi::Units::cm;
761 dy1WedgeMother = rMinITC *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
763
764 GeoTrd* itcModuleMotherNeg = new GeoTrd(thicknessWedgeMother/2.,
765 thicknessWedgeMother/2.,
766 dy1WedgeMother,
767 dy2WedgeMother,
768 heightWedgeMother/2.);
769
770 GeoLogVol* lvITCModuleMotherNeg = new GeoLogVol("ITCModule",itcModuleMotherNeg,matAir);
771 PVLink pvITCModuleMotherNeg = new GeoPhysVol(lvITCModuleMotherNeg);
772
773
774
775
776
777
778
779 thicknessWedgeMother = dbManager->
TILBdzmodul() * Gaudi::Units::cm;
781 dy1WedgeMother = dbManager->
TILBrmin() *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
783
785
786 GeoTrd* plug1SubMother = new GeoTrd(thicknessWedgeMother/2.,
787 thicknessWedgeMother/2.,
788 dy1WedgeMother,
789 dy2WedgeMother,
790 heightWedgeMother/2.);
791
792
793 thicknessWedgeMother = (dbManager->
TILBdzmodul() - dzITC2) * Gaudi::Units::cm;
796 dy2WedgeMother = dbManager->
TILBrmin() *
tan(
deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
797 GeoTrd* plug2SubMother = new GeoTrd(thicknessWedgeMother/2.,
798 thicknessWedgeMother/2.,
799 dy1WedgeMother,
800 dy2WedgeMother,
801 heightWedgeMother/2.);
802
803 GeoTrf::Translate3D plug1SubOffset(-dzITC2*Gaudi::Units::cm/2.,
804 0.,
806
807 const GeoShapeUnion& plug1ModuleMother = plug1SubMother->add(*plug2SubMother<<plug1SubOffset);
808 GeoLogVol* lvPlug1ModuleMother = new GeoLogVol("Plug1Module",&plug1ModuleMother,matAir);
809 PVLink pvPlug1ModuleMother = new GeoPhysVol(lvPlug1ModuleMother);
810
811
813 3,
816 dzGlue,
818 ModuleNcp,
819 dzITC2);
820
821 GeoTransform* tfPlug1ModuleMother = new GeoTransform(GeoTrf::Translate3D(0.,
822 0.,
823 (dbManager->
TILBrmin()-rMinITC)*Gaudi::Units::cm/2.));
824
825
826 pvITCModuleMotherNeg->add(tfPlug1ModuleMother);
827 pvITCModuleMotherNeg->add(pvPlug1ModuleMother);
828
829
831 thicknessWedgeMother = dbManager->
TILBdzmodul() * Gaudi::Units::cm;
836
837 GeoTrd* plug2ModuleMother = new GeoTrd(thicknessWedgeMother/2.,
838 thicknessWedgeMother/2.,
839 dy1WedgeMother,
840 dy2WedgeMother,
841 heightWedgeMother/2.);
842
843 GeoLogVol* lvPlug2ModuleMother = new GeoLogVol("Plug2Module",plug2ModuleMother,matAir);
844 PVLink pvPlug2ModuleMother = new GeoPhysVol(lvPlug2ModuleMother);
845
846
848 4,
851 dzGlue,
853
854
856 GeoTransform* tfPlug2ModuleMother =
new GeoTransform(GeoTrf::Translate3D((dbManager->
TILBdzmodul() - dzITC2)*Gaudi::Units::cm/2.,
857 0.,
859 pvITCModuleMotherNeg->add(tfPlug2ModuleMother);
860 pvITCModuleMotherNeg->add(pvPlug2ModuleMother);
861
862 TRANSFUNCTION xfITCModuleMotherNeg = Pow(GeoTrf::RotateZ3D(1.0),phiInd)*GeoTrf::TranslateX3D((dbManager->
TILBrmaximal()+rMinITC)/2.*Gaudi::Units::cm)*GeoTrf::RotateY3D(90*Gaudi::Units::deg);
863
864 GeoSerialTransformer* stITCModuleMotherNeg = new GeoSerialTransformer(pvITCModuleMotherNeg,
865 &xfITCModuleMotherNeg,
866 NumberOfMod);
867 pvITCMotherNeg->add(new GeoSerialIdentifier(ModPositionNumber));
868 pvITCMotherNeg->add(stITCModuleMotherNeg);
869 }
870 }
871
872 double ztrans=0.0;
873
874 if (EnvType == 1 || EnvType == 0) {
875 GeoTransform* tfBarrelMother;
876
877 if ((IfEBPos&&IfEBNeg)||((!IfEBPos)&&(!IfEBNeg))) {
879 }
880 else if (IfEBPos&&(!IfEBNeg)) {
882 }
883 else if ((!IfEBPos)&&IfEBNeg) {
885 }
886 else {
887 ztrans = 0;
888 }
889 tfBarrelMother =
new GeoTransform(GeoTrf::TranslateZ3D(ztrans*Gaudi::Units::cm) * GeoTrf::RotateZ3D((dbManager->
GetEnvDPhi())*Gaudi::Units::deg));
890 (*m_log) << MSG::DEBUG <<
"Positioning barrel with translation " << ztrans <<
" cm" <<
endmsg;
891 GeoNameTag* ntBarrelModuleMother = new GeoNameTag("Barrel");
892
893 pvTileTBEnv->add(tfBarrelMother);
894 pvTileTBEnv->add(ntBarrelModuleMother);
895 pvTileTBEnv->add(pvBarrelMother);
896
897 GeoTransform* tfFingerMotherPos;
898
899 if ((IfEBPos&&IfEBNeg)||((!IfEBPos)&&(!IfEBNeg))) {
901 }
902 else if ((!IfEBPos)&&IfEBNeg) {
903 ztrans = dbManager->
GetEnvDZ() + (tileTBEnvThickness/2. - BFingerLength/2.);
904 }
905 else if (IfEBPos&&(!IfEBNeg)) {
906 ztrans = dbManager->
GetEnvDZ() + (-tileTBEnvThickness/2. + dbManager->
GetEnvZLength() - BFingerLength/2.);
907 }
908 else {
909 ztrans = 0;
910 }
911 tfFingerMotherPos =
new GeoTransform(GeoTrf::TranslateZ3D(ztrans*Gaudi::Units::cm) * GeoTrf::RotateZ3D((dbManager->
GetEnvDPhi())*Gaudi::Units::deg));
912 (*m_log) << MSG::DEBUG << "Positioning positive barrel finger with translation " << ztrans
914 GeoNameTag* ntFingerMotherPos = new GeoNameTag("TileFingerPos");
915 pvTileTBEnv->add(tfFingerMotherPos);
916 pvTileTBEnv->add(ntFingerMotherPos);
917 pvTileTBEnv->add(pvFingerMotherPos);
918
919 GeoTransform* tfFingerMotherNeg;
920
921 if ((IfEBPos&&IfEBNeg)||((!IfEBPos)&&(!IfEBNeg))) {
923 }
924 else if (IfEBPos&&(!IfEBNeg)) {
925 ztrans = dbManager->
GetEnvDZ() + (-tileTBEnvThickness/2. + BFingerLength/2.);
926 }
927 else if ((!IfEBPos)&&IfEBNeg) {
928 ztrans = dbManager->
GetEnvDZ() + ( tileTBEnvThickness/2. - dbManager->
GetEnvZLength() + BFingerLength/2.);
929 }
930 else {
931 ztrans = 0;
932 }
933 tfFingerMotherNeg =
new GeoTransform(GeoTrf::TranslateZ3D(ztrans*Gaudi::Units::cm) * GeoTrf::RotateZ3D((dbManager->
GetEnvDPhi())*Gaudi::Units::deg));
934 (*m_log) << MSG::DEBUG << "Positioning negative barrel finger with translation " << ztrans
936 GeoNameTag* ntFingerMotherNeg = new GeoNameTag("TileFingerNeg");
937 pvTileTBEnv->add(tfFingerMotherNeg);
938 pvTileTBEnv->add(ntFingerMotherNeg);
939 pvTileTBEnv->add(pvFingerMotherNeg);
940
941 }
942
943
944 if (EnvType == 3) {
945 ztrans = (tileTBEnvThickness/2. - dbManager->
GetEnvZLength()/2. - EBFingerLength/2.);
946 GeoTransform* tfEBarrelMotherPos =
new GeoTransform(GeoTrf::TranslateZ3D(ztrans*Gaudi::Units::cm) * GeoTrf::RotateZ3D(dbManager->
GetEnvDPhi() * Gaudi::Units::deg));
947 (*m_log) << MSG::DEBUG << "Positioning positive ext.barrel with translation " << ztrans
949
950 GeoNameTag* ntEBarrelMotherPos = new GeoNameTag("EBarrelPos");
951 pvTileTBEnv->add(tfEBarrelMotherPos);
952 pvTileTBEnv->add(ntEBarrelMotherPos);
953 pvTileTBEnv->add(pvEBarrelMotherPos);
954
955 ztrans = (tileTBEnvThickness/2. - EBFingerLength/2.);
956 GeoTransform* tfEFingerMotherPos =
new GeoTransform(GeoTrf::TranslateZ3D(ztrans*Gaudi::Units::cm) * GeoTrf::RotateZ3D(dbManager->
GetEnvDPhi() * Gaudi::Units::deg));
957 (*m_log) << MSG::DEBUG << "Positioning positive ext.barrel finger with translation " << ztrans
959
960 GeoNameTag* ntEFingerMotherPos = new GeoNameTag("TileEFingerPos");
961 pvTileTBEnv->add(tfEFingerMotherPos);
962 pvTileTBEnv->add(ntEFingerMotherPos);
963 pvTileTBEnv->add(pvEFingerMotherPos);
964
965 }
966
967 if (EnvType == 2) {
968 ztrans = (-tileTBEnvThickness/2. + dbManager->
GetEnvZLength()/2. + EBFingerLength/2.);
969 GeoTransform* tfEBarrelMotherNeg =
new GeoTransform(GeoTrf::TranslateZ3D(ztrans*Gaudi::Units::cm) * GeoTrf::RotateZ3D(dbManager->
GetEnvDPhi() * Gaudi::Units::deg));
970 (*m_log) << MSG::DEBUG << "Positioning negative ext.barrel with translation " << ztrans
972
973 GeoNameTag* ntEBarrelMotherNeg = new GeoNameTag("EBarrelNeg");
974 pvTileTBEnv->add(tfEBarrelMotherNeg);
975 pvTileTBEnv->add(ntEBarrelMotherNeg);
976 pvTileTBEnv->add(pvEBarrelMotherNeg);
977
978 ztrans = (-tileTBEnvThickness/2. + EBFingerLength/2.);
979 GeoTransform* tfEFingerMotherNeg =
new GeoTransform(GeoTrf::TranslateZ3D(ztrans*Gaudi::Units::cm) * GeoTrf::RotateZ3D(dbManager->
GetEnvDPhi() * Gaudi::Units::deg));
980 (*m_log) << MSG::DEBUG << "Positioning negative ext.barrel finger with translation " << ztrans
982
983 GeoNameTag* ntEFingerMotherNeg = new GeoNameTag("TileEFingerNeg");
984 pvTileTBEnv->add(tfEFingerMotherNeg);
985 pvTileTBEnv->add(ntEFingerMotherNeg);
986 pvTileTBEnv->add(pvEFingerMotherNeg);
987
988 }
989
990 if (EnvType == 5) {
991 ztrans = (tileTBEnvThickness/2. - ZLengthEBarrelPos - dbManager->
GetEnvZLength()/2.);
992 GeoTransform* tfITCMotherPos =
new GeoTransform(GeoTrf::TranslateZ3D(ztrans*Gaudi::Units::cm) * GeoTrf::RotateZ3D(dbManager->
GetEnvDPhi() * Gaudi::Units::deg));
993 (*m_log) << MSG::DEBUG << "Positioning positive ITC with translation " << ztrans
995
996 GeoNameTag* ntITCMotherPos = new GeoNameTag("ITCPos");
997 pvTileTBEnv->add(tfITCMotherPos);
998 pvTileTBEnv->add(ntITCMotherPos);
999 pvTileTBEnv->add(pvITCMotherPos);
1000 }
1001
1002 if (EnvType == 4) {
1003 ztrans = (-tileTBEnvThickness/2. + ZLengthEBarrelNeg + dbManager->
GetEnvZLength()/2.);
1004 GeoTransform* tfITCMotherNeg =
new GeoTransform(GeoTrf::TranslateZ3D(ztrans*Gaudi::Units::cm) * GeoTrf::RotateZ3D(dbManager->
GetEnvDPhi() * Gaudi::Units::deg));
1005 (*m_log) << MSG::DEBUG << "Positioning negative ITC with translation " << ztrans
1007
1008 GeoNameTag* ntITCMotherNeg = new GeoNameTag("ITCNeg");
1009 pvTileTBEnv->add(tfITCMotherNeg);
1010 pvTileTBEnv->add(ntITCMotherNeg);
1011 pvTileTBEnv->add(pvITCMotherNeg);
1012 }
1013 }
1014
1015
1016
1017 int nModulesInSection[6] = {0,0,0,0,0,0};
1018 float zShiftInSection[6] = {0.0,0.0,0.0,0.0,0.0,0.0,};
1019
1021 for (int EnvCounter = 0; EnvCounter < NumberOfEnv; ++EnvCounter) {
1025 float Zshift = dbManager->
GetEnvZShift() * Gaudi::Units::cm;
1026 (*m_log) << MSG::DEBUG
1027 << "EnvCounter is " << EnvCounter
1028 << " EnvType is " << EnvType
1029 << " Nmodules is " << NumberOfMod
1030 << " Zshift is " << Zshift*(1./Gaudi::Units::cm) << " cm"
1032
1033 if (EnvType == 1 || EnvType == 0) {
1034 nModulesInSection[0] = nModulesInSection[1] = NumberOfMod;
1035 zShiftInSection[0] = zShiftInSection[1] = Zshift;
1036 } else if ((EnvType >0) and (EnvType < 6)) {
1037 nModulesInSection[EnvType] = NumberOfMod;
1038 zShiftInSection[EnvType] = Zshift;
1039 }
1040 }
1041
1042 TileCablingService *
cabling = TileCablingService::getInstance_nc();
1044
1048 int side[6] = {0,1,0,1,0,1};
1049
1050 for (int ii=0; ii<6; ++ii) {
1051
1052 if (ii%2 == 0) {
1054 dete[ii],
1056 zShiftInSection[ii+1],
1057 zShiftInSection[ii]);
1058 }
1059
1060 TileDetDescriptor* descriptor = new TileDetDescriptor();
1062 dete[ii],
1063 side[ii],
1066 nModulesInSection[ii],
1067 zShiftInSection[ii]);
1068
1069 Identifier idRegion = tileID->
region_id(ii);
1070 descriptor->
set(idRegion);
1073
1074 cabling->setConnected(dete[ii],side[ii],0,nModulesInSection[ii]);
1075 }
1076
1077
1078
1079 GeoNameTag*
nTag =
new GeoNameTag(
"Tile");
1080 world->add(nTag);
1081 world->add(pvTileTBEnv);
1083
1084 delete sectionBuilder;
1085}
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define TILE_REGION_CENTRAL
#define TILE_REGION_EXTENDED
virtual const GeoMaterial * getMaterial(const std::string &name)=0
double TILBrminimal() const
double TILBdzend1() const
int GetNumberOfEnv() const
int SetCurrentModuleByIndex(unsigned int Id)
int SetCurrentTifg(int section)
double GetEnvDPhi() const
double GetEnvZShift() const
double TILBdzspac() const
int GetEnvNModules() const
double TILBdzend2() const
int SetCurrentEnvByIndex(unsigned int envelope)
int SetCurrentSectionByNumber(unsigned int section)
double GetEnvZLength() const
int SetCurrentSection(unsigned int section, bool print=true)
double TILBdzmast() const
double TILBdzmodul() const
int SetCurrentEnvByType(unsigned int envelope)
double GetEnvRout() const
double TILBrmaximal() const
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:
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 computeCellDim(TileDetDescrManager *&manager, int detector, bool addPlates, float zShiftPos, float zShiftNeg)
Cell dimension parameters are the following:
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:
Identifier region_id(int index) const
build single region, module, tower, cell, pmt, adc identifiers