ATLAS Offline Software
Loading...
Searching...
No Matches
TileTBFactory Class Reference

#include <TileTBFactory.h>

Inheritance diagram for TileTBFactory:
Collaboration diagram for TileTBFactory:

Public Member Functions

 TileTBFactory (StoreGateSvc *pDetStore, TileDetDescrManager *manager, const TileSwitches &switches, MsgStream *log)
 Constructor.
 ~TileTBFactory ()
 Destructor.
virtual void create (GeoPhysVol *world) override
 Creation of Test Beam Tile geometry.
virtual const TileDetDescrManagergetDetectorManager () const override
 Access function to TileDetDescr geometry data.

Private Attributes

StoreGateSvcm_detectorStore
 Detector pointer to Store Gate service.
TileDetDescrManagerm_detectorManager
 Detector pointer to TileDetDescrManager.
MsgStream * m_log
 Get message SVC.
TileSwitches m_switches
 all switches
bool m_verbose
 Flag for activation verbose level for debugging.

Detailed Description

Definition at line 26 of file TileTBFactory.h.

Constructor & Destructor Documentation

◆ TileTBFactory()

TileTBFactory::TileTBFactory ( StoreGateSvc * pDetStore,
TileDetDescrManager * manager,
const TileSwitches & switches,
MsgStream * log )

Constructor.

Definition at line 44 of file TileTBFactory.cxx.

48 : m_detectorStore(pDetStore)
49 , m_detectorManager(manager)
50 , m_log(log)
51 , m_switches(switches)
52 , m_verbose(log->level()<=MSG::VERBOSE)
53{
54 m_switches.testBeam = true;
55}
MsgStream * m_log
Get message SVC.
StoreGateSvc * m_detectorStore
Detector pointer to Store Gate service.
TileSwitches m_switches
all switches
bool m_verbose
Flag for activation verbose level for debugging.
TileDetDescrManager * m_detectorManager
Detector pointer to TileDetDescrManager.

◆ ~TileTBFactory()

TileTBFactory::~TileTBFactory ( )

Destructor.

Definition at line 59 of file TileTBFactory.cxx.

60{
61}

Member Function Documentation

◆ create()

void TileTBFactory::create ( GeoPhysVol * world)
overridevirtual

Creation of Test Beam Tile geometry.

Definition at line 65 of file TileTBFactory.cxx.

66{
67 (*m_log) << MSG::INFO <<" Entering TileTBFactory::create()" << endmsg;
68
69 // -------- -------- MATERIAL MANAGER -------- ----------
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 // -------- -------- SECTION BUILDER -------- ----------
78 TileDddbManager* dbManager = m_detectorManager->getDbManager();
79 TileGeoSectionBuilder* sectionBuilder = new TileGeoSectionBuilder(theMaterialManager,dbManager,m_switches,m_log);
80
81 //Tile envelope thickness, Extended & ITC offset
82 //and Central module center Z coordinate
83 //double tileTBEnvThickness = 0;
84 //double extOffset = 0;
85 //double itcOffset = 0;
86 double rMinITC = 0;
87 double dzITC2 = 0;
88
89 double thicknessWedgeMother, heightWedgeMother, dy1WedgeMother, dy2WedgeMother;
90 double dzGlue; //Thickness of glue layer in the absorber
91 //double zEndSection;
92
93 // double deltaPhi = 360./dbManager->TILEnmodul();
94 double deltaPhi = 360./ 64; // we know apriory that 64 modules makes full cylinder
95
96 double PhiMax = -360.0;
97 double PhiMin = +360.0;
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 //I take Finger Length here; it's due to Fingers need in their own Envelope
107 //and despite they are not in GlobalEnv table they shift other Envelopes (EBarrels, for example)
108 dbManager->SetCurrentTifg(2); //ebarrel finger
109 double EBFingerLength = dbManager->TIFGdz();
110 dbManager->SetCurrentTifg(2); //barrel finger - make it of the same size as ext.barrel finger!!!
111 double BFingerLength = dbManager->TIFGdz();
112
113 // finger starts at the same radius as girder - after sensitive part
115 double FingerRmin = dbManager->TILBrmax();
116
117 int n_env = dbManager->GetNumberOfEnv();
118 for (int i = 0; i < n_env ; ++i) {
119 dbManager->SetCurrentEnvByIndex(i);
120 tileTBEnvThickness += dbManager->GetEnvZLength();
121 if (dbManager->GetEnvType() == 1) {
122 IfB = true;
123 //ZLengthBarrel = dbManager->GetEnvZLength();
124 }
125 if (dbManager->GetEnvType() == 2) {
126 IfEBNeg = true;
127 ZLengthEBarrelNeg = dbManager->GetEnvZLength();
128 }
129 if (dbManager->GetEnvType() == 3) {
130 IfEBPos = true;
131 ZLengthEBarrelPos = dbManager->GetEnvZLength();
132 }
133 PhiMin = std::min(PhiMin, dbManager->GetEnvDPhi());
134 PhiMax = std::max(PhiMax, dbManager->GetEnvNModules()*deltaPhi + dbManager->GetEnvDPhi());
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 // enlarge mother volume by extra distance between barrel and positive ext.barrel
142 if (IfEBPos) {
143 dbManager->SetCurrentEnvByType(3);
144 tileTBEnvThickness += dbManager->GetEnvDZ()*dbManager->GetEnvSide();
145 }
146
147 (*m_log) << MSG::DEBUG << "tileTBEnvThickness 2 " << tileTBEnvThickness << endmsg;
148
149 // enlarge mother volume by extra distance between barrel and negative ext.barrel
150 if (IfEBNeg) {
151 dbManager->SetCurrentEnvByType(2);
152 tileTBEnvThickness += dbManager->GetEnvDZ()*dbManager->GetEnvSide();
153 }
154
155 (*m_log) << MSG::DEBUG << "tileTBEnvThickness 3 " << tileTBEnvThickness << endmsg;
156
157 // take into account extra DZ for barrel only if there are no Ext.Barrel modules
158 // but keep the mother volume symmetric (i.e. add DZ on both sides)
159 if ((!IfEBNeg)&&(!IfEBPos)) {
160 dbManager->SetCurrentEnvByType(1);
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// -------------------- TILE TB ENVELOPE ---------------------
172
173 //int EnvNumLayer = 64;
174 //dbManager->SetCurrentSection(TileDddbManager::TILE_BARREL);
175 //double deltaPhi = 360./dbManager->TILEnmodul();
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"
188 << endmsg;
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
199 int NumberOfEnv = dbManager->GetNumberOfEnv();
200 for (int EnvCounter = 0; EnvCounter < NumberOfEnv; ++EnvCounter) { //Loop over Envelopes
201 dbManager->SetCurrentEnvByIndex(EnvCounter);
202 int EnvType = dbManager->GetEnvType();
203 int NumberOfMod = dbManager->GetEnvNModules();
204
205 //----------------------- BUILDING ENVELOPES------------------------
206
207 // It may be usful on the way of universalization
208 // GeoTubs* GeneralMother = new GeoTubs((dbManager->GetEnvRin()) * Gaudi::Units::cm,
209 // (dbManager->GetEnvRout()) * Gaudi::Units::cm,
210 // (dbManager->GetEnvZLength())/2.0 * Gaudi::Units::cm,
211 // 0.0 * deltaPhi * Gaudi::Units::deg,
212 // (NumberOfMod)*deltaPhi*Gaudi::Units::deg);
213
214 if (EnvType == 1) {
215
216 GeoTubs* GeneralMother = new GeoTubs((dbManager->GetEnvRin()) * Gaudi::Units::cm,
217 (dbManager->GetEnvRout()) * 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
231 << endmsg;
232
233 //Envelopes for two barrel fingers
234 dbManager->SetCurrentTifg(2); //use small size for barrel finger !
235
236 GeoTubs* fingerMother = new GeoTubs(FingerRmin*Gaudi::Units::cm,
237 dbManager->GetEnvRout()*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
251 << endmsg;
252 }
253
254 if (EnvType == 3) {
255 GeoTubs* GeneralMother = new GeoTubs((dbManager->GetEnvRin()) * Gaudi::Units::cm,
256 (dbManager->GetEnvRout()) * 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
270 << endmsg;
271
272 //Envelope for finger separately
273 GeoTubs* fingerMother = new GeoTubs(FingerRmin*Gaudi::Units::cm,
274 dbManager->GetEnvRout()*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
287 << endmsg;
288 }
289
290 if (EnvType == 2) {
291 GeoTubs* GeneralMother = new GeoTubs((dbManager->GetEnvRin()) * Gaudi::Units::cm,
292 (dbManager->GetEnvRout()) * 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
305 << endmsg;
306
307 //Envelope for finger separately
308 GeoTubs* fingerMother = new GeoTubs(FingerRmin*Gaudi::Units::cm,
309 dbManager->GetEnvRout()*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
322 << endmsg;
323 }
324
325 if (EnvType == 5) {
326 GeoTubs* GeneralMother = new GeoTubs((dbManager->GetEnvRin()) * Gaudi::Units::cm,
327 (dbManager->GetEnvRout()) * Gaudi::Units::cm,
328 (dbManager->GetEnvZLength())/2.0 * 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: "
337 << " length=" << (dbManager->GetEnvZLength()) << " cm"
338 << " Rmin=" << (dbManager->GetEnvRin()) << " cm"
339 << " Rmax=" << (dbManager->GetEnvRout()) << " cm"
340 << " nMod=" << NumberOfMod
341 << endmsg;
342 }
343
344 if (EnvType == 4) {
345 GeoTubs* GeneralMother = new GeoTubs((dbManager->GetEnvRin()) * Gaudi::Units::cm,
346 (dbManager->GetEnvRout()) * Gaudi::Units::cm,
347 (dbManager->GetEnvZLength())/2.0 * 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: "
356 << " length=" << (dbManager->GetEnvZLength()) << " cm"
357 << " Rmin=" << (dbManager->GetEnvRin()) << " cm"
358 << " Rmax=" << (dbManager->GetEnvRout()) << " cm"
359 << " nMod=" << NumberOfMod
360 << endmsg;
361 }
362
363
364 //Envelope 2-level has been made (it is tube); begin loop over modules
365
366 // for (int ModCounter = 0; ModCounter < NumberOfMod; ModCounter++) {
367 // simple hack - we know that all modules are identical,
368 // let's put all of them with GeoSerialTransfomer,
369 // i.e. execute this loop only once
370 for (int ModCounter = 0; ModCounter < NumberOfMod; ModCounter+=NumberOfMod) {
371 dbManager->SetCurrentModuleByIndex(ModCounter);
372 int ModType = dbManager->GetModType();
373 int ModPositionNumber = dbManager->GetModNumber();
374 (*m_log) << MSG::DEBUG
375 << "ModCounter is " << ModCounter
376 << " ModType is " << ModType
377 << " ModPositionNumber is " << ModPositionNumber
378 << endmsg;
379
380 Variable varInd;
381 GENFUNCTION phiInd = deltaPhi*(varInd + ModCounter + 0.5) * Gaudi::Units::deg;
382
383
384 //------------------- BARREL BLOCKS -------------------------------------
385
386 if ( EnvType == 1 || EnvType == 0 ) { // normal barrel module or module zero
387 dbManager->SetCurrentSectionByNumber(ModType);
388 thicknessWedgeMother = dbManager->TILBdzmodul() * Gaudi::Units::cm;
389 heightWedgeMother = (dbManager->TILBrmaximal() - dbManager->TILBrminimal()) * Gaudi::Units::cm;
390 dy1WedgeMother = dbManager->TILBrminimal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
391 dy2WedgeMother = dbManager->TILBrmaximal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
392
393 dzGlue = (dbManager->TILBdzmodul() - dbManager->TILBdzend1() - dbManager->TILBdzend2() - (dbManager->TILBnperiod()*2.*(dbManager->TILBdzmast() + dbManager->TILBdzspac()) - dbManager->TILBdzmast()))/(2.*(2.*dbManager->TILBnperiod() - 1));
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 //Fill the section
405 sectionBuilder->fillSection(pvBarrelModuleMother,
406 1,
407 dbManager->TILBrmaximal(),
408 dbManager->TILBrminimal(),
409 dzGlue,
410 deltaPhi);
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); // all modules at once
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 //--------------------------BARREL FINGERS MAKING------------------------------
426
427 dbManager->SetCurrentTifg(2); //at the testbeam put "small" barrel finger - the same as ext.barrel one
428 //zEndSection = dbManager->TILBzoffset() + dbManager->TILBdzmodul()/2.;
429
430 // Trd - one finger mother
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 // Fill the section
447 sectionBuilder->fillFinger(pvFingerModuleMother, 1,
448 dbManager->TILErmax(),
449 dbManager->TILBrmax(),
450 deltaPhi,
451 m_switches.testBeam,
452 ModuleNcp,
453 thicknessWedgeMother*(1./Gaudi::Units::cm));
454
455 // --- Position N modules inside mother (positive/negative) -----
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); // all modules at once
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); // all modules at once
469 pvFingerMotherNeg->add(new GeoSerialIdentifier(ModPositionNumber));
470 pvFingerMotherNeg->add(stFingerModuleMotherNeg);
471 }
472
473
474 //------------------- EBARREL BLOCKS POS --------------------------------
475
476 if ((ModType == 2)&&(EnvType == 3)) {
477 dbManager->SetCurrentSectionByNumber(ModType);
478 // Trd - module mother
479 thicknessWedgeMother = dbManager->TILBdzmodul() * Gaudi::Units::cm;
480 heightWedgeMother = (dbManager->TILBrmaximal() - dbManager->TILBrminimal()) * Gaudi::Units::cm;
481 dy1WedgeMother = dbManager->TILBrminimal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
482 dy2WedgeMother = dbManager->TILBrmaximal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
483
484 dzGlue = (dbManager->TILBdzmodul() - dbManager->TILBdzend1() - dbManager->TILBdzend2() - dbManager->TILBnperiod()*2.*(dbManager->TILBdzmast() + dbManager->TILBdzspac()))/(4.*dbManager->TILBnperiod());
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 // Fill the section
496 sectionBuilder->fillSection(pvEBarrelModuleMotherPos,
497 2,
498 dbManager->TILBrmaximal(),
499 dbManager->TILBrminimal(),
500 dzGlue,
501 deltaPhi);
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); // all modules at once
508 pvEBarrelMotherPos->add(new GeoSerialIdentifier(ModPositionNumber));
509 pvEBarrelMotherPos->add(stEBarrelModuleMotherPos);
510
511
512 //--------------------------EBARREL FINGERS MAKING------------------------------
513
514 dbManager->SetCurrentTifg(2); //barrel efinger (small)
515
516 // Trd - one finger mother
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 // Fill the section
532 sectionBuilder->fillFinger(pvEFingerModuleMother,
533 2,
534 dbManager->TILErmax(),
535 dbManager->TILBrmax(),
536 deltaPhi,
537 m_switches.testBeam);
538
539 // --- Position N modules inside mother (positive/negative) -----
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); // all modules at once
546 pvEFingerMotherPos->add(new GeoSerialIdentifier(ModPositionNumber));
547 pvEFingerMotherPos->add(stEFingerModuleMotherPos);
548 }
549
550
551 //------------------- EBARREL BLOCKS NEG --------------------------------
552
553 if ((ModType == 2)&&(EnvType == 2)) {
554 dbManager->SetCurrentSectionByNumber(ModType);
555 // Trd - module mother
556 thicknessWedgeMother = dbManager->TILBdzmodul() * Gaudi::Units::cm;
557 heightWedgeMother = (dbManager->TILBrmaximal() - dbManager->TILBrminimal()) * Gaudi::Units::cm;
558 dy1WedgeMother = dbManager->TILBrminimal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
559 dy2WedgeMother = dbManager->TILBrmaximal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
560
561 dzGlue = (dbManager->TILBdzmodul() - dbManager->TILBdzend1() - dbManager->TILBdzend2() - dbManager->TILBnperiod()*2.*(dbManager->TILBdzmast() + dbManager->TILBdzspac()))/(4.*dbManager->TILBnperiod());
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 // Fill the section
573 sectionBuilder->fillSection(pvEBarrelModuleMotherNeg,
574 2,
575 dbManager->TILBrmaximal(),
576 dbManager->TILBrminimal(),
577 dzGlue,
578 deltaPhi);
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); // all modules at once
585 pvEBarrelMotherNeg->add(new GeoSerialIdentifier(ModPositionNumber));
586 pvEBarrelMotherNeg->add(stEBarrelModuleMotherNeg);
587
588
589 //--------------------------EBARREL FINGERS MAKING------------------------------
590
591 dbManager->SetCurrentTifg(2); //barrel efinger (small)
592
593 //zEndSection = extOffset + dbManager->TILBdzmodul()/2. + dbManager->TILEzshift();
594 // Trd - one finger mother
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 // Fill the section
610 sectionBuilder->fillFinger(pvEFingerModuleMother,
611 2,
612 dbManager->TILErmax(),
613 dbManager->TILBrmax(),
614 deltaPhi,
615 m_switches.testBeam);
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); // all modules at once
622 pvEFingerMotherNeg->add(new GeoSerialIdentifier(ModPositionNumber));
623 pvEFingerMotherNeg->add(stEFingerModuleMotherNeg);
624 }
625
626
627 //------------------- ITC BLOCKS POS --------------------------------
628
629 if (((ModType == 6050403)||(ModType == 403))&&(EnvType == 5)) {
630
632 rMinITC = dbManager->TILBrminimal();
633 dzITC2 = dbManager->TILBdzmodul();
635
636 // Common mother for ITC1/2 modules
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;
640 dy2WedgeMother = dbManager->TILBrmaximal() * 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 //Mother volume for ITC1
652 //In plug1 it's necessary to produce GeoShapeUnion for mother volume that is composed by two parts:
653 // 1. Mother for absorber and girder
654 // 2. Mother for frontplate (since it's short)
655
656 //First submother
657 thicknessWedgeMother = dbManager->TILBdzmodul() * Gaudi::Units::cm;
658 heightWedgeMother = (dbManager->TILBrmaximal() - dbManager->TILBrmin()) * Gaudi::Units::cm;
659 dy1WedgeMother = dbManager->TILBrmin() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
660 dy2WedgeMother = dbManager->TILBrmaximal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
661
662 dzGlue = (dbManager->TILBdzmodul() - dbManager->TILBdzend1() - dbManager->TILBdzend2() - dbManager->TILBnperiod()*2.*(dbManager->TILBdzmast() + dbManager->TILBdzspac()))/(4.*dbManager->TILBnperiod());
663
664 GeoTrd* plug1SubMother = new GeoTrd(thicknessWedgeMother/2.,
665 thicknessWedgeMother/2.,
666 dy1WedgeMother,
667 dy2WedgeMother,
668 heightWedgeMother/2.);
669
670 //Second submother
671 thicknessWedgeMother = (dbManager->TILBdzmodul() - dzITC2) * Gaudi::Units::cm;
672 heightWedgeMother = (dbManager->TILBrmin() - dbManager->TILBrminimal()) * Gaudi::Units::cm;
673 dy1WedgeMother = dbManager->TILBrminimal() * tan(deltaPhi/2.*Gaudi::Units::deg) * 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.,
683 (dbManager->TILBrminimal()-dbManager->TILBrmaximal())*Gaudi::Units::cm/2.);
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 // Fill the section
690 sectionBuilder->fillSection(pvPlug1ModuleMother, 3,
691 dbManager->TILBrmaximal(),
692 dbManager->TILBrminimal(),
693 dzGlue,
694 deltaPhi,
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 //Mother volume for ITC2
708 thicknessWedgeMother = dbManager->TILBdzmodul() * Gaudi::Units::cm;
709 heightWedgeMother = (dbManager->TILBrmaximal() - dbManager->TILBrminimal()) * Gaudi::Units::cm;
710 dy1WedgeMother = dbManager->TILBrminimal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
711 dy2WedgeMother = dbManager->TILBrmaximal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
712 dzGlue = (dbManager->TILBdzmodul() - dbManager->TILBdzend1() - dbManager->TILBdzend2() - ((dbManager->TILBnperiod()-1)*2.*(dbManager->TILBdzmast() + dbManager->TILBdzspac()) + dbManager->TILBdzspac()))/(4.*(dbManager->TILBnperiod() - 1));
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 // Fill the section
724 sectionBuilder->fillSection(pvPlug2ModuleMother,
725 4,
726 dbManager->TILBrmaximal(),
727 dbManager->TILBrminimal(),
728 dzGlue,
729 deltaPhi);
730
731
733 GeoTransform* tfPlug2ModuleMother = new GeoTransform(GeoTrf::Translate3D((dbManager->TILBdzmodul() - dzITC2)*Gaudi::Units::cm/2.,
734 0.,
735 (dbManager->TILBrmin() - dbManager->TILBrmaximal())*Gaudi::Units::cm/2.));
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); // all modules at once
744 pvITCMotherPos->add(new GeoSerialIdentifier(ModPositionNumber));
745 pvITCMotherPos->add(stITCModuleMotherPos);
746 }
747
748
749 //------------------- ITC BLOCKS NEG --------------------------------
750
751 if (((ModType == 6050403)||(ModType == 403))&&(EnvType == 4)) {
752
754 rMinITC = dbManager->TILBrminimal();
755 dzITC2 = dbManager->TILBdzmodul();
757
758 // Common mother for ITC1/2 modules
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;
762 dy2WedgeMother = dbManager->TILBrmaximal() * 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 //Mother volume for ITC1
774 //In plug1 it's necessary to produce GeoShapeUnion for mother volume that is composed by two parts:
775 // 1. Mother for absorber and girder
776 // 2. Mother for frontplate (since it's short)
777
778 //First submother
779 thicknessWedgeMother = dbManager->TILBdzmodul() * Gaudi::Units::cm;
780 heightWedgeMother = (dbManager->TILBrmaximal() - dbManager->TILBrmin()) * Gaudi::Units::cm;
781 dy1WedgeMother = dbManager->TILBrmin() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
782 dy2WedgeMother = dbManager->TILBrmaximal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
783
784 dzGlue = (dbManager->TILBdzmodul() - dbManager->TILBdzend1() - dbManager->TILBdzend2() - dbManager->TILBnperiod()*2.*(dbManager->TILBdzmast() + dbManager->TILBdzspac()))/(4.*dbManager->TILBnperiod());
785
786 GeoTrd* plug1SubMother = new GeoTrd(thicknessWedgeMother/2.,
787 thicknessWedgeMother/2.,
788 dy1WedgeMother,
789 dy2WedgeMother,
790 heightWedgeMother/2.);
791
792 //Second submother
793 thicknessWedgeMother = (dbManager->TILBdzmodul() - dzITC2) * Gaudi::Units::cm;
794 heightWedgeMother = (dbManager->TILBrmin() - dbManager->TILBrminimal()) * Gaudi::Units::cm;
795 dy1WedgeMother = dbManager->TILBrminimal() * tan(deltaPhi/2.*Gaudi::Units::deg) * 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.,
805 (dbManager->TILBrminimal()-dbManager->TILBrmaximal())*Gaudi::Units::cm/2.);
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 // Fill the section
812 sectionBuilder->fillSection(pvPlug1ModuleMother,
813 3,
814 dbManager->TILBrmaximal(),
815 dbManager->TILBrminimal(),
816 dzGlue,
817 deltaPhi,
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 //Mother volume for ITC2
831 thicknessWedgeMother = dbManager->TILBdzmodul() * Gaudi::Units::cm;
832 heightWedgeMother = (dbManager->TILBrmaximal() - dbManager->TILBrminimal()) * Gaudi::Units::cm;
833 dy1WedgeMother = dbManager->TILBrminimal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
834 dy2WedgeMother = dbManager->TILBrmaximal() * tan(deltaPhi/2.*Gaudi::Units::deg) * Gaudi::Units::cm;
835 dzGlue = (dbManager->TILBdzmodul() - dbManager->TILBdzend1() - dbManager->TILBdzend2() - ((dbManager->TILBnperiod()-1)*2.*(dbManager->TILBdzmast() + dbManager->TILBdzspac()) + dbManager->TILBdzspac()))/(4.*(dbManager->TILBnperiod() - 1));
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 // Fill the section
847 sectionBuilder->fillSection(pvPlug2ModuleMother,
848 4,
849 dbManager->TILBrmaximal(),
850 dbManager->TILBrminimal(),
851 dzGlue,
852 deltaPhi);
853
854
856 GeoTransform* tfPlug2ModuleMother = new GeoTransform(GeoTrf::Translate3D((dbManager->TILBdzmodul() - dzITC2)*Gaudi::Units::cm/2.,
857 0.,
858 (dbManager->TILBrmin() - dbManager->TILBrmaximal())*Gaudi::Units::cm/2.));
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); // all modules at once
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 // consider 3 options - with/without ext.barrels and take into account DZ correction
877 if ((IfEBPos&&IfEBNeg)||((!IfEBPos)&&(!IfEBNeg))) {
878 ztrans = dbManager->GetEnvDZ();
879 }
880 else if (IfEBPos&&(!IfEBNeg)) {
881 ztrans = dbManager->GetEnvDZ() + (-tileTBEnvThickness/2. + (dbManager->GetEnvZLength())/2.);
882 }
883 else if ((!IfEBPos)&&IfEBNeg) {
884 ztrans = dbManager->GetEnvDZ() + ( tileTBEnvThickness/2. - (dbManager->GetEnvZLength())/2.);
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))) {
900 ztrans = dbManager->GetEnvDZ() + (dbManager->GetEnvZLength()/2. - BFingerLength/2.);
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
913 << " cm and rotation " << dbManager->GetEnvDPhi() << " deg " << endmsg;
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))) {
922 ztrans = dbManager->GetEnvDZ() + (-dbManager->GetEnvZLength()/2. + BFingerLength/2.);
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
935 << " cm and rotation " << dbManager->GetEnvDPhi() << " deg " << endmsg;
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) { // positive ext.barrel is always at positive boundary, after finger
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
948 << " cm and rotation " << dbManager->GetEnvDPhi() << " deg " << endmsg;
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
958 << " cm and rotation " << dbManager->GetEnvDPhi() << " deg " << endmsg;
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) { // negative ext.barrel is always at negative boundary, after finger
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
971 << " cm and rotation " << dbManager->GetEnvDPhi() << " deg " << endmsg;
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
981 << " cm and rotation " << dbManager->GetEnvDPhi() << " deg " << endmsg;
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) { // positive ITC attached to positive ext.barrel
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
994 << " cm and rotation " << dbManager->GetEnvDPhi() << " deg " << endmsg;
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) { // negative ITC attached to negative ext.barrel
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
1006 << " cm and rotation " << dbManager->GetEnvDPhi() << " deg " << endmsg;
1007
1008 GeoNameTag* ntITCMotherNeg = new GeoNameTag("ITCNeg");
1009 pvTileTBEnv->add(tfITCMotherNeg);
1010 pvTileTBEnv->add(ntITCMotherNeg);
1011 pvTileTBEnv->add(pvITCMotherNeg);
1012 }
1013 }
1014
1015 // creating Descriptiors and CaloDetDescrElements
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
1020 NumberOfEnv = dbManager->GetNumberOfEnv();
1021 for (int EnvCounter = 0; EnvCounter < NumberOfEnv; ++EnvCounter) { //Loop over Envelopes
1022 dbManager->SetCurrentEnvByIndex(EnvCounter);
1023 int EnvType = dbManager->GetEnvType();
1024 int NumberOfMod = dbManager->GetEnvNModules();
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"
1031 << endmsg;
1032
1033 if (EnvType == 1 || EnvType == 0) { // central barrel
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();
1043 const TileID* tileID = m_detectorManager->get_id();
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) {
1053 sectionBuilder->computeCellDim(m_detectorManager,
1054 dete[ii],
1055 m_switches.addPlatesToCell,
1056 zShiftInSection[ii+1], // zShiftPos
1057 zShiftInSection[ii]); // zShiftNeg
1058 }
1059
1060 TileDetDescriptor* descriptor = new TileDetDescriptor();
1061 sectionBuilder->fillDescriptor(descriptor,
1062 dete[ii],
1063 side[ii],
1064 m_switches.testBeam, // TB
1065 m_switches.addPlatesToCell, // add front/end plates to cell volume
1066 nModulesInSection[ii], // 0-3 modules
1067 zShiftInSection[ii]); // Z-shift
1068
1069 Identifier idRegion = tileID->region_id(ii);
1070 descriptor->set(idRegion);
1071 m_detectorManager->add(descriptor);
1072 m_detectorManager->add(new TileDetDescrRegion(idRegion, descriptor));
1073
1074 cabling->setConnected(dete[ii],side[ii],0,nModulesInSection[ii]);
1075 }
1076
1077
1078 // Set TileTB as tree top -----------
1079 GeoNameTag* nTag = new GeoNameTag("Tile");
1080 world->add(nTag);
1081 world->add(pvTileTBEnv);
1082 m_detectorManager->addTreeTop(pvTileTBEnv);
1083
1084 delete sectionBuilder;
1085}
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define endmsg
#define TILE_REGION_GAP
#define TILE_REGION_CENTRAL
#define TILE_REGION_EXTENDED
virtual const GeoMaterial * getMaterial(const std::string &name)=0
double TILBrminimal() const
double TILBdzend1() const
double GetEnvRin() const
int GetNumberOfEnv() const
int SetCurrentModuleByIndex(unsigned int Id)
double GetEnvDZ() const
int SetCurrentTifg(int section)
double GetEnvDPhi() const
double TIFGdz() const
double TILBrmax() const
double TILErmax() const
double GetEnvZShift() const
double TILBdzspac() const
int GetModNumber() 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 TILBrmin() const
double TILBdzmodul() const
int TILBnperiod() 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

◆ getDetectorManager()

virtual const TileDetDescrManager * TileTBFactory::getDetectorManager ( ) const
inlineoverridevirtual

Access function to TileDetDescr geometry data.

Definition at line 42 of file TileTBFactory.h.

42{ return m_detectorManager; }

Member Data Documentation

◆ m_detectorManager

TileDetDescrManager* TileTBFactory::m_detectorManager
private

Detector pointer to TileDetDescrManager.

Definition at line 50 of file TileTBFactory.h.

◆ m_detectorStore

StoreGateSvc* TileTBFactory::m_detectorStore
private

Detector pointer to Store Gate service.

Definition at line 47 of file TileTBFactory.h.

◆ m_log

MsgStream* TileTBFactory::m_log
private

Get message SVC.

Definition at line 53 of file TileTBFactory.h.

◆ m_switches

TileSwitches TileTBFactory::m_switches
private

all switches

Definition at line 56 of file TileTBFactory.h.

◆ m_verbose

bool TileTBFactory::m_verbose
private

Flag for activation verbose level for debugging.

Definition at line 59 of file TileTBFactory.h.


The documentation for this class was generated from the following files: