1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 purpeateose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 /////////////////////////////////////////////////////////
19 // Manager and hits classes for set:MUON version 0 //
20 /////////////////////////////////////////////////////////
23 #include <Riostream.h>
24 #include <TClonesArray.h>
25 #include <TLorentzVector.h>
29 #include <TVirtualMC.h>
31 #include "AliCallf77.h"
33 #include "AliMUONChamber.h"
34 #include "AliMUONConstants.h"
35 #include "AliMUONFactory.h"
36 #include "AliMUONHit.h"
37 #include "AliMUONPadHit.h"
38 #include "AliMUONTriggerCircuit.h"
39 #include "AliMUONv1.h"
45 //___________________________________________
46 AliMUONv1::AliMUONv1() : AliMUON()
51 fStepManagerVersionOld = kFALSE;
52 fStepManagerVersionNew = kFALSE;
53 fStepManagerVersionTest = kFALSE;
55 fStepMaxInActiveGas = 2.0;
59 //___________________________________________
60 AliMUONv1::AliMUONv1(const char *name, const char *title)
64 // By default include all stations
65 fStations = new Int_t[5];
66 for (Int_t i=0; i<5; i++) fStations[i] = 1;
68 AliMUONFactory factory;
69 factory.Build(this, title);
71 fStepManagerVersionOld = kFALSE;
72 fStepManagerVersionNew = kFALSE;
73 fStepManagerVersionTest = kFALSE;
75 fStepMaxInActiveGas = 2.0;
78 //___________________________________________
79 void AliMUONv1::CreateGeometry()
82 // Note: all chambers have the same structure, which could be
83 // easily parameterised. This was intentionally not done in order
84 // to give a starting point for the implementation of the actual
85 // design of each station.
86 Int_t *idtmed = fIdtmed->GetArray()-1099;
88 // Distance between Stations
93 Float_t zpos1, zpos2, zfpos;
94 // Outer excess and inner recess for mother volume radius
95 // with respect to ROuter and RInner
96 Float_t dframep=.001; // Value for station 3 should be 6 ...
97 // Width (RdPhi) of the frame crosses for stations 1 and 2 (cm)
98 // Float_t dframep1=.001;
99 Float_t dframep1 = 11.0;
100 // Bool_t frameCrosses=kFALSE;
101 Bool_t frameCrosses=kTRUE;
104 // Float_t dframez=0.9;
105 // Half of the total thickness of frame crosses (including DAlu)
106 // for each chamber in stations 1 and 2:
107 // 3% of X0 of composite material,
108 // but taken as Aluminium here, with same thickness in number of X0
109 Float_t dframez = 3. * 8.9 / 100;
114 // Rotation matrices in the x-y plane
117 AliMatrix(idrotm[1100], 90., 0., 90., 90., 0., 0.);
119 AliMatrix(idrotm[1101], 90., 90., 90., 180., 0., 0.);
121 AliMatrix(idrotm[1102], 90., 180., 90., 270., 0., 0.);
123 AliMatrix(idrotm[1103], 90., 270., 90., 0., 0., 0.);
125 Float_t phi=2*TMath::Pi()/12/2;
128 // pointer to the current chamber
129 // pointer to the current chamber
130 Int_t idAlu1=idtmed[1103]; // medium 4
131 Int_t idAlu2=idtmed[1104]; // medium 5
132 // Int_t idAlu1=idtmed[1100];
133 // Int_t idAlu2=idtmed[1100];
134 Int_t idAir=idtmed[1100]; // medium 1
135 // Int_t idGas=idtmed[1105]; // medium 6 = Ar-isoC4H10 gas
136 Int_t idGas=idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
139 AliMUONChamber *iChamber, *iChamber1, *iChamber2;
143 //********************************************************************
145 //********************************************************************
147 // indices 1 and 2 for first and second chambers in the station
148 // iChamber (first chamber) kept for other quanties than Z,
149 // assumed to be the same in both chambers
150 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[0];
151 iChamber2 =(AliMUONChamber*) (*fChambers)[1];
152 zpos1=iChamber1->Z();
153 zpos2=iChamber2->Z();
154 dstation = TMath::Abs(zpos2 - zpos1);
155 // DGas decreased from standard one (0.5)
156 iChamber->SetDGas(0.4); iChamber2->SetDGas(0.4);
157 // DAlu increased from standard one (3% of X0),
158 // because more electronics with smaller pads
159 iChamber->SetDAlu(3.5 * 8.9 / 100.); iChamber2->SetDAlu(3.5 * 8.9 / 100.);
160 zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
164 tpar[0] = iChamber->RInner()-dframep;
165 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
166 tpar[2] = dstation/5;
168 gMC->Gsvolu("S01M", "TUBE", idAir, tpar, 3);
169 gMC->Gsvolu("S02M", "TUBE", idAir, tpar, 3);
170 gMC->Gspos("S01M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
171 gMC->Gspos("S02M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
172 // // Aluminium frames
174 // pgpar[0] = 360/12/2;
178 // pgpar[4] = -dframez/2;
179 // pgpar[5] = iChamber->ROuter();
180 // pgpar[6] = pgpar[5]+dframep1;
181 // pgpar[7] = +dframez/2;
182 // pgpar[8] = pgpar[5];
183 // pgpar[9] = pgpar[6];
184 // gMC->Gsvolu("S01O", "PGON", idAlu1, pgpar, 10);
185 // gMC->Gsvolu("S02O", "PGON", idAlu1, pgpar, 10);
186 // gMC->Gspos("S01O",1,"S01M", 0.,0.,-zfpos, 0,"ONLY");
187 // gMC->Gspos("S01O",2,"S01M", 0.,0.,+zfpos, 0,"ONLY");
188 // gMC->Gspos("S02O",1,"S02M", 0.,0.,-zfpos, 0,"ONLY");
189 // gMC->Gspos("S02O",2,"S02M", 0.,0.,+zfpos, 0,"ONLY");
192 // tpar[0]= iChamber->RInner()-dframep1;
193 // tpar[1]= iChamber->RInner();
194 // tpar[2]= dframez/2;
195 // gMC->Gsvolu("S01I", "TUBE", idAlu1, tpar, 3);
196 // gMC->Gsvolu("S02I", "TUBE", idAlu1, tpar, 3);
198 // gMC->Gspos("S01I",1,"S01M", 0.,0.,-zfpos, 0,"ONLY");
199 // gMC->Gspos("S01I",2,"S01M", 0.,0.,+zfpos, 0,"ONLY");
200 // gMC->Gspos("S02I",1,"S02M", 0.,0.,-zfpos, 0,"ONLY");
201 // gMC->Gspos("S02I",2,"S02M", 0.,0.,+zfpos, 0,"ONLY");
206 // security for inside mother volume
207 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
208 * TMath::Cos(TMath::ASin(dframep1 /
209 (iChamber->ROuter() - iChamber->RInner())))
211 bpar[1] = dframep1/2;
212 // total thickness will be (4 * bpar[2]) for each chamber,
213 // which has to be equal to (2 * dframez) - DAlu
214 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
215 gMC->Gsvolu("S01B", "BOX", idAlu1, bpar, 3);
216 gMC->Gsvolu("S02B", "BOX", idAlu1, bpar, 3);
218 gMC->Gspos("S01B",1,"S01M", -iChamber->RInner()-bpar[0] , 0, zfpos,
219 idrotm[1100],"ONLY");
220 gMC->Gspos("S01B",2,"S01M", iChamber->RInner()+bpar[0] , 0, zfpos,
221 idrotm[1100],"ONLY");
222 gMC->Gspos("S01B",3,"S01M", 0, -iChamber->RInner()-bpar[0] , zfpos,
223 idrotm[1101],"ONLY");
224 gMC->Gspos("S01B",4,"S01M", 0, iChamber->RInner()+bpar[0] , zfpos,
225 idrotm[1101],"ONLY");
226 gMC->Gspos("S01B",5,"S01M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
227 idrotm[1100],"ONLY");
228 gMC->Gspos("S01B",6,"S01M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
229 idrotm[1100],"ONLY");
230 gMC->Gspos("S01B",7,"S01M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
231 idrotm[1101],"ONLY");
232 gMC->Gspos("S01B",8,"S01M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
233 idrotm[1101],"ONLY");
235 gMC->Gspos("S02B",1,"S02M", -iChamber->RInner()-bpar[0] , 0, zfpos,
236 idrotm[1100],"ONLY");
237 gMC->Gspos("S02B",2,"S02M", iChamber->RInner()+bpar[0] , 0, zfpos,
238 idrotm[1100],"ONLY");
239 gMC->Gspos("S02B",3,"S02M", 0, -iChamber->RInner()-bpar[0] , zfpos,
240 idrotm[1101],"ONLY");
241 gMC->Gspos("S02B",4,"S02M", 0, iChamber->RInner()+bpar[0] , zfpos,
242 idrotm[1101],"ONLY");
243 gMC->Gspos("S02B",5,"S02M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
244 idrotm[1100],"ONLY");
245 gMC->Gspos("S02B",6,"S02M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
246 idrotm[1100],"ONLY");
247 gMC->Gspos("S02B",7,"S02M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
248 idrotm[1101],"ONLY");
249 gMC->Gspos("S02B",8,"S02M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
250 idrotm[1101],"ONLY");
253 // Chamber Material represented by Alu sheet
254 tpar[0]= iChamber->RInner();
255 tpar[1]= iChamber->ROuter();
256 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
257 gMC->Gsvolu("S01A", "TUBE", idAlu2, tpar, 3);
258 gMC->Gsvolu("S02A", "TUBE",idAlu2, tpar, 3);
259 gMC->Gspos("S01A", 1, "S01M", 0., 0., 0., 0, "ONLY");
260 gMC->Gspos("S02A", 1, "S02M", 0., 0., 0., 0, "ONLY");
263 // tpar[2] = iChamber->DGas();
264 tpar[2] = iChamber->DGas()/2;
265 gMC->Gsvolu("S01G", "TUBE", idGas, tpar, 3);
266 gMC->Gsvolu("S02G", "TUBE", idGas, tpar, 3);
267 gMC->Gspos("S01G", 1, "S01A", 0., 0., 0., 0, "ONLY");
268 gMC->Gspos("S02G", 1, "S02A", 0., 0., 0., 0, "ONLY");
270 // Frame Crosses to be placed inside gas
271 // NONE: chambers are sensitive everywhere
272 // if (frameCrosses) {
274 // dr = (iChamber->ROuter() - iChamber->RInner());
275 // bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
276 // bpar[1] = dframep1/2;
277 // bpar[2] = iChamber->DGas()/2;
278 // gMC->Gsvolu("S01F", "BOX", idAlu1, bpar, 3);
279 // gMC->Gsvolu("S02F", "BOX", idAlu1, bpar, 3);
281 // gMC->Gspos("S01F",1,"S01G", +iChamber->RInner()+bpar[0] , 0, 0,
282 // idrotm[1100],"ONLY");
283 // gMC->Gspos("S01F",2,"S01G", -iChamber->RInner()-bpar[0] , 0, 0,
284 // idrotm[1100],"ONLY");
285 // gMC->Gspos("S01F",3,"S01G", 0, +iChamber->RInner()+bpar[0] , 0,
286 // idrotm[1101],"ONLY");
287 // gMC->Gspos("S01F",4,"S01G", 0, -iChamber->RInner()-bpar[0] , 0,
288 // idrotm[1101],"ONLY");
290 // gMC->Gspos("S02F",1,"S02G", +iChamber->RInner()+bpar[0] , 0, 0,
291 // idrotm[1100],"ONLY");
292 // gMC->Gspos("S02F",2,"S02G", -iChamber->RInner()-bpar[0] , 0, 0,
293 // idrotm[1100],"ONLY");
294 // gMC->Gspos("S02F",3,"S02G", 0, +iChamber->RInner()+bpar[0] , 0,
295 // idrotm[1101],"ONLY");
296 // gMC->Gspos("S02F",4,"S02G", 0, -iChamber->RInner()-bpar[0] , 0,
297 // idrotm[1101],"ONLY");
302 //********************************************************************
304 //********************************************************************
305 // indices 1 and 2 for first and second chambers in the station
306 // iChamber (first chamber) kept for other quanties than Z,
307 // assumed to be the same in both chambers
308 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[2];
309 iChamber2 =(AliMUONChamber*) (*fChambers)[3];
310 zpos1=iChamber1->Z();
311 zpos2=iChamber2->Z();
312 dstation = TMath::Abs(zpos2 - zpos1);
313 // DGas and DAlu not changed from standard values
314 zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
318 tpar[0] = iChamber->RInner()-dframep;
319 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
320 tpar[2] = dstation/5;
322 gMC->Gsvolu("S03M", "TUBE", idAir, tpar, 3);
323 gMC->Gsvolu("S04M", "TUBE", idAir, tpar, 3);
324 gMC->Gspos("S03M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
325 gMC->Gspos("S04M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
326 gMC->Gsbool("S03M", "L3DO");
327 gMC->Gsbool("S03M", "L3O1");
328 gMC->Gsbool("S03M", "L3O2");
329 gMC->Gsbool("S04M", "L3DO");
330 gMC->Gsbool("S04M", "L3O1");
331 gMC->Gsbool("S04M", "L3O2");
333 // // Aluminium frames
335 // pgpar[0] = 360/12/2;
339 // pgpar[4] = -dframez/2;
340 // pgpar[5] = iChamber->ROuter();
341 // pgpar[6] = pgpar[5]+dframep;
342 // pgpar[7] = +dframez/2;
343 // pgpar[8] = pgpar[5];
344 // pgpar[9] = pgpar[6];
345 // gMC->Gsvolu("S03O", "PGON", idAlu1, pgpar, 10);
346 // gMC->Gsvolu("S04O", "PGON", idAlu1, pgpar, 10);
347 // gMC->Gspos("S03O",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
348 // gMC->Gspos("S03O",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
349 // gMC->Gspos("S04O",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
350 // gMC->Gspos("S04O",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
353 // tpar[0]= iChamber->RInner()-dframep;
354 // tpar[1]= iChamber->RInner();
355 // tpar[2]= dframez/2;
356 // gMC->Gsvolu("S03I", "TUBE", idAlu1, tpar, 3);
357 // gMC->Gsvolu("S04I", "TUBE", idAlu1, tpar, 3);
359 // gMC->Gspos("S03I",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
360 // gMC->Gspos("S03I",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
361 // gMC->Gspos("S04I",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
362 // gMC->Gspos("S04I",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
367 // security for inside mother volume
368 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
369 * TMath::Cos(TMath::ASin(dframep1 /
370 (iChamber->ROuter() - iChamber->RInner())))
372 bpar[1] = dframep1/2;
373 // total thickness will be (4 * bpar[2]) for each chamber,
374 // which has to be equal to (2 * dframez) - DAlu
375 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
376 gMC->Gsvolu("S03B", "BOX", idAlu1, bpar, 3);
377 gMC->Gsvolu("S04B", "BOX", idAlu1, bpar, 3);
379 gMC->Gspos("S03B",1,"S03M", -iChamber->RInner()-bpar[0] , 0, zfpos,
380 idrotm[1100],"ONLY");
381 gMC->Gspos("S03B",2,"S03M", +iChamber->RInner()+bpar[0] , 0, zfpos,
382 idrotm[1100],"ONLY");
383 gMC->Gspos("S03B",3,"S03M", 0, -iChamber->RInner()-bpar[0] , zfpos,
384 idrotm[1101],"ONLY");
385 gMC->Gspos("S03B",4,"S03M", 0, +iChamber->RInner()+bpar[0] , zfpos,
386 idrotm[1101],"ONLY");
387 gMC->Gspos("S03B",5,"S03M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
388 idrotm[1100],"ONLY");
389 gMC->Gspos("S03B",6,"S03M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
390 idrotm[1100],"ONLY");
391 gMC->Gspos("S03B",7,"S03M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
392 idrotm[1101],"ONLY");
393 gMC->Gspos("S03B",8,"S03M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
394 idrotm[1101],"ONLY");
396 gMC->Gspos("S04B",1,"S04M", -iChamber->RInner()-bpar[0] , 0, zfpos,
397 idrotm[1100],"ONLY");
398 gMC->Gspos("S04B",2,"S04M", +iChamber->RInner()+bpar[0] , 0, zfpos,
399 idrotm[1100],"ONLY");
400 gMC->Gspos("S04B",3,"S04M", 0, -iChamber->RInner()-bpar[0] , zfpos,
401 idrotm[1101],"ONLY");
402 gMC->Gspos("S04B",4,"S04M", 0, +iChamber->RInner()+bpar[0] , zfpos,
403 idrotm[1101],"ONLY");
404 gMC->Gspos("S04B",5,"S04M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
405 idrotm[1100],"ONLY");
406 gMC->Gspos("S04B",6,"S04M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
407 idrotm[1100],"ONLY");
408 gMC->Gspos("S04B",7,"S04M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
409 idrotm[1101],"ONLY");
410 gMC->Gspos("S04B",8,"S04M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
411 idrotm[1101],"ONLY");
414 // Chamber Material represented by Alu sheet
415 tpar[0]= iChamber->RInner();
416 tpar[1]= iChamber->ROuter();
417 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
418 gMC->Gsvolu("S03A", "TUBE", idAlu2, tpar, 3);
419 gMC->Gsvolu("S04A", "TUBE", idAlu2, tpar, 3);
420 gMC->Gspos("S03A", 1, "S03M", 0., 0., 0., 0, "ONLY");
421 gMC->Gspos("S04A", 1, "S04M", 0., 0., 0., 0, "ONLY");
424 // tpar[2] = iChamber->DGas();
425 tpar[2] = iChamber->DGas()/2;
426 gMC->Gsvolu("S03G", "TUBE", idGas, tpar, 3);
427 gMC->Gsvolu("S04G", "TUBE", idGas, tpar, 3);
428 gMC->Gspos("S03G", 1, "S03A", 0., 0., 0., 0, "ONLY");
429 gMC->Gspos("S04G", 1, "S04A", 0., 0., 0., 0, "ONLY");
431 // Frame Crosses to be placed inside gas
432 // NONE: chambers are sensitive everywhere
433 // if (frameCrosses) {
435 // dr = (iChamber->ROuter() - iChamber->RInner());
436 // bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
437 // bpar[1] = dframep1/2;
438 // bpar[2] = iChamber->DGas()/2;
439 // gMC->Gsvolu("S03F", "BOX", idAlu1, bpar, 3);
440 // gMC->Gsvolu("S04F", "BOX", idAlu1, bpar, 3);
442 // gMC->Gspos("S03F",1,"S03G", +iChamber->RInner()+bpar[0] , 0, 0,
443 // idrotm[1100],"ONLY");
444 // gMC->Gspos("S03F",2,"S03G", -iChamber->RInner()-bpar[0] , 0, 0,
445 // idrotm[1100],"ONLY");
446 // gMC->Gspos("S03F",3,"S03G", 0, +iChamber->RInner()+bpar[0] , 0,
447 // idrotm[1101],"ONLY");
448 // gMC->Gspos("S03F",4,"S03G", 0, -iChamber->RInner()-bpar[0] , 0,
449 // idrotm[1101],"ONLY");
451 // gMC->Gspos("S04F",1,"S04G", +iChamber->RInner()+bpar[0] , 0, 0,
452 // idrotm[1100],"ONLY");
453 // gMC->Gspos("S04F",2,"S04G", -iChamber->RInner()-bpar[0] , 0, 0,
454 // idrotm[1100],"ONLY");
455 // gMC->Gspos("S04F",3,"S04G", 0, +iChamber->RInner()+bpar[0] , 0,
456 // idrotm[1101],"ONLY");
457 // gMC->Gspos("S04F",4,"S04G", 0, -iChamber->RInner()-bpar[0] , 0,
458 // idrotm[1101],"ONLY");
461 // define the id of tracking media:
462 Int_t idCopper = idtmed[1110];
463 Int_t idGlass = idtmed[1111];
464 Int_t idCarbon = idtmed[1112];
465 Int_t idRoha = idtmed[1113];
467 // sensitive area: 40*40 cm**2
468 const Float_t sensLength = 40.;
469 const Float_t sensHeight = 40.;
470 const Float_t sensWidth = 0.5; // according to TDR fig 2.120
471 const Int_t sensMaterial = idGas;
472 const Float_t yOverlap = 1.5;
474 // PCB dimensions in cm; width: 30 mum copper
475 const Float_t pcbLength = sensLength;
476 const Float_t pcbHeight = 60.;
477 const Float_t pcbWidth = 0.003;
478 const Int_t pcbMaterial = idCopper;
480 // Insulating material: 200 mum glass fiber glued to pcb
481 const Float_t insuLength = pcbLength;
482 const Float_t insuHeight = pcbHeight;
483 const Float_t insuWidth = 0.020;
484 const Int_t insuMaterial = idGlass;
486 // Carbon fiber panels: 200mum carbon/epoxy skin
487 const Float_t panelLength = sensLength;
488 const Float_t panelHeight = sensHeight;
489 const Float_t panelWidth = 0.020;
490 const Int_t panelMaterial = idCarbon;
492 // rohacell between the two carbon panels
493 const Float_t rohaLength = sensLength;
494 const Float_t rohaHeight = sensHeight;
495 const Float_t rohaWidth = 0.5;
496 const Int_t rohaMaterial = idRoha;
498 // Frame around the slat: 2 sticks along length,2 along height
499 // H: the horizontal ones
500 const Float_t hFrameLength = pcbLength;
501 const Float_t hFrameHeight = 1.5;
502 const Float_t hFrameWidth = sensWidth;
503 const Int_t hFrameMaterial = idGlass;
505 // V: the vertical ones
506 const Float_t vFrameLength = 4.0;
507 const Float_t vFrameHeight = sensHeight + hFrameHeight;
508 const Float_t vFrameWidth = sensWidth;
509 const Int_t vFrameMaterial = idGlass;
511 // B: the horizontal border filled with rohacell
512 const Float_t bFrameLength = hFrameLength;
513 const Float_t bFrameHeight = (pcbHeight - sensHeight)/2. - hFrameHeight;
514 const Float_t bFrameWidth = hFrameWidth;
515 const Int_t bFrameMaterial = idRoha;
517 // NULOC: 30 mum copper + 200 mum vetronite (same radiation length as 14mum copper)
518 const Float_t nulocLength = 2.5;
519 const Float_t nulocHeight = 7.5;
520 const Float_t nulocWidth = 0.0030 + 0.0014; // equivalent copper width of vetronite;
521 const Int_t nulocMaterial = idCopper;
523 const Float_t slatHeight = pcbHeight;
524 const Float_t slatWidth = sensWidth + 2.*(pcbWidth + insuWidth +
525 2.* panelWidth + rohaWidth);
526 const Int_t slatMaterial = idAir;
527 const Float_t dSlatLength = vFrameLength; // border on left and right
532 // the panel volume contains the rohacell
534 Float_t twidth = 2 * panelWidth + rohaWidth;
535 Float_t panelpar[3] = { panelLength/2., panelHeight/2., twidth/2. };
536 Float_t rohapar[3] = { rohaLength/2., rohaHeight/2., rohaWidth/2. };
538 // insulating material contains PCB-> gas-> 2 borders filled with rohacell
540 twidth = 2*(insuWidth + pcbWidth) + sensWidth;
541 Float_t insupar[3] = { insuLength/2., insuHeight/2., twidth/2. };
542 twidth -= 2 * insuWidth;
543 Float_t pcbpar[3] = { pcbLength/2., pcbHeight/2., twidth/2. };
544 Float_t senspar[3] = { sensLength/2., sensHeight/2., sensWidth/2. };
545 Float_t theight = 2*hFrameHeight + sensHeight;
546 Float_t hFramepar[3]={hFrameLength/2., theight/2., hFrameWidth/2.};
547 Float_t bFramepar[3]={bFrameLength/2., bFrameHeight/2., bFrameWidth/2.};
548 Float_t vFramepar[3]={vFrameLength/2., vFrameHeight/2., vFrameWidth/2.};
549 Float_t nulocpar[3]={nulocLength/2., nulocHeight/2., nulocWidth/2.};
551 Float_t xxmax = (bFrameLength - nulocLength)/2.;
556 //********************************************************************
558 //********************************************************************
559 // indices 1 and 2 for first and second chambers in the station
560 // iChamber (first chamber) kept for other quanties than Z,
561 // assumed to be the same in both chambers
562 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[4];
563 iChamber2 =(AliMUONChamber*) (*fChambers)[5];
564 zpos1=iChamber1->Z();
565 zpos2=iChamber2->Z();
566 dstation = TMath::Abs(zpos2 - zpos1);
570 tpar[0] = iChamber->RInner()-dframep;
571 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
572 tpar[2] = dstation/5;
574 char *slats5Mother = "S05M";
575 char *slats6Mother = "S06M";
579 if (gAlice->GetModule("DIPO")) {
583 zoffs5 = TMath::Abs(zpos1);
584 zoffs6 = TMath::Abs(zpos2);
587 gMC->Gsvolu("S05M", "TUBE", idAir, tpar, 3);
588 gMC->Gsvolu("S06M", "TUBE", idAir, tpar, 3);
589 gMC->Gspos("S05M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
590 gMC->Gspos("S06M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
593 // volumes for slat geometry (xx=5,..,10 chamber id):
594 // Sxx0 Sxx1 Sxx2 Sxx3 --> Slat Mother volumes
595 // SxxG --> Sensitive volume (gas)
596 // SxxP --> PCB (copper)
597 // SxxI --> Insulator (vetronite)
598 // SxxC --> Carbon panel
600 // SxxH, SxxV --> Horizontal and Vertical frames (vetronite)
601 // SB5x --> Volumes for the 35 cm long PCB
602 // slat dimensions: slat is a MOTHER volume!!! made of air
604 // only for chamber 5: slat 1 has a PCB shorter by 5cm!
606 Float_t tlength = 35.;
607 Float_t panelpar2[3] = { tlength/2., panelpar[1], panelpar[2]};
608 Float_t rohapar2[3] = { tlength/2., rohapar[1], rohapar[2]};
609 Float_t insupar2[3] = { tlength/2., insupar[1], insupar[2]};
610 Float_t pcbpar2[3] = { tlength/2., pcbpar[1], pcbpar[2]};
611 Float_t senspar2[3] = { tlength/2., senspar[1], senspar[2]};
612 Float_t hFramepar2[3] = { tlength/2., hFramepar[1], hFramepar[2]};
613 Float_t bFramepar2[3] = { tlength/2., bFramepar[1], bFramepar[2]};
615 const Int_t nSlats3 = 5; // number of slats per quadrant
616 const Int_t nPCB3[nSlats3] = {3,3,4,3,2}; // n PCB per slat
617 const Float_t xpos3[nSlats3] = {31., 40., 0., 0., 0.};
618 Float_t slatLength3[nSlats3];
620 // create and position the slat (mother) volumes
627 for (i = 0; i<nSlats3; i++){
628 slatLength3[i] = pcbLength * nPCB3[i] + 2. * dSlatLength;
629 xSlat3 = slatLength3[i]/2. - vFrameLength/2. + xpos3[i];
630 if (i==1 || i==0) slatLength3[i] -= 2. *dSlatLength; // frame out in PCB with circular border
631 Float_t ySlat31 = sensHeight * i - yOverlap * i;
632 Float_t ySlat32 = -sensHeight * i + yOverlap * i;
633 spar[0] = slatLength3[i]/2.;
634 spar[1] = slatHeight/2.;
635 spar[2] = slatWidth/2. * 1.01;
636 // take away 5 cm from the first slat in chamber 5
638 if (i==1 || i==2) { // 1 pcb is shortened by 5cm
639 spar2[0] = spar[0]-5./2.;
640 xSlat32 = xSlat3 - 5/2.;
648 Float_t dzCh3=spar[2] * 1.01;
649 // zSlat to be checked (odd downstream or upstream?)
650 Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2];
651 sprintf(volNam5,"S05%d",i);
652 gMC->Gsvolu(volNam5,"BOX",slatMaterial,spar2,3);
653 gMC->Gspos(volNam5, i*4+1,slats5Mother, -xSlat32, ySlat31, zoffs5-zSlat-2.*dzCh3, 0, "ONLY");
654 gMC->Gspos(volNam5, i*4+2,slats5Mother, +xSlat32, ySlat31, zoffs5-zSlat+2.*dzCh3, 0, "ONLY");
657 gMC->Gspos(volNam5, i*4+3,slats5Mother,-xSlat32, ySlat32, zoffs5-zSlat-2.*dzCh3, 0, "ONLY");
658 gMC->Gspos(volNam5, i*4+4,slats5Mother,+xSlat32, ySlat32, zoffs5-zSlat+2.*dzCh3, 0, "ONLY");
660 sprintf(volNam6,"S06%d",i);
661 gMC->Gsvolu(volNam6,"BOX",slatMaterial,spar,3);
662 gMC->Gspos(volNam6, i*4+1,slats6Mother,-xSlat3, ySlat31, zoffs6-zSlat-2.*dzCh3, 0, "ONLY");
663 gMC->Gspos(volNam6, i*4+2,slats6Mother,+xSlat3, ySlat31, zoffs6-zSlat+2.*dzCh3, 0, "ONLY");
665 gMC->Gspos(volNam6, i*4+3,slats6Mother,-xSlat3, ySlat32, zoffs6-zSlat-2.*dzCh3, 0, "ONLY");
666 gMC->Gspos(volNam6, i*4+4,slats6Mother,+xSlat3, ySlat32, zoffs6-zSlat+2.*dzCh3, 0, "ONLY");
670 // create the panel volume
672 gMC->Gsvolu("S05C","BOX",panelMaterial,panelpar,3);
673 gMC->Gsvolu("SB5C","BOX",panelMaterial,panelpar2,3);
674 gMC->Gsvolu("S06C","BOX",panelMaterial,panelpar,3);
676 // create the rohacell volume
678 gMC->Gsvolu("S05R","BOX",rohaMaterial,rohapar,3);
679 gMC->Gsvolu("SB5R","BOX",rohaMaterial,rohapar2,3);
680 gMC->Gsvolu("S06R","BOX",rohaMaterial,rohapar,3);
682 // create the insulating material volume
684 gMC->Gsvolu("S05I","BOX",insuMaterial,insupar,3);
685 gMC->Gsvolu("SB5I","BOX",insuMaterial,insupar2,3);
686 gMC->Gsvolu("S06I","BOX",insuMaterial,insupar,3);
688 // create the PCB volume
690 gMC->Gsvolu("S05P","BOX",pcbMaterial,pcbpar,3);
691 gMC->Gsvolu("SB5P","BOX",pcbMaterial,pcbpar2,3);
692 gMC->Gsvolu("S06P","BOX",pcbMaterial,pcbpar,3);
694 // create the sensitive volumes,
695 gMC->Gsvolu("S05G","BOX",sensMaterial,dum,0);
696 gMC->Gsvolu("S06G","BOX",sensMaterial,dum,0);
699 // create the vertical frame volume
701 gMC->Gsvolu("S05V","BOX",vFrameMaterial,vFramepar,3);
702 gMC->Gsvolu("S06V","BOX",vFrameMaterial,vFramepar,3);
704 // create the horizontal frame volume
706 gMC->Gsvolu("S05H","BOX",hFrameMaterial,hFramepar,3);
707 gMC->Gsvolu("SB5H","BOX",hFrameMaterial,hFramepar2,3);
708 gMC->Gsvolu("S06H","BOX",hFrameMaterial,hFramepar,3);
710 // create the horizontal border volume
712 gMC->Gsvolu("S05B","BOX",bFrameMaterial,bFramepar,3);
713 gMC->Gsvolu("SB5B","BOX",bFrameMaterial,bFramepar2,3);
714 gMC->Gsvolu("S06B","BOX",bFrameMaterial,bFramepar,3);
717 for (i = 0; i<nSlats3; i++){
718 sprintf(volNam5,"S05%d",i);
719 sprintf(volNam6,"S06%d",i);
720 Float_t xvFrame = (slatLength3[i] - vFrameLength)/2.;
721 Float_t xvFrame2 = xvFrame;
722 if ( i==1 || i ==2 ) xvFrame2 -= 5./2.;
723 // position the vertical frames
725 gMC->Gspos("S05V",2*i-1,volNam5, xvFrame2, 0., 0. , 0, "ONLY");
726 gMC->Gspos("S05V",2*i ,volNam5,-xvFrame2, 0., 0. , 0, "ONLY");
727 gMC->Gspos("S06V",2*i-1,volNam6, xvFrame, 0., 0. , 0, "ONLY");
728 gMC->Gspos("S06V",2*i ,volNam6,-xvFrame, 0., 0. , 0, "ONLY");
730 // position the panels and the insulating material
731 for (j=0; j<nPCB3[i]; j++){
733 Float_t xx = sensLength * (-nPCB3[i]/2.+j+.5);
734 Float_t xx2 = xx + 5/2.;
736 Float_t zPanel = spar[2] - panelpar[2];
737 if ( (i==1 || i==2) && j == nPCB3[i]-1) { // 1 pcb is shortened by 5cm
738 gMC->Gspos("SB5C",2*index-1,volNam5, xx, 0., zPanel , 0, "ONLY");
739 gMC->Gspos("SB5C",2*index ,volNam5, xx, 0.,-zPanel , 0, "ONLY");
740 gMC->Gspos("SB5I",index ,volNam5, xx, 0., 0 , 0, "ONLY");
742 else if ( (i==1 || i==2) && j < nPCB3[i]-1) {
743 gMC->Gspos("S05C",2*index-1,volNam5, xx2, 0., zPanel , 0, "ONLY");
744 gMC->Gspos("S05C",2*index ,volNam5, xx2, 0.,-zPanel , 0, "ONLY");
745 gMC->Gspos("S05I",index ,volNam5, xx2, 0., 0 , 0, "ONLY");
748 gMC->Gspos("S05C",2*index-1,volNam5, xx, 0., zPanel , 0, "ONLY");
749 gMC->Gspos("S05C",2*index ,volNam5, xx, 0.,-zPanel , 0, "ONLY");
750 gMC->Gspos("S05I",index ,volNam5, xx, 0., 0 , 0, "ONLY");
752 gMC->Gspos("S06C",2*index-1,volNam6, xx, 0., zPanel , 0, "ONLY");
753 gMC->Gspos("S06C",2*index ,volNam6, xx, 0.,-zPanel , 0, "ONLY");
754 gMC->Gspos("S06I",index,volNam6, xx, 0., 0 , 0, "ONLY");
758 // position the rohacell volume inside the panel volume
759 gMC->Gspos("S05R",1,"S05C",0.,0.,0.,0,"ONLY");
760 gMC->Gspos("SB5R",1,"SB5C",0.,0.,0.,0,"ONLY");
761 gMC->Gspos("S06R",1,"S06C",0.,0.,0.,0,"ONLY");
763 // position the PCB volume inside the insulating material volume
764 gMC->Gspos("S05P",1,"S05I",0.,0.,0.,0,"ONLY");
765 gMC->Gspos("SB5P",1,"SB5I",0.,0.,0.,0,"ONLY");
766 gMC->Gspos("S06P",1,"S06I",0.,0.,0.,0,"ONLY");
767 // position the horizontal frame volume inside the PCB volume
768 gMC->Gspos("S05H",1,"S05P",0.,0.,0.,0,"ONLY");
769 gMC->Gspos("SB5H",1,"SB5P",0.,0.,0.,0,"ONLY");
770 gMC->Gspos("S06H",1,"S06P",0.,0.,0.,0,"ONLY");
771 // position the sensitive volume inside the horizontal frame volume
772 gMC->Gsposp("S05G",1,"S05H",0.,0.,0.,0,"ONLY",senspar,3);
773 gMC->Gsposp("S05G",1,"SB5H",0.,0.,0.,0,"ONLY",senspar2,3);
774 gMC->Gsposp("S06G",1,"S06H",0.,0.,0.,0,"ONLY",senspar,3);
775 // position the border volumes inside the PCB volume
776 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
777 gMC->Gspos("S05B",1,"S05P",0., yborder,0.,0,"ONLY");
778 gMC->Gspos("S05B",2,"S05P",0.,-yborder,0.,0,"ONLY");
779 gMC->Gspos("SB5B",1,"SB5P",0., yborder,0.,0,"ONLY");
780 gMC->Gspos("SB5B",2,"SB5P",0.,-yborder,0.,0,"ONLY");
781 gMC->Gspos("S06B",1,"S06P",0., yborder,0.,0,"ONLY");
782 gMC->Gspos("S06B",2,"S06P",0.,-yborder,0.,0,"ONLY");
784 // create the NULOC volume and position it in the horizontal frame
786 gMC->Gsvolu("S05N","BOX",nulocMaterial,nulocpar,3);
787 gMC->Gsvolu("S06N","BOX",nulocMaterial,nulocpar,3);
789 Float_t xxmax2 = xxmax - 5./2.;
790 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
792 gMC->Gspos("S05N",2*index-1,"S05B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
793 gMC->Gspos("S05N",2*index ,"S05B", xx, 0., bFrameWidth/4., 0, "ONLY");
794 if (xx > -xxmax2 && xx< xxmax2) {
795 gMC->Gspos("S05N",2*index-1,"SB5B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
796 gMC->Gspos("S05N",2*index ,"SB5B", xx, 0., bFrameWidth/4., 0, "ONLY");
798 gMC->Gspos("S06N",2*index-1,"S06B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
799 gMC->Gspos("S06N",2*index ,"S06B", xx, 0., bFrameWidth/4., 0, "ONLY");
802 // position the volumes approximating the circular section of the pipe
803 Float_t yoffs = sensHeight/2. - yOverlap;
804 Float_t epsilon = 0.001;
807 Double_t dydiv= sensHeight/ndiv;
808 Double_t ydiv = yoffs -dydiv;
812 Float_t z1 = spar[2], z2=2*spar[2]*1.01;
813 for (Int_t idiv=0;idiv<ndiv; idiv++){
816 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
817 divpar[0] = (pcbLength-xdiv)/2.;
818 divpar[1] = dydiv/2. - epsilon;
819 divpar[2] = sensWidth/2.;
820 Float_t xvol=(pcbLength+xdiv)/2.+1.999;
821 Float_t yvol=ydiv + dydiv/2.;
822 //printf ("y ll = %f y ur = %f \n",yvol - divpar[1], yvol + divpar[1]);
823 gMC->Gsposp("S05G",imax+4*idiv+1,slats5Mother,-xvol, yvol, zoffs5-z1-z2, 0, "ONLY",divpar,3);
824 gMC->Gsposp("S06G",imax+4*idiv+1,slats6Mother,-xvol, yvol, zoffs6-z1-z2, 0, "ONLY",divpar,3);
825 gMC->Gsposp("S05G",imax+4*idiv+2,slats5Mother,-xvol,-yvol, zoffs5-z1-z2, 0, "ONLY",divpar,3);
826 gMC->Gsposp("S06G",imax+4*idiv+2,slats6Mother,-xvol,-yvol, zoffs6-z1-z2, 0, "ONLY",divpar,3);
827 gMC->Gsposp("S05G",imax+4*idiv+3,slats5Mother,+xvol, yvol, zoffs5-z1+z2, 0, "ONLY",divpar,3);
828 gMC->Gsposp("S06G",imax+4*idiv+3,slats6Mother,+xvol, yvol, zoffs6-z1+z2, 0, "ONLY",divpar,3);
829 gMC->Gsposp("S05G",imax+4*idiv+4,slats5Mother,+xvol,-yvol, zoffs5-z1+z2, 0, "ONLY",divpar,3);
830 gMC->Gsposp("S06G",imax+4*idiv+4,slats6Mother,+xvol,-yvol, zoffs6-z1+z2, 0, "ONLY",divpar,3);
836 //********************************************************************
838 //********************************************************************
839 // indices 1 and 2 for first and second chambers in the station
840 // iChamber (first chamber) kept for other quanties than Z,
841 // assumed to be the same in both chambers
842 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[6];
843 iChamber2 =(AliMUONChamber*) (*fChambers)[7];
844 zpos1=iChamber1->Z();
845 zpos2=iChamber2->Z();
846 dstation = TMath::Abs(zpos2 - zpos1);
847 // zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
851 tpar[0] = iChamber->RInner()-dframep;
852 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
853 tpar[2] = dstation/4;
855 gMC->Gsvolu("S07M", "TUBE", idAir, tpar, 3);
856 gMC->Gsvolu("S08M", "TUBE", idAir, tpar, 3);
857 gMC->Gspos("S07M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
858 gMC->Gspos("S08M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
861 const Int_t nSlats4 = 6; // number of slats per quadrant
862 const Int_t nPCB4[nSlats4] = {4,4,5,5,4,3}; // n PCB per slat
863 const Float_t xpos4[nSlats4] = {38.5, 40., 0., 0., 0., 0.};
864 Float_t slatLength4[nSlats4];
866 // create and position the slat (mother) volumes
873 for (i = 0; i<nSlats4; i++){
874 slatLength4[i] = pcbLength * nPCB4[i] + 2. * dSlatLength;
875 xSlat4 = slatLength4[i]/2. - vFrameLength/2. + xpos4[i];
876 if (i==1) slatLength4[i] -= 2. *dSlatLength; // frame out in PCB with circular border
877 ySlat4 = sensHeight * i - yOverlap *i;
879 spar[0] = slatLength4[i]/2.;
880 spar[1] = slatHeight/2.;
881 spar[2] = slatWidth/2.*1.01;
882 Float_t dzCh4=spar[2]*1.01;
883 // zSlat to be checked (odd downstream or upstream?)
884 Float_t zSlat = (i%2 ==0)? spar[2] : -spar[2];
885 sprintf(volNam7,"S07%d",i);
886 gMC->Gsvolu(volNam7,"BOX",slatMaterial,spar,3);
887 gMC->Gspos(volNam7, i*4+1,"S07M",-xSlat4, ySlat4, -zSlat-2.*dzCh4, 0, "ONLY");
888 gMC->Gspos(volNam7, i*4+2,"S07M",+xSlat4, ySlat4, -zSlat+2.*dzCh4, 0, "ONLY");
890 gMC->Gspos(volNam7, i*4+3,"S07M",-xSlat4,-ySlat4, -zSlat-2.*dzCh4, 0, "ONLY");
891 gMC->Gspos(volNam7, i*4+4,"S07M",+xSlat4,-ySlat4, -zSlat+2.*dzCh4, 0, "ONLY");
893 sprintf(volNam8,"S08%d",i);
894 gMC->Gsvolu(volNam8,"BOX",slatMaterial,spar,3);
895 gMC->Gspos(volNam8, i*4+1,"S08M",-xSlat4, ySlat4, -zSlat-2.*dzCh4, 0, "ONLY");
896 gMC->Gspos(volNam8, i*4+2,"S08M",+xSlat4, ySlat4, -zSlat+2.*dzCh4, 0, "ONLY");
898 gMC->Gspos(volNam8, i*4+3,"S08M",-xSlat4,-ySlat4, -zSlat-2.*dzCh4, 0, "ONLY");
899 gMC->Gspos(volNam8, i*4+4,"S08M",+xSlat4,-ySlat4, -zSlat+2.*dzCh4, 0, "ONLY");
904 // create the panel volume
906 gMC->Gsvolu("S07C","BOX",panelMaterial,panelpar,3);
907 gMC->Gsvolu("S08C","BOX",panelMaterial,panelpar,3);
909 // create the rohacell volume
911 gMC->Gsvolu("S07R","BOX",rohaMaterial,rohapar,3);
912 gMC->Gsvolu("S08R","BOX",rohaMaterial,rohapar,3);
914 // create the insulating material volume
916 gMC->Gsvolu("S07I","BOX",insuMaterial,insupar,3);
917 gMC->Gsvolu("S08I","BOX",insuMaterial,insupar,3);
919 // create the PCB volume
921 gMC->Gsvolu("S07P","BOX",pcbMaterial,pcbpar,3);
922 gMC->Gsvolu("S08P","BOX",pcbMaterial,pcbpar,3);
924 // create the sensitive volumes,
926 gMC->Gsvolu("S07G","BOX",sensMaterial,dum,0);
927 gMC->Gsvolu("S08G","BOX",sensMaterial,dum,0);
929 // create the vertical frame volume
931 gMC->Gsvolu("S07V","BOX",vFrameMaterial,vFramepar,3);
932 gMC->Gsvolu("S08V","BOX",vFrameMaterial,vFramepar,3);
934 // create the horizontal frame volume
936 gMC->Gsvolu("S07H","BOX",hFrameMaterial,hFramepar,3);
937 gMC->Gsvolu("S08H","BOX",hFrameMaterial,hFramepar,3);
939 // create the horizontal border volume
941 gMC->Gsvolu("S07B","BOX",bFrameMaterial,bFramepar,3);
942 gMC->Gsvolu("S08B","BOX",bFrameMaterial,bFramepar,3);
945 for (i = 0; i<nSlats4; i++){
946 sprintf(volNam7,"S07%d",i);
947 sprintf(volNam8,"S08%d",i);
948 Float_t xvFrame = (slatLength4[i] - vFrameLength)/2.;
949 // position the vertical frames
951 gMC->Gspos("S07V",2*i-1,volNam7, xvFrame, 0., 0. , 0, "ONLY");
952 gMC->Gspos("S07V",2*i ,volNam7,-xvFrame, 0., 0. , 0, "ONLY");
953 gMC->Gspos("S08V",2*i-1,volNam8, xvFrame, 0., 0. , 0, "ONLY");
954 gMC->Gspos("S08V",2*i ,volNam8,-xvFrame, 0., 0. , 0, "ONLY");
956 // position the panels and the insulating material
957 for (j=0; j<nPCB4[i]; j++){
959 Float_t xx = sensLength * (-nPCB4[i]/2.+j+.5);
961 Float_t zPanel = spar[2] - panelpar[2];
962 gMC->Gspos("S07C",2*index-1,volNam7, xx, 0., zPanel , 0, "ONLY");
963 gMC->Gspos("S07C",2*index ,volNam7, xx, 0.,-zPanel , 0, "ONLY");
964 gMC->Gspos("S08C",2*index-1,volNam8, xx, 0., zPanel , 0, "ONLY");
965 gMC->Gspos("S08C",2*index ,volNam8, xx, 0.,-zPanel , 0, "ONLY");
967 gMC->Gspos("S07I",index,volNam7, xx, 0., 0 , 0, "ONLY");
968 gMC->Gspos("S08I",index,volNam8, xx, 0., 0 , 0, "ONLY");
972 // position the rohacell volume inside the panel volume
973 gMC->Gspos("S07R",1,"S07C",0.,0.,0.,0,"ONLY");
974 gMC->Gspos("S08R",1,"S08C",0.,0.,0.,0,"ONLY");
976 // position the PCB volume inside the insulating material volume
977 gMC->Gspos("S07P",1,"S07I",0.,0.,0.,0,"ONLY");
978 gMC->Gspos("S08P",1,"S08I",0.,0.,0.,0,"ONLY");
979 // position the horizontal frame volume inside the PCB volume
980 gMC->Gspos("S07H",1,"S07P",0.,0.,0.,0,"ONLY");
981 gMC->Gspos("S08H",1,"S08P",0.,0.,0.,0,"ONLY");
982 // position the sensitive volume inside the horizontal frame volume
983 gMC->Gsposp("S07G",1,"S07H",0.,0.,0.,0,"ONLY",senspar,3);
984 gMC->Gsposp("S08G",1,"S08H",0.,0.,0.,0,"ONLY",senspar,3);
985 // position the border volumes inside the PCB volume
986 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
987 gMC->Gspos("S07B",1,"S07P",0., yborder,0.,0,"ONLY");
988 gMC->Gspos("S07B",2,"S07P",0.,-yborder,0.,0,"ONLY");
989 gMC->Gspos("S08B",1,"S08P",0., yborder,0.,0,"ONLY");
990 gMC->Gspos("S08B",2,"S08P",0.,-yborder,0.,0,"ONLY");
992 // create the NULOC volume and position it in the horizontal frame
994 gMC->Gsvolu("S07N","BOX",nulocMaterial,nulocpar,3);
995 gMC->Gsvolu("S08N","BOX",nulocMaterial,nulocpar,3);
997 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
999 gMC->Gspos("S07N",2*index-1,"S07B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1000 gMC->Gspos("S07N",2*index ,"S07B", xx, 0., bFrameWidth/4., 0, "ONLY");
1001 gMC->Gspos("S08N",2*index-1,"S08B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1002 gMC->Gspos("S08N",2*index ,"S08B", xx, 0., bFrameWidth/4., 0, "ONLY");
1005 // position the volumes approximating the circular section of the pipe
1006 Float_t yoffs = sensHeight/2. - yOverlap;
1007 Float_t epsilon = 0.001;
1010 Double_t dydiv= sensHeight/ndiv;
1011 Double_t ydiv = yoffs -dydiv;
1015 Float_t z1 = -spar[2], z2=2*spar[2]*1.01;
1016 for (Int_t idiv=0;idiv<ndiv; idiv++){
1019 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
1020 divpar[0] = (pcbLength-xdiv)/2.;
1021 divpar[1] = dydiv/2. - epsilon;
1022 divpar[2] = sensWidth/2.;
1023 Float_t xvol=(pcbLength+xdiv)/2.+1.999;
1024 Float_t yvol=ydiv + dydiv/2.;
1025 gMC->Gsposp("S07G",imax+4*idiv+1,"S07M", -xvol, yvol, -z1-z2, 0, "ONLY",divpar,3);
1026 gMC->Gsposp("S08G",imax+4*idiv+1,"S08M", -xvol, yvol, -z1-z2, 0, "ONLY",divpar,3);
1027 gMC->Gsposp("S07G",imax+4*idiv+2,"S07M", -xvol,-yvol, -z1-z2, 0, "ONLY",divpar,3);
1028 gMC->Gsposp("S08G",imax+4*idiv+2,"S08M", -xvol,-yvol, -z1-z2, 0, "ONLY",divpar,3);
1029 gMC->Gsposp("S07G",imax+4*idiv+3,"S07M", xvol, yvol, -z1+z2, 0, "ONLY",divpar,3);
1030 gMC->Gsposp("S08G",imax+4*idiv+3,"S08M", xvol, yvol, -z1+z2, 0, "ONLY",divpar,3);
1031 gMC->Gsposp("S07G",imax+4*idiv+4,"S07M", xvol,-yvol, -z1+z2, 0, "ONLY",divpar,3);
1032 gMC->Gsposp("S08G",imax+4*idiv+4,"S08M", xvol,-yvol, -z1+z2, 0, "ONLY",divpar,3);
1044 //********************************************************************
1046 //********************************************************************
1047 // indices 1 and 2 for first and second chambers in the station
1048 // iChamber (first chamber) kept for other quanties than Z,
1049 // assumed to be the same in both chambers
1050 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[8];
1051 iChamber2 =(AliMUONChamber*) (*fChambers)[9];
1052 zpos1=iChamber1->Z();
1053 zpos2=iChamber2->Z();
1054 dstation = TMath::Abs(zpos2 - zpos1);
1055 // zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
1059 tpar[0] = iChamber->RInner()-dframep;
1060 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
1061 tpar[2] = dstation/5.;
1063 gMC->Gsvolu("S09M", "TUBE", idAir, tpar, 3);
1064 gMC->Gsvolu("S10M", "TUBE", idAir, tpar, 3);
1065 gMC->Gspos("S09M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
1066 gMC->Gspos("S10M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
1069 const Int_t nSlats5 = 7; // number of slats per quadrant
1070 const Int_t nPCB5[nSlats5] = {5,5,6,6,5,4,3}; // n PCB per slat
1071 const Float_t xpos5[nSlats5] = {38.5, 40., 0., 0., 0., 0., 0.};
1072 Float_t slatLength5[nSlats5];
1078 for (i = 0; i<nSlats5; i++){
1079 slatLength5[i] = pcbLength * nPCB5[i] + 2. * dSlatLength;
1080 xSlat5 = slatLength5[i]/2. - vFrameLength/2. +xpos5[i];
1081 if (i==1 || i==0) slatLength5[i] -= 2. *dSlatLength; // frame out in PCB with circular border
1082 ySlat5 = sensHeight * i - yOverlap * i;
1083 spar[0] = slatLength5[i]/2.;
1084 spar[1] = slatHeight/2.;
1085 spar[2] = slatWidth/2. * 1.01;
1086 Float_t dzCh5=spar[2]*1.01;
1087 // zSlat to be checked (odd downstream or upstream?)
1088 Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2];
1089 sprintf(volNam9,"S09%d",i);
1090 gMC->Gsvolu(volNam9,"BOX",slatMaterial,spar,3);
1091 gMC->Gspos(volNam9, i*4+1,"S09M",-xSlat5, ySlat5, -zSlat-2.*dzCh5, 0, "ONLY");
1092 gMC->Gspos(volNam9, i*4+2,"S09M",+xSlat5, ySlat5, -zSlat+2.*dzCh5, 0, "ONLY");
1094 gMC->Gspos(volNam9, i*4+3,"S09M",-xSlat5,-ySlat5, -zSlat-2.*dzCh5, 0, "ONLY");
1095 gMC->Gspos(volNam9, i*4+4,"S09M",+xSlat5,-ySlat5, -zSlat+2.*dzCh5, 0, "ONLY");
1097 sprintf(volNam10,"S10%d",i);
1098 gMC->Gsvolu(volNam10,"BOX",slatMaterial,spar,3);
1099 gMC->Gspos(volNam10, i*4+1,"S10M",-xSlat5, ySlat5, -zSlat-2.*dzCh5, 0, "ONLY");
1100 gMC->Gspos(volNam10, i*4+2,"S10M",+xSlat5, ySlat5, -zSlat+2.*dzCh5, 0, "ONLY");
1102 gMC->Gspos(volNam10, i*4+3,"S10M",-xSlat5,-ySlat5, -zSlat-2.*dzCh5, 0, "ONLY");
1103 gMC->Gspos(volNam10, i*4+4,"S10M",+xSlat5,-ySlat5, -zSlat+2.*dzCh5, 0, "ONLY");
1107 // create the panel volume
1109 gMC->Gsvolu("S09C","BOX",panelMaterial,panelpar,3);
1110 gMC->Gsvolu("S10C","BOX",panelMaterial,panelpar,3);
1112 // create the rohacell volume
1114 gMC->Gsvolu("S09R","BOX",rohaMaterial,rohapar,3);
1115 gMC->Gsvolu("S10R","BOX",rohaMaterial,rohapar,3);
1117 // create the insulating material volume
1119 gMC->Gsvolu("S09I","BOX",insuMaterial,insupar,3);
1120 gMC->Gsvolu("S10I","BOX",insuMaterial,insupar,3);
1122 // create the PCB volume
1124 gMC->Gsvolu("S09P","BOX",pcbMaterial,pcbpar,3);
1125 gMC->Gsvolu("S10P","BOX",pcbMaterial,pcbpar,3);
1127 // create the sensitive volumes,
1129 gMC->Gsvolu("S09G","BOX",sensMaterial,dum,0);
1130 gMC->Gsvolu("S10G","BOX",sensMaterial,dum,0);
1132 // create the vertical frame volume
1134 gMC->Gsvolu("S09V","BOX",vFrameMaterial,vFramepar,3);
1135 gMC->Gsvolu("S10V","BOX",vFrameMaterial,vFramepar,3);
1137 // create the horizontal frame volume
1139 gMC->Gsvolu("S09H","BOX",hFrameMaterial,hFramepar,3);
1140 gMC->Gsvolu("S10H","BOX",hFrameMaterial,hFramepar,3);
1142 // create the horizontal border volume
1144 gMC->Gsvolu("S09B","BOX",bFrameMaterial,bFramepar,3);
1145 gMC->Gsvolu("S10B","BOX",bFrameMaterial,bFramepar,3);
1148 for (i = 0; i<nSlats5; i++){
1149 sprintf(volNam9,"S09%d",i);
1150 sprintf(volNam10,"S10%d",i);
1151 Float_t xvFrame = (slatLength5[i] - vFrameLength)/2.;
1152 // position the vertical frames
1154 gMC->Gspos("S09V",2*i-1,volNam9, xvFrame, 0., 0. , 0, "ONLY");
1155 gMC->Gspos("S09V",2*i ,volNam9,-xvFrame, 0., 0. , 0, "ONLY");
1156 gMC->Gspos("S10V",2*i-1,volNam10, xvFrame, 0., 0. , 0, "ONLY");
1157 gMC->Gspos("S10V",2*i ,volNam10,-xvFrame, 0., 0. , 0, "ONLY");
1160 // position the panels and the insulating material
1161 for (j=0; j<nPCB5[i]; j++){
1163 Float_t xx = sensLength * (-nPCB5[i]/2.+j+.5);
1165 Float_t zPanel = spar[2] - panelpar[2];
1166 gMC->Gspos("S09C",2*index-1,volNam9, xx, 0., zPanel , 0, "ONLY");
1167 gMC->Gspos("S09C",2*index ,volNam9, xx, 0.,-zPanel , 0, "ONLY");
1168 gMC->Gspos("S10C",2*index-1,volNam10, xx, 0., zPanel , 0, "ONLY");
1169 gMC->Gspos("S10C",2*index ,volNam10, xx, 0.,-zPanel , 0, "ONLY");
1171 gMC->Gspos("S09I",index,volNam9, xx, 0., 0 , 0, "ONLY");
1172 gMC->Gspos("S10I",index,volNam10, xx, 0., 0 , 0, "ONLY");
1176 // position the rohacell volume inside the panel volume
1177 gMC->Gspos("S09R",1,"S09C",0.,0.,0.,0,"ONLY");
1178 gMC->Gspos("S10R",1,"S10C",0.,0.,0.,0,"ONLY");
1180 // position the PCB volume inside the insulating material volume
1181 gMC->Gspos("S09P",1,"S09I",0.,0.,0.,0,"ONLY");
1182 gMC->Gspos("S10P",1,"S10I",0.,0.,0.,0,"ONLY");
1183 // position the horizontal frame volume inside the PCB volume
1184 gMC->Gspos("S09H",1,"S09P",0.,0.,0.,0,"ONLY");
1185 gMC->Gspos("S10H",1,"S10P",0.,0.,0.,0,"ONLY");
1186 // position the sensitive volume inside the horizontal frame volume
1187 gMC->Gsposp("S09G",1,"S09H",0.,0.,0.,0,"ONLY",senspar,3);
1188 gMC->Gsposp("S10G",1,"S10H",0.,0.,0.,0,"ONLY",senspar,3);
1189 // position the border volumes inside the PCB volume
1190 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
1191 gMC->Gspos("S09B",1,"S09P",0., yborder,0.,0,"ONLY");
1192 gMC->Gspos("S09B",2,"S09P",0.,-yborder,0.,0,"ONLY");
1193 gMC->Gspos("S10B",1,"S10P",0., yborder,0.,0,"ONLY");
1194 gMC->Gspos("S10B",2,"S10P",0.,-yborder,0.,0,"ONLY");
1196 // create the NULOC volume and position it in the horizontal frame
1198 gMC->Gsvolu("S09N","BOX",nulocMaterial,nulocpar,3);
1199 gMC->Gsvolu("S10N","BOX",nulocMaterial,nulocpar,3);
1201 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
1203 gMC->Gspos("S09N",2*index-1,"S09B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1204 gMC->Gspos("S09N",2*index ,"S09B", xx, 0., bFrameWidth/4., 0, "ONLY");
1205 gMC->Gspos("S10N",2*index-1,"S10B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1206 gMC->Gspos("S10N",2*index ,"S10B", xx, 0., bFrameWidth/4., 0, "ONLY");
1208 // position the volumes approximating the circular section of the pipe
1209 Float_t yoffs = sensHeight/2. - yOverlap;
1210 Float_t epsilon = 0.001;
1213 Double_t dydiv= sensHeight/ndiv;
1214 Double_t ydiv = yoffs -dydiv;
1216 // for (Int_t islat=0; islat<nSlats3; islat++) imax += nPCB3[islat];
1219 Float_t z1 = spar[2], z2=2*spar[2]*1.01;
1220 for (Int_t idiv=0;idiv<ndiv; idiv++){
1223 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
1224 divpar[0] = (pcbLength-xdiv)/2.;
1225 divpar[1] = dydiv/2. - epsilon;
1226 divpar[2] = sensWidth/2.;
1227 Float_t xvol=(pcbLength+xdiv)/2. + 1.999;
1228 Float_t yvol=ydiv + dydiv/2.;
1229 gMC->Gsposp("S09G",imax+4*idiv+1,"S09M", -xvol, yvol, -z1-z2, 0, "ONLY",divpar,3);
1230 gMC->Gsposp("S10G",imax+4*idiv+1,"S10M", -xvol, yvol, -z1-z2, 0, "ONLY",divpar,3);
1231 gMC->Gsposp("S09G",imax+4*idiv+2,"S09M", -xvol,-yvol, -z1-z2, 0, "ONLY",divpar,3);
1232 gMC->Gsposp("S10G",imax+4*idiv+2,"S10M", -xvol,-yvol, -z1-z2, 0, "ONLY",divpar,3);
1233 gMC->Gsposp("S09G",imax+4*idiv+3,"S09M", +xvol, yvol, -z1+z2, 0, "ONLY",divpar,3);
1234 gMC->Gsposp("S10G",imax+4*idiv+3,"S10M", +xvol, yvol, -z1+z2, 0, "ONLY",divpar,3);
1235 gMC->Gsposp("S09G",imax+4*idiv+4,"S09M", +xvol,-yvol, -z1+z2, 0, "ONLY",divpar,3);
1236 gMC->Gsposp("S10G",imax+4*idiv+4,"S10M", +xvol,-yvol, -z1+z2, 0, "ONLY",divpar,3);
1241 //********************************************************************
1243 //********************************************************************
1245 zpos1 and zpos2 are the middle of the first and second
1246 planes of station 1 (+1m for second station):
1247 zpos1=(zpos1m+zpos1p)/2=(15999+16071)/2=16035 mm, thick/2=40 mm
1248 zpos2=(zpos2m+zpos2p)/2=(16169+16241)/2=16205 mm, thick/2=40 mm
1249 zposxm and zposxp= middles of gaz gaps within a detection plane
1250 rem: the total thickness accounts for 1 mm of al on both
1251 side of the RPCs (see zpos1 and zpos2)
1254 // vertical gap between right and left chambers (kDXZERO*2=4cm)
1255 const Float_t kDXZERO=2.;
1256 // main distances for chamber definition in first plane/first station
1257 const Float_t kXMIN=34.;
1258 const Float_t kXMED=51.;
1259 const Float_t kXMAX=272.;
1260 // kXMAX will become 255. in real life. segmentation to be updated accordingly
1261 // (see fig.2-4 & 2-5 of Local Trigger Board PRR)
1262 const Float_t kYMIN=34.;
1263 const Float_t kYMAX=51.;
1264 // inner/outer radius of flange between beam shield. and chambers (1/station)
1265 const Float_t kRMIN[2]={50.,50.};
1266 const Float_t kRMAX[2]={64.,68.};
1267 // z position of the middle of the gas gap in mother vol
1268 const Float_t kZm=-3.6;
1269 const Float_t kZp=+3.6;
1271 iChamber1 = (AliMUONChamber*) (*fChambers)[10];
1272 zpos1 = iChamber1->Z();
1274 // ratio of zpos1m/zpos1p and inverse for first plane
1275 Float_t zmp=(zpos1+3.6)/(zpos1-3.6);
1278 Int_t icount=0; // chamber counter (0 1 2 3)
1280 for (Int_t istation=0; istation<2; istation++) { // loop on stations
1281 for (Int_t iplane=0; iplane<2; iplane++) { // loop on detection planes
1283 Int_t iVolNum=1; // counter Volume Number
1284 icount = Int_t(iplane*TMath::Power(2,0))+
1285 Int_t(istation*TMath::Power(2,1));
1288 sprintf(volPlane,"SM%d%d",istation+1,iplane+1);
1290 iChamber = (AliMUONChamber*) (*fChambers)[10+icount];
1291 Float_t zpos = iChamber->Z();
1294 tpar[0] = iChamber->RInner();
1295 tpar[1] = iChamber->ROuter();
1297 gMC->Gsvolu(volPlane,"TUBE",idAir,tpar,3);
1299 // Flange between beam shielding and RPC
1300 tpar[0]= kRMIN[istation];
1301 tpar[1]= kRMAX[istation];
1305 sprintf(volFlange,"SF%dA",icount+1);
1306 gMC->Gsvolu(volFlange,"TUBE",idAlu1,tpar,3); //Al
1307 gMC->Gspos(volFlange,1,volPlane,0.,0.,0.,0,"MANY");
1310 Float_t zRatio = zpos / zpos1;
1312 // chamber prototype
1317 char volAlu[5]; // Alu
1318 char volBak[5]; // Bakelite
1319 char volGaz[5]; // Gas streamer
1321 sprintf(volAlu,"SC%dA",icount+1);
1322 sprintf(volBak,"SB%dA",icount+1);
1323 sprintf(volGaz,"SG%dA",icount+1);
1325 gMC->Gsvolu(volAlu,"BOX",idAlu1,tpar,0); // Al
1326 gMC->Gsvolu(volBak,"BOX",idtmed[1107],tpar,0); // Bakelite
1327 gMC->Gsvolu(volGaz,"BOX",idtmed[1106],tpar,0); // Gas streamer
1333 Float_t xA=(kDXZERO+kXMED+(kXMAX-kXMED)/2.)*zRatio;
1338 gMC->Gsposp(volGaz,1,volBak,0.,0.,0.,0,"ONLY",tpar,3);
1340 gMC->Gsposp(volBak,1,volAlu,0.,0.,0.,0,"ONLY",tpar,3);
1343 tpar[0] = ((kXMAX-kXMED)/2.)*zRatio;
1344 tpar[1] = kYMIN*zRatio;
1346 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xA,yAm,-kZm,0,"ONLY",tpar,3);
1347 gMC->Gsposp(volAlu,iVolNum++,volPlane, xA,yAp,-kZp,0,"ONLY",tpar,3);
1348 gMC->Gsbool(volAlu,volFlange);
1351 Float_t tpar1save=tpar[1];
1352 Float_t y1msave=yAm;
1353 Float_t y1psave=yAp;
1355 tpar[0] = ((kXMAX-kXMIN)/2.) * zRatio;
1356 tpar[1] = ((kYMAX-kYMIN)/2.) * zRatio;
1358 Float_t xB=(kDXZERO+kXMIN)*zRatio+tpar[0];
1359 Float_t yBp=(y1msave+tpar1save)*zpm+tpar[1];
1360 Float_t yBm=(y1psave+tpar1save)*zmp+tpar[1];
1362 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xB, yBp,-kZp,0,"ONLY",tpar,3);
1363 gMC->Gsposp(volAlu,iVolNum++,volPlane, xB, yBm,-kZm,0,"ONLY",tpar,3);
1364 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xB,-yBp,-kZp,0,"ONLY",tpar,3);
1365 gMC->Gsposp(volAlu,iVolNum++,volPlane, xB,-yBm,-kZm,0,"ONLY",tpar,3);
1367 // chamber type C (note : same Z than type B)
1372 tpar[0] = (kXMAX/2)*zRatio;
1373 tpar[1] = (kYMAX/2)*zRatio;
1375 Float_t xC=kDXZERO*zRatio+tpar[0];
1376 Float_t yCp=(y1psave+tpar1save)*1.+tpar[1];
1377 Float_t yCm=(y1msave+tpar1save)*1.+tpar[1];
1379 gMC->Gsposp(volAlu,iVolNum++,volPlane,-xC, yCp,-kZp,0,"ONLY",tpar,3);
1380 gMC->Gsposp(volAlu,iVolNum++,volPlane, xC, yCm,-kZm,0,"ONLY",tpar,3);
1381 gMC->Gsposp(volAlu,iVolNum++,volPlane,-xC,-yCp,-kZp,0,"ONLY",tpar,3);
1382 gMC->Gsposp(volAlu,iVolNum++,volPlane, xC,-yCm,-kZm,0,"ONLY",tpar,3);
1384 // chamber type D, E and F (same size)
1389 tpar[0] = (kXMAX/2.)*zRatio;
1390 tpar[1] = kYMIN*zRatio;
1392 Float_t xD=kDXZERO*zRatio+tpar[0];
1393 Float_t yDp=(y1msave+tpar1save)*zpm+tpar[1];
1394 Float_t yDm=(y1psave+tpar1save)*zmp+tpar[1];
1396 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD, yDm,-kZm,0,"ONLY",tpar,3);
1397 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD, yDp,-kZp,0,"ONLY",tpar,3);
1398 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD,-yDm,-kZm,0,"ONLY",tpar,3);
1399 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD,-yDp,-kZp,0,"ONLY",tpar,3);
1404 Float_t yEp=(y1msave+tpar1save)*zpm+tpar[1];
1405 Float_t yEm=(y1psave+tpar1save)*zmp+tpar[1];
1407 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD, yEp,-kZp,0,"ONLY",tpar,3);
1408 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD, yEm,-kZm,0,"ONLY",tpar,3);
1409 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD,-yEp,-kZp,0,"ONLY",tpar,3);
1410 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD,-yEm,-kZm,0,"ONLY",tpar,3);
1415 Float_t yFp=(y1msave+tpar1save)*zpm+tpar[1];
1416 Float_t yFm=(y1psave+tpar1save)*zmp+tpar[1];
1418 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD, yFm,-kZm,0,"ONLY",tpar,3);
1419 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD, yFp,-kZp,0,"ONLY",tpar,3);
1420 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD,-yFm,-kZm,0,"ONLY",tpar,3);
1421 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD,-yFp,-kZp,0,"ONLY",tpar,3);
1423 // Positioning plane in ALICE
1424 gMC->Gspos(volPlane,1,"ALIC",0.,0.,zpos,0,"ONLY");
1426 } // end loop on detection planes
1427 } // end loop on stations
1432 //___________________________________________
1433 void AliMUONv1::CreateMaterials()
1435 // *** DEFINITION OF AVAILABLE MUON MATERIALS ***
1437 // Ar-CO2 gas (80%+20%)
1438 Float_t ag1[3] = { 39.95,12.01,16. };
1439 Float_t zg1[3] = { 18.,6.,8. };
1440 Float_t wg1[3] = { .8,.0667,.13333 };
1441 Float_t dg1 = .001821;
1443 // Ar-buthane-freon gas -- trigger chambers
1444 Float_t atr1[4] = { 39.95,12.01,1.01,19. };
1445 Float_t ztr1[4] = { 18.,6.,1.,9. };
1446 Float_t wtr1[4] = { .56,.1262857,.2857143,.028 };
1447 Float_t dtr1 = .002599;
1450 Float_t agas[3] = { 39.95,12.01,16. };
1451 Float_t zgas[3] = { 18.,6.,8. };
1452 Float_t wgas[3] = { .74,.086684,.173316 };
1453 Float_t dgas = .0018327;
1455 // Ar-Isobutane gas (80%+20%) -- tracking
1456 Float_t ag[3] = { 39.95,12.01,1.01 };
1457 Float_t zg[3] = { 18.,6.,1. };
1458 Float_t wg[3] = { .8,.057,.143 };
1459 Float_t dg = .0019596;
1461 // Ar-Isobutane-Forane-SF6 gas (49%+7%+40%+4%) -- trigger
1462 Float_t atrig[5] = { 39.95,12.01,1.01,19.,32.066 };
1463 Float_t ztrig[5] = { 18.,6.,1.,9.,16. };
1464 Float_t wtrig[5] = { .49,1.08,1.5,1.84,0.04 };
1465 Float_t dtrig = .0031463;
1469 Float_t abak[3] = {12.01 , 1.01 , 16.};
1470 Float_t zbak[3] = {6. , 1. , 8.};
1471 Float_t wbak[3] = {6. , 6. , 1.};
1474 Float_t epsil, stmin, deemax, tmaxfd, stemax;
1476 Int_t iSXFLD = gAlice->Field()->Integ();
1477 Float_t sXMGMX = gAlice->Field()->Max();
1479 // --- Define the various materials for GEANT ---
1480 AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
1481 AliMaterial(10, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
1482 AliMaterial(15, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500);
1483 AliMixture(19, "Bakelite$", abak, zbak, dbak, -3, wbak);
1484 AliMixture(20, "ArC4H10 GAS$", ag, zg, dg, 3, wg);
1485 AliMixture(21, "TRIG GAS$", atrig, ztrig, dtrig, -5, wtrig);
1486 AliMixture(22, "ArCO2 80%$", ag1, zg1, dg1, 3, wg1);
1487 AliMixture(23, "Ar-freon $", atr1, ztr1, dtr1, 4, wtr1);
1488 AliMixture(24, "ArCO2 GAS$", agas, zgas, dgas, 3, wgas);
1489 // materials for slat:
1490 // Sensitive area: gas (already defined)
1492 // insulating material and frame: vetronite
1493 // walls: carbon, rohacell, carbon
1494 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
1495 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
1496 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
1497 Float_t dglass=1.74;
1499 // rohacell: C9 H13 N1 O2
1500 Float_t arohac[4] = {12.01, 1.01, 14.010, 16.};
1501 Float_t zrohac[4] = { 6., 1., 7., 8.};
1502 Float_t wrohac[4] = { 9., 13., 1., 2.};
1503 Float_t drohac = 0.03;
1505 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
1506 AliMixture(32, "Vetronite$",aglass, zglass, dglass, 5, wglass);
1507 AliMaterial(33, "Carbon$", 12.01, 6., 2.265, 18.8, 49.9);
1508 AliMixture(34, "Rohacell$", arohac, zrohac, drohac, -4, wrohac);
1511 epsil = .001; // Tracking precision,
1512 stemax = -1.; // Maximum displacement for multiple scat
1513 tmaxfd = -20.; // Maximum angle due to field deflection
1514 deemax = -.3; // Maximum fractional energy loss, DLS
1518 AliMedium(1, "AIR_CH_US ", 15, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1522 AliMedium(4, "ALU_CH_US ", 9, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
1523 fMaxDestepAlu, epsil, stmin);
1524 AliMedium(5, "ALU_CH_US ", 10, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
1525 fMaxDestepAlu, epsil, stmin);
1529 AliMedium(6, "AR_CH_US ", 20, 1, iSXFLD, sXMGMX, tmaxfd, fMaxStepGas,
1530 fMaxDestepGas, epsil, stmin);
1532 // Ar-Isobuthane-Forane-SF6 gas
1534 AliMedium(7, "GAS_CH_TRIGGER ", 21, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1536 AliMedium(8, "BAKE_CH_TRIGGER ", 19, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
1537 fMaxDestepAlu, epsil, stmin);
1539 AliMedium(9, "ARG_CO2 ", 22, 1, iSXFLD, sXMGMX, tmaxfd, fMaxStepGas,
1540 fMaxDestepAlu, epsil, stmin);
1541 // tracking media for slats: check the parameters!!
1542 AliMedium(11, "PCB_COPPER ", 31, 0, iSXFLD, sXMGMX, tmaxfd,
1543 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
1544 AliMedium(12, "VETRONITE ", 32, 0, iSXFLD, sXMGMX, tmaxfd,
1545 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
1546 AliMedium(13, "CARBON ", 33, 0, iSXFLD, sXMGMX, tmaxfd,
1547 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
1548 AliMedium(14, "Rohacell ", 34, 0, iSXFLD, sXMGMX, tmaxfd,
1549 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
1552 //___________________________________________
1554 void AliMUONv1::Init()
1557 // Initialize Tracking Chambers
1560 if(fDebug) printf("\n%s: Start Init for version 1 - CPC chamber type\n\n",ClassName());
1562 for (i=0; i<AliMUONConstants::NCh(); i++) {
1563 ( (AliMUONChamber*) (*fChambers)[i])->Init();
1567 // Set the chamber (sensitive region) GEANT identifier
1568 ((AliMUONChamber*)(*fChambers)[0])->SetGid(gMC->VolId("S01G"));
1569 ((AliMUONChamber*)(*fChambers)[1])->SetGid(gMC->VolId("S02G"));
1571 ((AliMUONChamber*)(*fChambers)[2])->SetGid(gMC->VolId("S03G"));
1572 ((AliMUONChamber*)(*fChambers)[3])->SetGid(gMC->VolId("S04G"));
1574 ((AliMUONChamber*)(*fChambers)[4])->SetGid(gMC->VolId("S05G"));
1575 ((AliMUONChamber*)(*fChambers)[5])->SetGid(gMC->VolId("S06G"));
1577 ((AliMUONChamber*)(*fChambers)[6])->SetGid(gMC->VolId("S07G"));
1578 ((AliMUONChamber*)(*fChambers)[7])->SetGid(gMC->VolId("S08G"));
1580 ((AliMUONChamber*)(*fChambers)[8])->SetGid(gMC->VolId("S09G"));
1581 ((AliMUONChamber*)(*fChambers)[9])->SetGid(gMC->VolId("S10G"));
1583 ((AliMUONChamber*)(*fChambers)[10])->SetGid(gMC->VolId("SG1A"));
1584 ((AliMUONChamber*)(*fChambers)[11])->SetGid(gMC->VolId("SG2A"));
1585 ((AliMUONChamber*)(*fChambers)[12])->SetGid(gMC->VolId("SG3A"));
1586 ((AliMUONChamber*)(*fChambers)[13])->SetGid(gMC->VolId("SG4A"));
1588 if(fDebug) printf("\n%s: Finished Init for version 1 - CPC chamber type\n",ClassName());
1591 if(fDebug) printf("\n%s: Start Init for Trigger Circuits\n",ClassName());
1592 for (i=0; i<AliMUONConstants::NTriggerCircuit(); i++) {
1593 ( (AliMUONTriggerCircuit*) (*fTriggerCircuits)[i])->Init(i);
1595 if(fDebug) printf("%s: Finished Init for Trigger Circuits\n",ClassName());
1599 //___________________________________________
1600 void AliMUONv1::StepManager()
1602 if (fStepManagerVersionOld) {
1606 if (fStepManagerVersionNew) {
1611 if (fStepManagerVersionTest) {
1621 // Particule id, pos and mom vectors,
1622 // theta, phi angles with respect the normal of the chamber,
1623 // spatial step, delta_energy and time of flight
1625 TLorentzVector pos, mom;
1626 Float_t theta, phi, tof;
1627 Float_t destep, step;
1628 const Float_t kBig = 1.e10;
1630 // Only charged tracks
1631 if( !(gMC->TrackCharge()) ) return;
1633 // Only gas gap inside chamber
1634 // Tag chambers and record hits when track enters
1636 id=gMC->CurrentVolID(copy);
1637 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) {
1638 if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) {
1643 if (idvol == -1) return;
1645 // printf(">>>> This Chamber %d\n",iChamber);
1647 // record hits when track enters ...
1648 if( gMC->IsTrackEntering()) gMC->SetMaxStep(fStepMaxInActiveGas);
1650 if (gMC->TrackStep() > 0.) {
1651 // Get current particle id (ipart), track position (pos) and momentum (mom)
1652 gMC->TrackPosition(pos);
1653 gMC->TrackMomentum(mom);
1654 ipart = gMC->TrackPid();
1655 theta = mom.Theta()*kRaddeg; // theta of track
1656 phi = mom.Phi() *kRaddeg; // phi of the track
1657 tof = gMC->TrackTime(); // Time of flight
1659 // momentum loss and steplength in last step
1660 destep = gMC->Edep();
1661 step = gMC->TrackStep();
1664 GetMUONData()->AddHit(fIshunt, gAlice->GetCurrentTrackNumber(), iChamber, ipart,
1665 pos.X(), pos.Y(), pos.Z(), tof, mom.P(),
1666 theta, phi, step, destep);
1668 // Track left chamber ...
1669 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1670 gMC->SetMaxStep(kBig);
1675 Int_t AliMUONv1::GetChamberId(Int_t volId) const
1677 // Check if the volume with specified volId is a sensitive volume (gas)
1678 // of some chamber and returns the chamber number;
1679 // if not sensitive volume - return 0.
1682 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++)
1683 if (volId==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) return i;
1691 void AliMUONv1::StepManagerTest()
1695 //________________________________________
1696 void AliMUONv1::StepManagerNew()
1702 // Int_t iChamber=0;
1703 // // Particule id, pos and mom vectors,
1704 // // theta, phi angles with respect the normal of the chamber,
1705 // // spatial step, delta_energy and time of flight
1707 // TLorentzVector pos, mom;
1708 // Float_t theta, phi, tof;
1709 // Float_t destep, step;
1710 // const Float_t kBig = 1.e10;
1712 // // Only charged tracks
1713 // if( !(gMC->TrackCharge()) ) return;
1715 // // Only gas gap inside chamber
1716 // // Tag chambers and record hits when track enters
1718 // id=gMC->CurrentVolID(copy);
1719 // for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) {
1720 // if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) {
1725 // static Float_t Sstep[20]; // Sum of steps per chamber
1726 // // static Float_t Sdestep[20]; // Sum of eloss per chamber
1730 // if (idvol == -1) return;
1732 // // printf(">>>> This Chamber %d\n",iChamber);
1734 // // record hits when track enters ...
1735 // //if( gMC->IsTrackEntering()) gMC->SetMaxStep(fStepMaxInActiveGas);
1737 // if (gMC->TrackStep() > 0.) {
1738 // // Get current particle id (ipart), track position (pos) and momentum (mom)
1739 // gMC->TrackPosition(pos);
1740 // gMC->TrackMomentum(mom);
1741 // ipart = gMC->TrackPid(); // Particle
1742 // theta = mom.Theta()*kRaddeg; // theta of track
1743 // phi = mom.Phi() *kRaddeg; // phi of the track
1744 // tof = gMC->TrackTime(); // Time of flight
1746 // // momentum loss and steplength in last step
1747 // destep = gMC->Edep();
1748 // step = gMC->TrackStep();
1750 // Sstep[iChamber]+=step;
1751 // // Sdestep[iChamber]+=destep;
1755 // step = Sstep[iChamber]; // Total step >= gap
1756 // // destep = Sdestep[iChamber]; // Total eloss
1759 // // Track left chamber ...
1760 // if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1761 // gMC->SetMaxStep(kBig);
1763 // Sstep[iChamber]=0; // Reset for the next event
1764 // //Sdestep[iChamber]=0; // Reset for the next event
1766 // if (iChamber>=1 && iChamber<=2) GAP=0.4;
1767 // if (iChamber>=11 && iChamber<=14) GAP=0.2;
1768 // if (iChamber>=3 && iChamber<=10) GAP=0.5;
1770 // TF1 *ELOSS1 = new TF1("Gauss1","exp(-((x-4.13727e+01)**2)/(2*1.42223e+01**2))",0,75);
1771 // TF1 *ELOSS2 = new TF1("Gauss2","exp(-((x+6.83795e+02)**2)/(2*4.48415e+02**2))",75,350);
1772 // TEST=gRandom->Rndm();
1773 // if (TEST <=0.89) destep=ELOSS1->GetRandom();
1774 // else destep=ELOSS2->GetRandom();
1775 // destep*=pow(10,-6)*0.0274;
1778 // // One hit per chamber
1779 // GetMUONData()->AddHit(fIshunt, gAlice->GetCurrentTrackNumber(), iChamber, ipart,
1780 // pos.X()-(step/2*sin(theta*kDegrad)*cos(phi*kDegrad)), pos.Y()-(step/2*sin(theta*kDegrad)*sin(phi*kDegrad)), pos.Z()-GAP/2, tof, mom.P(),theta, phi, step, destep);
1785 //___________________________________________
1786 void AliMUONv1::StepManagerOld()
1790 static Int_t vol[2];
1795 Float_t destep, step;
1797 static Float_t Sstep;
1798 static Float_t eloss, eloss2, xhit, yhit, zhit, tof, tlength;
1799 const Float_t kBig = 1.e10;
1800 static Float_t hits[15];
1802 TClonesArray &lhits = *fHits;
1806 // Only charged tracks
1807 if( !(gMC->TrackCharge()) ) return;
1809 // Only gas gap inside chamber
1810 // Tag chambers and record hits when track enters
1811 id=gMC->CurrentVolID(copy);
1812 vol[0] = GetChamberId(id);
1815 if (idvol == -1) return;
1818 // Get current particle id (ipart), track position (pos) and momentum (mom)
1819 gMC->TrackPosition(pos);
1820 gMC->TrackMomentum(mom);
1822 ipart = gMC->TrackPid();
1825 // momentum loss and steplength in last step
1826 destep = gMC->Edep();
1827 step = gMC->TrackStep();
1828 // cout<<"------------"<<step<<endl;
1830 // record hits when track enters ...
1831 if( gMC->IsTrackEntering()) {
1833 gMC->SetMaxStep(fMaxStepGas);
1834 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1835 Double_t rt = TMath::Sqrt(tc);
1836 Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
1837 Double_t tx = mom[0]/pmom;
1838 Double_t ty = mom[1]/pmom;
1839 Double_t tz = mom[2]/pmom;
1840 Double_t s = ((AliMUONChamber*)(*fChambers)[idvol])
1843 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1844 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1845 hits[0] = Float_t(ipart); // Geant3 particle type
1846 hits[1] = pos[0]+s*tx; // X-position for hit
1847 hits[2] = pos[1]+s*ty; // Y-position for hit
1848 hits[3] = pos[2]+s*tz; // Z-position for hit
1849 hits[4] = theta; // theta angle of incidence
1850 hits[5] = phi; // phi angle of incidence
1851 hits[8] = 0;//PadHits does not exist anymore (Float_t) fNPadHits; // first padhit
1852 hits[9] = -1; // last pad hit
1853 hits[10] = mom[3]; // hit momentum P
1854 hits[11] = mom[0]; // Px
1855 hits[12] = mom[1]; // Py
1856 hits[13] = mom[2]; // Pz
1857 tof=gMC->TrackTime();
1858 hits[14] = tof; // Time of flight
1866 Chamber(idvol).ChargeCorrelationInit();
1867 // Only if not trigger chamber
1869 // printf("---------------------------\n");
1870 // printf(">>>> Y = %f \n",hits[2]);
1871 // printf("---------------------------\n");
1875 // if(idvol < AliMUONConstants::NTrackingCh()) {
1877 // // Initialize hit position (cursor) in the segmentation model
1878 // ((AliMUONChamber*) (*fChambers)[idvol])
1879 // ->SigGenInit(pos[0], pos[1], pos[2]);
1881 // //geant3->Gpcxyz();
1882 // //printf("In the Trigger Chamber #%d\n",idvol-9);
1888 // cout<<Sstep<<endl;
1891 // Calculate the charge induced on a pad (disintegration) in case
1893 // Mip left chamber ...
1894 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1895 gMC->SetMaxStep(kBig);
1900 Float_t localPos[3];
1901 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
1902 gMC->Gmtod(globalPos,localPos,1);
1904 if(idvol < AliMUONConstants::NTrackingCh()) {
1905 // tracking chambers
1906 x0 = 0.5*(xhit+pos[0]);
1907 y0 = 0.5*(yhit+pos[1]);
1908 z0 = 0.5*(zhit+pos[2]);
1917 // if (eloss >0) MakePadHits(x0,y0,z0,eloss,tof,idvol);
1920 hits[6] = tlength; // track length
1921 hits[7] = eloss2; // de/dx energy loss
1924 // if (fNPadHits > (Int_t)hits[8]) {
1925 // hits[8] = hits[8]+1;
1926 // hits[9] = 0: // PadHits does not exist anymore (Float_t) fNPadHits;
1931 new(lhits[fNhits++])
1932 AliMUONHit(fIshunt, gAlice->GetCurrentTrackNumber(), vol,hits);
1935 // Check additional signal generation conditions
1936 // defined by the segmentation
1937 // model (boundary crossing conditions)
1938 // only for tracking chambers
1940 ((idvol < AliMUONConstants::NTrackingCh()) &&
1941 ((AliMUONChamber*) (*fChambers)[idvol])->SigGenCond(pos[0], pos[1], pos[2]))
1943 ((AliMUONChamber*) (*fChambers)[idvol])
1944 ->SigGenInit(pos[0], pos[1], pos[2]);
1946 Float_t localPos[3];
1947 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
1948 gMC->Gmtod(globalPos,localPos,1);
1952 // if (eloss > 0 && idvol < AliMUONConstants::NTrackingCh())
1953 // MakePadHits(0.5*(xhit+pos[0]),0.5*(yhit+pos[1]),pos[2],eloss,tof,idvol);
1960 // nothing special happened, add up energy loss