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