]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONv3.cxx
04-mar-2004 NvE Functionality of AliObjMatrix extended to provide the number of refer...
[u/mrichter/AliRoot.git] / MUON / AliMUONv3.cxx
CommitLineData
d1cd2474 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * SigmaEffect_thetadegrees *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpeateose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id$ */
17
18/////////////////////////////////////////////////////////
19// Manager and hits classes for set:MUON version 3 //
20/////////////////////////////////////////////////////////
21
22// Old MUONv1 class
23// (AliMUONv1.h 1.11, AliMUONv1.cxx 1.60)
24// - now replaced with a new one where geometry and materials
25// are created using new geometry builders
26// (See ALIMUON*GeometryBuilder classes)
27// To be removed later
28
29#include <TRandom.h>
30#include <TF1.h>
31#include <TClonesArray.h>
32#include <TLorentzVector.h>
33#include <TVirtualMC.h>
34#include <TParticle.h>
35
36#include "AliConst.h"
37#include "AliMUONChamber.h"
38#include "AliMUONConstants.h"
39#include "AliMUONFactory.h"
40#include "AliMUONHit.h"
41#include "AliMUONTriggerCircuit.h"
42#include "AliMUONChamberGeometry.h"
43#include "AliMUONv3.h"
44#include "AliMagF.h"
45#include "AliRun.h"
46#include "AliMC.h"
47
48ClassImp(AliMUONv3)
49
50//___________________________________________
51AliMUONv3::AliMUONv3() : AliMUON()
52 ,fTrackMomentum(), fTrackPosition()
53{
54// Constructor
55 fChambers = 0;
56 fStations = 0;
57 fStepManagerVersionOld = kFALSE;
58 fAngleEffect = kTRUE;
59 fStepMaxInActiveGas = 0.6;
60 fStepSum = 0x0;
61 fDestepSum = 0x0;
62 fElossRatio = 0x0;
63 fAngleEffect10 = 0x0;
64 fAngleEffectNorma= 0x0;
65}
66//___________________________________________
67AliMUONv3::AliMUONv3(const char *name, const char *title)
68 : AliMUON(name,title), fTrackMomentum(), fTrackPosition()
69{
70// Constructor
71 // By default include all stations
72 fStations = new Int_t[5];
73 for (Int_t i=0; i<5; i++) fStations[i] = 1;
74
75 AliMUONFactory factory;
76 factory.Build(this, title);
77
78 fStepManagerVersionOld = kFALSE;
79 fAngleEffect = kTRUE;
80 fStepMaxInActiveGas = 0.6;
81
82 fStepSum = new Float_t [AliMUONConstants::NCh()];
83 fDestepSum = new Float_t [AliMUONConstants::NCh()];
84 for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
85 fStepSum[i] =0.0;
86 fDestepSum[i]=0.0;
87 }
88 // Ratio of particle mean eloss with respect MIP's Khalil Boudjemline, sep 2003, PhD.Thesis and Particle Data Book
89 fElossRatio = new TF1("ElossRatio","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x",0.5,5.);
90 fElossRatio->SetParameter(0,1.02138);
91 fElossRatio->SetParameter(1,-9.54149e-02);
92 fElossRatio->SetParameter(2,+7.83433e-02);
93 fElossRatio->SetParameter(3,-9.98208e-03);
94 fElossRatio->SetParameter(4,+3.83279e-04);
95
96 // Angle effect in tracking chambers at theta =10 degres as a function of ElossRatio (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) (in micrometers)
97 fAngleEffect10 = new TF1("AngleEffect10","[0]+[1]*x+[2]*x*x",0.5,3.0);
98 fAngleEffect10->SetParameter(0, 1.90691e+02);
99 fAngleEffect10->SetParameter(1,-6.62258e+01);
100 fAngleEffect10->SetParameter(2,+1.28247e+01);
101 // Angle effect: Normalisation form theta=10 degres to theta between 0 and 10 (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis)
102 // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
103 fAngleEffectNorma = new TF1("AngleEffectNorma","[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.0,10.0);
104 fAngleEffectNorma->SetParameter(0,4.148);
105 fAngleEffectNorma->SetParameter(1,-6.809e-01);
106 fAngleEffectNorma->SetParameter(2,5.151e-02);
107 fAngleEffectNorma->SetParameter(3,-1.490e-03);
108}
109
fb1bf5c0 110//_____________________________________________________________________________
111AliMUONv3::AliMUONv3(const AliMUONv3& right)
112 : AliMUON(right)
113{
114 // copy constructor (not implemented)
115
116 Fatal("AliMUONv3", "Copy constructor not provided.");
117}
118
119//_____________________________________________________________________________
120AliMUONv3& AliMUONv3::operator=(const AliMUONv3& right)
121{
122 // assignement operator (not implemented)
123
124 // check assignement to self
125 if (this == &right) return *this;
126
127 Fatal("operator =", "Assignement operator not provided.");
128
129 return *this;
130}
131
d1cd2474 132//___________________________________________
133void AliMUONv3::CreateGeometry()
134{
135//
136// Note: all chambers have the same structure, which could be
137// easily parameterised. This was intentionally not done in order
138// to give a starting point for the implementation of the actual
139// design of each station.
140 Int_t *idtmed = fIdtmed->GetArray()-1099;
141
142// Distance between Stations
143//
144 Float_t bpar[3];
145 Float_t tpar[3];
146// Float_t pgpar[10];
147 Float_t zpos1, zpos2, zfpos;
148 // Outer excess and inner recess for mother volume radius
149 // with respect to ROuter and RInner
150 Float_t dframep=.001; // Value for station 3 should be 6 ...
151 // Width (RdPhi) of the frame crosses for stations 1 and 2 (cm)
152// Float_t dframep1=.001;
153 Float_t dframep1 = 11.0;
154// Bool_t frameCrosses=kFALSE;
155 Bool_t frameCrosses=kTRUE;
156 Float_t *dum=0;
157
158// Float_t dframez=0.9;
159 // Half of the total thickness of frame crosses (including DAlu)
160 // for each chamber in stations 1 and 2:
161 // 3% of X0 of composite material,
162 // but taken as Aluminium here, with same thickness in number of X0
163 Float_t dframez = 3. * 8.9 / 100;
164// Float_t dr;
165 Float_t dstation;
166
167//
168// Rotation matrices in the x-y plane
169 Int_t idrotm[1199];
170// phi= 0 deg
171 AliMatrix(idrotm[1100], 90., 0., 90., 90., 0., 0.);
172// phi= 90 deg
173 AliMatrix(idrotm[1101], 90., 90., 90., 180., 0., 0.);
174// phi= 180 deg
175 AliMatrix(idrotm[1102], 90., 180., 90., 270., 0., 0.);
176// phi= 270 deg
177 AliMatrix(idrotm[1103], 90., 270., 90., 0., 0., 0.);
178//
179 Float_t phi=2*TMath::Pi()/12/2;
180
181//
182// pointer to the current chamber
183// pointer to the current chamber
184 Int_t idAlu1=idtmed[1103]; // medium 4
185 Int_t idAlu2=idtmed[1104]; // medium 5
186// Int_t idAlu1=idtmed[1100];
187// Int_t idAlu2=idtmed[1100];
188 Int_t idAir=idtmed[1100]; // medium 1
189// Int_t idGas=idtmed[1105]; // medium 6 = Ar-isoC4H10 gas
190 Int_t idGas=idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
191
192
193 AliMUONChamber *iChamber, *iChamber1, *iChamber2;
194
195 if (fStations[0]) {
196
197//********************************************************************
198// Station 1 **
199//********************************************************************
200// CONCENTRIC
201 // indices 1 and 2 for first and second chambers in the station
202 // iChamber (first chamber) kept for other quanties than Z,
203 // assumed to be the same in both chambers
204 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[0];
205 iChamber2 =(AliMUONChamber*) (*fChambers)[1];
206 zpos1=iChamber1->Z();
207 zpos2=iChamber2->Z();
208 dstation = TMath::Abs(zpos2 - zpos1);
209 // DGas decreased from standard one (0.5)
210 iChamber->SetDGas(0.4); iChamber2->SetDGas(0.4);
211 // DAlu increased from standard one (3% of X0),
212 // because more electronics with smaller pads
213 iChamber->SetDAlu(3.5 * 8.9 / 100.); iChamber2->SetDAlu(3.5 * 8.9 / 100.);
214 zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
215
216//
217// Mother volume
218 tpar[0] = iChamber->RInner()-dframep;
219 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
220 tpar[2] = dstation/5;
221
222 gMC->Gsvolu("S01M", "TUBE", idAir, tpar, 3);
223 gMC->Gsvolu("S02M", "TUBE", idAir, tpar, 3);
224 gMC->Gspos("S01M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
225 gMC->Gspos("S02M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
226// // Aluminium frames
227// // Outer frames
228// pgpar[0] = 360/12/2;
229// pgpar[1] = 360.;
230// pgpar[2] = 12.;
231// pgpar[3] = 2;
232// pgpar[4] = -dframez/2;
233// pgpar[5] = iChamber->ROuter();
234// pgpar[6] = pgpar[5]+dframep1;
235// pgpar[7] = +dframez/2;
236// pgpar[8] = pgpar[5];
237// pgpar[9] = pgpar[6];
238// gMC->Gsvolu("S01O", "PGON", idAlu1, pgpar, 10);
239// gMC->Gsvolu("S02O", "PGON", idAlu1, pgpar, 10);
240// gMC->Gspos("S01O",1,"S01M", 0.,0.,-zfpos, 0,"ONLY");
241// gMC->Gspos("S01O",2,"S01M", 0.,0.,+zfpos, 0,"ONLY");
242// gMC->Gspos("S02O",1,"S02M", 0.,0.,-zfpos, 0,"ONLY");
243// gMC->Gspos("S02O",2,"S02M", 0.,0.,+zfpos, 0,"ONLY");
244// //
245// // Inner frame
246// tpar[0]= iChamber->RInner()-dframep1;
247// tpar[1]= iChamber->RInner();
248// tpar[2]= dframez/2;
249// gMC->Gsvolu("S01I", "TUBE", idAlu1, tpar, 3);
250// gMC->Gsvolu("S02I", "TUBE", idAlu1, tpar, 3);
251
252// gMC->Gspos("S01I",1,"S01M", 0.,0.,-zfpos, 0,"ONLY");
253// gMC->Gspos("S01I",2,"S01M", 0.,0.,+zfpos, 0,"ONLY");
254// gMC->Gspos("S02I",1,"S02M", 0.,0.,-zfpos, 0,"ONLY");
255// gMC->Gspos("S02I",2,"S02M", 0.,0.,+zfpos, 0,"ONLY");
256//
257// Frame Crosses
258 if (frameCrosses) {
259 // outside gas
260 // security for inside mother volume
261 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
262 * TMath::Cos(TMath::ASin(dframep1 /
263 (iChamber->ROuter() - iChamber->RInner())))
264 / 2.0;
265 bpar[1] = dframep1/2;
266 // total thickness will be (4 * bpar[2]) for each chamber,
267 // which has to be equal to (2 * dframez) - DAlu
268 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
269 gMC->Gsvolu("S01B", "BOX", idAlu1, bpar, 3);
270 gMC->Gsvolu("S02B", "BOX", idAlu1, bpar, 3);
271
272 gMC->Gspos("S01B",1,"S01M", -iChamber->RInner()-bpar[0] , 0, zfpos,
273 idrotm[1100],"ONLY");
274 gMC->Gspos("S01B",2,"S01M", iChamber->RInner()+bpar[0] , 0, zfpos,
275 idrotm[1100],"ONLY");
276 gMC->Gspos("S01B",3,"S01M", 0, -iChamber->RInner()-bpar[0] , zfpos,
277 idrotm[1101],"ONLY");
278 gMC->Gspos("S01B",4,"S01M", 0, iChamber->RInner()+bpar[0] , zfpos,
279 idrotm[1101],"ONLY");
280 gMC->Gspos("S01B",5,"S01M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
281 idrotm[1100],"ONLY");
282 gMC->Gspos("S01B",6,"S01M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
283 idrotm[1100],"ONLY");
284 gMC->Gspos("S01B",7,"S01M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
285 idrotm[1101],"ONLY");
286 gMC->Gspos("S01B",8,"S01M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
287 idrotm[1101],"ONLY");
288
289 gMC->Gspos("S02B",1,"S02M", -iChamber->RInner()-bpar[0] , 0, zfpos,
290 idrotm[1100],"ONLY");
291 gMC->Gspos("S02B",2,"S02M", iChamber->RInner()+bpar[0] , 0, zfpos,
292 idrotm[1100],"ONLY");
293 gMC->Gspos("S02B",3,"S02M", 0, -iChamber->RInner()-bpar[0] , zfpos,
294 idrotm[1101],"ONLY");
295 gMC->Gspos("S02B",4,"S02M", 0, iChamber->RInner()+bpar[0] , zfpos,
296 idrotm[1101],"ONLY");
297 gMC->Gspos("S02B",5,"S02M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
298 idrotm[1100],"ONLY");
299 gMC->Gspos("S02B",6,"S02M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
300 idrotm[1100],"ONLY");
301 gMC->Gspos("S02B",7,"S02M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
302 idrotm[1101],"ONLY");
303 gMC->Gspos("S02B",8,"S02M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
304 idrotm[1101],"ONLY");
305 }
306//
307// Chamber Material represented by Alu sheet
308 tpar[0]= iChamber->RInner();
309 tpar[1]= iChamber->ROuter();
310 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
311 gMC->Gsvolu("S01A", "TUBE", idAlu2, tpar, 3);
312 gMC->Gsvolu("S02A", "TUBE",idAlu2, tpar, 3);
313 gMC->Gspos("S01A", 1, "S01M", 0., 0., 0., 0, "ONLY");
314 gMC->Gspos("S02A", 1, "S02M", 0., 0., 0., 0, "ONLY");
315//
316// Sensitive volumes
317 // tpar[2] = iChamber->DGas();
318 tpar[2] = iChamber->DGas()/2;
319 gMC->Gsvolu("S01G", "TUBE", idGas, tpar, 3);
320 gMC->Gsvolu("S02G", "TUBE", idGas, tpar, 3);
321 gMC->Gspos("S01G", 1, "S01A", 0., 0., 0., 0, "ONLY");
322 gMC->Gspos("S02G", 1, "S02A", 0., 0., 0., 0, "ONLY");
323//
324// Frame Crosses to be placed inside gas
325 // NONE: chambers are sensitive everywhere
326// if (frameCrosses) {
327
328// dr = (iChamber->ROuter() - iChamber->RInner());
329// bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
330// bpar[1] = dframep1/2;
331// bpar[2] = iChamber->DGas()/2;
332// gMC->Gsvolu("S01F", "BOX", idAlu1, bpar, 3);
333// gMC->Gsvolu("S02F", "BOX", idAlu1, bpar, 3);
334
335// gMC->Gspos("S01F",1,"S01G", +iChamber->RInner()+bpar[0] , 0, 0,
336// idrotm[1100],"ONLY");
337// gMC->Gspos("S01F",2,"S01G", -iChamber->RInner()-bpar[0] , 0, 0,
338// idrotm[1100],"ONLY");
339// gMC->Gspos("S01F",3,"S01G", 0, +iChamber->RInner()+bpar[0] , 0,
340// idrotm[1101],"ONLY");
341// gMC->Gspos("S01F",4,"S01G", 0, -iChamber->RInner()-bpar[0] , 0,
342// idrotm[1101],"ONLY");
343
344// gMC->Gspos("S02F",1,"S02G", +iChamber->RInner()+bpar[0] , 0, 0,
345// idrotm[1100],"ONLY");
346// gMC->Gspos("S02F",2,"S02G", -iChamber->RInner()-bpar[0] , 0, 0,
347// idrotm[1100],"ONLY");
348// gMC->Gspos("S02F",3,"S02G", 0, +iChamber->RInner()+bpar[0] , 0,
349// idrotm[1101],"ONLY");
350// gMC->Gspos("S02F",4,"S02G", 0, -iChamber->RInner()-bpar[0] , 0,
351// idrotm[1101],"ONLY");
352// }
353 }
354 if (fStations[1]) {
355
356//********************************************************************
357// Station 2 **
358//********************************************************************
359 // indices 1 and 2 for first and second chambers in the station
360 // iChamber (first chamber) kept for other quanties than Z,
361 // assumed to be the same in both chambers
362 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[2];
363 iChamber2 =(AliMUONChamber*) (*fChambers)[3];
364 zpos1=iChamber1->Z();
365 zpos2=iChamber2->Z();
366 dstation = TMath::Abs(zpos2 - zpos1);
367 // DGas and DAlu not changed from standard values
368 zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
369
370//
371// Mother volume
372 tpar[0] = iChamber->RInner()-dframep;
373 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
374 tpar[2] = dstation/5;
375
376 gMC->Gsvolu("S03M", "TUBE", idAir, tpar, 3);
377 gMC->Gsvolu("S04M", "TUBE", idAir, tpar, 3);
378 gMC->Gspos("S03M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
379 gMC->Gspos("S04M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
380 gMC->Gsbool("S03M", "L3DO");
381 gMC->Gsbool("S03M", "L3O1");
382 gMC->Gsbool("S03M", "L3O2");
383 gMC->Gsbool("S04M", "L3DO");
384 gMC->Gsbool("S04M", "L3O1");
385 gMC->Gsbool("S04M", "L3O2");
386
387// // Aluminium frames
388// // Outer frames
389// pgpar[0] = 360/12/2;
390// pgpar[1] = 360.;
391// pgpar[2] = 12.;
392// pgpar[3] = 2;
393// pgpar[4] = -dframez/2;
394// pgpar[5] = iChamber->ROuter();
395// pgpar[6] = pgpar[5]+dframep;
396// pgpar[7] = +dframez/2;
397// pgpar[8] = pgpar[5];
398// pgpar[9] = pgpar[6];
399// gMC->Gsvolu("S03O", "PGON", idAlu1, pgpar, 10);
400// gMC->Gsvolu("S04O", "PGON", idAlu1, pgpar, 10);
401// gMC->Gspos("S03O",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
402// gMC->Gspos("S03O",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
403// gMC->Gspos("S04O",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
404// gMC->Gspos("S04O",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
405// //
406// // Inner frame
407// tpar[0]= iChamber->RInner()-dframep;
408// tpar[1]= iChamber->RInner();
409// tpar[2]= dframez/2;
410// gMC->Gsvolu("S03I", "TUBE", idAlu1, tpar, 3);
411// gMC->Gsvolu("S04I", "TUBE", idAlu1, tpar, 3);
412
413// gMC->Gspos("S03I",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
414// gMC->Gspos("S03I",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
415// gMC->Gspos("S04I",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
416// gMC->Gspos("S04I",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
417//
418// Frame Crosses
419 if (frameCrosses) {
420 // outside gas
421 // security for inside mother volume
422 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
423 * TMath::Cos(TMath::ASin(dframep1 /
424 (iChamber->ROuter() - iChamber->RInner())))
425 / 2.0;
426 bpar[1] = dframep1/2;
427 // total thickness will be (4 * bpar[2]) for each chamber,
428 // which has to be equal to (2 * dframez) - DAlu
429 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
430 gMC->Gsvolu("S03B", "BOX", idAlu1, bpar, 3);
431 gMC->Gsvolu("S04B", "BOX", idAlu1, bpar, 3);
432
433 gMC->Gspos("S03B",1,"S03M", -iChamber->RInner()-bpar[0] , 0, zfpos,
434 idrotm[1100],"ONLY");
435 gMC->Gspos("S03B",2,"S03M", +iChamber->RInner()+bpar[0] , 0, zfpos,
436 idrotm[1100],"ONLY");
437 gMC->Gspos("S03B",3,"S03M", 0, -iChamber->RInner()-bpar[0] , zfpos,
438 idrotm[1101],"ONLY");
439 gMC->Gspos("S03B",4,"S03M", 0, +iChamber->RInner()+bpar[0] , zfpos,
440 idrotm[1101],"ONLY");
441 gMC->Gspos("S03B",5,"S03M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
442 idrotm[1100],"ONLY");
443 gMC->Gspos("S03B",6,"S03M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
444 idrotm[1100],"ONLY");
445 gMC->Gspos("S03B",7,"S03M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
446 idrotm[1101],"ONLY");
447 gMC->Gspos("S03B",8,"S03M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
448 idrotm[1101],"ONLY");
449
450 gMC->Gspos("S04B",1,"S04M", -iChamber->RInner()-bpar[0] , 0, zfpos,
451 idrotm[1100],"ONLY");
452 gMC->Gspos("S04B",2,"S04M", +iChamber->RInner()+bpar[0] , 0, zfpos,
453 idrotm[1100],"ONLY");
454 gMC->Gspos("S04B",3,"S04M", 0, -iChamber->RInner()-bpar[0] , zfpos,
455 idrotm[1101],"ONLY");
456 gMC->Gspos("S04B",4,"S04M", 0, +iChamber->RInner()+bpar[0] , zfpos,
457 idrotm[1101],"ONLY");
458 gMC->Gspos("S04B",5,"S04M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
459 idrotm[1100],"ONLY");
460 gMC->Gspos("S04B",6,"S04M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
461 idrotm[1100],"ONLY");
462 gMC->Gspos("S04B",7,"S04M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
463 idrotm[1101],"ONLY");
464 gMC->Gspos("S04B",8,"S04M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
465 idrotm[1101],"ONLY");
466 }
467//
468// Chamber Material represented by Alu sheet
469 tpar[0]= iChamber->RInner();
470 tpar[1]= iChamber->ROuter();
471 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
472 gMC->Gsvolu("S03A", "TUBE", idAlu2, tpar, 3);
473 gMC->Gsvolu("S04A", "TUBE", idAlu2, tpar, 3);
474 gMC->Gspos("S03A", 1, "S03M", 0., 0., 0., 0, "ONLY");
475 gMC->Gspos("S04A", 1, "S04M", 0., 0., 0., 0, "ONLY");
476//
477// Sensitive volumes
478 // tpar[2] = iChamber->DGas();
479 tpar[2] = iChamber->DGas()/2;
480 gMC->Gsvolu("S03G", "TUBE", idGas, tpar, 3);
481 gMC->Gsvolu("S04G", "TUBE", idGas, tpar, 3);
482 gMC->Gspos("S03G", 1, "S03A", 0., 0., 0., 0, "ONLY");
483 gMC->Gspos("S04G", 1, "S04A", 0., 0., 0., 0, "ONLY");
484//
485// Frame Crosses to be placed inside gas
486 // NONE: chambers are sensitive everywhere
487// if (frameCrosses) {
488
489// dr = (iChamber->ROuter() - iChamber->RInner());
490// bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
491// bpar[1] = dframep1/2;
492// bpar[2] = iChamber->DGas()/2;
493// gMC->Gsvolu("S03F", "BOX", idAlu1, bpar, 3);
494// gMC->Gsvolu("S04F", "BOX", idAlu1, bpar, 3);
495
496// gMC->Gspos("S03F",1,"S03G", +iChamber->RInner()+bpar[0] , 0, 0,
497// idrotm[1100],"ONLY");
498// gMC->Gspos("S03F",2,"S03G", -iChamber->RInner()-bpar[0] , 0, 0,
499// idrotm[1100],"ONLY");
500// gMC->Gspos("S03F",3,"S03G", 0, +iChamber->RInner()+bpar[0] , 0,
501// idrotm[1101],"ONLY");
502// gMC->Gspos("S03F",4,"S03G", 0, -iChamber->RInner()-bpar[0] , 0,
503// idrotm[1101],"ONLY");
504
505// gMC->Gspos("S04F",1,"S04G", +iChamber->RInner()+bpar[0] , 0, 0,
506// idrotm[1100],"ONLY");
507// gMC->Gspos("S04F",2,"S04G", -iChamber->RInner()-bpar[0] , 0, 0,
508// idrotm[1100],"ONLY");
509// gMC->Gspos("S04F",3,"S04G", 0, +iChamber->RInner()+bpar[0] , 0,
510// idrotm[1101],"ONLY");
511// gMC->Gspos("S04F",4,"S04G", 0, -iChamber->RInner()-bpar[0] , 0,
512// idrotm[1101],"ONLY");
513// }
514 }
515 // define the id of tracking media:
516 Int_t idCopper = idtmed[1110];
517 Int_t idGlass = idtmed[1111];
518 Int_t idCarbon = idtmed[1112];
519 Int_t idRoha = idtmed[1113];
520
521 // sensitive area: 40*40 cm**2
522 const Float_t ksensLength = 40.;
523 const Float_t ksensHeight = 40.;
524 const Float_t ksensWidth = 0.5; // according to TDR fig 2.120
525 const Int_t ksensMaterial = idGas;
526 const Float_t kyOverlap = 1.5;
527
528 // PCB dimensions in cm; width: 30 mum copper
529 const Float_t kpcbLength = ksensLength;
530 const Float_t kpcbHeight = 60.;
531 const Float_t kpcbWidth = 0.003;
532 const Int_t kpcbMaterial= idCopper;
533
534 // Insulating material: 200 mum glass fiber glued to pcb
535 const Float_t kinsuLength = kpcbLength;
536 const Float_t kinsuHeight = kpcbHeight;
537 const Float_t kinsuWidth = 0.020;
538 const Int_t kinsuMaterial = idGlass;
539
540 // Carbon fiber panels: 200mum carbon/epoxy skin
541 const Float_t kpanelLength = ksensLength;
542 const Float_t kpanelHeight = ksensHeight;
543 const Float_t kpanelWidth = 0.020;
544 const Int_t kpanelMaterial = idCarbon;
545
546 // rohacell between the two carbon panels
547 const Float_t krohaLength = ksensLength;
548 const Float_t krohaHeight = ksensHeight;
549 const Float_t krohaWidth = 0.5;
550 const Int_t krohaMaterial = idRoha;
551
552 // Frame around the slat: 2 sticks along length,2 along height
553 // H: the horizontal ones
554 const Float_t khFrameLength = kpcbLength;
555 const Float_t khFrameHeight = 1.5;
556 const Float_t khFrameWidth = ksensWidth;
557 const Int_t khFrameMaterial = idGlass;
558
559 // V: the vertical ones
560 const Float_t kvFrameLength = 4.0;
561 const Float_t kvFrameHeight = ksensHeight + khFrameHeight;
562 const Float_t kvFrameWidth = ksensWidth;
563 const Int_t kvFrameMaterial = idGlass;
564
565 // B: the horizontal border filled with rohacell
566 const Float_t kbFrameLength = khFrameLength;
567 const Float_t kbFrameHeight = (kpcbHeight - ksensHeight)/2. - khFrameHeight;
568 const Float_t kbFrameWidth = khFrameWidth;
569 const Int_t kbFrameMaterial = idRoha;
570
571 // NULOC: 30 mum copper + 200 mum vetronite (same radiation length as 14mum copper)
572 const Float_t knulocLength = 2.5;
573 const Float_t knulocHeight = 7.5;
574 const Float_t knulocWidth = 0.0030 + 0.0014; // equivalent copper width of vetronite;
575 const Int_t knulocMaterial = idCopper;
576
577 const Float_t kslatHeight = kpcbHeight;
578 const Float_t kslatWidth = ksensWidth + 2.*(kpcbWidth + kinsuWidth +
579 2.* kpanelWidth + krohaWidth);
580 const Int_t kslatMaterial = idAir;
581 const Float_t kdSlatLength = kvFrameLength; // border on left and right
582
583 Float_t spar[3];
584 Int_t i, j;
585
586 // the panel volume contains the rohacell
587
588 Float_t twidth = 2 * kpanelWidth + krohaWidth;
589 Float_t panelpar[3] = { kpanelLength/2., kpanelHeight/2., twidth/2. };
590 Float_t rohapar[3] = { krohaLength/2., krohaHeight/2., krohaWidth/2. };
591
592 // insulating material contains PCB-> gas-> 2 borders filled with rohacell
593
594 twidth = 2*(kinsuWidth + kpcbWidth) + ksensWidth;
595 Float_t insupar[3] = { kinsuLength/2., kinsuHeight/2., twidth/2. };
596 twidth -= 2 * kinsuWidth;
597 Float_t pcbpar[3] = { kpcbLength/2., kpcbHeight/2., twidth/2. };
598 Float_t senspar[3] = { ksensLength/2., ksensHeight/2., ksensWidth/2. };
599 Float_t theight = 2*khFrameHeight + ksensHeight;
600 Float_t hFramepar[3]={khFrameLength/2., theight/2., khFrameWidth/2.};
601 Float_t bFramepar[3]={kbFrameLength/2., kbFrameHeight/2., kbFrameWidth/2.};
602 Float_t vFramepar[3]={kvFrameLength/2., kvFrameHeight/2., kvFrameWidth/2.};
603 Float_t nulocpar[3]={knulocLength/2., knulocHeight/2., knulocWidth/2.};
604 Float_t xx;
605 Float_t xxmax = (kbFrameLength - knulocLength)/2.;
606 Int_t index=0;
607
608 if (fStations[2]) {
609
610//********************************************************************
611// Station 3 **
612//********************************************************************
613 // indices 1 and 2 for first and second chambers in the station
614 // iChamber (first chamber) kept for other quanties than Z,
615 // assumed to be the same in both chambers
616 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[4];
617 iChamber2 =(AliMUONChamber*) (*fChambers)[5];
618 zpos1=iChamber1->Z();
619 zpos2=iChamber2->Z();
620 dstation = TMath::Abs(zpos2 - zpos1);
621
622//
623// Mother volume
624 tpar[0] = iChamber->RInner()-dframep;
625 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
626 tpar[2] = dstation/5;
627
8e8eae84 628 const char *slats5Mother = "S05M";
629 const char *slats6Mother = "S06M";
d1cd2474 630 Float_t zoffs5 = 0;
631 Float_t zoffs6 = 0;
632
633 if (gAlice->GetModule("DIPO")) {
634 slats5Mother="DDIP";
635 slats6Mother="DDIP";
636
637 zoffs5 = TMath::Abs(zpos1);
638 zoffs6 = TMath::Abs(zpos2);
639 }
640
641 else {
642 gMC->Gsvolu("S05M", "TUBE", idAir, tpar, 3);
643 gMC->Gsvolu("S06M", "TUBE", idAir, tpar, 3);
644 gMC->Gspos("S05M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
645 gMC->Gspos("S06M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
646 }
647
648 // volumes for slat geometry (xx=5,..,10 chamber id):
649 // Sxx0 Sxx1 Sxx2 Sxx3 --> Slat Mother volumes
650 // SxxG --> Sensitive volume (gas)
651 // SxxP --> PCB (copper)
652 // SxxI --> Insulator (vetronite)
653 // SxxC --> Carbon panel
654 // SxxR --> Rohacell
655 // SxxH, SxxV --> Horizontal and Vertical frames (vetronite)
656 // SB5x --> Volumes for the 35 cm long PCB
657 // slat dimensions: slat is a MOTHER volume!!! made of air
658
659 // only for chamber 5: slat 1 has a PCB shorter by 5cm!
660
661 Float_t tlength = 35.;
662 Float_t panelpar2[3] = { tlength/2., panelpar[1], panelpar[2]};
663 Float_t rohapar2[3] = { tlength/2., rohapar[1], rohapar[2]};
664 Float_t insupar2[3] = { tlength/2., insupar[1], insupar[2]};
665 Float_t pcbpar2[3] = { tlength/2., pcbpar[1], pcbpar[2]};
666 Float_t senspar2[3] = { tlength/2., senspar[1], senspar[2]};
667 Float_t hFramepar2[3] = { tlength/2., hFramepar[1], hFramepar[2]};
668 Float_t bFramepar2[3] = { tlength/2., bFramepar[1], bFramepar[2]};
669
670 const Int_t knSlats3 = 5; // number of slats per quadrant
671 const Int_t knPCB3[knSlats3] = {3,3,4,3,2}; // n PCB per slat
672 const Float_t kxpos3[knSlats3] = {31., 40., 0., 0., 0.};
673 Float_t slatLength3[knSlats3];
674
675 // create and position the slat (mother) volumes
676
677 char volNam5[5];
678 char volNam6[5];
679 Float_t xSlat3;
680
681 Float_t spar2[3];
682 for (i = 0; i<knSlats3; i++){
683 slatLength3[i] = kpcbLength * knPCB3[i] + 2. * kdSlatLength;
684 xSlat3 = slatLength3[i]/2. - kvFrameLength/2. + kxpos3[i];
685 if (i==1 || i==0) slatLength3[i] -= 2. *kdSlatLength; // frame out in PCB with circular border
686 Float_t ySlat31 = ksensHeight * i - kyOverlap * i;
687 Float_t ySlat32 = -ksensHeight * i + kyOverlap * i;
688 spar[0] = slatLength3[i]/2.;
689 spar[1] = kslatHeight/2.;
690 spar[2] = kslatWidth/2. * 1.01;
691 // take away 5 cm from the first slat in chamber 5
692 Float_t xSlat32 = 0;
693 if (i==1 || i==2) { // 1 pcb is shortened by 5cm
694 spar2[0] = spar[0]-5./2.;
695 xSlat32 = xSlat3 - 5/2.;
696 }
697 else {
698 spar2[0] = spar[0];
699 xSlat32 = xSlat3;
700 }
701 spar2[1] = spar[1];
702 spar2[2] = spar[2];
703 Float_t dzCh3=spar[2] * 1.01;
704 // zSlat to be checked (odd downstream or upstream?)
705 Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2];
706
707 if (gAlice->GetModule("DIPO")) {zSlat*=-1.;}
708
709 sprintf(volNam5,"S05%d",i);
710 gMC->Gsvolu(volNam5,"BOX",kslatMaterial,spar2,3);
711 gMC->Gspos(volNam5, i*4+1,slats5Mother, -xSlat32, ySlat31, zoffs5-zSlat-2.*dzCh3, 0, "ONLY");
712 gMC->Gspos(volNam5, i*4+2,slats5Mother, +xSlat32, ySlat31, zoffs5-zSlat+2.*dzCh3, 0, "ONLY");
713
714 if (i>0) {
715 gMC->Gspos(volNam5, i*4+3,slats5Mother,-xSlat32, ySlat32, zoffs5-zSlat-2.*dzCh3, 0, "ONLY");
716 gMC->Gspos(volNam5, i*4+4,slats5Mother,+xSlat32, ySlat32, zoffs5-zSlat+2.*dzCh3, 0, "ONLY");
717 }
718 sprintf(volNam6,"S06%d",i);
719 gMC->Gsvolu(volNam6,"BOX",kslatMaterial,spar,3);
720 gMC->Gspos(volNam6, i*4+1,slats6Mother,-xSlat3, ySlat31, zoffs6-zSlat-2.*dzCh3, 0, "ONLY");
721 gMC->Gspos(volNam6, i*4+2,slats6Mother,+xSlat3, ySlat31, zoffs6-zSlat+2.*dzCh3, 0, "ONLY");
722 if (i>0) {
723 gMC->Gspos(volNam6, i*4+3,slats6Mother,-xSlat3, ySlat32, zoffs6-zSlat-2.*dzCh3, 0, "ONLY");
724 gMC->Gspos(volNam6, i*4+4,slats6Mother,+xSlat3, ySlat32, zoffs6-zSlat+2.*dzCh3, 0, "ONLY");
725 }
726 }
727
728 // create the panel volume
729
730 gMC->Gsvolu("S05C","BOX",kpanelMaterial,panelpar,3);
731 gMC->Gsvolu("SB5C","BOX",kpanelMaterial,panelpar2,3);
732 gMC->Gsvolu("S06C","BOX",kpanelMaterial,panelpar,3);
733
734 // create the rohacell volume
735
736 gMC->Gsvolu("S05R","BOX",krohaMaterial,rohapar,3);
737 gMC->Gsvolu("SB5R","BOX",krohaMaterial,rohapar2,3);
738 gMC->Gsvolu("S06R","BOX",krohaMaterial,rohapar,3);
739
740 // create the insulating material volume
741
742 gMC->Gsvolu("S05I","BOX",kinsuMaterial,insupar,3);
743 gMC->Gsvolu("SB5I","BOX",kinsuMaterial,insupar2,3);
744 gMC->Gsvolu("S06I","BOX",kinsuMaterial,insupar,3);
745
746 // create the PCB volume
747
748 gMC->Gsvolu("S05P","BOX",kpcbMaterial,pcbpar,3);
749 gMC->Gsvolu("SB5P","BOX",kpcbMaterial,pcbpar2,3);
750 gMC->Gsvolu("S06P","BOX",kpcbMaterial,pcbpar,3);
751
752 // create the sensitive volumes,
753 gMC->Gsvolu("S05G","BOX",ksensMaterial,dum,0);
754 gMC->Gsvolu("S06G","BOX",ksensMaterial,dum,0);
755
756
757 // create the vertical frame volume
758
759 gMC->Gsvolu("S05V","BOX",kvFrameMaterial,vFramepar,3);
760 gMC->Gsvolu("S06V","BOX",kvFrameMaterial,vFramepar,3);
761
762 // create the horizontal frame volume
763
764 gMC->Gsvolu("S05H","BOX",khFrameMaterial,hFramepar,3);
765 gMC->Gsvolu("SB5H","BOX",khFrameMaterial,hFramepar2,3);
766 gMC->Gsvolu("S06H","BOX",khFrameMaterial,hFramepar,3);
767
768 // create the horizontal border volume
769
770 gMC->Gsvolu("S05B","BOX",kbFrameMaterial,bFramepar,3);
771 gMC->Gsvolu("SB5B","BOX",kbFrameMaterial,bFramepar2,3);
772 gMC->Gsvolu("S06B","BOX",kbFrameMaterial,bFramepar,3);
773
774 index=0;
775 for (i = 0; i<knSlats3; i++){
776 sprintf(volNam5,"S05%d",i);
777 sprintf(volNam6,"S06%d",i);
778 Float_t xvFrame = (slatLength3[i] - kvFrameLength)/2.;
779 Float_t xvFrame2 = xvFrame;
780 if ( i==1 || i ==2 ) xvFrame2 -= 5./2.;
781 // position the vertical frames
782 if (i!=1 && i!=0) {
783 gMC->Gspos("S05V",2*i-1,volNam5, xvFrame2, 0., 0. , 0, "ONLY");
784 gMC->Gspos("S05V",2*i ,volNam5,-xvFrame2, 0., 0. , 0, "ONLY");
785 gMC->Gspos("S06V",2*i-1,volNam6, xvFrame, 0., 0. , 0, "ONLY");
786 gMC->Gspos("S06V",2*i ,volNam6,-xvFrame, 0., 0. , 0, "ONLY");
787 }
788 // position the panels and the insulating material
789 for (j=0; j<knPCB3[i]; j++){
790 index++;
791 Float_t xx = ksensLength * (-knPCB3[i]/2.+j+.5);
792 Float_t xx2 = xx + 5/2.;
793
794 Float_t zPanel = spar[2] - panelpar[2];
795 if ( (i==1 || i==2) && j == knPCB3[i]-1) { // 1 pcb is shortened by 5cm
796 gMC->Gspos("SB5C",2*index-1,volNam5, xx, 0., zPanel , 0, "ONLY");
797 gMC->Gspos("SB5C",2*index ,volNam5, xx, 0.,-zPanel , 0, "ONLY");
798 gMC->Gspos("SB5I",index ,volNam5, xx, 0., 0 , 0, "ONLY");
799 }
800 else if ( (i==1 || i==2) && j < knPCB3[i]-1) {
801 gMC->Gspos("S05C",2*index-1,volNam5, xx2, 0., zPanel , 0, "ONLY");
802 gMC->Gspos("S05C",2*index ,volNam5, xx2, 0.,-zPanel , 0, "ONLY");
803 gMC->Gspos("S05I",index ,volNam5, xx2, 0., 0 , 0, "ONLY");
804 }
805 else {
806 gMC->Gspos("S05C",2*index-1,volNam5, xx, 0., zPanel , 0, "ONLY");
807 gMC->Gspos("S05C",2*index ,volNam5, xx, 0.,-zPanel , 0, "ONLY");
808 gMC->Gspos("S05I",index ,volNam5, xx, 0., 0 , 0, "ONLY");
809 }
810 gMC->Gspos("S06C",2*index-1,volNam6, xx, 0., zPanel , 0, "ONLY");
811 gMC->Gspos("S06C",2*index ,volNam6, xx, 0.,-zPanel , 0, "ONLY");
812 gMC->Gspos("S06I",index,volNam6, xx, 0., 0 , 0, "ONLY");
813 }
814 }
815
816 // position the rohacell volume inside the panel volume
817 gMC->Gspos("S05R",1,"S05C",0.,0.,0.,0,"ONLY");
818 gMC->Gspos("SB5R",1,"SB5C",0.,0.,0.,0,"ONLY");
819 gMC->Gspos("S06R",1,"S06C",0.,0.,0.,0,"ONLY");
820
821 // position the PCB volume inside the insulating material volume
822 gMC->Gspos("S05P",1,"S05I",0.,0.,0.,0,"ONLY");
823 gMC->Gspos("SB5P",1,"SB5I",0.,0.,0.,0,"ONLY");
824 gMC->Gspos("S06P",1,"S06I",0.,0.,0.,0,"ONLY");
825 // position the horizontal frame volume inside the PCB volume
826 gMC->Gspos("S05H",1,"S05P",0.,0.,0.,0,"ONLY");
827 gMC->Gspos("SB5H",1,"SB5P",0.,0.,0.,0,"ONLY");
828 gMC->Gspos("S06H",1,"S06P",0.,0.,0.,0,"ONLY");
829 // position the sensitive volume inside the horizontal frame volume
830 gMC->Gsposp("S05G",1,"S05H",0.,0.,0.,0,"ONLY",senspar,3);
831 gMC->Gsposp("S05G",1,"SB5H",0.,0.,0.,0,"ONLY",senspar2,3);
832 gMC->Gsposp("S06G",1,"S06H",0.,0.,0.,0,"ONLY",senspar,3);
833 // position the border volumes inside the PCB volume
834 Float_t yborder = ( kpcbHeight - kbFrameHeight ) / 2.;
835 gMC->Gspos("S05B",1,"S05P",0., yborder,0.,0,"ONLY");
836 gMC->Gspos("S05B",2,"S05P",0.,-yborder,0.,0,"ONLY");
837 gMC->Gspos("SB5B",1,"SB5P",0., yborder,0.,0,"ONLY");
838 gMC->Gspos("SB5B",2,"SB5P",0.,-yborder,0.,0,"ONLY");
839 gMC->Gspos("S06B",1,"S06P",0., yborder,0.,0,"ONLY");
840 gMC->Gspos("S06B",2,"S06P",0.,-yborder,0.,0,"ONLY");
841
842 // create the NULOC volume and position it in the horizontal frame
843
844 gMC->Gsvolu("S05N","BOX",knulocMaterial,nulocpar,3);
845 gMC->Gsvolu("S06N","BOX",knulocMaterial,nulocpar,3);
846 index = 0;
847 Float_t xxmax2 = xxmax - 5./2.;
848 for (xx = -xxmax; xx<=xxmax; xx+=2*knulocLength) {
849 index++;
850 gMC->Gspos("S05N",2*index-1,"S05B", xx, 0.,-kbFrameWidth/4., 0, "ONLY");
851 gMC->Gspos("S05N",2*index ,"S05B", xx, 0., kbFrameWidth/4., 0, "ONLY");
852 if (xx > -xxmax2 && xx< xxmax2) {
853 gMC->Gspos("S05N",2*index-1,"SB5B", xx, 0.,-kbFrameWidth/4., 0, "ONLY");
854 gMC->Gspos("S05N",2*index ,"SB5B", xx, 0., kbFrameWidth/4., 0, "ONLY");
855 }
856 gMC->Gspos("S06N",2*index-1,"S06B", xx, 0.,-kbFrameWidth/4., 0, "ONLY");
857 gMC->Gspos("S06N",2*index ,"S06B", xx, 0., kbFrameWidth/4., 0, "ONLY");
858 }
859
860 // position the volumes approximating the circular section of the pipe
861 Float_t yoffs = ksensHeight/2. - kyOverlap;
862 Float_t epsilon = 0.001;
863 Int_t ndiv=6;
864 Float_t divpar[3];
865 Double_t dydiv= ksensHeight/ndiv;
866 Double_t ydiv = yoffs -dydiv;
867 Int_t imax=0;
868 imax = 1;
869 Float_t rmin = 33.;
870 Float_t z1 = spar[2], z2=2*spar[2]*1.01;
871 if (gAlice->GetModule("DIPO")) {z1*=-1.;}
872 for (Int_t idiv=0;idiv<ndiv; idiv++){
873 ydiv+= dydiv;
874 Float_t xdiv = 0.;
875 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
876 divpar[0] = (kpcbLength-xdiv)/2.;
877 divpar[1] = dydiv/2. - epsilon;
878 divpar[2] = ksensWidth/2.;
879 Float_t xvol=(kpcbLength+xdiv)/2.+1.999;
880 Float_t yvol=ydiv + dydiv/2.;
881 //printf ("y ll = %f y ur = %f \n",yvol - divpar[1], yvol + divpar[1]);
882 gMC->Gsposp("S05G",imax+4*idiv+1,slats5Mother,-xvol, yvol, zoffs5-z1-z2, 0, "ONLY",divpar,3);
883 gMC->Gsposp("S06G",imax+4*idiv+1,slats6Mother,-xvol, yvol, zoffs6-z1-z2, 0, "ONLY",divpar,3);
884 gMC->Gsposp("S05G",imax+4*idiv+2,slats5Mother,-xvol,-yvol, zoffs5-z1-z2, 0, "ONLY",divpar,3);
885 gMC->Gsposp("S06G",imax+4*idiv+2,slats6Mother,-xvol,-yvol, zoffs6-z1-z2, 0, "ONLY",divpar,3);
886 gMC->Gsposp("S05G",imax+4*idiv+3,slats5Mother,+xvol, yvol, zoffs5-z1+z2, 0, "ONLY",divpar,3);
887 gMC->Gsposp("S06G",imax+4*idiv+3,slats6Mother,+xvol, yvol, zoffs6-z1+z2, 0, "ONLY",divpar,3);
888 gMC->Gsposp("S05G",imax+4*idiv+4,slats5Mother,+xvol,-yvol, zoffs5-z1+z2, 0, "ONLY",divpar,3);
889 gMC->Gsposp("S06G",imax+4*idiv+4,slats6Mother,+xvol,-yvol, zoffs6-z1+z2, 0, "ONLY",divpar,3);
890 }
891 }
892
893 if (fStations[3]) {
894
895//********************************************************************
896// Station 4 **
897//********************************************************************
898 // indices 1 and 2 for first and second chambers in the station
899 // iChamber (first chamber) kept for other quanties than Z,
900 // assumed to be the same in both chambers
901 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[6];
902 iChamber2 =(AliMUONChamber*) (*fChambers)[7];
903 zpos1=iChamber1->Z();
904 zpos2=iChamber2->Z();
905 dstation = TMath::Abs(zpos2 - zpos1);
906// zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
907
908//
909// Mother volume
910 tpar[0] = iChamber->RInner()-dframep;
911 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
912 tpar[2] = dstation/4;
913
914 gMC->Gsvolu("S07M", "TUBE", idAir, tpar, 3);
915 gMC->Gsvolu("S08M", "TUBE", idAir, tpar, 3);
916 gMC->Gspos("S07M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
917 gMC->Gspos("S08M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
918
919
920 const Int_t knSlats4 = 6; // number of slats per quadrant
921 const Int_t knPCB4[knSlats4] = {4,4,5,5,4,3}; // n PCB per slat
922 const Float_t kxpos4[knSlats4] = {38.5, 40., 0., 0., 0., 0.};
923 Float_t slatLength4[knSlats4];
924
925 // create and position the slat (mother) volumes
926
927 char volNam7[5];
928 char volNam8[5];
929 Float_t xSlat4;
930 Float_t ySlat4;
931
932 for (i = 0; i<knSlats4; i++){
933 slatLength4[i] = kpcbLength * knPCB4[i] + 2. * kdSlatLength;
934 xSlat4 = slatLength4[i]/2. - kvFrameLength/2. + kxpos4[i];
935 if (i==1) slatLength4[i] -= 2. *kdSlatLength; // frame out in PCB with circular border
936 ySlat4 = ksensHeight * i - kyOverlap *i;
937
938 spar[0] = slatLength4[i]/2.;
939 spar[1] = kslatHeight/2.;
940 spar[2] = kslatWidth/2.*1.01;
941 Float_t dzCh4=spar[2]*1.01;
942 // zSlat to be checked (odd downstream or upstream?)
943 Float_t zSlat = (i%2 ==0)? spar[2] : -spar[2];
944 sprintf(volNam7,"S07%d",i);
945 gMC->Gsvolu(volNam7,"BOX",kslatMaterial,spar,3);
946 gMC->Gspos(volNam7, i*4+1,"S07M",-xSlat4, ySlat4, -zSlat-2.*dzCh4, 0, "ONLY");
947 gMC->Gspos(volNam7, i*4+2,"S07M",+xSlat4, ySlat4, -zSlat+2.*dzCh4, 0, "ONLY");
948 if (i>0) {
949 gMC->Gspos(volNam7, i*4+3,"S07M",-xSlat4,-ySlat4, -zSlat-2.*dzCh4, 0, "ONLY");
950 gMC->Gspos(volNam7, i*4+4,"S07M",+xSlat4,-ySlat4, -zSlat+2.*dzCh4, 0, "ONLY");
951 }
952 sprintf(volNam8,"S08%d",i);
953 gMC->Gsvolu(volNam8,"BOX",kslatMaterial,spar,3);
954 gMC->Gspos(volNam8, i*4+1,"S08M",-xSlat4, ySlat4, -zSlat-2.*dzCh4, 0, "ONLY");
955 gMC->Gspos(volNam8, i*4+2,"S08M",+xSlat4, ySlat4, -zSlat+2.*dzCh4, 0, "ONLY");
956 if (i>0) {
957 gMC->Gspos(volNam8, i*4+3,"S08M",-xSlat4,-ySlat4, -zSlat-2.*dzCh4, 0, "ONLY");
958 gMC->Gspos(volNam8, i*4+4,"S08M",+xSlat4,-ySlat4, -zSlat+2.*dzCh4, 0, "ONLY");
959 }
960 }
961
962
963 // create the panel volume
964
965 gMC->Gsvolu("S07C","BOX",kpanelMaterial,panelpar,3);
966 gMC->Gsvolu("S08C","BOX",kpanelMaterial,panelpar,3);
967
968 // create the rohacell volume
969
970 gMC->Gsvolu("S07R","BOX",krohaMaterial,rohapar,3);
971 gMC->Gsvolu("S08R","BOX",krohaMaterial,rohapar,3);
972
973 // create the insulating material volume
974
975 gMC->Gsvolu("S07I","BOX",kinsuMaterial,insupar,3);
976 gMC->Gsvolu("S08I","BOX",kinsuMaterial,insupar,3);
977
978 // create the PCB volume
979
980 gMC->Gsvolu("S07P","BOX",kpcbMaterial,pcbpar,3);
981 gMC->Gsvolu("S08P","BOX",kpcbMaterial,pcbpar,3);
982
983 // create the sensitive volumes,
984
985 gMC->Gsvolu("S07G","BOX",ksensMaterial,dum,0);
986 gMC->Gsvolu("S08G","BOX",ksensMaterial,dum,0);
987
988 // create the vertical frame volume
989
990 gMC->Gsvolu("S07V","BOX",kvFrameMaterial,vFramepar,3);
991 gMC->Gsvolu("S08V","BOX",kvFrameMaterial,vFramepar,3);
992
993 // create the horizontal frame volume
994
995 gMC->Gsvolu("S07H","BOX",khFrameMaterial,hFramepar,3);
996 gMC->Gsvolu("S08H","BOX",khFrameMaterial,hFramepar,3);
997
998 // create the horizontal border volume
999
1000 gMC->Gsvolu("S07B","BOX",kbFrameMaterial,bFramepar,3);
1001 gMC->Gsvolu("S08B","BOX",kbFrameMaterial,bFramepar,3);
1002
1003 index=0;
1004 for (i = 0; i<knSlats4; i++){
1005 sprintf(volNam7,"S07%d",i);
1006 sprintf(volNam8,"S08%d",i);
1007 Float_t xvFrame = (slatLength4[i] - kvFrameLength)/2.;
1008 // position the vertical frames
1009 if (i!=1 && i!=0) {
1010 gMC->Gspos("S07V",2*i-1,volNam7, xvFrame, 0., 0. , 0, "ONLY");
1011 gMC->Gspos("S07V",2*i ,volNam7,-xvFrame, 0., 0. , 0, "ONLY");
1012 gMC->Gspos("S08V",2*i-1,volNam8, xvFrame, 0., 0. , 0, "ONLY");
1013 gMC->Gspos("S08V",2*i ,volNam8,-xvFrame, 0., 0. , 0, "ONLY");
1014 }
1015 // position the panels and the insulating material
1016 for (j=0; j<knPCB4[i]; j++){
1017 index++;
1018 Float_t xx = ksensLength * (-knPCB4[i]/2.+j+.5);
1019
1020 Float_t zPanel = spar[2] - panelpar[2];
1021 gMC->Gspos("S07C",2*index-1,volNam7, xx, 0., zPanel , 0, "ONLY");
1022 gMC->Gspos("S07C",2*index ,volNam7, xx, 0.,-zPanel , 0, "ONLY");
1023 gMC->Gspos("S08C",2*index-1,volNam8, xx, 0., zPanel , 0, "ONLY");
1024 gMC->Gspos("S08C",2*index ,volNam8, xx, 0.,-zPanel , 0, "ONLY");
1025
1026 gMC->Gspos("S07I",index,volNam7, xx, 0., 0 , 0, "ONLY");
1027 gMC->Gspos("S08I",index,volNam8, xx, 0., 0 , 0, "ONLY");
1028 }
1029 }
1030
1031 // position the rohacell volume inside the panel volume
1032 gMC->Gspos("S07R",1,"S07C",0.,0.,0.,0,"ONLY");
1033 gMC->Gspos("S08R",1,"S08C",0.,0.,0.,0,"ONLY");
1034
1035 // position the PCB volume inside the insulating material volume
1036 gMC->Gspos("S07P",1,"S07I",0.,0.,0.,0,"ONLY");
1037 gMC->Gspos("S08P",1,"S08I",0.,0.,0.,0,"ONLY");
1038 // position the horizontal frame volume inside the PCB volume
1039 gMC->Gspos("S07H",1,"S07P",0.,0.,0.,0,"ONLY");
1040 gMC->Gspos("S08H",1,"S08P",0.,0.,0.,0,"ONLY");
1041 // position the sensitive volume inside the horizontal frame volume
1042 gMC->Gsposp("S07G",1,"S07H",0.,0.,0.,0,"ONLY",senspar,3);
1043 gMC->Gsposp("S08G",1,"S08H",0.,0.,0.,0,"ONLY",senspar,3);
1044 // position the border volumes inside the PCB volume
1045 Float_t yborder = ( kpcbHeight - kbFrameHeight ) / 2.;
1046 gMC->Gspos("S07B",1,"S07P",0., yborder,0.,0,"ONLY");
1047 gMC->Gspos("S07B",2,"S07P",0.,-yborder,0.,0,"ONLY");
1048 gMC->Gspos("S08B",1,"S08P",0., yborder,0.,0,"ONLY");
1049 gMC->Gspos("S08B",2,"S08P",0.,-yborder,0.,0,"ONLY");
1050
1051 // create the NULOC volume and position it in the horizontal frame
1052
1053 gMC->Gsvolu("S07N","BOX",knulocMaterial,nulocpar,3);
1054 gMC->Gsvolu("S08N","BOX",knulocMaterial,nulocpar,3);
1055 index = 0;
1056 for (xx = -xxmax; xx<=xxmax; xx+=2*knulocLength) {
1057 index++;
1058 gMC->Gspos("S07N",2*index-1,"S07B", xx, 0.,-kbFrameWidth/4., 0, "ONLY");
1059 gMC->Gspos("S07N",2*index ,"S07B", xx, 0., kbFrameWidth/4., 0, "ONLY");
1060 gMC->Gspos("S08N",2*index-1,"S08B", xx, 0.,-kbFrameWidth/4., 0, "ONLY");
1061 gMC->Gspos("S08N",2*index ,"S08B", xx, 0., kbFrameWidth/4., 0, "ONLY");
1062 }
1063
1064 // position the volumes approximating the circular section of the pipe
1065 Float_t yoffs = ksensHeight/2. - kyOverlap;
1066 Float_t epsilon = 0.001;
1067 Int_t ndiv=6;
1068 Float_t divpar[3];
1069 Double_t dydiv= ksensHeight/ndiv;
1070 Double_t ydiv = yoffs -dydiv;
1071 Int_t imax=0;
1072 imax = 1;
1073 Float_t rmin = 40.;
1074 Float_t z1 = -spar[2], z2=2*spar[2]*1.01;
1075 for (Int_t idiv=0;idiv<ndiv; idiv++){
1076 ydiv+= dydiv;
1077 Float_t xdiv = 0.;
1078 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
1079 divpar[0] = (kpcbLength-xdiv)/2.;
1080 divpar[1] = dydiv/2. - epsilon;
1081 divpar[2] = ksensWidth/2.;
1082 Float_t xvol=(kpcbLength+xdiv)/2.+1.999;
1083 Float_t yvol=ydiv + dydiv/2.;
1084 gMC->Gsposp("S07G",imax+4*idiv+1,"S07M", -xvol, yvol, -z1-z2, 0, "ONLY",divpar,3);
1085 gMC->Gsposp("S08G",imax+4*idiv+1,"S08M", -xvol, yvol, -z1-z2, 0, "ONLY",divpar,3);
1086 gMC->Gsposp("S07G",imax+4*idiv+2,"S07M", -xvol,-yvol, -z1-z2, 0, "ONLY",divpar,3);
1087 gMC->Gsposp("S08G",imax+4*idiv+2,"S08M", -xvol,-yvol, -z1-z2, 0, "ONLY",divpar,3);
1088 gMC->Gsposp("S07G",imax+4*idiv+3,"S07M", xvol, yvol, -z1+z2, 0, "ONLY",divpar,3);
1089 gMC->Gsposp("S08G",imax+4*idiv+3,"S08M", xvol, yvol, -z1+z2, 0, "ONLY",divpar,3);
1090 gMC->Gsposp("S07G",imax+4*idiv+4,"S07M", xvol,-yvol, -z1+z2, 0, "ONLY",divpar,3);
1091 gMC->Gsposp("S08G",imax+4*idiv+4,"S08M", xvol,-yvol, -z1+z2, 0, "ONLY",divpar,3);
1092 }
1093
1094
1095
1096
1097
1098 }
1099
1100 if (fStations[4]) {
1101
1102
1103//********************************************************************
1104// Station 5 **
1105//********************************************************************
1106 // indices 1 and 2 for first and second chambers in the station
1107 // iChamber (first chamber) kept for other quanties than Z,
1108 // assumed to be the same in both chambers
1109 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[8];
1110 iChamber2 =(AliMUONChamber*) (*fChambers)[9];
1111 zpos1=iChamber1->Z();
1112 zpos2=iChamber2->Z();
1113 dstation = TMath::Abs(zpos2 - zpos1);
1114// zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
1115
1116//
1117// Mother volume
1118 tpar[0] = iChamber->RInner()-dframep;
1119 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
1120 tpar[2] = dstation/5.;
1121
1122 gMC->Gsvolu("S09M", "TUBE", idAir, tpar, 3);
1123 gMC->Gsvolu("S10M", "TUBE", idAir, tpar, 3);
1124 gMC->Gspos("S09M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
1125 gMC->Gspos("S10M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
1126
1127
1128 const Int_t knSlats5 = 7; // number of slats per quadrant
1129 const Int_t knPCB5[knSlats5] = {5,5,6,6,5,4,3}; // n PCB per slat
1130 const Float_t kxpos5[knSlats5] = {38.5, 40., 0., 0., 0., 0., 0.};
1131 Float_t slatLength5[knSlats5];
1132 char volNam9[5];
1133 char volNam10[5];
1134 Float_t xSlat5;
1135 Float_t ySlat5;
1136
1137 for (i = 0; i<knSlats5; i++){
1138 slatLength5[i] = kpcbLength * knPCB5[i] + 2. * kdSlatLength;
1139 xSlat5 = slatLength5[i]/2. - kvFrameLength/2. +kxpos5[i];
1140 if (i==1 || i==0) slatLength5[i] -= 2. *kdSlatLength; // frame out in PCB with circular border
1141 ySlat5 = ksensHeight * i - kyOverlap * i;
1142 spar[0] = slatLength5[i]/2.;
1143 spar[1] = kslatHeight/2.;
1144 spar[2] = kslatWidth/2. * 1.01;
1145 Float_t dzCh5=spar[2]*1.01;
1146 // zSlat to be checked (odd downstream or upstream?)
1147 Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2];
1148 sprintf(volNam9,"S09%d",i);
1149 gMC->Gsvolu(volNam9,"BOX",kslatMaterial,spar,3);
1150 gMC->Gspos(volNam9, i*4+1,"S09M",-xSlat5, ySlat5, -zSlat-2.*dzCh5, 0, "ONLY");
1151 gMC->Gspos(volNam9, i*4+2,"S09M",+xSlat5, ySlat5, -zSlat+2.*dzCh5, 0, "ONLY");
1152 if (i>0) {
1153 gMC->Gspos(volNam9, i*4+3,"S09M",-xSlat5,-ySlat5, -zSlat-2.*dzCh5, 0, "ONLY");
1154 gMC->Gspos(volNam9, i*4+4,"S09M",+xSlat5,-ySlat5, -zSlat+2.*dzCh5, 0, "ONLY");
1155 }
1156 sprintf(volNam10,"S10%d",i);
1157 gMC->Gsvolu(volNam10,"BOX",kslatMaterial,spar,3);
1158 gMC->Gspos(volNam10, i*4+1,"S10M",-xSlat5, ySlat5, -zSlat-2.*dzCh5, 0, "ONLY");
1159 gMC->Gspos(volNam10, i*4+2,"S10M",+xSlat5, ySlat5, -zSlat+2.*dzCh5, 0, "ONLY");
1160 if (i>0) {
1161 gMC->Gspos(volNam10, i*4+3,"S10M",-xSlat5,-ySlat5, -zSlat-2.*dzCh5, 0, "ONLY");
1162 gMC->Gspos(volNam10, i*4+4,"S10M",+xSlat5,-ySlat5, -zSlat+2.*dzCh5, 0, "ONLY");
1163 }
1164 }
1165
1166 // create the panel volume
1167
1168 gMC->Gsvolu("S09C","BOX",kpanelMaterial,panelpar,3);
1169 gMC->Gsvolu("S10C","BOX",kpanelMaterial,panelpar,3);
1170
1171 // create the rohacell volume
1172
1173 gMC->Gsvolu("S09R","BOX",krohaMaterial,rohapar,3);
1174 gMC->Gsvolu("S10R","BOX",krohaMaterial,rohapar,3);
1175
1176 // create the insulating material volume
1177
1178 gMC->Gsvolu("S09I","BOX",kinsuMaterial,insupar,3);
1179 gMC->Gsvolu("S10I","BOX",kinsuMaterial,insupar,3);
1180
1181 // create the PCB volume
1182
1183 gMC->Gsvolu("S09P","BOX",kpcbMaterial,pcbpar,3);
1184 gMC->Gsvolu("S10P","BOX",kpcbMaterial,pcbpar,3);
1185
1186 // create the sensitive volumes,
1187
1188 gMC->Gsvolu("S09G","BOX",ksensMaterial,dum,0);
1189 gMC->Gsvolu("S10G","BOX",ksensMaterial,dum,0);
1190
1191 // create the vertical frame volume
1192
1193 gMC->Gsvolu("S09V","BOX",kvFrameMaterial,vFramepar,3);
1194 gMC->Gsvolu("S10V","BOX",kvFrameMaterial,vFramepar,3);
1195
1196 // create the horizontal frame volume
1197
1198 gMC->Gsvolu("S09H","BOX",khFrameMaterial,hFramepar,3);
1199 gMC->Gsvolu("S10H","BOX",khFrameMaterial,hFramepar,3);
1200
1201 // create the horizontal border volume
1202
1203 gMC->Gsvolu("S09B","BOX",kbFrameMaterial,bFramepar,3);
1204 gMC->Gsvolu("S10B","BOX",kbFrameMaterial,bFramepar,3);
1205
1206 index=0;
1207 for (i = 0; i<knSlats5; i++){
1208 sprintf(volNam9,"S09%d",i);
1209 sprintf(volNam10,"S10%d",i);
1210 Float_t xvFrame = (slatLength5[i] - kvFrameLength)/2.;
1211 // position the vertical frames
1212 if (i!=1 && i!=0) {
1213 gMC->Gspos("S09V",2*i-1,volNam9, xvFrame, 0., 0. , 0, "ONLY");
1214 gMC->Gspos("S09V",2*i ,volNam9,-xvFrame, 0., 0. , 0, "ONLY");
1215 gMC->Gspos("S10V",2*i-1,volNam10, xvFrame, 0., 0. , 0, "ONLY");
1216 gMC->Gspos("S10V",2*i ,volNam10,-xvFrame, 0., 0. , 0, "ONLY");
1217 }
1218
1219 // position the panels and the insulating material
1220 for (j=0; j<knPCB5[i]; j++){
1221 index++;
1222 Float_t xx = ksensLength * (-knPCB5[i]/2.+j+.5);
1223
1224 Float_t zPanel = spar[2] - panelpar[2];
1225 gMC->Gspos("S09C",2*index-1,volNam9, xx, 0., zPanel , 0, "ONLY");
1226 gMC->Gspos("S09C",2*index ,volNam9, xx, 0.,-zPanel , 0, "ONLY");
1227 gMC->Gspos("S10C",2*index-1,volNam10, xx, 0., zPanel , 0, "ONLY");
1228 gMC->Gspos("S10C",2*index ,volNam10, xx, 0.,-zPanel , 0, "ONLY");
1229
1230 gMC->Gspos("S09I",index,volNam9, xx, 0., 0 , 0, "ONLY");
1231 gMC->Gspos("S10I",index,volNam10, xx, 0., 0 , 0, "ONLY");
1232 }
1233 }
1234
1235 // position the rohacell volume inside the panel volume
1236 gMC->Gspos("S09R",1,"S09C",0.,0.,0.,0,"ONLY");
1237 gMC->Gspos("S10R",1,"S10C",0.,0.,0.,0,"ONLY");
1238
1239 // position the PCB volume inside the insulating material volume
1240 gMC->Gspos("S09P",1,"S09I",0.,0.,0.,0,"ONLY");
1241 gMC->Gspos("S10P",1,"S10I",0.,0.,0.,0,"ONLY");
1242 // position the horizontal frame volume inside the PCB volume
1243 gMC->Gspos("S09H",1,"S09P",0.,0.,0.,0,"ONLY");
1244 gMC->Gspos("S10H",1,"S10P",0.,0.,0.,0,"ONLY");
1245 // position the sensitive volume inside the horizontal frame volume
1246 gMC->Gsposp("S09G",1,"S09H",0.,0.,0.,0,"ONLY",senspar,3);
1247 gMC->Gsposp("S10G",1,"S10H",0.,0.,0.,0,"ONLY",senspar,3);
1248 // position the border volumes inside the PCB volume
1249 Float_t yborder = ( kpcbHeight - kbFrameHeight ) / 2.;
1250 gMC->Gspos("S09B",1,"S09P",0., yborder,0.,0,"ONLY");
1251 gMC->Gspos("S09B",2,"S09P",0.,-yborder,0.,0,"ONLY");
1252 gMC->Gspos("S10B",1,"S10P",0., yborder,0.,0,"ONLY");
1253 gMC->Gspos("S10B",2,"S10P",0.,-yborder,0.,0,"ONLY");
1254
1255 // create the NULOC volume and position it in the horizontal frame
1256
1257 gMC->Gsvolu("S09N","BOX",knulocMaterial,nulocpar,3);
1258 gMC->Gsvolu("S10N","BOX",knulocMaterial,nulocpar,3);
1259 index = 0;
1260 for (xx = -xxmax; xx<=xxmax; xx+=2*knulocLength) {
1261 index++;
1262 gMC->Gspos("S09N",2*index-1,"S09B", xx, 0.,-kbFrameWidth/4., 0, "ONLY");
1263 gMC->Gspos("S09N",2*index ,"S09B", xx, 0., kbFrameWidth/4., 0, "ONLY");
1264 gMC->Gspos("S10N",2*index-1,"S10B", xx, 0.,-kbFrameWidth/4., 0, "ONLY");
1265 gMC->Gspos("S10N",2*index ,"S10B", xx, 0., kbFrameWidth/4., 0, "ONLY");
1266 }
1267 // position the volumes approximating the circular section of the pipe
1268 Float_t yoffs = ksensHeight/2. - kyOverlap;
1269 Float_t epsilon = 0.001;
1270 Int_t ndiv=6;
1271 Float_t divpar[3];
1272 Double_t dydiv= ksensHeight/ndiv;
1273 Double_t ydiv = yoffs -dydiv;
1274 Int_t imax=0;
1275 // for (Int_t islat=0; islat<knSlats3; islat++) imax += knPCB3[islat];
1276 imax = 1;
1277 Float_t rmin = 40.;
1278 Float_t z1 = spar[2], z2=2*spar[2]*1.01;
1279 for (Int_t idiv=0;idiv<ndiv; idiv++){
1280 ydiv+= dydiv;
1281 Float_t xdiv = 0.;
1282 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
1283 divpar[0] = (kpcbLength-xdiv)/2.;
1284 divpar[1] = dydiv/2. - epsilon;
1285 divpar[2] = ksensWidth/2.;
1286 Float_t xvol=(kpcbLength+xdiv)/2. + 1.999;
1287 Float_t yvol=ydiv + dydiv/2.;
1288 gMC->Gsposp("S09G",imax+4*idiv+1,"S09M", -xvol, yvol, -z1-z2, 0, "ONLY",divpar,3);
1289 gMC->Gsposp("S10G",imax+4*idiv+1,"S10M", -xvol, yvol, -z1-z2, 0, "ONLY",divpar,3);
1290 gMC->Gsposp("S09G",imax+4*idiv+2,"S09M", -xvol,-yvol, -z1-z2, 0, "ONLY",divpar,3);
1291 gMC->Gsposp("S10G",imax+4*idiv+2,"S10M", -xvol,-yvol, -z1-z2, 0, "ONLY",divpar,3);
1292 gMC->Gsposp("S09G",imax+4*idiv+3,"S09M", +xvol, yvol, -z1+z2, 0, "ONLY",divpar,3);
1293 gMC->Gsposp("S10G",imax+4*idiv+3,"S10M", +xvol, yvol, -z1+z2, 0, "ONLY",divpar,3);
1294 gMC->Gsposp("S09G",imax+4*idiv+4,"S09M", +xvol,-yvol, -z1+z2, 0, "ONLY",divpar,3);
1295 gMC->Gsposp("S10G",imax+4*idiv+4,"S10M", +xvol,-yvol, -z1+z2, 0, "ONLY",divpar,3);
1296 }
1297
1298 }
1299
1300//********************************************************************
1301// Trigger **
1302//********************************************************************
1303 /*
1304 zpos1 and zpos2 are the middle of the first and second
1305 planes of station 1 (+1m for second station):
1306 zpos1=(zpos1m+zpos1p)/2=(15999+16071)/2=16035 mm, thick/2=40 mm
1307 zpos2=(zpos2m+zpos2p)/2=(16169+16241)/2=16205 mm, thick/2=40 mm
1308 zposxm and zposxp= middles of gaz gaps within a detection plane
1309 rem: the total thickness accounts for 1 mm of al on both
1310 side of the RPCs (see zpos1 and zpos2)
1311 */
1312
1313// vertical gap between right and left chambers (kDXZERO*2=4cm)
1314 const Float_t kDXZERO=2.;
1315// main distances for chamber definition in first plane/first station
1316 const Float_t kXMIN=34.;
1317 const Float_t kXMED=51.;
1318 const Float_t kXMAX=272.;
1319// kXMAX will become 255. in real life. segmentation to be updated accordingly
1320// (see fig.2-4 & 2-5 of Local Trigger Board PRR)
1321 const Float_t kYMIN=34.;
1322 const Float_t kYMAX=51.;
1323// inner/outer radius of flange between beam shield. and chambers (1/station)
1324 const Float_t kRMIN[2]={50.,50.};
1325 const Float_t kRMAX[2]={64.,68.};
1326// z position of the middle of the gas gap in mother vol
1327 const Float_t kZm=-3.6;
1328 const Float_t kZp=+3.6;
1329
1330 iChamber1 = (AliMUONChamber*) (*fChambers)[10];
1331 zpos1 = iChamber1->Z();
1332
1333// ratio of zpos1m/zpos1p and inverse for first plane
1334 Float_t zmp=(zpos1+3.6)/(zpos1-3.6);
1335 Float_t zpm=1./zmp;
1336
1337 Int_t icount=0; // chamber counter (0 1 2 3)
1338
1339 for (Int_t istation=0; istation<2; istation++) { // loop on stations
1340 for (Int_t iplane=0; iplane<2; iplane++) { // loop on detection planes
1341
1342 Int_t iVolNum=1; // counter Volume Number
1343 icount = Int_t(iplane*TMath::Power(2,0))+
1344 Int_t(istation*TMath::Power(2,1));
1345
1346 char volPlane[5];
1347 sprintf(volPlane,"SM%d%d",istation+1,iplane+1);
1348
1349 iChamber = (AliMUONChamber*) (*fChambers)[10+icount];
1350 Float_t zpos = iChamber->Z();
1351
1352// mother volume
1353 tpar[0] = iChamber->RInner();
1354 tpar[1] = iChamber->ROuter();
1355 tpar[2] = 4.0;
1356 gMC->Gsvolu(volPlane,"TUBE",idAir,tpar,3);
1357
1358// Flange between beam shielding and RPC
1359 tpar[0]= kRMIN[istation];
1360 tpar[1]= kRMAX[istation];
1361 tpar[2]= 4.0;
1362
1363 char volFlange[5];
1364 sprintf(volFlange,"SF%dA",icount+1);
1365 gMC->Gsvolu(volFlange,"TUBE",idAlu1,tpar,3); //Al
1366 gMC->Gspos(volFlange,1,volPlane,0.,0.,0.,0,"MANY");
1367
1368// scaling factor
1369 Float_t zRatio = zpos / zpos1;
1370
1371// chamber prototype
1372 tpar[0]= 0.;
1373 tpar[1]= 0.;
1374 tpar[2]= 0.;
1375
1376 char volAlu[5]; // Alu
1377 char volBak[5]; // Bakelite
1378 char volGaz[5]; // Gas streamer
1379
1380 sprintf(volAlu,"SC%dA",icount+1);
1381 sprintf(volBak,"SB%dA",icount+1);
1382 sprintf(volGaz,"SG%dA",icount+1);
1383
1384 gMC->Gsvolu(volAlu,"BOX",idAlu1,tpar,0); // Al
1385 gMC->Gsvolu(volBak,"BOX",idtmed[1107],tpar,0); // Bakelite
1386 gMC->Gsvolu(volGaz,"BOX",idtmed[1106],tpar,0); // Gas streamer
1387
1388// chamber type A
1389 tpar[0] = -1.;
1390 tpar[1] = -1.;
1391
1392 Float_t xA=(kDXZERO+kXMED+(kXMAX-kXMED)/2.)*zRatio;
1393 Float_t yAm=0.;
1394 Float_t yAp=0.;
1395
1396 tpar[2] = 0.1;
1397 gMC->Gsposp(volGaz,1,volBak,0.,0.,0.,0,"ONLY",tpar,3);
1398 tpar[2] = 0.3;
1399 gMC->Gsposp(volBak,1,volAlu,0.,0.,0.,0,"ONLY",tpar,3);
1400
1401 tpar[2] = 0.4;
1402 tpar[0] = ((kXMAX-kXMED)/2.)*zRatio;
1403 tpar[1] = kYMIN*zRatio;
1404
1405 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xA,yAm,-kZm,0,"ONLY",tpar,3);
1406 gMC->Gsposp(volAlu,iVolNum++,volPlane, xA,yAp,-kZp,0,"ONLY",tpar,3);
1407 gMC->Gsbool(volAlu,volFlange);
1408
1409// chamber type B
1410 Float_t tpar1save=tpar[1];
1411 Float_t y1msave=yAm;
1412 Float_t y1psave=yAp;
1413
1414 tpar[0] = ((kXMAX-kXMIN)/2.) * zRatio;
1415 tpar[1] = ((kYMAX-kYMIN)/2.) * zRatio;
1416
1417 Float_t xB=(kDXZERO+kXMIN)*zRatio+tpar[0];
1418 Float_t yBp=(y1msave+tpar1save)*zpm+tpar[1];
1419 Float_t yBm=(y1psave+tpar1save)*zmp+tpar[1];
1420
1421 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xB, yBp,-kZp,0,"ONLY",tpar,3);
1422 gMC->Gsposp(volAlu,iVolNum++,volPlane, xB, yBm,-kZm,0,"ONLY",tpar,3);
1423 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xB,-yBp,-kZp,0,"ONLY",tpar,3);
1424 gMC->Gsposp(volAlu,iVolNum++,volPlane, xB,-yBm,-kZm,0,"ONLY",tpar,3);
1425
1426// chamber type C (note : same Z than type B)
1427 tpar1save=tpar[1];
1428 y1msave=yBm;
1429 y1psave=yBp;
1430
1431 tpar[0] = (kXMAX/2)*zRatio;
1432 tpar[1] = (kYMAX/2)*zRatio;
1433
1434 Float_t xC=kDXZERO*zRatio+tpar[0];
1435 Float_t yCp=(y1psave+tpar1save)*1.+tpar[1];
1436 Float_t yCm=(y1msave+tpar1save)*1.+tpar[1];
1437
1438 gMC->Gsposp(volAlu,iVolNum++,volPlane,-xC, yCp,-kZp,0,"ONLY",tpar,3);
1439 gMC->Gsposp(volAlu,iVolNum++,volPlane, xC, yCm,-kZm,0,"ONLY",tpar,3);
1440 gMC->Gsposp(volAlu,iVolNum++,volPlane,-xC,-yCp,-kZp,0,"ONLY",tpar,3);
1441 gMC->Gsposp(volAlu,iVolNum++,volPlane, xC,-yCm,-kZm,0,"ONLY",tpar,3);
1442
1443// chamber type D, E and F (same size)
1444 tpar1save=tpar[1];
1445 y1msave=yCm;
1446 y1psave=yCp;
1447
1448 tpar[0] = (kXMAX/2.)*zRatio;
1449 tpar[1] = kYMIN*zRatio;
1450
1451 Float_t xD=kDXZERO*zRatio+tpar[0];
1452 Float_t yDp=(y1msave+tpar1save)*zpm+tpar[1];
1453 Float_t yDm=(y1psave+tpar1save)*zmp+tpar[1];
1454
1455 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD, yDm,-kZm,0,"ONLY",tpar,3);
1456 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD, yDp,-kZp,0,"ONLY",tpar,3);
1457 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD,-yDm,-kZm,0,"ONLY",tpar,3);
1458 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD,-yDp,-kZp,0,"ONLY",tpar,3);
1459
1460 tpar1save=tpar[1];
1461 y1msave=yDm;
1462 y1psave=yDp;
1463 Float_t yEp=(y1msave+tpar1save)*zpm+tpar[1];
1464 Float_t yEm=(y1psave+tpar1save)*zmp+tpar[1];
1465
1466 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD, yEp,-kZp,0,"ONLY",tpar,3);
1467 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD, yEm,-kZm,0,"ONLY",tpar,3);
1468 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD,-yEp,-kZp,0,"ONLY",tpar,3);
1469 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD,-yEm,-kZm,0,"ONLY",tpar,3);
1470
1471 tpar1save=tpar[1];
1472 y1msave=yEm;
1473 y1psave=yEp;
1474 Float_t yFp=(y1msave+tpar1save)*zpm+tpar[1];
1475 Float_t yFm=(y1psave+tpar1save)*zmp+tpar[1];
1476
1477 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD, yFm,-kZm,0,"ONLY",tpar,3);
1478 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD, yFp,-kZp,0,"ONLY",tpar,3);
1479 gMC->Gsposp(volAlu,iVolNum++,volPlane, -xD,-yFm,-kZm,0,"ONLY",tpar,3);
1480 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD,-yFp,-kZp,0,"ONLY",tpar,3);
1481
1482// Positioning plane in ALICE
1483 gMC->Gspos(volPlane,1,"ALIC",0.,0.,zpos,0,"ONLY");
1484
1485 } // end loop on detection planes
1486 } // end loop on stations
1487
1488}
1489
1490
1491//___________________________________________
1492void AliMUONv3::CreateMaterials()
1493{
1494 // *** DEFINITION OF AVAILABLE MUON MATERIALS ***
1495 //
1496 // Ar-CO2 gas (80%+20%)
1497 Float_t ag1[3] = { 39.95,12.01,16. };
1498 Float_t zg1[3] = { 18.,6.,8. };
1499 Float_t wg1[3] = { .8,.0667,.13333 };
1500 Float_t dg1 = .001821;
1501 //
1502 // Ar-buthane-freon gas -- trigger chambers
1503 Float_t atr1[4] = { 39.95,12.01,1.01,19. };
1504 Float_t ztr1[4] = { 18.,6.,1.,9. };
1505 Float_t wtr1[4] = { .56,.1262857,.2857143,.028 };
1506 Float_t dtr1 = .002599;
1507 //
1508 // Ar-CO2 gas
1509 Float_t agas[3] = { 39.95,12.01,16. };
1510 Float_t zgas[3] = { 18.,6.,8. };
1511 Float_t wgas[3] = { .74,.086684,.173316 };
1512 Float_t dgas = .0018327;
1513 //
1514 // Ar-Isobutane gas (80%+20%) -- tracking
1515 Float_t ag[3] = { 39.95,12.01,1.01 };
1516 Float_t zg[3] = { 18.,6.,1. };
1517 Float_t wg[3] = { .8,.057,.143 };
1518 Float_t dg = .0019596;
1519 //
1520 // Ar-Isobutane-Forane-SF6 gas (49%+7%+40%+4%) -- trigger
1521 Float_t atrig[5] = { 39.95,12.01,1.01,19.,32.066 };
1522 Float_t ztrig[5] = { 18.,6.,1.,9.,16. };
1523 Float_t wtrig[5] = { .49,1.08,1.5,1.84,0.04 };
1524 Float_t dtrig = .0031463;
1525 //
1526 // bakelite
1527
1528 Float_t abak[3] = {12.01 , 1.01 , 16.};
1529 Float_t zbak[3] = {6. , 1. , 8.};
1530 Float_t wbak[3] = {6. , 6. , 1.};
1531 Float_t dbak = 1.4;
1532
1533 Float_t epsil, stmin, deemax, tmaxfd, stemax;
1534
1535 Int_t iSXFLD = gAlice->Field()->Integ();
1536 Float_t sXMGMX = gAlice->Field()->Max();
1537 //
1538 // --- Define the various materials for GEANT ---
1539 AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
1540 AliMaterial(10, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
1541 AliMaterial(15, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500);
1542 AliMixture(19, "Bakelite$", abak, zbak, dbak, -3, wbak);
1543 AliMixture(20, "ArC4H10 GAS$", ag, zg, dg, 3, wg);
1544 AliMixture(21, "TRIG GAS$", atrig, ztrig, dtrig, -5, wtrig);
1545 AliMixture(22, "ArCO2 80%$", ag1, zg1, dg1, 3, wg1);
1546 AliMixture(23, "Ar-freon $", atr1, ztr1, dtr1, 4, wtr1);
1547 AliMixture(24, "ArCO2 GAS$", agas, zgas, dgas, 3, wgas);
1548 // materials for slat:
1549 // Sensitive area: gas (already defined)
1550 // PCB: copper
1551 // insulating material and frame: vetronite
1552 // walls: carbon, rohacell, carbon
1553 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
1554 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
1555 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
1556 Float_t dglass=1.74;
1557
1558 // rohacell: C9 H13 N1 O2
1559 Float_t arohac[4] = {12.01, 1.01, 14.010, 16.};
1560 Float_t zrohac[4] = { 6., 1., 7., 8.};
1561 Float_t wrohac[4] = { 9., 13., 1., 2.};
1562 Float_t drohac = 0.03;
1563
1564 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
1565 AliMixture(32, "Vetronite$",aglass, zglass, dglass, 5, wglass);
1566 AliMaterial(33, "Carbon$", 12.01, 6., 2.265, 18.8, 49.9);
1567 AliMixture(34, "Rohacell$", arohac, zrohac, drohac, -4, wrohac);
1568
1569
1570 epsil = .001; // Tracking precision,
1571 stemax = -1.; // Maximum displacement for multiple scat
1572 tmaxfd = -20.; // Maximum angle due to field deflection
1573 deemax = -.3; // Maximum fractional energy loss, DLS
1574 stmin = -.8;
1575 //
1576 // Air
1577 AliMedium(1, "AIR_CH_US ", 15, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1578 //
1579 // Aluminum
1580
1581 AliMedium(4, "ALU_CH_US ", 9, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
1582 fMaxDestepAlu, epsil, stmin);
1583 AliMedium(5, "ALU_CH_US ", 10, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
1584 fMaxDestepAlu, epsil, stmin);
1585 //
1586 // Ar-isoC4H10 gas
1587
1588 AliMedium(6, "AR_CH_US ", 20, 1, iSXFLD, sXMGMX, tmaxfd, fMaxStepGas,
1589 fMaxDestepGas, epsil, stmin);
1590//
1591 // Ar-Isobuthane-Forane-SF6 gas
1592
1593 AliMedium(7, "GAS_CH_TRIGGER ", 21, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1594
1595 AliMedium(8, "BAKE_CH_TRIGGER ", 19, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
1596 fMaxDestepAlu, epsil, stmin);
1597
1598 AliMedium(9, "ARG_CO2 ", 22, 1, iSXFLD, sXMGMX, tmaxfd, fMaxStepGas,
1599 fMaxDestepAlu, epsil, stmin);
1600 // tracking media for slats: check the parameters!!
1601 AliMedium(11, "PCB_COPPER ", 31, 0, iSXFLD, sXMGMX, tmaxfd,
1602 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
1603 AliMedium(12, "VETRONITE ", 32, 0, iSXFLD, sXMGMX, tmaxfd,
1604 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
1605 AliMedium(13, "CARBON ", 33, 0, iSXFLD, sXMGMX, tmaxfd,
1606 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
1607 AliMedium(14, "Rohacell ", 34, 0, iSXFLD, sXMGMX, tmaxfd,
1608 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
1609}
1610
1611//___________________________________________
1612
1613void AliMUONv3::Init()
1614{
1615 //
1616 // Initialize Tracking Chambers
1617 //
1618
1619 if(fDebug) printf("\n%s: Start Init for version 1 - CPC chamber type\n\n",ClassName());
1620 Int_t i;
1621 for (i=0; i<AliMUONConstants::NCh(); i++) {
1622 ( (AliMUONChamber*) (*fChambers)[i])->Init();
1623 }
1624
1625 //
1626 // Set the chamber (sensitive region) GEANT identifier
1627 ((AliMUONChamber*)(*fChambers)[0])->GetGeometry()->SetSensitiveVolume("S01G");
1628 ((AliMUONChamber*)(*fChambers)[1])->GetGeometry()->SetSensitiveVolume("S02G");
1629
1630 ((AliMUONChamber*)(*fChambers)[2])->GetGeometry()->SetSensitiveVolume("S03G");
1631 ((AliMUONChamber*)(*fChambers)[3])->GetGeometry()->SetSensitiveVolume("S04G");
1632
1633 ((AliMUONChamber*)(*fChambers)[4])->GetGeometry()->SetSensitiveVolume("S05G");
1634 ((AliMUONChamber*)(*fChambers)[5])->GetGeometry()->SetSensitiveVolume("S06G");
1635
1636 ((AliMUONChamber*)(*fChambers)[6])->GetGeometry()->SetSensitiveVolume("S07G");
1637 ((AliMUONChamber*)(*fChambers)[7])->GetGeometry()->SetSensitiveVolume("S08G");
1638
1639 ((AliMUONChamber*)(*fChambers)[8])->GetGeometry()->SetSensitiveVolume("S09G");
1640 ((AliMUONChamber*)(*fChambers)[9])->GetGeometry()->SetSensitiveVolume("S10G");
1641
1642 ((AliMUONChamber*)(*fChambers)[10])->GetGeometry()->SetSensitiveVolume("SG1A");
1643 ((AliMUONChamber*)(*fChambers)[11])->GetGeometry()->SetSensitiveVolume("SG2A");
1644 ((AliMUONChamber*)(*fChambers)[12])->GetGeometry()->SetSensitiveVolume("SG3A");
1645 ((AliMUONChamber*)(*fChambers)[13])->GetGeometry()->SetSensitiveVolume("SG4A");
1646
1647 if(fDebug) printf("\n%s: Finished Init for version 1 - CPC chamber type\n",ClassName());
1648
1649 //cp
1650 if(fDebug) printf("\n%s: Start Init for Trigger Circuits\n",ClassName());
1651 for (i=0; i<AliMUONConstants::NTriggerCircuit(); i++) {
1652 ( (AliMUONTriggerCircuit*) (*fTriggerCircuits)[i])->Init(i);
1653 }
1654 if(fDebug) printf("%s: Finished Init for Trigger Circuits\n",ClassName());
1655 //cp
1656
1657}
1658
1659//_______________________________________________________________________________
1660Int_t AliMUONv3::GetChamberId(Int_t volId) const
1661{
1662// Check if the volume with specified volId is a sensitive volume (gas)
1663// of some chamber and returns the chamber number;
1664// if not sensitive volume - return 0.
1665// ---
1666
1667 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++)
1668 if ( ((AliMUONChamber*)(*fChambers)[i-1])->IsSensId(volId) ) return i;
1669
1670 return 0;
1671}
1672//_______________________________________________________________________________
1673void AliMUONv3::StepManager()
1674{
1675 // Stepmanager for the chambers
1676
1677 if (fStepManagerVersionOld) {
1678 StepManagerOld();
1679 return;
1680 }
1681
1682 // Only charged tracks
1683 if( !(gMC->TrackCharge()) ) return;
1684 // Only charged tracks
1685
1686 // Only gas gap inside chamber
1687 // Tag chambers and record hits when track enters
1688 Int_t idvol=-1;
1689 Int_t iChamber=0;
1690 Int_t id=0;
1691 Int_t copy;
1692 const Float_t kBig = 1.e10;
1693
1694 id=gMC->CurrentVolID(copy);
1695 iChamber = GetChamberId(id);
1696 idvol=GetChamberId(id)-1;
1697
1698 if (idvol == -1) return;
1699
1700 if( gMC->IsTrackEntering() ) {
1701 Float_t theta = fTrackMomentum.Theta();
1702 if ((TMath::Pi()-theta)*kRaddeg>=15.) gMC->SetMaxStep(fStepMaxInActiveGas); // We use Pi-theta because z is negative
1703 }
1704
1705// if (GetDebug()) {
1706// Float_t z = ( (AliMUONChamber*)(*fChambers)[idvol])->Z() ;
1707// Info("StepManager Step","Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, z);
1708// }
1709 // Particule id and mass,
1710 Int_t ipart = gMC->TrackPid();
1711 Float_t mass = gMC->TrackMass();
1712
1713 fDestepSum[idvol]+=gMC->Edep();
1714 // Get current particle id (ipart), track position (pos) and momentum (mom)
1715 if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum);
1716 fStepSum[idvol]+=gMC->TrackStep();
1717
1718// if (GetDebug()) {
1719// Info("StepManager Step","iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g",
1720// iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep());
1721// Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ;
1722// gMC->TrackPosition(fTrackPosition);
1723// Info("StepManager Step","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
1724// }
1725
1726 // Track left chamber or StepSum larger than fStepMaxInActiveGas
1727 if ( gMC->IsTrackExiting() ||
1728 gMC->IsTrackStop() ||
1729 gMC->IsTrackDisappeared()||
1730 (fStepSum[idvol]>fStepMaxInActiveGas) ) {
1731
1732 if ( gMC->IsTrackExiting() ||
1733 gMC->IsTrackStop() ||
1734 gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig);
1735
1736 gMC->TrackPosition(fTrackPosition);
1737 Float_t theta = fTrackMomentum.Theta();
1738 Float_t phi = fTrackMomentum.Phi();
1739
1740 TLorentzVector backToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi),
1741 fStepSum[idvol]/2.*sin(theta)*sin(phi),
1742 fStepSum[idvol]/2.*cos(theta),0.0 );
1743 // if (GetDebug())
1744 // Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
1745 // if (GetDebug())
1746 // Info("StepManager Exit ","Track backToWire %f %f %f",backToWire.X(),backToWire.Y(),backToWire.Z()) ;
1747 fTrackPosition-=backToWire;
1748
1749 //-------------- Angle effect
1750 // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass)
1751
1752 Float_t BetaxGamma = fTrackMomentum.P()/mass;// pc/mc2
1753 Float_t sigmaEffect10degrees;
1754 Float_t sigmaEffectThetadegrees;
1755 Float_t eLossParticleELossMip;
1756 Float_t yAngleEffect=0.;
1757 Float_t thetawires = TMath::Abs( TMath::ASin( TMath::Sin(TMath::Pi()-theta) * TMath::Sin(phi) ) );// We use Pi-theta because z is negative
1758
1759
1760 if (fAngleEffect){
1761 if ( (BetaxGamma >3.2) && (thetawires*kRaddeg<=15.) ) {
1762 BetaxGamma=TMath::Log(BetaxGamma);
1763 eLossParticleELossMip = fElossRatio->Eval(BetaxGamma);
1764 // 10 degrees is a reference for a model (arbitrary)
1765 sigmaEffect10degrees=fAngleEffect10->Eval(eLossParticleELossMip);// in micrometers
1766 // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
1767 sigmaEffectThetadegrees = sigmaEffect10degrees/fAngleEffectNorma->Eval(thetawires*kRaddeg); // For 5mm gap
1768 if ( (iChamber==1) || (iChamber==2) )
1769 sigmaEffectThetadegrees/=(1.09833e+00+1.70000e-02*(thetawires*kRaddeg)); // The gap is different (4mm)
1770 yAngleEffect=1.e-04*gRandom->Gaus(0,sigmaEffectThetadegrees); // Error due to the angle effect in cm
1771 }
1772 }
1773
1774 // One hit per chamber
1775 GetMUONData()->AddHit(fIshunt, gAlice->GetMCApp()->GetCurrentTrackNumber(), iChamber, ipart,
1776 fTrackPosition.X(), fTrackPosition.Y()+yAngleEffect, fTrackPosition.Z(), 0.0,
1777 fTrackMomentum.P(),theta, phi, fStepSum[idvol], fDestepSum[idvol],
1778 fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z());
1779// if (GetDebug()){
1780// Info("StepManager Exit","Particle exiting from chamber %d",iChamber);
1781// Info("StepManager Exit","StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol]);
1782// Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
1783// }
1784 fStepSum[idvol] =0; // Reset for the next event
1785 fDestepSum[idvol]=0; // Reset for the next event
1786 }
1787}
1788
1789//__________________________________________
1790void AliMUONv3::StepManagerOld()
1791{
1792 // Old Stepmanager for the chambers
1793 Int_t copy, id;
1794 static Int_t idvol;
1795 static Int_t vol[2];
1796 Int_t ipart;
1797 TLorentzVector pos;
1798 TLorentzVector mom;
1799 Float_t theta,phi;
1800 Float_t destep, step;
1801
1802 static Float_t sstep;
1803 static Float_t eloss, eloss2, xhit, yhit, zhit, tof, tlength;
1804 const Float_t kBig = 1.e10;
1805 static Float_t hits[15];
1806
1807 TClonesArray &lhits = *fHits;
1808
1809 //
1810 //
1811 // Only charged tracks
1812 if( !(gMC->TrackCharge()) ) return;
1813 //
1814 // Only gas gap inside chamber
1815 // Tag chambers and record hits when track enters
1816 id=gMC->CurrentVolID(copy);
1817 vol[0] = GetChamberId(id);
1818 idvol = vol[0] -1;
1819
1820 if (idvol == -1) return;
1821
1822 //
1823 // Get current particle id (ipart), track position (pos) and momentum (mom)
1824 gMC->TrackPosition(pos);
1825 gMC->TrackMomentum(mom);
1826
1827 ipart = gMC->TrackPid();
1828
1829 //
1830 // momentum loss and steplength in last step
1831 destep = gMC->Edep();
1832 step = gMC->TrackStep();
1833 // cout<<"------------"<<step<<endl;
1834 //
1835 // record hits when track enters ...
1836 if( gMC->IsTrackEntering()) {
1837
1838 gMC->SetMaxStep(fMaxStepGas);
1839 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1840 Double_t rt = TMath::Sqrt(tc);
1841 Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
1842 Double_t tx = mom[0]/pmom;
1843 Double_t ty = mom[1]/pmom;
1844 Double_t tz = mom[2]/pmom;
1845 Double_t s = ((AliMUONChamber*)(*fChambers)[idvol])
1846 ->ResponseModel()
1847 ->Pitch()/tz;
1848 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1849 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1850 hits[0] = Float_t(ipart); // Geant3 particle type
1851 hits[1] = pos[0]+s*tx; // X-position for hit
1852 hits[2] = pos[1]+s*ty; // Y-position for hit
1853 hits[3] = pos[2]+s*tz; // Z-position for hit
1854 hits[4] = theta; // theta angle of incidence
1855 hits[5] = phi; // phi angle of incidence
1856 hits[8] = 0;//PadHits does not exist anymore (Float_t) fNPadHits; // first padhit
1857 hits[9] = -1; // last pad hit
1858 hits[10] = mom[3]; // hit momentum P
1859 hits[11] = mom[0]; // Px
1860 hits[12] = mom[1]; // Py
1861 hits[13] = mom[2]; // Pz
1862 tof=gMC->TrackTime();
1863 hits[14] = tof; // Time of flight
1864 tlength = 0;
1865 eloss = 0;
1866 eloss2 = 0;
1867 sstep=0;
1868 xhit = pos[0];
1869 yhit = pos[1];
1870 zhit = pos[2];
1871 Chamber(idvol).ChargeCorrelationInit();
1872 // Only if not trigger chamber
1873
1874// printf("---------------------------\n");
1875// printf(">>>> Y = %f \n",hits[2]);
1876// printf("---------------------------\n");
1877
1878
1879
1880 // if(idvol < AliMUONConstants::NTrackingCh()) {
1881// //
1882// // Initialize hit position (cursor) in the segmentation model
1883// ((AliMUONChamber*) (*fChambers)[idvol])
1884// ->SigGenInit(pos[0], pos[1], pos[2]);
1885// } else {
1886// //geant3->Gpcxyz();
1887// //printf("In the Trigger Chamber #%d\n",idvol-9);
1888// }
1889 }
1890 eloss2+=destep;
1891 sstep+=step;
1892
1893 // cout<<sstep<<endl;
1894
1895 //
1896 // Calculate the charge induced on a pad (disintegration) in case
1897 //
1898 // Mip left chamber ...
1899 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1900 gMC->SetMaxStep(kBig);
1901 eloss += destep;
1902 tlength += step;
1903
1904 Float_t x0,y0,z0;
1905 Float_t localPos[3];
1906 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
1907 gMC->Gmtod(globalPos,localPos,1);
1908
1909 if(idvol < AliMUONConstants::NTrackingCh()) {
1910// tracking chambers
1911 x0 = 0.5*(xhit+pos[0]);
1912 y0 = 0.5*(yhit+pos[1]);
1913 z0 = 0.5*(zhit+pos[2]);
1914 } else {
1915// trigger chambers
1916 x0 = xhit;
1917 y0 = yhit;
1918 z0 = 0.;
1919 }
1920
1921
1922 // if (eloss >0) MakePadHits(x0,y0,z0,eloss,tof,idvol);
1923
1924
1925 hits[6] = tlength; // track length
1926 hits[7] = eloss2; // de/dx energy loss
1927
1928
1929 // if (fNPadHits > (Int_t)hits[8]) {
1930 // hits[8] = hits[8]+1;
1931 // hits[9] = 0: // PadHits does not exist anymore (Float_t) fNPadHits;
1932 //}
1933//
1934// new hit
1935
1936 new(lhits[fNhits++])
1937 AliMUONHit(fIshunt, gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
1938 eloss = 0;
1939 //
1940 // Check additional signal generation conditions
1941 // defined by the segmentation
1942 // model (boundary crossing conditions)
1943 // only for tracking chambers
1944 } else if
1945 ((idvol < AliMUONConstants::NTrackingCh()) &&
1946 ((AliMUONChamber*) (*fChambers)[idvol])->SigGenCond(pos[0], pos[1], pos[2]))
1947 {
1948 ((AliMUONChamber*) (*fChambers)[idvol])
1949 ->SigGenInit(pos[0], pos[1], pos[2]);
1950
1951 Float_t localPos[3];
1952 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
1953 gMC->Gmtod(globalPos,localPos,1);
1954
1955 eloss += destep;
1956
1957 // if (eloss > 0 && idvol < AliMUONConstants::NTrackingCh())
1958 // MakePadHits(0.5*(xhit+pos[0]),0.5*(yhit+pos[1]),pos[2],eloss,tof,idvol);
1959 xhit = pos[0];
1960 yhit = pos[1];
1961 zhit = pos[2];
1962 eloss = 0;
1963 tlength += step ;
1964 //
1965 // nothing special happened, add up energy loss
1966 } else {
1967 eloss += destep;
1968 tlength += step ;
1969 }
1970}
1971
1972