Added check for floating exception in TParticle->Eta() and support for various Eventh...
[u/mrichter/AliRoot.git] / MUON / AliMUONSlatGeometryBuilder.cxx
CommitLineData
d1cd2474 1// $Id$
2//
3// Class AliMUONSlatGeometryBuilder
4// -------------------------------
5// Abstract base class for geometry construction per chamber.
6//
2057e0cc 7// Author: Eric Dumonteil (dumontei@cea.fr)
8
9
c10e6eaf 10// This Builder is designed according to the enveloppe methode. The basic idea is to be able to allow moves
11// of the slats on the support panels.
12// Those moves can be described with a simple set of parameters. The next step should be now to describe all
13// the slats and their places by a unique
14// class, which would make the SlatBuilder far more compact since now only three parameters can define a slat
15// and its position, like:
2057e0cc 16// * Bool_t rounded_shape_slat
17// * Float_t slat_length
18// * Float_t slat_number or Float_t slat_position
19
d1cd2474 20#include <TVirtualMC.h>
d1cd2474 21#include <TGeoMatrix.h>
30178c30 22#include <Riostream.h>
d1cd2474 23
24#include "AliMUONSlatGeometryBuilder.h"
25#include "AliMUON.h"
26#include "AliMUONChamber.h"
27#include "AliMUONChamberGeometry.h"
30178c30 28#include "AliRun.h"
d1cd2474 29
30ClassImp(AliMUONSlatGeometryBuilder)
31
30178c30 32//Int_t ConvertSlatNum(Int_t numslat, Int_t quadnum, Int_t fspq);
d1cd2474 33
34//______________________________________________________________________________
35AliMUONSlatGeometryBuilder::AliMUONSlatGeometryBuilder(AliMUON* muon)
30178c30 36 : AliMUONVGeometryBuilder(&muon->Chamber(4), &muon->Chamber(5),
37 &muon->Chamber(6), &muon->Chamber(7),
38 &muon->Chamber(8), &muon->Chamber(9)),
d1cd2474 39 fMUON(muon)
40{
41// Standard constructor
42
43}
44
45//______________________________________________________________________________
46AliMUONSlatGeometryBuilder::AliMUONSlatGeometryBuilder()
47 : AliMUONVGeometryBuilder(),
48 fMUON(0)
49{
50// Default constructor
51}
52
53
54//______________________________________________________________________________
55AliMUONSlatGeometryBuilder::AliMUONSlatGeometryBuilder(const AliMUONSlatGeometryBuilder& rhs)
56 : AliMUONVGeometryBuilder(rhs)
57{
58 Fatal("Copy constructor",
59 "Copy constructor is not implemented.");
60}
61
62//______________________________________________________________________________
63AliMUONSlatGeometryBuilder::~AliMUONSlatGeometryBuilder() {
64//
65}
66
67//______________________________________________________________________________
68AliMUONSlatGeometryBuilder&
69AliMUONSlatGeometryBuilder::operator = (const AliMUONSlatGeometryBuilder& rhs)
70{
71 // check assignement to self
72 if (this == &rhs) return *this;
73
74 Fatal("operator=",
75 "Assignment operator is not implemented.");
76
77 return *this;
78}
79
80//
81// public methods
82//
83
84//______________________________________________________________________________
85void AliMUONSlatGeometryBuilder::CreateGeometry()
86{
2057e0cc 87// CreateGeometry is the method containing all the informations concerning Stations 345 geometry.
88// It includes description and placements of support panels and slats.
c10e6eaf 89// The code comes directly from what was written in AliMUONv1.cxx before, with modifications concerning
90// the use of Enveloppe method to place the Geant volumes.
91// Now, few changes would allow the creation of a Slat methode where slat could be described by few parameters,
92// and this builder would then be dedicated only to the
2057e0cc 93// placements of the slats. Those modifications could shorten the Station 345 geometry by a non-negligeable factor...
d1cd2474 94
95 Int_t *idtmed = fMUON->GetIdtmed()->GetArray()-1099;
96
97 Float_t angle;
98 Float_t *dum=0;
99
100 // define the id of tracking media:
101 Int_t idCopper = idtmed[1110];
102 Int_t idGlass = idtmed[1111];
103 Int_t idCarbon = idtmed[1112];
104 Int_t idRoha = idtmed[1113];
c10e6eaf 105 Int_t idGas = idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
106 Int_t idAir = idtmed[1100]; // medium 1
d1cd2474 107
108 // sensitive area: 40*40 cm**2
2057e0cc 109 const Float_t kSensLength = 40.;
110 const Float_t kSensHeight = 40.;
111 const Float_t kSensWidth = 0.5; // according to TDR fig 2.120
112 const Int_t kSensMaterial = idGas;
113 const Float_t kYoverlap = 1.5;
d1cd2474 114
115 // PCB dimensions in cm; width: 30 mum copper
2057e0cc 116 const Float_t kPcbLength = kSensLength;
117 const Float_t kPcbHeight = 60.;
118 const Float_t kPcbWidth = 0.003;
119 const Int_t kPcbMaterial = idCopper;
d1cd2474 120
121 // Insulating material: 200 mum glass fiber glued to pcb
2057e0cc 122 const Float_t kInsuLength = kPcbLength;
123 const Float_t kInsuHeight = kPcbHeight;
124 const Float_t kInsuWidth = 0.020;
125 const Int_t kInsuMaterial = idGlass;
d1cd2474 126
127 // Carbon fiber panels: 200mum carbon/epoxy skin
2057e0cc 128 const Float_t kPanelLength = kSensLength;
129 const Float_t kPanelHeight = kSensHeight;
130 const Float_t kPanelWidth = 0.020;
131 const Int_t kPanelMaterial = idCarbon;
d1cd2474 132
133 // rohacell between the two carbon panels
2057e0cc 134 const Float_t kRohaLength = kSensLength;
135 const Float_t kRohaHeight = kSensHeight;
136 const Float_t kRohaWidth = 0.5;
137 const Int_t kRohaMaterial = idRoha;
d1cd2474 138
139 // Frame around the slat: 2 sticks along length,2 along height
140 // H: the horizontal ones
2057e0cc 141 const Float_t kHframeLength = kPcbLength;
142 const Float_t kHframeHeight = 1.5;
143 const Float_t kHframeWidth = kSensWidth;
144 const Int_t kHframeMaterial = idGlass;
d1cd2474 145
146 // V: the vertical ones
2057e0cc 147 const Float_t kVframeLength = 4.0;
148 const Float_t kVframeHeight = kSensHeight + kHframeHeight;
149 const Float_t kVframeWidth = kSensWidth;
150 const Int_t kVframeMaterial = idGlass;
d1cd2474 151
152 // B: the horizontal border filled with rohacell
2057e0cc 153 const Float_t kBframeLength = kHframeLength;
154 const Float_t kBframeHeight = (kPcbHeight - kSensHeight)/2. - kHframeHeight;
155 const Float_t kBframeWidth = kHframeWidth;
156 const Int_t kBframeMaterial = idRoha;
d1cd2474 157
158 // NULOC: 30 mum copper + 200 mum vetronite (same radiation length as 14mum copper)
2057e0cc 159 const Float_t kNulocLength = 2.5;
160 const Float_t kNulocHeight = 7.5;
161 const Float_t kNulocWidth = 0.0030 + 0.0014; // equivalent copper width of vetronite;
162 const Int_t kNulocMaterial = idCopper;
d1cd2474 163
2057e0cc 164 const Float_t kSlatHeight = kPcbHeight;
165 const Float_t kSlatWidth = kSensWidth + 2.*(kPcbWidth + kInsuWidth +
166 2.* kPanelWidth + kRohaWidth);
167 const Int_t kSlatMaterial = idAir;
168 const Float_t kDslatLength = kVframeLength; // border on left and right
d1cd2474 169
170 Float_t spar[3];
171 Int_t i, j;
c10e6eaf 172 Int_t detElementNumber;
d1cd2474 173
174 // the panel volume contains the rohacell
175
2057e0cc 176 Float_t twidth = 2 * kPanelWidth + kRohaWidth;
177 Float_t panelpar[3] = { kPanelLength/2., kPanelHeight/2., twidth/2. };
178 Float_t rohapar[3] = { kRohaLength/2., kRohaHeight/2., kRohaWidth/2. };
d1cd2474 179
180 // insulating material contains PCB-> gas-> 2 borders filled with rohacell
181
2057e0cc 182 twidth = 2*(kInsuWidth + kPcbWidth) + kSensWidth;
183 Float_t insupar[3] = { kInsuLength/2., kInsuHeight/2., twidth/2. };
184 twidth -= 2 * kInsuWidth;
185 Float_t pcbpar[3] = { kPcbLength/2., kPcbHeight/2., twidth/2. };
186 Float_t senspar[3] = { kSensLength/2., kSensHeight/2., kSensWidth/2. };
187 Float_t theight = 2*kHframeHeight + kSensHeight;
188 Float_t hFramepar[3]={kHframeLength/2., theight/2., kHframeWidth/2.};
189 Float_t bFramepar[3]={kBframeLength/2., kBframeHeight/2., kBframeWidth/2.};
190 Float_t vFramepar[3]={kVframeLength/2., kVframeHeight/2., kVframeWidth/2.};
191 Float_t nulocpar[3]={kNulocLength/2., kNulocHeight/2., kNulocWidth/2.};
d1cd2474 192 Float_t xx;
2057e0cc 193 Float_t xxmax = (kBframeLength - kNulocLength)/2.;
d1cd2474 194 Int_t index=0;
195
196 AliMUONChamber *iChamber, *iChamber1, *iChamber2;
197
198 Int_t* fStations = new Int_t[5];
199 for (Int_t i=0; i<5; i++) fStations[i] = 1;
c10e6eaf 200 fStations[2] = 1;
d1cd2474 201
202 if (fStations[2])
203 {
d1cd2474 204//********************************************************************
205// Station 3 **
206//********************************************************************
207 // indices 1 and 2 for first and second chambers in the station
208 // iChamber (first chamber) kept for other quanties than Z,
209 // assumed to be the same in both chambers
210
211 iChamber = GetChamber(4);
212 iChamber1 = iChamber;
213 iChamber2 = GetChamber(5);
214
84717edf 215 //iChamber1->GetGeometry()->SetDebug(kTRUE);
d1cd2474 216 //iChamber2->GetGeometry()->SetDebug(kTRUE);
217
218 if (gAlice->GetModule("DIPO")) {
219 // if DIPO is preset, the whole station will be placed in DDIP volume
220 iChamber1->GetGeometry()->SetMotherVolume("DDIP");
221 iChamber2->GetGeometry()->SetMotherVolume("DDIP");
222 }
223
224// if (gAlice->GetModule("DIPO")) {
225// slats5Mother="DDIP";
226// slats6Mother="DDIP";
227
228// zoffs5 = zpos1;
229// zoffs6 = zpos2;
230// }
231// else {
232// gMC->Gsvolu("S05M", "TUBE", idAir, tpar, 3);
233// gMC->Gsvolu("S06M", "TUBE", idAir, tpar, 3);
234// gMC->Gspos("S05M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
235
236// gMC->Gspos("S06M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
237// }
238
239 // volumes for slat geometry (xx=5,..,10 chamber id):
240 // Sxx0 Sxx1 Sxx2 Sxx3 --> Slat Mother volumes
241 // SxxG --> Sensitive volume (gas)
242 // SxxP --> PCB (copper)
243 // SxxI --> Insulator (vetronite)
244 // SxxC --> Carbon panel
245 // SxxR --> Rohacell
246 // SxxH, SxxV --> Horizontal and Vertical frames (vetronite)
247 // SB5x --> Volumes for the 35 cm long PCB
248 // slat dimensions: slat is a MOTHER volume!!! made of air
249
250 // only for chamber 5: slat 1 has a PCB shorter by 5cm!
251
252 Float_t tlength = 35.;
253 Float_t panelpar2[3] = { tlength/2., panelpar[1], panelpar[2]};
254 Float_t rohapar2[3] = { tlength/2., rohapar[1], rohapar[2]};
255 Float_t insupar2[3] = { tlength/2., insupar[1], insupar[2]};
256 Float_t pcbpar2[3] = { tlength/2., pcbpar[1], pcbpar[2]};
257 Float_t senspar2[3] = { tlength/2., senspar[1], senspar[2]};
258 Float_t hFramepar2[3] = { tlength/2., hFramepar[1], hFramepar[2]};
259 Float_t bFramepar2[3] = { tlength/2., bFramepar[1], bFramepar[2]};
260 Float_t *dum=0;
261
2057e0cc 262 const Int_t kNslats3 = 5; // number of slats per quadrant
c10e6eaf 263 const Int_t kNPCB3[kNslats3] = {4,4,4,3,2}; // n PCB per slat
264 const Float_t kXpos3[kNslats3] = {0., 0., 0., 0., 0.};//{31., 0., 0., 0., 0.};
2057e0cc 265 Float_t slatLength3[kNslats3];
d1cd2474 266
267 // create and position the slat (mother) volumes
268
269// char volNam5[5];
270// char volNam6[5];
271 char idSlatCh5[5];
272 char idSlatCh6[5];
273 Float_t xSlat3;
274 Float_t angle = 0.;
d1cd2474 275 Float_t spar2[3];
c10e6eaf 276 for (i = 0; i < kNslats3; i++){
2057e0cc 277 slatLength3[i] = kPcbLength * kNPCB3[i] + 2. * kDslatLength;
278 xSlat3 = slatLength3[i]/2. - kVframeLength/2. + kXpos3[i];
c10e6eaf 279 if (i == 1 || i == 0) slatLength3[i] -= 2. *kDslatLength; // frame out in PCB with circular border
2057e0cc 280 Float_t ySlat31 = kSensHeight * i - kYoverlap * i;
281 Float_t ySlat32 = -kSensHeight * i + kYoverlap * i;
d1cd2474 282 spar[0] = slatLength3[i]/2.;
2057e0cc 283 spar[1] = kSlatHeight/2.;
284 spar[2] = kSlatWidth/2. * 1.01;
d1cd2474 285 // take away 5 cm from the first slat in chamber 5
286 Float_t xSlat32 = 0;
c10e6eaf 287 if (i==0 || i==1 || i==2) { // 1 pcb is shortened by 5cm
d1cd2474 288 spar2[0] = spar[0]-5./2.;
289 xSlat32 = xSlat3 - 5/2.;
c10e6eaf 290 } else {
d1cd2474 291 spar2[0] = spar[0];
292 xSlat32 = xSlat3;
293 }
294 spar2[1] = spar[1];
295 spar2[2] = spar[2];
296 Float_t dzCh3=spar[2] * 1.01;
297 // zSlat to be checked (odd downstream or upstream?)
298 Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2];
c10e6eaf 299 // sprintf(volNam5,"S05%d",i);
300 // gMC->Gsvolu(volNam5,"BOX",slatMaterial,spar2,3);
301 // gMC->Gspos(volNam5, i*4+1,slats5Mother, xSlat32, ySlat31, zoffs5+zSlat+2.*dzCh3, 0, "ONLY");
302 // gMC->Gspos(volNam5, i*4+2,slats5Mother,-xSlat32, ySlat31, zoffs5+zSlat-2.*dzCh3, 0, "ONLY");
d1cd2474 303
2057e0cc 304 sprintf(idSlatCh5,"LA%d",kNslats3-1+i);
c10e6eaf 305 detElementNumber = 500 + i + kNslats3-1;
2057e0cc 306 gMC->Gsvolu(idSlatCh5,"BOX",kSlatMaterial,spar2,3);
c10e6eaf 307 GetChamber(4)->GetGeometry()->AddEnvelope(idSlatCh5, true, TGeoTranslation(xSlat32, ySlat31, zSlat+2.*dzCh3),
308 TGeoRotation("rot1",90,angle,90,90+angle,0,0) );
d1cd2474 309
2057e0cc 310 sprintf(idSlatCh5,"LA%d",3*kNslats3-2+i);
c10e6eaf 311 detElementNumber = 550 + i + kNslats3-1;
2057e0cc 312 gMC->Gsvolu(idSlatCh5,"BOX",kSlatMaterial,spar2,3);
c10e6eaf 313 GetChamber(4)->GetGeometry()->AddEnvelope(idSlatCh5, true, TGeoTranslation(-xSlat32, ySlat31, zSlat-2.*dzCh3),
314 TGeoRotation("rot2",90,180+angle,90,90+angle,180,0) );
315
316 if (i > 0) {
317 sprintf(idSlatCh5,"LA%d",kNslats3-1-i);
318 detElementNumber = 500 - i + kNslats3-1;
319 gMC->Gsvolu(idSlatCh5,"BOX",kSlatMaterial,spar2,3);
320 GetChamber(4)->GetGeometry()->AddEnvelope(idSlatCh5, true, TGeoTranslation(xSlat32, ySlat32, zSlat+2.*dzCh3),
321 TGeoRotation("rot3",90,angle,90,270+angle,180,0) );
322
323 sprintf(idSlatCh5,"LA%d",3*kNslats3-2-i);
324 detElementNumber = 550 - i + kNslats3-1;
325 gMC->Gsvolu(idSlatCh5,"BOX",kSlatMaterial,spar2,3);
326 GetChamber(4)->GetGeometry()->AddEnvelope(idSlatCh5, true, TGeoTranslation(-xSlat32, ySlat32, zSlat-2.*dzCh3),
327 TGeoRotation("rot4",90,180+angle,90,270+angle,0,0) );
d1cd2474 328 }
329
c10e6eaf 330 sprintf(idSlatCh6,"LB%d",kNslats3-1+i);
331 detElementNumber = 600 + i + kNslats3-1;
2057e0cc 332 gMC->Gsvolu(idSlatCh6,"BOX",kSlatMaterial,spar2,3);
c10e6eaf 333 GetChamber(5)->GetGeometry()->AddEnvelope(idSlatCh6, true, TGeoTranslation(xSlat3, ySlat31, zSlat+2.*dzCh3),
334 TGeoRotation("rot5",90,angle,90,90+angle,0,0) );
2057e0cc 335 sprintf(idSlatCh6,"LB%d",3*kNslats3-2+i);
c10e6eaf 336 detElementNumber = 650 + i + kNslats3-1;
2057e0cc 337 gMC->Gsvolu(idSlatCh6,"BOX",kSlatMaterial,spar2,3);
c10e6eaf 338 GetChamber(5)->GetGeometry()->AddEnvelope(idSlatCh6, true, TGeoTranslation(-xSlat3, ySlat31, zSlat-2.*dzCh3),
339 TGeoRotation("rot6",90,180+angle,90,90+angle,180,0) );
340
341 if (i > 0) {
342 sprintf(idSlatCh6,"LB%d",kNslats3-1-i);
343 detElementNumber = 600 - i + kNslats3-1;
344 gMC->Gsvolu(idSlatCh6,"BOX",kSlatMaterial,spar2,3);
345 GetChamber(5)->GetGeometry()->AddEnvelope(idSlatCh6, true, TGeoTranslation(xSlat3, ySlat32, zSlat+2.*dzCh3),
346 TGeoRotation("rot7",90,angle,90,270+angle,180,0) );
347
348 sprintf(idSlatCh6,"LB%d",3*kNslats3-2-i);
349 detElementNumber = 650 - i + kNslats3-1;
350 gMC->Gsvolu(idSlatCh6,"BOX",kSlatMaterial,spar2,3);
351 GetChamber(5)->GetGeometry()->AddEnvelope(idSlatCh6, true, TGeoTranslation(-xSlat3, ySlat32, zSlat-2.*dzCh3),
352 TGeoRotation("rot8",90,180+angle,90,270+angle,0,0) );
353 }
354 }
d1cd2474 355
356 // create the panel volume
357
2057e0cc 358 gMC->Gsvolu("S05C","BOX",kPanelMaterial,panelpar,3);
359 gMC->Gsvolu("SB5C","BOX",kPanelMaterial,panelpar2,3);
360 gMC->Gsvolu("S06C","BOX",kPanelMaterial,panelpar,3);
d1cd2474 361
362 // create the rohacell volume
363
2057e0cc 364 gMC->Gsvolu("S05R","BOX",kRohaMaterial,rohapar,3);
365 gMC->Gsvolu("SB5R","BOX",kRohaMaterial,rohapar2,3);
366 gMC->Gsvolu("S06R","BOX",kRohaMaterial,rohapar,3);
d1cd2474 367
368 // create the insulating material volume
369
2057e0cc 370 gMC->Gsvolu("S05I","BOX",kInsuMaterial,insupar,3);
371 gMC->Gsvolu("SB5I","BOX",kInsuMaterial,insupar2,3);
372 gMC->Gsvolu("S06I","BOX",kInsuMaterial,insupar,3);
d1cd2474 373
374 // create the PCB volume
375
2057e0cc 376 gMC->Gsvolu("S05P","BOX",kPcbMaterial,pcbpar,3);
377 gMC->Gsvolu("SB5P","BOX",kPcbMaterial,pcbpar2,3);
378 gMC->Gsvolu("S06P","BOX",kPcbMaterial,pcbpar,3);
d1cd2474 379
380 // create the sensitive volumes,
2057e0cc 381 gMC->Gsvolu("S05G","BOX",kSensMaterial,dum,0);
382 gMC->Gsvolu("S06G","BOX",kSensMaterial,dum,0);
d1cd2474 383
384
385 // create the vertical frame volume
386
2057e0cc 387 gMC->Gsvolu("S05V","BOX",kVframeMaterial,vFramepar,3);
388 gMC->Gsvolu("S06V","BOX",kVframeMaterial,vFramepar,3);
d1cd2474 389
390 // create the horizontal frame volume
391
392
2057e0cc 393 gMC->Gsvolu("S05H","BOX",kHframeMaterial,hFramepar,3);
394 gMC->Gsvolu("SB5H","BOX",kHframeMaterial,hFramepar2,3);
395 gMC->Gsvolu("S06H","BOX",kHframeMaterial,hFramepar,3);
d1cd2474 396
397 // create the horizontal border volume
398
2057e0cc 399 gMC->Gsvolu("S05B","BOX",kBframeMaterial,bFramepar,3);
400 gMC->Gsvolu("SB5B","BOX",kBframeMaterial,bFramepar2,3);
401 gMC->Gsvolu("S06B","BOX",kBframeMaterial,bFramepar,3);
d1cd2474 402
c10e6eaf 403 index = 0;
2057e0cc 404 for (i = 0; i<kNslats3; i++){
c10e6eaf 405 for (Int_t quadrant=1; quadrant<=4; quadrant++) {
406
407 if (i==0&&quadrant==2) continue;
408 if (i==0&&quadrant==4) continue;
409
410 sprintf(idSlatCh5,"LA%d",ConvertSlatNum(i,quadrant,kNslats3-1));
411 sprintf(idSlatCh6,"LB%d",ConvertSlatNum(i,quadrant,kNslats3-1));
412 Float_t xvFrame = (slatLength3[i] - kVframeLength)/2.;
413 Float_t xvFrame2 = xvFrame;
414
415 if ( i==0 || i==1 || i ==2 ) xvFrame2 -= 5./2.;
416
417 // position the vertical frames
418 if (i!=1 && i!=0) {
419 GetChamber(4)->GetGeometry()->AddEnvelopeConstituent("S05V", idSlatCh5,
420 (2*i-1)*10+quadrant,TGeoTranslation(xvFrame2,0.,0.));
421 GetChamber(4)->GetGeometry()->AddEnvelopeConstituent("S05V", idSlatCh5,
422 (2*i)*10+quadrant,TGeoTranslation(-xvFrame2,0.,0.));
423 GetChamber(5)->GetGeometry()->AddEnvelopeConstituent("S06V", idSlatCh6,
424 (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
425 GetChamber(5)->GetGeometry()->AddEnvelopeConstituent("S06V", idSlatCh6,
426 (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
427
428 }
429 // position the panels and the insulating material
430 for (j=0; j<kNPCB3[i]; j++){
431 if (i==1&&j==0) continue;
432 if (i==0&&j==0) continue;
433 index++;
434 Float_t xx = kSensLength * (-kNPCB3[i]/2.+j+.5);
435 Float_t xx2 = xx+ 5/2.;
d1cd2474 436
c10e6eaf 437 Float_t zPanel = spar[2] - panelpar[2];
438 if ( (i == 0 || i == 1 || i == 2) && j == kNPCB3[i]-1) { // 1 pcb is shortened by 5cm
439 GetChamber(4)->GetGeometry()->AddEnvelopeConstituent("SB5C", idSlatCh5, 2*index-1,TGeoTranslation(xx,0.,zPanel));
440 GetChamber(4)->GetGeometry()->AddEnvelopeConstituent("SB5C", idSlatCh5, 2*index,TGeoTranslation(xx,0.,-zPanel));
441 GetChamber(4)->GetGeometry()->AddEnvelopeConstituent("SB5I", idSlatCh5, index,TGeoTranslation(xx,0.,0.));
442 }
443 else if ( (i == 0 || i == 1 || i == 2) && j < kNPCB3[i]-1) {
444 GetChamber(4)->GetGeometry()->AddEnvelopeConstituent("S05C", idSlatCh5, 2*index-1,TGeoTranslation(xx2,0.,zPanel));
445 GetChamber(4)->GetGeometry()->AddEnvelopeConstituent("S05C", idSlatCh5, 2*index,TGeoTranslation(xx2,0.,-zPanel));
446 GetChamber(4)->GetGeometry()->AddEnvelopeConstituent("S05I", idSlatCh5, index,TGeoTranslation(xx2,0.,0.));
447 }
448 else {
449 GetChamber(4)->GetGeometry()->AddEnvelopeConstituent("S05C", idSlatCh5, 2*index-1,TGeoTranslation(xx,0.,zPanel));
450 GetChamber(4)->GetGeometry()->AddEnvelopeConstituent("S05C", idSlatCh5, 2*index,TGeoTranslation(xx,0.,-zPanel));
451 GetChamber(4)->GetGeometry()->AddEnvelopeConstituent("S05I", idSlatCh5, index,TGeoTranslation(xx,0.,0.));
452 }
453 GetChamber(5)->GetGeometry()->AddEnvelopeConstituent("S06C", idSlatCh6, 2*index-1,TGeoTranslation(xx,0.,zPanel));
454 GetChamber(5)->GetGeometry()->AddEnvelopeConstituent("S06C", idSlatCh6, 2*index,TGeoTranslation(xx,0.,-zPanel));
455 GetChamber(5)->GetGeometry()->AddEnvelopeConstituent("S06I", idSlatCh6, index,TGeoTranslation(xx,0.,0.));
d1cd2474 456
c10e6eaf 457 }
458 }
d1cd2474 459 }
c10e6eaf 460
d1cd2474 461 // position the rohacell volume inside the panel volume
462 gMC->Gspos("S05R",1,"S05C",0.,0.,0.,0,"ONLY");
463 gMC->Gspos("SB5R",1,"SB5C",0.,0.,0.,0,"ONLY");
464 gMC->Gspos("S06R",1,"S06C",0.,0.,0.,0,"ONLY");
465
466 // position the PCB volume inside the insulating material volume
467 gMC->Gspos("S05P",1,"S05I",0.,0.,0.,0,"ONLY");
468 gMC->Gspos("SB5P",1,"SB5I",0.,0.,0.,0,"ONLY");
469 gMC->Gspos("S06P",1,"S06I",0.,0.,0.,0,"ONLY");
470 // position the horizontal frame volume inside the PCB volume
471 gMC->Gspos("S05H",1,"S05P",0.,0.,0.,0,"ONLY");
472 gMC->Gspos("SB5H",1,"SB5P",0.,0.,0.,0,"ONLY");
473 gMC->Gspos("S06H",1,"S06P",0.,0.,0.,0,"ONLY");
474 // position the sensitive volume inside the horizontal frame volume
475 gMC->Gsposp("S05G",1,"S05H",0.,0.,0.,0,"ONLY",senspar,3);
476 gMC->Gsposp("S05G",1,"SB5H",0.,0.,0.,0,"ONLY",senspar2,3);
477 gMC->Gsposp("S06G",1,"S06H",0.,0.,0.,0,"ONLY",senspar,3);
478 // position the border volumes inside the PCB volume
2057e0cc 479 Float_t yborder = ( kPcbHeight - kBframeHeight ) / 2.;
d1cd2474 480 gMC->Gspos("S05B",1,"S05P",0., yborder,0.,0,"ONLY");
481 gMC->Gspos("S05B",2,"S05P",0.,-yborder,0.,0,"ONLY");
482 gMC->Gspos("SB5B",1,"SB5P",0., yborder,0.,0,"ONLY");
483 gMC->Gspos("SB5B",2,"SB5P",0.,-yborder,0.,0,"ONLY");
484 gMC->Gspos("S06B",1,"S06P",0., yborder,0.,0,"ONLY");
485 gMC->Gspos("S06B",2,"S06P",0.,-yborder,0.,0,"ONLY");
486
487 // create the NULOC volume and position it in the horizontal frame
488
2057e0cc 489 gMC->Gsvolu("S05N","BOX",kNulocMaterial,nulocpar,3);
490 gMC->Gsvolu("S06N","BOX",kNulocMaterial,nulocpar,3);
d1cd2474 491 index = 0;
492 Float_t xxmax2 = xxmax - 5./2.;
c10e6eaf 493 for (xx = -xxmax; xx <= xxmax; xx += 2*kNulocLength) {
d1cd2474 494 index++;
2057e0cc 495 gMC->Gspos("S05N",2*index-1,"S05B", xx, 0.,-kBframeWidth/4., 0, "ONLY");
496 gMC->Gspos("S05N",2*index ,"S05B", xx, 0., kBframeWidth/4., 0, "ONLY");
d1cd2474 497 if (xx > -xxmax2 && xx< xxmax2) {
2057e0cc 498 gMC->Gspos("S05N",2*index-1,"SB5B", xx, 0.,-kBframeWidth/4., 0, "ONLY");
499 gMC->Gspos("S05N",2*index ,"SB5B", xx, 0., kBframeWidth/4., 0, "ONLY");
d1cd2474 500 }
2057e0cc 501 gMC->Gspos("S06N",2*index-1,"S06B", xx, 0.,-kBframeWidth/4., 0, "ONLY");
502 gMC->Gspos("S06N",2*index ,"S06B", xx, 0., kBframeWidth/4., 0, "ONLY");
d1cd2474 503 }
d1cd2474 504 // position the volumes approximating the circular section of the pipe
2057e0cc 505 Float_t yoffs = kSensHeight/2.-kYoverlap;
d1cd2474 506 Float_t epsilon = 0.001;
c10e6eaf 507 Int_t ndiv = 6;
d1cd2474 508 Double_t divpar[3];
2057e0cc 509 Double_t dydiv= kSensHeight/ndiv;
c10e6eaf 510 Double_t ydiv = yoffs -dydiv/2.;
511 Int_t imax = 0;
d1cd2474 512 imax = 1;
c10e6eaf 513 Double_t rmin = 31.5; // Corrected in sep04 from PQ-LAT-SR2 de CEA-DSM-DAPNIA-SIS/BE ph HARDY 19-Oct-2002 slat
514 Double_t xdiv = 0.;
515 for (Int_t idiv = 0;idiv < ndiv; idiv++){
516 ydiv += dydiv;
517 xdiv = 0.;
518 if (ydiv < rmin) xdiv = rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
2057e0cc 519 divpar[0] = (kPcbLength-xdiv)/2.;
d1cd2474 520 divpar[1] = dydiv/2. - epsilon;
2057e0cc 521 divpar[2] = kSensWidth/2.;
c10e6eaf 522 Float_t xvol = (kPcbLength+xdiv)/2.;
523 Float_t yvol = ydiv;
524 // Volumes close to the beam pipe for slat i=1 so 4 slats per chamber
525 for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
526 sprintf(idSlatCh5,"LA%d",ConvertSlatNum(1,quadrant,kNslats3-1));
527 sprintf(idSlatCh6,"LB%d",ConvertSlatNum(1,quadrant,kNslats3-1));
528
529 GetChamber(4)->GetGeometry()->AddEnvelopeConstituentParam("S05G", idSlatCh5, quadrant*100+imax+4*idiv+1,
530 TGeoTranslation(xvol-(kPcbLength * (kNPCB3[1]-1)/2. + 35./2.),yvol-kPcbLength+kYoverlap,0.),3,divpar);
531
532 GetChamber(5)->GetGeometry()->AddEnvelopeConstituentParam("S06G", idSlatCh6, quadrant*100+imax+4*idiv+1,
533 TGeoTranslation(xvol-kPcbLength * kNPCB3[1]/2.,yvol-kPcbLength+kYoverlap,0.),3,divpar);
d1cd2474 534 }
d1cd2474 535 }
c10e6eaf 536
537 // Volumes close to the beam pipe for slat i=0 so 2 slats per chamber (Lattes centrales de la station 3)
538 // Gines Martinez, Subatech sep 04
539 // 9 box volumes are used to define the PCB closed to the beam pipe of the slat 122000SR1 of chamber 5 and 6 of St3
540 // Cette code a ete ecrit suivant le plan PQ-LAT-SR1 de CEA-DSM-DAPNIA-SIS/BE ph HARDY 8-Oct-2002
541 // Rmin = 31.5 cm
542 Double_t rmin_122000SR1 = 31.5; //in cm
543 ndiv = 9;
544 dydiv = kSensHeight/ndiv; // Vertical size of the box volume approximating the rounded PCB
545 ydiv = -kSensHeight/2 + dydiv/2.-kYoverlap; // Initializing vertical position of the volume from bottom
546 xdiv = 0.; // Initializing horizontal position of the box volumes
547 for (Int_t idiv=0;idiv<ndiv; idiv++){
548 xdiv = TMath::Abs( rmin_122000SR1 * TMath::Sin( TMath::ACos(ydiv/rmin_122000SR1) ) );
549 divpar[0] = (kPcbLength-xdiv)/2.; // Dimension of the box volume
550 divpar[1] = dydiv/2. - epsilon;
551 divpar[2] = kSensWidth/2.;
552 Float_t xvol = (kPcbLength+xdiv)/2.; //2D traslition for positionning of box volume
553 Float_t yvol = ydiv;
554 Int_t side;
555 for (side = 1; side <= 2; side++) {
556 sprintf(idSlatCh5,"LA%d",4);
557 sprintf(idSlatCh6,"LB%d",4);
558 if(side == 2) {
559 sprintf(idSlatCh5,"LA%d",13);
560 sprintf(idSlatCh6,"LB%d",13);
561 }
562 GetChamber(4)->GetGeometry()->AddEnvelopeConstituentParam("S05G", idSlatCh5,500+side*100+imax+4*idiv+1,
563 TGeoTranslation(xvol-(kPcbLength * (kNPCB3[0]-1)/2. + 35./2.),yvol+kYoverlap,0.),3,divpar);
564
565 GetChamber(5)->GetGeometry()->AddEnvelopeConstituentParam("S06G", idSlatCh6,500+side*100+imax+4*idiv+1,
566 TGeoTranslation(xvol-kPcbLength * kNPCB3[0]/2.,yvol+kYoverlap,0.),3,divpar);
567 }
568 ydiv += dydiv; // Going from bottom to top
569 }
570 cout << "Geometry for Station 3...... done" << endl;
d1cd2474 571 }
572
573 if (fStations[3]) {
574
575
576// //********************************************************************
577// // Station 4 **
578// //********************************************************************
579// // indices 1 and 2 for first and second chambers in the station
580// // iChamber (first chamber) kept for other quanties than Z,
581// // assumed to be the same in both chambers
c10e6eaf 582// corrected geometry (JP. Cussonneau, Ch. Finck)
d1cd2474 583
584 iChamber = GetChamber(6);
585 iChamber1 = iChamber;
586 iChamber2 = GetChamber(7);
587
c10e6eaf 588 const Int_t kNslats4 = 7; // number of slats per quadrant
589 const Int_t kNPCB4[kNslats4] = {5,6,5,5,4,3,2}; // n PCB per slat
590 const Float_t kXpos4[kNslats4] = {38.5, 0., 0., 0., 0., 0., 0.};
2057e0cc 591 Float_t slatLength4[kNslats4];
d1cd2474 592
593// // create and position the slat (mother) volumes
594
595 char idSlatCh7[5];
596 char idSlatCh8[5];
597 Float_t xSlat4;
598 Float_t ySlat4;
599 angle = 0.;
600
2057e0cc 601 for (i = 0; i<kNslats4; i++){
602 slatLength4[i] = kPcbLength * kNPCB4[i] + 2. * kDslatLength;
603 xSlat4 = slatLength4[i]/2. - kVframeLength/2. + kXpos4[i];
c10e6eaf 604 if (i == 1) slatLength4[i] -= 2. *kDslatLength; // frame out in PCB with circular border
605 ySlat4 = kSensHeight * i - kYoverlap *i;
d1cd2474 606
607 spar[0] = slatLength4[i]/2.;
2057e0cc 608 spar[1] = kSlatHeight/2.;
609 spar[2] = kSlatWidth/2.*1.01;
c10e6eaf 610 Float_t dzCh4 = spar[2]*1.01;
d1cd2474 611 // zSlat to be checked (odd downstream or upstream?)
612 Float_t zSlat = (i%2 ==0)? spar[2] : -spar[2];
613
2057e0cc 614 sprintf(idSlatCh7,"LC%d",kNslats4-1+i);
c10e6eaf 615 detElementNumber = 700 + i + kNslats4-1;
2057e0cc 616 gMC->Gsvolu(idSlatCh7,"BOX",kSlatMaterial,spar,3);
c10e6eaf 617 GetChamber(6)->GetGeometry()->AddEnvelope(idSlatCh7, true, TGeoTranslation(xSlat4, ySlat4, zSlat+2.*dzCh4),
618 TGeoRotation("rot1",90,angle,90,90+angle,0,0) );
d1cd2474 619
2057e0cc 620 sprintf(idSlatCh7,"LC%d",3*kNslats4-2+i);
c10e6eaf 621 detElementNumber = 750 + i + kNslats4-1;
2057e0cc 622 gMC->Gsvolu(idSlatCh7,"BOX",kSlatMaterial,spar,3);
c10e6eaf 623 GetChamber(6)->GetGeometry()->AddEnvelope(idSlatCh7, true, TGeoTranslation(-xSlat4, ySlat4, zSlat-2.*dzCh4),
624 TGeoRotation("rot2",90,180+angle,90,90+angle,180,0) );
d1cd2474 625
c10e6eaf 626 if (i > 0) {
627 sprintf(idSlatCh7,"LC%d",kNslats4-1-i);
628 detElementNumber = 700 - i + kNslats4-1;
629 gMC->Gsvolu(idSlatCh7,"BOX",kSlatMaterial,spar,3);
630 GetChamber(6)->GetGeometry()->AddEnvelope(idSlatCh7, true, TGeoTranslation(xSlat4, -ySlat4, zSlat+2.*dzCh4),
631 TGeoRotation("rot3",90,angle,90,270+angle,180,0) );
632
633 sprintf(idSlatCh7,"LC%d",3*kNslats4-2-i);
634 detElementNumber = 750 - i + kNslats4-1;
635 gMC->Gsvolu(idSlatCh7,"BOX",kSlatMaterial,spar,3);
636 GetChamber(6)->GetGeometry()->AddEnvelope(idSlatCh7, true,
637 TGeoTranslation(-xSlat4, -ySlat4, zSlat-2.*dzCh4),
638 TGeoRotation("rot4",90,180+angle,90,270+angle,0,0) );
d1cd2474 639 }
640
2057e0cc 641 sprintf(idSlatCh8,"LD%d",kNslats4-1+i);
c10e6eaf 642 detElementNumber = 800 + i + kNslats4-1;
2057e0cc 643 gMC->Gsvolu(idSlatCh8,"BOX",kSlatMaterial,spar,3);
c10e6eaf 644 GetChamber(7)->GetGeometry()->AddEnvelope(idSlatCh8, true, TGeoTranslation(xSlat4, ySlat4, zSlat+2.*dzCh4),
645 TGeoRotation("rot5",90,angle,90,90+angle,0,0) );
2057e0cc 646 sprintf(idSlatCh8,"LD%d",3*kNslats4-2+i);
c10e6eaf 647 detElementNumber = 850 + i + kNslats4-1;
2057e0cc 648 gMC->Gsvolu(idSlatCh8,"BOX",kSlatMaterial,spar,3);
c10e6eaf 649 GetChamber(7)->GetGeometry()->AddEnvelope(idSlatCh8, true, TGeoTranslation(-xSlat4, ySlat4, zSlat-2.*dzCh4),
650 TGeoRotation("rot6",90,180+angle,90,90+angle,180,0) );
651 if (i > 0) {
652 sprintf(idSlatCh8,"LD%d",kNslats4-1-i);
653 detElementNumber = 800 - i + kNslats4-1;
654 gMC->Gsvolu(idSlatCh8,"BOX",kSlatMaterial,spar,3);
655 GetChamber(7)->GetGeometry()->AddEnvelope(idSlatCh8, true, TGeoTranslation(xSlat4, -ySlat4, zSlat+2.*dzCh4),
656 TGeoRotation("rot7",90,angle,90,270+angle,180,0) );
657 sprintf(idSlatCh8,"LD%d",3*kNslats4-2-i);
658 detElementNumber = 850 - i + kNslats4-1;
659 gMC->Gsvolu(idSlatCh8,"BOX",kSlatMaterial,spar,3);
660 GetChamber(7)->GetGeometry()->AddEnvelope(idSlatCh8, true, TGeoTranslation(-xSlat4, -ySlat4, zSlat-2.*dzCh4),
661 TGeoRotation("rot8",90,180+angle,90,270+angle,0,0) );
d1cd2474 662 }
663 }
664
d1cd2474 665 // create the panel volume
666
2057e0cc 667 gMC->Gsvolu("S07C","BOX",kPanelMaterial,panelpar,3);
668 gMC->Gsvolu("S08C","BOX",kPanelMaterial,panelpar,3);
d1cd2474 669
670 // create the rohacell volume
671
2057e0cc 672 gMC->Gsvolu("S07R","BOX",kRohaMaterial,rohapar,3);
673 gMC->Gsvolu("S08R","BOX",kRohaMaterial,rohapar,3);
d1cd2474 674
675 // create the insulating material volume
676
2057e0cc 677 gMC->Gsvolu("S07I","BOX",kInsuMaterial,insupar,3);
678 gMC->Gsvolu("S08I","BOX",kInsuMaterial,insupar,3);
d1cd2474 679
680 // create the PCB volume
681
2057e0cc 682 gMC->Gsvolu("S07P","BOX",kPcbMaterial,pcbpar,3);
683 gMC->Gsvolu("S08P","BOX",kPcbMaterial,pcbpar,3);
d1cd2474 684
685 // create the sensitive volumes,
686
2057e0cc 687 gMC->Gsvolu("S07G","BOX",kSensMaterial,dum,0);
688 gMC->Gsvolu("S08G","BOX",kSensMaterial,dum,0);
d1cd2474 689
690 // create the vertical frame volume
691
2057e0cc 692 gMC->Gsvolu("S07V","BOX",kVframeMaterial,vFramepar,3);
693 gMC->Gsvolu("S08V","BOX",kVframeMaterial,vFramepar,3);
d1cd2474 694
695 // create the horizontal frame volume
696
2057e0cc 697 gMC->Gsvolu("S07H","BOX",kHframeMaterial,hFramepar,3);
698 gMC->Gsvolu("S08H","BOX",kHframeMaterial,hFramepar,3);
d1cd2474 699
700 // create the horizontal border volume
701
2057e0cc 702 gMC->Gsvolu("S07B","BOX",kBframeMaterial,bFramepar,3);
703 gMC->Gsvolu("S08B","BOX",kBframeMaterial,bFramepar,3);
d1cd2474 704
c10e6eaf 705 index = 0;
706 for (i = 0; i < kNslats4; i++){
707 for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
d1cd2474 708
c10e6eaf 709 if (i == 0 && quadrant == 2) continue;
710 if (i == 0 && quadrant == 4) continue;
d1cd2474 711
c10e6eaf 712 sprintf(idSlatCh7,"LC%d",ConvertSlatNum(i,quadrant,kNslats4-1));
713 sprintf(idSlatCh8,"LD%d",ConvertSlatNum(i,quadrant,kNslats4-1));
714 Float_t xvFrame = (slatLength4[i] - kVframeLength)/2.;
d1cd2474 715
c10e6eaf 716 // position the vertical frames
717 if (i != 1 && i != 0) {
718 GetChamber(6)->GetGeometry()->AddEnvelopeConstituent("S07V", idSlatCh7, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
719 GetChamber(6)->GetGeometry()->AddEnvelopeConstituent("S07V", idSlatCh7, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
720 GetChamber(7)->GetGeometry()->AddEnvelopeConstituent("S08V", idSlatCh8, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
721 GetChamber(7)->GetGeometry()->AddEnvelopeConstituent("S08V", idSlatCh8, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
722 }
723 // position the panels and the insulating material
724 for (j = 0; j < kNPCB4[i]; j++){
725 if (i == 1 && j == 0) continue;
726 index++;
727 Float_t xx = kSensLength * (-kNPCB4[i]/2.+j+.5);
728
729 Float_t zPanel = spar[2] - panelpar[2];
730 GetChamber(6)->GetGeometry()->AddEnvelopeConstituent("S07C", idSlatCh7, 2*index-1,TGeoTranslation(xx,0.,zPanel));
731 GetChamber(6)->GetGeometry()->AddEnvelopeConstituent("S07C", idSlatCh7, 2*index,TGeoTranslation(xx,0.,-zPanel));
732 GetChamber(6)->GetGeometry()->AddEnvelopeConstituent("S07I", idSlatCh7, index,TGeoTranslation(xx,0.,0.));
733 GetChamber(7)->GetGeometry()->AddEnvelopeConstituent("S08C", idSlatCh8, 2*index-1,TGeoTranslation(xx,0.,zPanel));
734 GetChamber(7)->GetGeometry()->AddEnvelopeConstituent("S08C", idSlatCh8, 2*index,TGeoTranslation(xx,0.,-zPanel));
735 GetChamber(7)->GetGeometry()->AddEnvelopeConstituent("S08I", idSlatCh8, index,TGeoTranslation(xx,0.,0.));
736 }
737 }
d1cd2474 738 }
739
740 // position the rohacell volume inside the panel volume
741 gMC->Gspos("S07R",1,"S07C",0.,0.,0.,0,"ONLY");
742 gMC->Gspos("S08R",1,"S08C",0.,0.,0.,0,"ONLY");
743
744 // position the PCB volume inside the insulating material volume
745 gMC->Gspos("S07P",1,"S07I",0.,0.,0.,0,"ONLY");
746 gMC->Gspos("S08P",1,"S08I",0.,0.,0.,0,"ONLY");
747 // position the horizontal frame volume inside the PCB volume
748 gMC->Gspos("S07H",1,"S07P",0.,0.,0.,0,"ONLY");
749 gMC->Gspos("S08H",1,"S08P",0.,0.,0.,0,"ONLY");
750 // position the sensitive volume inside the horizontal frame volume
751 gMC->Gsposp("S07G",1,"S07H",0.,0.,0.,0,"ONLY",senspar,3);
752 gMC->Gsposp("S08G",1,"S08H",0.,0.,0.,0,"ONLY",senspar,3);
753 // position the border volumes inside the PCB volume
2057e0cc 754 Float_t yborder = ( kPcbHeight - kBframeHeight ) / 2.;
d1cd2474 755 gMC->Gspos("S07B",1,"S07P",0., yborder,0.,0,"ONLY");
756 gMC->Gspos("S07B",2,"S07P",0.,-yborder,0.,0,"ONLY");
757 gMC->Gspos("S08B",1,"S08P",0., yborder,0.,0,"ONLY");
758 gMC->Gspos("S08B",2,"S08P",0.,-yborder,0.,0,"ONLY");
759
760// // create the NULOC volume and position it in the horizontal frame
761
2057e0cc 762 gMC->Gsvolu("S07N","BOX",kNulocMaterial,nulocpar,3);
763 gMC->Gsvolu("S08N","BOX",kNulocMaterial,nulocpar,3);
d1cd2474 764 index = 0;
c10e6eaf 765 for (xx = -xxmax; xx <= xxmax; xx += 2*kNulocLength) {
d1cd2474 766 index++;
2057e0cc 767 gMC->Gspos("S07N",2*index-1,"S07B", xx, 0.,-kBframeWidth/4., 0, "ONLY");
768 gMC->Gspos("S07N",2*index ,"S07B", xx, 0., kBframeWidth/4., 0, "ONLY");
769 gMC->Gspos("S08N",2*index-1,"S08B", xx, 0.,-kBframeWidth/4., 0, "ONLY");
770 gMC->Gspos("S08N",2*index ,"S08B", xx, 0., kBframeWidth/4., 0, "ONLY");
d1cd2474 771 }
772
773// // position the volumes approximating the circular section of the pipe
2057e0cc 774 Float_t yoffs = kSensHeight/2. - kYoverlap;
d1cd2474 775 Float_t epsilon = 0.001;
c10e6eaf 776 Int_t ndiv = 6;
d1cd2474 777 Double_t divpar[3];
2057e0cc 778 Double_t dydiv= kSensHeight/ndiv;
d1cd2474 779 Double_t ydiv = yoffs -dydiv;
780 Int_t imax=0;
781 imax = 1;
782 Float_t rmin = 40.;
c10e6eaf 783 for (Int_t idiv = 0; idiv < ndiv; idiv++){
784 ydiv += dydiv;
d1cd2474 785 Float_t xdiv = 0.;
c10e6eaf 786 if (ydiv < rmin) xdiv = rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
2057e0cc 787 divpar[0] = (kPcbLength-xdiv)/2.;
d1cd2474 788 divpar[1] = dydiv/2. - epsilon;
2057e0cc 789 divpar[2] = kSensWidth/2.;
c10e6eaf 790 Float_t xvol = (kPcbLength+xdiv)/2.+1.999;
791 Float_t yvol = ydiv + dydiv/2.;
d1cd2474 792
c10e6eaf 793 for (Int_t quadrant=1; quadrant<=4; quadrant++) {
794 sprintf(idSlatCh7,"LC%d",ConvertSlatNum(1,quadrant,kNslats4-1));
795 sprintf(idSlatCh8,"LD%d",ConvertSlatNum(1,quadrant,kNslats4-1));
d1cd2474 796
c10e6eaf 797 GetChamber(6)->GetGeometry()->AddEnvelopeConstituentParam("S07G",idSlatCh7, quadrant*100+imax+4*idiv+1,
798 TGeoTranslation(xvol-kPcbLength * kNPCB4[1]/2.,yvol-kPcbLength+kYoverlap,0.),3,divpar);
799
800 GetChamber(7)->GetGeometry()->AddEnvelopeConstituentParam("S08G", idSlatCh8, quadrant*100+imax+4*idiv+1,
801 TGeoTranslation(xvol-kPcbLength * kNPCB4[1]/2.,yvol-kPcbLength+kYoverlap,0.),3,divpar);
d1cd2474 802 }
803 }
804 cout << "Geometry for Station 4...... done" << endl;
805
806 }
807
808 if (fStations[4]) {
809
810
811// //********************************************************************
812// // Station 5 **
813// //********************************************************************
814// // indices 1 and 2 for first and second chambers in the station
815// // iChamber (first chamber) kept for other quanties than Z,
816// // assumed to be the same in both chambers
c10e6eaf 817// corrected geometry (JP. Cussonneau, Ch. Finck)
d1cd2474 818
819 iChamber = GetChamber(8);
820 iChamber1 = iChamber;
821 iChamber2 = GetChamber(9);
822
2057e0cc 823 const Int_t kNslats5 = 7; // number of slats per quadrant
c10e6eaf 824 const Int_t kNPCB5[kNslats5] = {5,6,6,6,5,4,3}; // n PCB per slat
825 const Float_t kXpos5[kNslats5] = {38.5, 0., 0., 0., 0., 0., 0.};
2057e0cc 826 Float_t slatLength5[kNslats5];
d1cd2474 827
828// // create and position the slat (mother) volumes
829
830 char idSlatCh9[5];
831 char idSlatCh10[5];
832 Float_t xSlat5;
833 Float_t ySlat5;
834 angle = 0.;
835
c10e6eaf 836 for (i = 0; i < kNslats5; i++){
2057e0cc 837 slatLength5[i] = kPcbLength * kNPCB5[i] + 2. * kDslatLength;
838 xSlat5 = slatLength5[i]/2. - kVframeLength/2. +kXpos5[i];
c10e6eaf 839 if (i == 1 || i == 0) slatLength5[i] -= 2. *kDslatLength; // frame out in PCB with circular border
2057e0cc 840 ySlat5 = kSensHeight * i - kYoverlap * i;
d1cd2474 841
842 spar[0] = slatLength5[i]/2.;
2057e0cc 843 spar[1] = kSlatHeight/2.;
844 spar[2] = kSlatWidth/2. * 1.01;
c10e6eaf 845 Float_t dzCh5 = spar[2]*1.01;
d1cd2474 846 // zSlat to be checked (odd downstream or upstream?)
847 Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2];
848
2057e0cc 849 sprintf(idSlatCh9,"LE%d",kNslats5-1+i);
c10e6eaf 850 detElementNumber = 900 + i + kNslats5-1;
2057e0cc 851 gMC->Gsvolu(idSlatCh9,"BOX",kSlatMaterial,spar,3);
c10e6eaf 852 GetChamber(8)->GetGeometry()->AddEnvelope(idSlatCh9, true, TGeoTranslation(xSlat5, ySlat5, zSlat+2.*dzCh5),
853 TGeoRotation("rot1",90,angle,90,90+angle,0,0) );
d1cd2474 854
2057e0cc 855 sprintf(idSlatCh9,"LE%d",3*kNslats5-2+i);
c10e6eaf 856 detElementNumber = 950 + i + kNslats5-1;
2057e0cc 857 gMC->Gsvolu(idSlatCh9,"BOX",kSlatMaterial,spar,3);
c10e6eaf 858 GetChamber(8)->GetGeometry()->AddEnvelope(idSlatCh9, true, TGeoTranslation(-xSlat5, ySlat5, zSlat-2.*dzCh5),
859 TGeoRotation("rot2",90,180+angle,90,90+angle,180,0) );
d1cd2474 860
c10e6eaf 861 if (i > 0) {
862 sprintf(idSlatCh9,"LE%d",kNslats5-1-i);
863 detElementNumber = 900 - i + kNslats5-1;
864 gMC->Gsvolu(idSlatCh9,"BOX",kSlatMaterial,spar,3);
865 GetChamber(8)->GetGeometry()->AddEnvelope(idSlatCh9, true, TGeoTranslation(xSlat5, -ySlat5, zSlat+2.*dzCh5),
866 TGeoRotation("rot3",90,angle,90,270+angle,180,0) );
867
868 sprintf(idSlatCh9,"LE%d",3*kNslats5-2-i);
869 detElementNumber = 950 - i + kNslats5-1;
870 gMC->Gsvolu(idSlatCh9,"BOX",kSlatMaterial,spar,3);
871 GetChamber(8)->GetGeometry()->AddEnvelope(idSlatCh9, true, TGeoTranslation(-xSlat5, -ySlat5, zSlat-2.*dzCh5),
872 TGeoRotation("rot4",90,180+angle,90,270+angle,0,0) );
d1cd2474 873 }
874
2057e0cc 875 sprintf(idSlatCh10,"LF%d",kNslats5-1+i);
c10e6eaf 876 detElementNumber = 1000 + i + kNslats5-1;
2057e0cc 877 gMC->Gsvolu(idSlatCh10,"BOX",kSlatMaterial,spar,3);
c10e6eaf 878 GetChamber(9)->GetGeometry()->AddEnvelope(idSlatCh10, true, TGeoTranslation(xSlat5, ySlat5, zSlat+2.*dzCh5),
879 TGeoRotation("rot5",90,angle,90,90+angle,0,0) );
d1cd2474 880
2057e0cc 881 sprintf(idSlatCh10,"LF%d",3*kNslats5-2+i);
c10e6eaf 882 detElementNumber = 1050 + i + kNslats5-1;
2057e0cc 883 gMC->Gsvolu(idSlatCh10,"BOX",kSlatMaterial,spar,3);
c10e6eaf 884 GetChamber(9)->GetGeometry()->AddEnvelope(idSlatCh10, true, TGeoTranslation(-xSlat5, ySlat5, zSlat-2.*dzCh5),
885 TGeoRotation("rot6",90,180+angle,90,90+angle,180,0) );
886
887 if (i > 0) {
888 sprintf(idSlatCh10,"LF%d",kNslats5-1-i);
889 detElementNumber = 1000 - i + kNslats5-1;
890 gMC->Gsvolu(idSlatCh10,"BOX",kSlatMaterial,spar,3);
891 GetChamber(9)->GetGeometry()->AddEnvelope(idSlatCh10, true, TGeoTranslation(xSlat5, -ySlat5, zSlat+2.*dzCh5),
892 TGeoRotation("rot7",90,angle,90,270+angle,180,0) );
893 sprintf(idSlatCh10,"LF%d",3*kNslats5-2-i);
894 detElementNumber = 1050 - i + kNslats5-1;
895 gMC->Gsvolu(idSlatCh10,"BOX",kSlatMaterial,spar,3);
896 GetChamber(9)->GetGeometry()->AddEnvelope(idSlatCh10, true, TGeoTranslation(-xSlat5, -ySlat5, zSlat-2.*dzCh5),
897 TGeoRotation("rot8",90,180+angle,90,270+angle,0,0) );
898 }
d1cd2474 899 }
c10e6eaf 900 // // create the panel volume
d1cd2474 901
2057e0cc 902 gMC->Gsvolu("S09C","BOX",kPanelMaterial,panelpar,3);
903 gMC->Gsvolu("S10C","BOX",kPanelMaterial,panelpar,3);
d1cd2474 904
905 // create the rohacell volume
906
2057e0cc 907 gMC->Gsvolu("S09R","BOX",kRohaMaterial,rohapar,3);
908 gMC->Gsvolu("S10R","BOX",kRohaMaterial,rohapar,3);
d1cd2474 909
910 // create the insulating material volume
911
2057e0cc 912 gMC->Gsvolu("S09I","BOX",kInsuMaterial,insupar,3);
913 gMC->Gsvolu("S10I","BOX",kInsuMaterial,insupar,3);
d1cd2474 914
915 // create the PCB volume
916
2057e0cc 917 gMC->Gsvolu("S09P","BOX",kPcbMaterial,pcbpar,3);
918 gMC->Gsvolu("S10P","BOX",kPcbMaterial,pcbpar,3);
d1cd2474 919
920 // create the sensitive volumes,
921
2057e0cc 922 gMC->Gsvolu("S09G","BOX",kSensMaterial,dum,0);
923 gMC->Gsvolu("S10G","BOX",kSensMaterial,dum,0);
d1cd2474 924
925 // create the vertical frame volume
926
2057e0cc 927 gMC->Gsvolu("S09V","BOX",kVframeMaterial,vFramepar,3);
928 gMC->Gsvolu("S10V","BOX",kVframeMaterial,vFramepar,3);
d1cd2474 929
930 // create the horizontal frame volume
931
2057e0cc 932 gMC->Gsvolu("S09H","BOX",kHframeMaterial,hFramepar,3);
933 gMC->Gsvolu("S10H","BOX",kHframeMaterial,hFramepar,3);
d1cd2474 934
935 // create the horizontal border volume
936
2057e0cc 937 gMC->Gsvolu("S09B","BOX",kBframeMaterial,bFramepar,3);
938 gMC->Gsvolu("S10B","BOX",kBframeMaterial,bFramepar,3);
d1cd2474 939
c10e6eaf 940 index = 0;
941 for (i = 0; i < kNslats5; i++){
942 for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
d1cd2474 943
c10e6eaf 944 if (i == 0 && quadrant == 2) continue;
945 if (i == 0 && quadrant == 4) continue;
d1cd2474 946
c10e6eaf 947 sprintf(idSlatCh9,"LE%d",ConvertSlatNum(i,quadrant,kNslats5-1));
948 sprintf(idSlatCh10,"LF%d",ConvertSlatNum(i,quadrant,kNslats5-1));
949 Float_t xvFrame = (slatLength5[i] - kVframeLength)/2.;
d1cd2474 950
c10e6eaf 951 // position the vertical frames
952 if (i!=1 && i!=0) {
953 GetChamber(8)->GetGeometry()->AddEnvelopeConstituent("S09V", idSlatCh9, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
954 GetChamber(8)->GetGeometry()->AddEnvelopeConstituent("S09V", idSlatCh9, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
955 GetChamber(9)->GetGeometry()->AddEnvelopeConstituent("S10V", idSlatCh10, (2*i-1)*10+quadrant,TGeoTranslation(xvFrame,0.,0.));
956 GetChamber(9)->GetGeometry()->AddEnvelopeConstituent("S10V", idSlatCh10, (2*i)*10+quadrant,TGeoTranslation(-xvFrame,0.,0.));
957 }
d1cd2474 958
c10e6eaf 959 // position the panels and the insulating material
960 for (j = 0; j < kNPCB5[i]; j++){
961 if (i == 1 && j == 0) continue;
962 index++;
963 Float_t xx = kSensLength * (-kNPCB5[i]/2.+j+.5);
964
965 Float_t zPanel = spar[2] - panelpar[2];
966 GetChamber(8)->GetGeometry()->AddEnvelopeConstituent("S09C", idSlatCh9, 2*index-1,TGeoTranslation(xx,0.,zPanel));
967 GetChamber(8)->GetGeometry()->AddEnvelopeConstituent("S09C", idSlatCh9, 2*index,TGeoTranslation(xx,0.,-zPanel));
968 GetChamber(8)->GetGeometry()->AddEnvelopeConstituent("S09I", idSlatCh9, index,TGeoTranslation(xx,0.,0.));
969 GetChamber(9)->GetGeometry()->AddEnvelopeConstituent("S10C", idSlatCh10, 2*index-1,TGeoTranslation(xx,0.,zPanel));
970 GetChamber(9)->GetGeometry()->AddEnvelopeConstituent("S10C", idSlatCh10, 2*index,TGeoTranslation(xx,0.,-zPanel));
971 GetChamber(9)->GetGeometry()->AddEnvelopeConstituent("S10I", idSlatCh10, index,TGeoTranslation(xx,0.,0.));
972 }
973 }
d1cd2474 974 }
975
976 // position the rohacell volume inside the panel volume
977 gMC->Gspos("S09R",1,"S09C",0.,0.,0.,0,"ONLY");
978 gMC->Gspos("S10R",1,"S10C",0.,0.,0.,0,"ONLY");
979
980 // position the PCB volume inside the insulating material volume
981 gMC->Gspos("S09P",1,"S09I",0.,0.,0.,0,"ONLY");
982 gMC->Gspos("S10P",1,"S10I",0.,0.,0.,0,"ONLY");
983 // position the horizontal frame volume inside the PCB volume
984 gMC->Gspos("S09H",1,"S09P",0.,0.,0.,0,"ONLY");
985 gMC->Gspos("S10H",1,"S10P",0.,0.,0.,0,"ONLY");
986 // position the sensitive volume inside the horizontal frame volume
987 gMC->Gsposp("S09G",1,"S09H",0.,0.,0.,0,"ONLY",senspar,3);
988 gMC->Gsposp("S10G",1,"S10H",0.,0.,0.,0,"ONLY",senspar,3);
989 // position the border volumes inside the PCB volume
2057e0cc 990 Float_t yborder = ( kPcbHeight - kBframeHeight ) / 2.;
d1cd2474 991 gMC->Gspos("S09B",1,"S09P",0., yborder,0.,0,"ONLY");
992 gMC->Gspos("S09B",2,"S09P",0.,-yborder,0.,0,"ONLY");
993 gMC->Gspos("S10B",1,"S10P",0., yborder,0.,0,"ONLY");
994 gMC->Gspos("S10B",2,"S10P",0.,-yborder,0.,0,"ONLY");
995
c10e6eaf 996 // // create the NULOC volume and position it in the horizontal frame
d1cd2474 997
2057e0cc 998 gMC->Gsvolu("S09N","BOX",kNulocMaterial,nulocpar,3);
999 gMC->Gsvolu("S10N","BOX",kNulocMaterial,nulocpar,3);
d1cd2474 1000 index = 0;
c10e6eaf 1001 for (xx = -xxmax; xx <= xxmax; xx += 2*kNulocLength) {
d1cd2474 1002 index++;
2057e0cc 1003 gMC->Gspos("S09N",2*index-1,"S09B", xx, 0.,-kBframeWidth/4., 0, "ONLY");
1004 gMC->Gspos("S09N",2*index ,"S09B", xx, 0., kBframeWidth/4., 0, "ONLY");
1005 gMC->Gspos("S10N",2*index-1,"S10B", xx, 0.,-kBframeWidth/4., 0, "ONLY");
1006 gMC->Gspos("S10N",2*index ,"S10B", xx, 0., kBframeWidth/4., 0, "ONLY");
d1cd2474 1007 }
1008
c10e6eaf 1009 // // position the volumes approximating the circular section of the pipe
2057e0cc 1010 Float_t yoffs = kSensHeight/2. - kYoverlap;
d1cd2474 1011 Float_t epsilon = 0.001;
c10e6eaf 1012 Int_t ndiv = 6;
d1cd2474 1013 Double_t divpar[3];
c10e6eaf 1014 Double_t dydiv = kSensHeight/ndiv;
d1cd2474 1015 Double_t ydiv = yoffs -dydiv;
c10e6eaf 1016 Int_t imax = 0;
2057e0cc 1017 // for (Int_t islat=0; islat<kNslats3; islat++) imax += kNPCB3[islat];
d1cd2474 1018 imax = 1;
1019 Float_t rmin = 40.;
c10e6eaf 1020 for (Int_t idiv = 0;idiv < ndiv; idiv++){
1021 ydiv += dydiv;
d1cd2474 1022 Float_t xdiv = 0.;
c10e6eaf 1023 if (ydiv < rmin) xdiv = rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
2057e0cc 1024 divpar[0] = (kPcbLength-xdiv)/2.;
d1cd2474 1025 divpar[1] = dydiv/2. - epsilon;
2057e0cc 1026 divpar[2] = kSensWidth/2.;
c10e6eaf 1027 Float_t xvol = (kPcbLength+xdiv)/2.+ 1.999;
1028 Float_t yvol = ydiv + dydiv/2.;
d1cd2474 1029
c10e6eaf 1030 for (Int_t quadrant = 1; quadrant <= 4; quadrant++) {
1031 sprintf(idSlatCh9,"LE%d",ConvertSlatNum(1,quadrant,kNslats5-1));
1032 sprintf(idSlatCh10,"LF%d",ConvertSlatNum(1,quadrant,kNslats5-1));
d1cd2474 1033
c10e6eaf 1034 GetChamber(8)->GetGeometry()->AddEnvelopeConstituentParam("S09G", idSlatCh9, quadrant*100+imax+4*idiv+1,
1035 TGeoTranslation(xvol-kPcbLength * kNPCB5[1]/2.,yvol-kPcbLength+kYoverlap,0.),3,divpar);
1036
1037 GetChamber(9)->GetGeometry()->AddEnvelopeConstituentParam("S10G", idSlatCh10, quadrant*100+imax+4*idiv+1,
1038 TGeoTranslation(xvol-kPcbLength * kNPCB5[1]/2.,yvol-kPcbLength+kYoverlap,0.),3,divpar);
d1cd2474 1039 }
1040 }
1041 cout << "Geometry for Station 5...... done" << endl;
1042
1043 }
1044}
1045
1046
1047//______________________________________________________________________________
1048void AliMUONSlatGeometryBuilder::SetTransformations()
1049{
1050// Defines the transformations for the station2 chambers.
1051// ---
1052
1053 AliMUONChamber* iChamber1 = GetChamber(4);
1054 Double_t zpos1 = - iChamber1->Z();
1055 iChamber1->GetGeometry()
1056 ->SetTranslation(TGeoTranslation(0., 0., zpos1));
1057
1058 AliMUONChamber* iChamber2 = GetChamber(5);
1059 Double_t zpos2 = - iChamber2->Z();
1060 iChamber2->GetGeometry()
1061 ->SetTranslation(TGeoTranslation(0., 0., zpos2));
1062
1063 iChamber1 = GetChamber(6);
1064 zpos1 = - iChamber1->Z();
1065 iChamber1->GetGeometry()
1066 ->SetTranslation(TGeoTranslation(0., 0., zpos1));
1067
1068 iChamber2 = GetChamber(7);
1069 zpos2 = - iChamber2->Z();
1070 iChamber2->GetGeometry()
1071 ->SetTranslation(TGeoTranslation(0., 0., zpos2));
1072
1073 iChamber1 = GetChamber(8);
1074 zpos1 = - iChamber1->Z();
1075 iChamber1->GetGeometry()
1076 ->SetTranslation(TGeoTranslation(0., 0., zpos1));
1077
1078 iChamber2 = GetChamber(9);
1079 zpos2 = - iChamber2->Z();
1080 iChamber2->GetGeometry()
1081 ->SetTranslation(TGeoTranslation(0., 0., zpos2));
1082
1083}
1084
1085//______________________________________________________________________________
1086void AliMUONSlatGeometryBuilder::SetSensitiveVolumes()
1087{
1088// Defines the sensitive volumes for slat stations chambers.
1089// ---
1090
1091 GetChamber(4)->GetGeometry()->SetSensitiveVolume("S05G");
1092 GetChamber(5)->GetGeometry()->SetSensitiveVolume("S06G");
1093 GetChamber(6)->GetGeometry()->SetSensitiveVolume("S07G");
1094 GetChamber(7)->GetGeometry()->SetSensitiveVolume("S08G");
1095 GetChamber(8)->GetGeometry()->SetSensitiveVolume("S09G");
1096 GetChamber(9)->GetGeometry()->SetSensitiveVolume("S10G");
1097}
1098
1099//______________________________________________________________________________
1100Int_t AliMUONSlatGeometryBuilder::ConvertSlatNum(Int_t numslat, Int_t quadnum, Int_t fspq) const
1101{
2057e0cc 1102// On-line function establishing the correspondance between numslat (the slat number on a particular quadrant (numslat->0....4 for St3))
1103// and slatnum (the slat number on the whole panel (slatnum->1...18 for St3)
c10e6eaf 1104 numslat += 1;
1105 if (quadnum==2 || quadnum==3)
1106 numslat += fspq;
1107 else
1108 numslat = fspq + 2-numslat;
1109 numslat -= 1;
d1cd2474 1110
c10e6eaf 1111 if (quadnum==3 || quadnum==4) numslat += 2*fspq+1;
1112
1113 return numslat;
d1cd2474 1114}