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