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