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