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