MC-dependent part of AliRun extracted in AliMC (F.Carminati)
[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"
5d12ce38 43#include "AliMC.h"
a9e2aefa 44
45ClassImp(AliMUONv1)
46
47//___________________________________________
37c0cd40 48AliMUONv1::AliMUONv1() : AliMUON()
1391e633 49 ,fTrackMomentum(), fTrackPosition()
a9e2aefa 50{
51// Constructor
1391e633 52 fChambers = 0;
53 fStations = 0;
54 fStepManagerVersionOld = kFALSE;
55 fStepMaxInActiveGas = 0.6;
56 fStepSum = 0x0;
57 fDestepSum = 0x0;
58 fElossRatio = 0x0;
59 fAngleEffect10 = 0x0;
60 fAngleEffectNorma= 0x0;
61}
a9e2aefa 62//___________________________________________
63AliMUONv1::AliMUONv1(const char *name, const char *title)
1391e633 64 : AliMUON(name,title), fTrackMomentum(), fTrackPosition()
a9e2aefa 65{
66// Constructor
ba030c0e 67 // By default include all stations
68 fStations = new Int_t[5];
69 for (Int_t i=0; i<5; i++) fStations[i] = 1;
70
71 AliMUONFactory factory;
72 factory.Build(this, title);
c33d9661 73
74 fStepManagerVersionOld = kFALSE;
abaf7c9d 75
1391e633 76 fStepMaxInActiveGas = 0.6;
77
78 fStepSum = new Float_t [AliMUONConstants::NCh()];
79 fDestepSum = new Float_t [AliMUONConstants::NCh()];
80 for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
81 fStepSum[i] =0.0;
82 fDestepSum[i]=0.0;
83 }
84 // Ratio of particle mean eloss with respect MIP's Khalil Boudjemline, sep 2003, PhD.Thesis and Particle Data Book
85 fElossRatio = new TF1("ElossRatio","[0]+[1]*x+[2]*x*x+[3]*x*x*x+[4]*x*x*x*x",0.5,5.);
86 fElossRatio->SetParameter(0,1.02138);
87 fElossRatio->SetParameter(1,-9.54149e-02);
88 fElossRatio->SetParameter(2,+7.83433e-02);
89 fElossRatio->SetParameter(3,-9.98208e-03);
90 fElossRatio->SetParameter(4,+3.83279e-04);
91
92 // Angle effect in tracking chambers at theta =10 degres as a function of ElossRatio (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis) (in micrometers)
93 fAngleEffect10 = new TF1("AngleEffect10","[0]+[1]*x+[2]*x*x",0.5,3.0);
94 fAngleEffect10->SetParameter(0, 1.90691e+02);
95 fAngleEffect10->SetParameter(1,-6.62258e+01);
96 fAngleEffect10->SetParameter(2,+1.28247e+01);
97 // Angle effect: Normalisation form theta=10 degres to theta between 0 and 10 (Khalil BOUDJEMLINE sep 2003 Ph.D Thesis)
98 // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
99 fAngleEffectNorma = new TF1("AngleEffectNorma","[0]+[1]*x+[2]*x*x+[3]*x*x*x",0.0,10.0);
100 fAngleEffectNorma->SetParameter(0,4.148);
101 fAngleEffectNorma->SetParameter(1,-6.809e-01);
102 fAngleEffectNorma->SetParameter(2,5.151e-02);
103 fAngleEffectNorma->SetParameter(3,-1.490e-03);
a9e2aefa 104}
105
106//___________________________________________
107void AliMUONv1::CreateGeometry()
108{
109//
110// Note: all chambers have the same structure, which could be
111// easily parameterised. This was intentionally not done in order
112// to give a starting point for the implementation of the actual
113// design of each station.
114 Int_t *idtmed = fIdtmed->GetArray()-1099;
115
116// Distance between Stations
117//
118 Float_t bpar[3];
119 Float_t tpar[3];
b64652f5 120// Float_t pgpar[10];
a9e2aefa 121 Float_t zpos1, zpos2, zfpos;
b64652f5 122 // Outer excess and inner recess for mother volume radius
123 // with respect to ROuter and RInner
a9e2aefa 124 Float_t dframep=.001; // Value for station 3 should be 6 ...
b64652f5 125 // Width (RdPhi) of the frame crosses for stations 1 and 2 (cm)
126// Float_t dframep1=.001;
127 Float_t dframep1 = 11.0;
128// Bool_t frameCrosses=kFALSE;
129 Bool_t frameCrosses=kTRUE;
3f08857e 130 Float_t *dum=0;
a9e2aefa 131
b64652f5 132// Float_t dframez=0.9;
133 // Half of the total thickness of frame crosses (including DAlu)
134 // for each chamber in stations 1 and 2:
135 // 3% of X0 of composite material,
136 // but taken as Aluminium here, with same thickness in number of X0
137 Float_t dframez = 3. * 8.9 / 100;
138// Float_t dr;
a9e2aefa 139 Float_t dstation;
140
141//
142// Rotation matrices in the x-y plane
143 Int_t idrotm[1199];
144// phi= 0 deg
145 AliMatrix(idrotm[1100], 90., 0., 90., 90., 0., 0.);
146// phi= 90 deg
147 AliMatrix(idrotm[1101], 90., 90., 90., 180., 0., 0.);
148// phi= 180 deg
149 AliMatrix(idrotm[1102], 90., 180., 90., 270., 0., 0.);
150// phi= 270 deg
151 AliMatrix(idrotm[1103], 90., 270., 90., 0., 0., 0.);
152//
153 Float_t phi=2*TMath::Pi()/12/2;
154
155//
156// pointer to the current chamber
157// pointer to the current chamber
b64652f5 158 Int_t idAlu1=idtmed[1103]; // medium 4
159 Int_t idAlu2=idtmed[1104]; // medium 5
a9e2aefa 160// Int_t idAlu1=idtmed[1100];
161// Int_t idAlu2=idtmed[1100];
b64652f5 162 Int_t idAir=idtmed[1100]; // medium 1
163// Int_t idGas=idtmed[1105]; // medium 6 = Ar-isoC4H10 gas
164 Int_t idGas=idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
a9e2aefa 165
166
167 AliMUONChamber *iChamber, *iChamber1, *iChamber2;
ba030c0e 168
169 if (fStations[0]) {
b17c0c87 170
a9e2aefa 171//********************************************************************
172// Station 1 **
173//********************************************************************
174// CONCENTRIC
175 // indices 1 and 2 for first and second chambers in the station
176 // iChamber (first chamber) kept for other quanties than Z,
177 // assumed to be the same in both chambers
178 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[0];
179 iChamber2 =(AliMUONChamber*) (*fChambers)[1];
180 zpos1=iChamber1->Z();
181 zpos2=iChamber2->Z();
b13a15bc 182 dstation = TMath::Abs(zpos2 - zpos1);
b64652f5 183 // DGas decreased from standard one (0.5)
184 iChamber->SetDGas(0.4); iChamber2->SetDGas(0.4);
185 // DAlu increased from standard one (3% of X0),
186 // because more electronics with smaller pads
187 iChamber->SetDAlu(3.5 * 8.9 / 100.); iChamber2->SetDAlu(3.5 * 8.9 / 100.);
a9e2aefa 188 zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
189
190//
191// Mother volume
b64652f5 192 tpar[0] = iChamber->RInner()-dframep;
193 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
2c799aa2 194 tpar[2] = dstation/5;
a9e2aefa 195
b74f1c6a 196 gMC->Gsvolu("S01M", "TUBE", idAir, tpar, 3);
197 gMC->Gsvolu("S02M", "TUBE", idAir, tpar, 3);
198 gMC->Gspos("S01M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
199 gMC->Gspos("S02M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
b64652f5 200// // Aluminium frames
201// // Outer frames
202// pgpar[0] = 360/12/2;
203// pgpar[1] = 360.;
204// pgpar[2] = 12.;
205// pgpar[3] = 2;
206// pgpar[4] = -dframez/2;
207// pgpar[5] = iChamber->ROuter();
208// pgpar[6] = pgpar[5]+dframep1;
209// pgpar[7] = +dframez/2;
210// pgpar[8] = pgpar[5];
211// pgpar[9] = pgpar[6];
b74f1c6a 212// gMC->Gsvolu("S01O", "PGON", idAlu1, pgpar, 10);
213// gMC->Gsvolu("S02O", "PGON", idAlu1, pgpar, 10);
214// gMC->Gspos("S01O",1,"S01M", 0.,0.,-zfpos, 0,"ONLY");
215// gMC->Gspos("S01O",2,"S01M", 0.,0.,+zfpos, 0,"ONLY");
216// gMC->Gspos("S02O",1,"S02M", 0.,0.,-zfpos, 0,"ONLY");
217// gMC->Gspos("S02O",2,"S02M", 0.,0.,+zfpos, 0,"ONLY");
b64652f5 218// //
219// // Inner frame
220// tpar[0]= iChamber->RInner()-dframep1;
221// tpar[1]= iChamber->RInner();
222// tpar[2]= dframez/2;
b74f1c6a 223// gMC->Gsvolu("S01I", "TUBE", idAlu1, tpar, 3);
224// gMC->Gsvolu("S02I", "TUBE", idAlu1, tpar, 3);
b64652f5 225
b74f1c6a 226// gMC->Gspos("S01I",1,"S01M", 0.,0.,-zfpos, 0,"ONLY");
227// gMC->Gspos("S01I",2,"S01M", 0.,0.,+zfpos, 0,"ONLY");
228// gMC->Gspos("S02I",1,"S02M", 0.,0.,-zfpos, 0,"ONLY");
229// gMC->Gspos("S02I",2,"S02M", 0.,0.,+zfpos, 0,"ONLY");
a9e2aefa 230//
231// Frame Crosses
b64652f5 232 if (frameCrosses) {
233 // outside gas
234 // security for inside mother volume
235 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
236 * TMath::Cos(TMath::ASin(dframep1 /
237 (iChamber->ROuter() - iChamber->RInner())))
238 / 2.0;
a9e2aefa 239 bpar[1] = dframep1/2;
b64652f5 240 // total thickness will be (4 * bpar[2]) for each chamber,
241 // which has to be equal to (2 * dframez) - DAlu
242 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
b74f1c6a 243 gMC->Gsvolu("S01B", "BOX", idAlu1, bpar, 3);
244 gMC->Gsvolu("S02B", "BOX", idAlu1, bpar, 3);
a9e2aefa 245
2d3423a6 246 gMC->Gspos("S01B",1,"S01M", -iChamber->RInner()-bpar[0] , 0, zfpos,
a9e2aefa 247 idrotm[1100],"ONLY");
2d3423a6 248 gMC->Gspos("S01B",2,"S01M", iChamber->RInner()+bpar[0] , 0, zfpos,
a9e2aefa 249 idrotm[1100],"ONLY");
2d3423a6 250 gMC->Gspos("S01B",3,"S01M", 0, -iChamber->RInner()-bpar[0] , zfpos,
a9e2aefa 251 idrotm[1101],"ONLY");
2d3423a6 252 gMC->Gspos("S01B",4,"S01M", 0, iChamber->RInner()+bpar[0] , zfpos,
a9e2aefa 253 idrotm[1101],"ONLY");
2d3423a6 254 gMC->Gspos("S01B",5,"S01M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 255 idrotm[1100],"ONLY");
2d3423a6 256 gMC->Gspos("S01B",6,"S01M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 257 idrotm[1100],"ONLY");
2d3423a6 258 gMC->Gspos("S01B",7,"S01M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 259 idrotm[1101],"ONLY");
2d3423a6 260 gMC->Gspos("S01B",8,"S01M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 261 idrotm[1101],"ONLY");
262
2d3423a6 263 gMC->Gspos("S02B",1,"S02M", -iChamber->RInner()-bpar[0] , 0, zfpos,
a9e2aefa 264 idrotm[1100],"ONLY");
2d3423a6 265 gMC->Gspos("S02B",2,"S02M", iChamber->RInner()+bpar[0] , 0, zfpos,
a9e2aefa 266 idrotm[1100],"ONLY");
2d3423a6 267 gMC->Gspos("S02B",3,"S02M", 0, -iChamber->RInner()-bpar[0] , zfpos,
a9e2aefa 268 idrotm[1101],"ONLY");
2d3423a6 269 gMC->Gspos("S02B",4,"S02M", 0, iChamber->RInner()+bpar[0] , zfpos,
a9e2aefa 270 idrotm[1101],"ONLY");
2d3423a6 271 gMC->Gspos("S02B",5,"S02M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 272 idrotm[1100],"ONLY");
2d3423a6 273 gMC->Gspos("S02B",6,"S02M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 274 idrotm[1100],"ONLY");
2d3423a6 275 gMC->Gspos("S02B",7,"S02M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 276 idrotm[1101],"ONLY");
2d3423a6 277 gMC->Gspos("S02B",8,"S02M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 278 idrotm[1101],"ONLY");
279 }
280//
281// Chamber Material represented by Alu sheet
282 tpar[0]= iChamber->RInner();
283 tpar[1]= iChamber->ROuter();
284 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
b74f1c6a 285 gMC->Gsvolu("S01A", "TUBE", idAlu2, tpar, 3);
286 gMC->Gsvolu("S02A", "TUBE",idAlu2, tpar, 3);
287 gMC->Gspos("S01A", 1, "S01M", 0., 0., 0., 0, "ONLY");
288 gMC->Gspos("S02A", 1, "S02M", 0., 0., 0., 0, "ONLY");
a9e2aefa 289//
290// Sensitive volumes
291 // tpar[2] = iChamber->DGas();
292 tpar[2] = iChamber->DGas()/2;
b74f1c6a 293 gMC->Gsvolu("S01G", "TUBE", idGas, tpar, 3);
294 gMC->Gsvolu("S02G", "TUBE", idGas, tpar, 3);
295 gMC->Gspos("S01G", 1, "S01A", 0., 0., 0., 0, "ONLY");
296 gMC->Gspos("S02G", 1, "S02A", 0., 0., 0., 0, "ONLY");
a9e2aefa 297//
b64652f5 298// Frame Crosses to be placed inside gas
299 // NONE: chambers are sensitive everywhere
300// if (frameCrosses) {
301
302// dr = (iChamber->ROuter() - iChamber->RInner());
303// bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
304// bpar[1] = dframep1/2;
305// bpar[2] = iChamber->DGas()/2;
b74f1c6a 306// gMC->Gsvolu("S01F", "BOX", idAlu1, bpar, 3);
307// gMC->Gsvolu("S02F", "BOX", idAlu1, bpar, 3);
a9e2aefa 308
b74f1c6a 309// gMC->Gspos("S01F",1,"S01G", +iChamber->RInner()+bpar[0] , 0, 0,
b64652f5 310// idrotm[1100],"ONLY");
b74f1c6a 311// gMC->Gspos("S01F",2,"S01G", -iChamber->RInner()-bpar[0] , 0, 0,
b64652f5 312// idrotm[1100],"ONLY");
b74f1c6a 313// gMC->Gspos("S01F",3,"S01G", 0, +iChamber->RInner()+bpar[0] , 0,
b64652f5 314// idrotm[1101],"ONLY");
b74f1c6a 315// gMC->Gspos("S01F",4,"S01G", 0, -iChamber->RInner()-bpar[0] , 0,
b64652f5 316// idrotm[1101],"ONLY");
a9e2aefa 317
b74f1c6a 318// gMC->Gspos("S02F",1,"S02G", +iChamber->RInner()+bpar[0] , 0, 0,
b64652f5 319// idrotm[1100],"ONLY");
b74f1c6a 320// gMC->Gspos("S02F",2,"S02G", -iChamber->RInner()-bpar[0] , 0, 0,
b64652f5 321// idrotm[1100],"ONLY");
b74f1c6a 322// gMC->Gspos("S02F",3,"S02G", 0, +iChamber->RInner()+bpar[0] , 0,
b64652f5 323// idrotm[1101],"ONLY");
b74f1c6a 324// gMC->Gspos("S02F",4,"S02G", 0, -iChamber->RInner()-bpar[0] , 0,
b64652f5 325// idrotm[1101],"ONLY");
326// }
b17c0c87 327 }
ba030c0e 328 if (fStations[1]) {
b17c0c87 329
a9e2aefa 330//********************************************************************
331// Station 2 **
332//********************************************************************
333 // indices 1 and 2 for first and second chambers in the station
334 // iChamber (first chamber) kept for other quanties than Z,
335 // assumed to be the same in both chambers
336 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[2];
337 iChamber2 =(AliMUONChamber*) (*fChambers)[3];
338 zpos1=iChamber1->Z();
339 zpos2=iChamber2->Z();
b13a15bc 340 dstation = TMath::Abs(zpos2 - zpos1);
b64652f5 341 // DGas and DAlu not changed from standard values
a9e2aefa 342 zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
343
344//
345// Mother volume
346 tpar[0] = iChamber->RInner()-dframep;
347 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
2c799aa2 348 tpar[2] = dstation/5;
a9e2aefa 349
b74f1c6a 350 gMC->Gsvolu("S03M", "TUBE", idAir, tpar, 3);
351 gMC->Gsvolu("S04M", "TUBE", idAir, tpar, 3);
352 gMC->Gspos("S03M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
353 gMC->Gspos("S04M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
03da3c56 354 gMC->Gsbool("S03M", "L3DO");
355 gMC->Gsbool("S03M", "L3O1");
356 gMC->Gsbool("S03M", "L3O2");
357 gMC->Gsbool("S04M", "L3DO");
358 gMC->Gsbool("S04M", "L3O1");
359 gMC->Gsbool("S04M", "L3O2");
1e8fff9c 360
b64652f5 361// // Aluminium frames
362// // Outer frames
363// pgpar[0] = 360/12/2;
364// pgpar[1] = 360.;
365// pgpar[2] = 12.;
366// pgpar[3] = 2;
367// pgpar[4] = -dframez/2;
368// pgpar[5] = iChamber->ROuter();
369// pgpar[6] = pgpar[5]+dframep;
370// pgpar[7] = +dframez/2;
371// pgpar[8] = pgpar[5];
372// pgpar[9] = pgpar[6];
b74f1c6a 373// gMC->Gsvolu("S03O", "PGON", idAlu1, pgpar, 10);
374// gMC->Gsvolu("S04O", "PGON", idAlu1, pgpar, 10);
375// gMC->Gspos("S03O",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
376// gMC->Gspos("S03O",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
377// gMC->Gspos("S04O",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
378// gMC->Gspos("S04O",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
b64652f5 379// //
380// // Inner frame
381// tpar[0]= iChamber->RInner()-dframep;
382// tpar[1]= iChamber->RInner();
383// tpar[2]= dframez/2;
b74f1c6a 384// gMC->Gsvolu("S03I", "TUBE", idAlu1, tpar, 3);
385// gMC->Gsvolu("S04I", "TUBE", idAlu1, tpar, 3);
b64652f5 386
b74f1c6a 387// gMC->Gspos("S03I",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
388// gMC->Gspos("S03I",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
389// gMC->Gspos("S04I",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
390// gMC->Gspos("S04I",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
a9e2aefa 391//
392// Frame Crosses
b64652f5 393 if (frameCrosses) {
394 // outside gas
395 // security for inside mother volume
396 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
397 * TMath::Cos(TMath::ASin(dframep1 /
398 (iChamber->ROuter() - iChamber->RInner())))
399 / 2.0;
400 bpar[1] = dframep1/2;
401 // total thickness will be (4 * bpar[2]) for each chamber,
402 // which has to be equal to (2 * dframez) - DAlu
403 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
b74f1c6a 404 gMC->Gsvolu("S03B", "BOX", idAlu1, bpar, 3);
405 gMC->Gsvolu("S04B", "BOX", idAlu1, bpar, 3);
a9e2aefa 406
2d3423a6 407 gMC->Gspos("S03B",1,"S03M", -iChamber->RInner()-bpar[0] , 0, zfpos,
a9e2aefa 408 idrotm[1100],"ONLY");
2d3423a6 409 gMC->Gspos("S03B",2,"S03M", +iChamber->RInner()+bpar[0] , 0, zfpos,
a9e2aefa 410 idrotm[1100],"ONLY");
2d3423a6 411 gMC->Gspos("S03B",3,"S03M", 0, -iChamber->RInner()-bpar[0] , zfpos,
a9e2aefa 412 idrotm[1101],"ONLY");
2d3423a6 413 gMC->Gspos("S03B",4,"S03M", 0, +iChamber->RInner()+bpar[0] , zfpos,
a9e2aefa 414 idrotm[1101],"ONLY");
2d3423a6 415 gMC->Gspos("S03B",5,"S03M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 416 idrotm[1100],"ONLY");
2d3423a6 417 gMC->Gspos("S03B",6,"S03M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 418 idrotm[1100],"ONLY");
2d3423a6 419 gMC->Gspos("S03B",7,"S03M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 420 idrotm[1101],"ONLY");
2d3423a6 421 gMC->Gspos("S03B",8,"S03M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 422 idrotm[1101],"ONLY");
423
2d3423a6 424 gMC->Gspos("S04B",1,"S04M", -iChamber->RInner()-bpar[0] , 0, zfpos,
a9e2aefa 425 idrotm[1100],"ONLY");
2d3423a6 426 gMC->Gspos("S04B",2,"S04M", +iChamber->RInner()+bpar[0] , 0, zfpos,
a9e2aefa 427 idrotm[1100],"ONLY");
2d3423a6 428 gMC->Gspos("S04B",3,"S04M", 0, -iChamber->RInner()-bpar[0] , zfpos,
a9e2aefa 429 idrotm[1101],"ONLY");
2d3423a6 430 gMC->Gspos("S04B",4,"S04M", 0, +iChamber->RInner()+bpar[0] , zfpos,
a9e2aefa 431 idrotm[1101],"ONLY");
2d3423a6 432 gMC->Gspos("S04B",5,"S04M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 433 idrotm[1100],"ONLY");
2d3423a6 434 gMC->Gspos("S04B",6,"S04M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 435 idrotm[1100],"ONLY");
2d3423a6 436 gMC->Gspos("S04B",7,"S04M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 437 idrotm[1101],"ONLY");
2d3423a6 438 gMC->Gspos("S04B",8,"S04M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 439 idrotm[1101],"ONLY");
440 }
441//
442// Chamber Material represented by Alu sheet
443 tpar[0]= iChamber->RInner();
444 tpar[1]= iChamber->ROuter();
445 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
b74f1c6a 446 gMC->Gsvolu("S03A", "TUBE", idAlu2, tpar, 3);
447 gMC->Gsvolu("S04A", "TUBE", idAlu2, tpar, 3);
448 gMC->Gspos("S03A", 1, "S03M", 0., 0., 0., 0, "ONLY");
449 gMC->Gspos("S04A", 1, "S04M", 0., 0., 0., 0, "ONLY");
a9e2aefa 450//
451// Sensitive volumes
452 // tpar[2] = iChamber->DGas();
453 tpar[2] = iChamber->DGas()/2;
b74f1c6a 454 gMC->Gsvolu("S03G", "TUBE", idGas, tpar, 3);
455 gMC->Gsvolu("S04G", "TUBE", idGas, tpar, 3);
456 gMC->Gspos("S03G", 1, "S03A", 0., 0., 0., 0, "ONLY");
457 gMC->Gspos("S04G", 1, "S04A", 0., 0., 0., 0, "ONLY");
a9e2aefa 458//
459// Frame Crosses to be placed inside gas
b64652f5 460 // NONE: chambers are sensitive everywhere
461// if (frameCrosses) {
462
463// dr = (iChamber->ROuter() - iChamber->RInner());
464// bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
465// bpar[1] = dframep1/2;
466// bpar[2] = iChamber->DGas()/2;
b74f1c6a 467// gMC->Gsvolu("S03F", "BOX", idAlu1, bpar, 3);
468// gMC->Gsvolu("S04F", "BOX", idAlu1, bpar, 3);
a9e2aefa 469
b74f1c6a 470// gMC->Gspos("S03F",1,"S03G", +iChamber->RInner()+bpar[0] , 0, 0,
b64652f5 471// idrotm[1100],"ONLY");
b74f1c6a 472// gMC->Gspos("S03F",2,"S03G", -iChamber->RInner()-bpar[0] , 0, 0,
b64652f5 473// idrotm[1100],"ONLY");
b74f1c6a 474// gMC->Gspos("S03F",3,"S03G", 0, +iChamber->RInner()+bpar[0] , 0,
b64652f5 475// idrotm[1101],"ONLY");
b74f1c6a 476// gMC->Gspos("S03F",4,"S03G", 0, -iChamber->RInner()-bpar[0] , 0,
b64652f5 477// idrotm[1101],"ONLY");
a9e2aefa 478
b74f1c6a 479// gMC->Gspos("S04F",1,"S04G", +iChamber->RInner()+bpar[0] , 0, 0,
b64652f5 480// idrotm[1100],"ONLY");
b74f1c6a 481// gMC->Gspos("S04F",2,"S04G", -iChamber->RInner()-bpar[0] , 0, 0,
b64652f5 482// idrotm[1100],"ONLY");
b74f1c6a 483// gMC->Gspos("S04F",3,"S04G", 0, +iChamber->RInner()+bpar[0] , 0,
b64652f5 484// idrotm[1101],"ONLY");
b74f1c6a 485// gMC->Gspos("S04F",4,"S04G", 0, -iChamber->RInner()-bpar[0] , 0,
b64652f5 486// idrotm[1101],"ONLY");
487// }
b17c0c87 488 }
1e8fff9c 489 // define the id of tracking media:
490 Int_t idCopper = idtmed[1110];
491 Int_t idGlass = idtmed[1111];
492 Int_t idCarbon = idtmed[1112];
493 Int_t idRoha = idtmed[1113];
494
1e8fff9c 495 // sensitive area: 40*40 cm**2
6c5ddcfa 496 const Float_t sensLength = 40.;
497 const Float_t sensHeight = 40.;
498 const Float_t sensWidth = 0.5; // according to TDR fig 2.120
499 const Int_t sensMaterial = idGas;
1e8fff9c 500 const Float_t yOverlap = 1.5;
501
502 // PCB dimensions in cm; width: 30 mum copper
6c5ddcfa 503 const Float_t pcbLength = sensLength;
504 const Float_t pcbHeight = 60.;
505 const Float_t pcbWidth = 0.003;
506 const Int_t pcbMaterial = idCopper;
1e8fff9c 507
508 // Insulating material: 200 mum glass fiber glued to pcb
6c5ddcfa 509 const Float_t insuLength = pcbLength;
510 const Float_t insuHeight = pcbHeight;
511 const Float_t insuWidth = 0.020;
512 const Int_t insuMaterial = idGlass;
1e8fff9c 513
514 // Carbon fiber panels: 200mum carbon/epoxy skin
6c5ddcfa 515 const Float_t panelLength = sensLength;
516 const Float_t panelHeight = sensHeight;
517 const Float_t panelWidth = 0.020;
518 const Int_t panelMaterial = idCarbon;
1e8fff9c 519
520 // rohacell between the two carbon panels
6c5ddcfa 521 const Float_t rohaLength = sensLength;
522 const Float_t rohaHeight = sensHeight;
523 const Float_t rohaWidth = 0.5;
524 const Int_t rohaMaterial = idRoha;
1e8fff9c 525
526 // Frame around the slat: 2 sticks along length,2 along height
527 // H: the horizontal ones
6c5ddcfa 528 const Float_t hFrameLength = pcbLength;
529 const Float_t hFrameHeight = 1.5;
530 const Float_t hFrameWidth = sensWidth;
531 const Int_t hFrameMaterial = idGlass;
1e8fff9c 532
533 // V: the vertical ones
6c5ddcfa 534 const Float_t vFrameLength = 4.0;
535 const Float_t vFrameHeight = sensHeight + hFrameHeight;
536 const Float_t vFrameWidth = sensWidth;
537 const Int_t vFrameMaterial = idGlass;
1e8fff9c 538
539 // B: the horizontal border filled with rohacell
6c5ddcfa 540 const Float_t bFrameLength = hFrameLength;
541 const Float_t bFrameHeight = (pcbHeight - sensHeight)/2. - hFrameHeight;
542 const Float_t bFrameWidth = hFrameWidth;
543 const Int_t bFrameMaterial = idRoha;
1e8fff9c 544
545 // NULOC: 30 mum copper + 200 mum vetronite (same radiation length as 14mum copper)
6c5ddcfa 546 const Float_t nulocLength = 2.5;
547 const Float_t nulocHeight = 7.5;
548 const Float_t nulocWidth = 0.0030 + 0.0014; // equivalent copper width of vetronite;
549 const Int_t nulocMaterial = idCopper;
1e8fff9c 550
6c5ddcfa 551 const Float_t slatHeight = pcbHeight;
552 const Float_t slatWidth = sensWidth + 2.*(pcbWidth + insuWidth +
553 2.* panelWidth + rohaWidth);
554 const Int_t slatMaterial = idAir;
555 const Float_t dSlatLength = vFrameLength; // border on left and right
1e8fff9c 556
1e8fff9c 557 Float_t spar[3];
b17c0c87 558 Int_t i, j;
559
3c084d9f 560 // the panel volume contains the rohacell
561
562 Float_t twidth = 2 * panelWidth + rohaWidth;
563 Float_t panelpar[3] = { panelLength/2., panelHeight/2., twidth/2. };
b17c0c87 564 Float_t rohapar[3] = { rohaLength/2., rohaHeight/2., rohaWidth/2. };
3c084d9f 565
566 // insulating material contains PCB-> gas-> 2 borders filled with rohacell
567
568 twidth = 2*(insuWidth + pcbWidth) + sensWidth;
569 Float_t insupar[3] = { insuLength/2., insuHeight/2., twidth/2. };
570 twidth -= 2 * insuWidth;
571 Float_t pcbpar[3] = { pcbLength/2., pcbHeight/2., twidth/2. };
572 Float_t senspar[3] = { sensLength/2., sensHeight/2., sensWidth/2. };
573 Float_t theight = 2*hFrameHeight + sensHeight;
574 Float_t hFramepar[3]={hFrameLength/2., theight/2., hFrameWidth/2.};
b17c0c87 575 Float_t bFramepar[3]={bFrameLength/2., bFrameHeight/2., bFrameWidth/2.};
3c084d9f 576 Float_t vFramepar[3]={vFrameLength/2., vFrameHeight/2., vFrameWidth/2.};
b17c0c87 577 Float_t nulocpar[3]={nulocLength/2., nulocHeight/2., nulocWidth/2.};
b17c0c87 578 Float_t xx;
579 Float_t xxmax = (bFrameLength - nulocLength)/2.;
580 Int_t index=0;
581
ba030c0e 582 if (fStations[2]) {
b17c0c87 583
584//********************************************************************
585// Station 3 **
586//********************************************************************
587 // indices 1 and 2 for first and second chambers in the station
588 // iChamber (first chamber) kept for other quanties than Z,
589 // assumed to be the same in both chambers
590 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[4];
591 iChamber2 =(AliMUONChamber*) (*fChambers)[5];
592 zpos1=iChamber1->Z();
593 zpos2=iChamber2->Z();
b13a15bc 594 dstation = TMath::Abs(zpos2 - zpos1);
b17c0c87 595
b17c0c87 596//
597// Mother volume
598 tpar[0] = iChamber->RInner()-dframep;
599 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
21a18f36 600 tpar[2] = dstation/5;
2724ae40 601
b74f1c6a 602 char *slats5Mother = "S05M";
603 char *slats6Mother = "S06M";
2724ae40 604 Float_t zoffs5 = 0;
605 Float_t zoffs6 = 0;
606
fe713e43 607 if (gAlice->GetModule("DIPO")) {
2724ae40 608 slats5Mother="DDIP";
609 slats6Mother="DDIP";
610
b13a15bc 611 zoffs5 = TMath::Abs(zpos1);
612 zoffs6 = TMath::Abs(zpos2);
2724ae40 613 }
614 else {
b74f1c6a 615 gMC->Gsvolu("S05M", "TUBE", idAir, tpar, 3);
616 gMC->Gsvolu("S06M", "TUBE", idAir, tpar, 3);
617 gMC->Gspos("S05M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
618 gMC->Gspos("S06M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
2724ae40 619 }
620
b17c0c87 621 // volumes for slat geometry (xx=5,..,10 chamber id):
622 // Sxx0 Sxx1 Sxx2 Sxx3 --> Slat Mother volumes
623 // SxxG --> Sensitive volume (gas)
624 // SxxP --> PCB (copper)
625 // SxxI --> Insulator (vetronite)
626 // SxxC --> Carbon panel
627 // SxxR --> Rohacell
628 // SxxH, SxxV --> Horizontal and Vertical frames (vetronite)
21a18f36 629 // SB5x --> Volumes for the 35 cm long PCB
b17c0c87 630 // slat dimensions: slat is a MOTHER volume!!! made of air
631
21a18f36 632 // only for chamber 5: slat 1 has a PCB shorter by 5cm!
633
634 Float_t tlength = 35.;
635 Float_t panelpar2[3] = { tlength/2., panelpar[1], panelpar[2]};
636 Float_t rohapar2[3] = { tlength/2., rohapar[1], rohapar[2]};
637 Float_t insupar2[3] = { tlength/2., insupar[1], insupar[2]};
638 Float_t pcbpar2[3] = { tlength/2., pcbpar[1], pcbpar[2]};
639 Float_t senspar2[3] = { tlength/2., senspar[1], senspar[2]};
640 Float_t hFramepar2[3] = { tlength/2., hFramepar[1], hFramepar[2]};
641 Float_t bFramepar2[3] = { tlength/2., bFramepar[1], bFramepar[2]};
642
a083207d 643 const Int_t nSlats3 = 5; // number of slats per quadrant
644 const Int_t nPCB3[nSlats3] = {3,3,4,3,2}; // n PCB per slat
21a18f36 645 const Float_t xpos3[nSlats3] = {31., 40., 0., 0., 0.};
b17c0c87 646 Float_t slatLength3[nSlats3];
647
648 // create and position the slat (mother) volumes
649
6c5ddcfa 650 char volNam5[5];
651 char volNam6[5];
f9f7c205 652 Float_t xSlat3;
b17c0c87 653
21a18f36 654 Float_t spar2[3];
6c5ddcfa 655 for (i = 0; i<nSlats3; i++){
3c084d9f 656 slatLength3[i] = pcbLength * nPCB3[i] + 2. * dSlatLength;
a083207d 657 xSlat3 = slatLength3[i]/2. - vFrameLength/2. + xpos3[i];
21a18f36 658 if (i==1 || i==0) slatLength3[i] -= 2. *dSlatLength; // frame out in PCB with circular border
a083207d 659 Float_t ySlat31 = sensHeight * i - yOverlap * i;
660 Float_t ySlat32 = -sensHeight * i + yOverlap * i;
3c084d9f 661 spar[0] = slatLength3[i]/2.;
662 spar[1] = slatHeight/2.;
663 spar[2] = slatWidth/2. * 1.01;
21a18f36 664 // take away 5 cm from the first slat in chamber 5
665 Float_t xSlat32 = 0;
666 if (i==1 || i==2) { // 1 pcb is shortened by 5cm
667 spar2[0] = spar[0]-5./2.;
668 xSlat32 = xSlat3 - 5/2.;
669 }
670 else {
671 spar2[0] = spar[0];
672 xSlat32 = xSlat3;
673 }
674 spar2[1] = spar[1];
675 spar2[2] = spar[2];
3c084d9f 676 Float_t dzCh3=spar[2] * 1.01;
677 // zSlat to be checked (odd downstream or upstream?)
678 Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2];
679 sprintf(volNam5,"S05%d",i);
21a18f36 680 gMC->Gsvolu(volNam5,"BOX",slatMaterial,spar2,3);
2d3423a6 681 gMC->Gspos(volNam5, i*4+1,slats5Mother, -xSlat32, ySlat31, zoffs5-zSlat-2.*dzCh3, 0, "ONLY");
682 gMC->Gspos(volNam5, i*4+2,slats5Mother, +xSlat32, ySlat31, zoffs5-zSlat+2.*dzCh3, 0, "ONLY");
21a18f36 683
a083207d 684 if (i>0) {
2d3423a6 685 gMC->Gspos(volNam5, i*4+3,slats5Mother,-xSlat32, ySlat32, zoffs5-zSlat-2.*dzCh3, 0, "ONLY");
686 gMC->Gspos(volNam5, i*4+4,slats5Mother,+xSlat32, ySlat32, zoffs5-zSlat+2.*dzCh3, 0, "ONLY");
a083207d 687 }
3c084d9f 688 sprintf(volNam6,"S06%d",i);
689 gMC->Gsvolu(volNam6,"BOX",slatMaterial,spar,3);
2d3423a6 690 gMC->Gspos(volNam6, i*4+1,slats6Mother,-xSlat3, ySlat31, zoffs6-zSlat-2.*dzCh3, 0, "ONLY");
691 gMC->Gspos(volNam6, i*4+2,slats6Mother,+xSlat3, ySlat31, zoffs6-zSlat+2.*dzCh3, 0, "ONLY");
a083207d 692 if (i>0) {
2d3423a6 693 gMC->Gspos(volNam6, i*4+3,slats6Mother,-xSlat3, ySlat32, zoffs6-zSlat-2.*dzCh3, 0, "ONLY");
694 gMC->Gspos(volNam6, i*4+4,slats6Mother,+xSlat3, ySlat32, zoffs6-zSlat+2.*dzCh3, 0, "ONLY");
a083207d 695 }
3c084d9f 696 }
1e8fff9c 697
698 // create the panel volume
b17c0c87 699
6c5ddcfa 700 gMC->Gsvolu("S05C","BOX",panelMaterial,panelpar,3);
21a18f36 701 gMC->Gsvolu("SB5C","BOX",panelMaterial,panelpar2,3);
6c5ddcfa 702 gMC->Gsvolu("S06C","BOX",panelMaterial,panelpar,3);
1e8fff9c 703
704 // create the rohacell volume
b17c0c87 705
6c5ddcfa 706 gMC->Gsvolu("S05R","BOX",rohaMaterial,rohapar,3);
21a18f36 707 gMC->Gsvolu("SB5R","BOX",rohaMaterial,rohapar2,3);
6c5ddcfa 708 gMC->Gsvolu("S06R","BOX",rohaMaterial,rohapar,3);
1e8fff9c 709
3c084d9f 710 // create the insulating material volume
711
712 gMC->Gsvolu("S05I","BOX",insuMaterial,insupar,3);
21a18f36 713 gMC->Gsvolu("SB5I","BOX",insuMaterial,insupar2,3);
3c084d9f 714 gMC->Gsvolu("S06I","BOX",insuMaterial,insupar,3);
715
716 // create the PCB volume
717
718 gMC->Gsvolu("S05P","BOX",pcbMaterial,pcbpar,3);
21a18f36 719 gMC->Gsvolu("SB5P","BOX",pcbMaterial,pcbpar2,3);
3c084d9f 720 gMC->Gsvolu("S06P","BOX",pcbMaterial,pcbpar,3);
721
722 // create the sensitive volumes,
3f08857e 723 gMC->Gsvolu("S05G","BOX",sensMaterial,dum,0);
724 gMC->Gsvolu("S06G","BOX",sensMaterial,dum,0);
3c084d9f 725
726
1e8fff9c 727 // create the vertical frame volume
b17c0c87 728
6c5ddcfa 729 gMC->Gsvolu("S05V","BOX",vFrameMaterial,vFramepar,3);
730 gMC->Gsvolu("S06V","BOX",vFrameMaterial,vFramepar,3);
1e8fff9c 731
732 // create the horizontal frame volume
b17c0c87 733
6c5ddcfa 734 gMC->Gsvolu("S05H","BOX",hFrameMaterial,hFramepar,3);
21a18f36 735 gMC->Gsvolu("SB5H","BOX",hFrameMaterial,hFramepar2,3);
6c5ddcfa 736 gMC->Gsvolu("S06H","BOX",hFrameMaterial,hFramepar,3);
1e8fff9c 737
738 // create the horizontal border volume
b17c0c87 739
6c5ddcfa 740 gMC->Gsvolu("S05B","BOX",bFrameMaterial,bFramepar,3);
21a18f36 741 gMC->Gsvolu("SB5B","BOX",bFrameMaterial,bFramepar2,3);
6c5ddcfa 742 gMC->Gsvolu("S06B","BOX",bFrameMaterial,bFramepar,3);
1e8fff9c 743
b17c0c87 744 index=0;
6c5ddcfa 745 for (i = 0; i<nSlats3; i++){
746 sprintf(volNam5,"S05%d",i);
747 sprintf(volNam6,"S06%d",i);
f9f7c205 748 Float_t xvFrame = (slatLength3[i] - vFrameLength)/2.;
21a18f36 749 Float_t xvFrame2 = xvFrame;
750 if ( i==1 || i ==2 ) xvFrame2 -= 5./2.;
3c084d9f 751 // position the vertical frames
21a18f36 752 if (i!=1 && i!=0) {
753 gMC->Gspos("S05V",2*i-1,volNam5, xvFrame2, 0., 0. , 0, "ONLY");
754 gMC->Gspos("S05V",2*i ,volNam5,-xvFrame2, 0., 0. , 0, "ONLY");
3c084d9f 755 gMC->Gspos("S06V",2*i-1,volNam6, xvFrame, 0., 0. , 0, "ONLY");
756 gMC->Gspos("S06V",2*i ,volNam6,-xvFrame, 0., 0. , 0, "ONLY");
757 }
758 // position the panels and the insulating material
6c5ddcfa 759 for (j=0; j<nPCB3[i]; j++){
1e8fff9c 760 index++;
6c5ddcfa 761 Float_t xx = sensLength * (-nPCB3[i]/2.+j+.5);
21a18f36 762 Float_t xx2 = xx + 5/2.;
3c084d9f 763
764 Float_t zPanel = spar[2] - panelpar[2];
21a18f36 765 if ( (i==1 || i==2) && j == nPCB3[i]-1) { // 1 pcb is shortened by 5cm
766 gMC->Gspos("SB5C",2*index-1,volNam5, xx, 0., zPanel , 0, "ONLY");
767 gMC->Gspos("SB5C",2*index ,volNam5, xx, 0.,-zPanel , 0, "ONLY");
768 gMC->Gspos("SB5I",index ,volNam5, xx, 0., 0 , 0, "ONLY");
769 }
770 else if ( (i==1 || i==2) && j < nPCB3[i]-1) {
771 gMC->Gspos("S05C",2*index-1,volNam5, xx2, 0., zPanel , 0, "ONLY");
772 gMC->Gspos("S05C",2*index ,volNam5, xx2, 0.,-zPanel , 0, "ONLY");
773 gMC->Gspos("S05I",index ,volNam5, xx2, 0., 0 , 0, "ONLY");
774 }
775 else {
776 gMC->Gspos("S05C",2*index-1,volNam5, xx, 0., zPanel , 0, "ONLY");
777 gMC->Gspos("S05C",2*index ,volNam5, xx, 0.,-zPanel , 0, "ONLY");
778 gMC->Gspos("S05I",index ,volNam5, xx, 0., 0 , 0, "ONLY");
779 }
3c084d9f 780 gMC->Gspos("S06C",2*index-1,volNam6, xx, 0., zPanel , 0, "ONLY");
781 gMC->Gspos("S06C",2*index ,volNam6, xx, 0.,-zPanel , 0, "ONLY");
3c084d9f 782 gMC->Gspos("S06I",index,volNam6, xx, 0., 0 , 0, "ONLY");
1e8fff9c 783 }
a9e2aefa 784 }
21a18f36 785
3c084d9f 786 // position the rohacell volume inside the panel volume
787 gMC->Gspos("S05R",1,"S05C",0.,0.,0.,0,"ONLY");
21a18f36 788 gMC->Gspos("SB5R",1,"SB5C",0.,0.,0.,0,"ONLY");
3c084d9f 789 gMC->Gspos("S06R",1,"S06C",0.,0.,0.,0,"ONLY");
790
791 // position the PCB volume inside the insulating material volume
792 gMC->Gspos("S05P",1,"S05I",0.,0.,0.,0,"ONLY");
21a18f36 793 gMC->Gspos("SB5P",1,"SB5I",0.,0.,0.,0,"ONLY");
3c084d9f 794 gMC->Gspos("S06P",1,"S06I",0.,0.,0.,0,"ONLY");
795 // position the horizontal frame volume inside the PCB volume
796 gMC->Gspos("S05H",1,"S05P",0.,0.,0.,0,"ONLY");
21a18f36 797 gMC->Gspos("SB5H",1,"SB5P",0.,0.,0.,0,"ONLY");
3c084d9f 798 gMC->Gspos("S06H",1,"S06P",0.,0.,0.,0,"ONLY");
799 // position the sensitive volume inside the horizontal frame volume
800 gMC->Gsposp("S05G",1,"S05H",0.,0.,0.,0,"ONLY",senspar,3);
21a18f36 801 gMC->Gsposp("S05G",1,"SB5H",0.,0.,0.,0,"ONLY",senspar2,3);
3c084d9f 802 gMC->Gsposp("S06G",1,"S06H",0.,0.,0.,0,"ONLY",senspar,3);
803 // position the border volumes inside the PCB volume
804 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
805 gMC->Gspos("S05B",1,"S05P",0., yborder,0.,0,"ONLY");
806 gMC->Gspos("S05B",2,"S05P",0.,-yborder,0.,0,"ONLY");
21a18f36 807 gMC->Gspos("SB5B",1,"SB5P",0., yborder,0.,0,"ONLY");
808 gMC->Gspos("SB5B",2,"SB5P",0.,-yborder,0.,0,"ONLY");
3c084d9f 809 gMC->Gspos("S06B",1,"S06P",0., yborder,0.,0,"ONLY");
810 gMC->Gspos("S06B",2,"S06P",0.,-yborder,0.,0,"ONLY");
811
1e8fff9c 812 // create the NULOC volume and position it in the horizontal frame
b17c0c87 813
6c5ddcfa 814 gMC->Gsvolu("S05N","BOX",nulocMaterial,nulocpar,3);
815 gMC->Gsvolu("S06N","BOX",nulocMaterial,nulocpar,3);
6c5ddcfa 816 index = 0;
21a18f36 817 Float_t xxmax2 = xxmax - 5./2.;
818 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
1e8fff9c 819 index++;
6c5ddcfa 820 gMC->Gspos("S05N",2*index-1,"S05B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
821 gMC->Gspos("S05N",2*index ,"S05B", xx, 0., bFrameWidth/4., 0, "ONLY");
21a18f36 822 if (xx > -xxmax2 && xx< xxmax2) {
823 gMC->Gspos("S05N",2*index-1,"SB5B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
824 gMC->Gspos("S05N",2*index ,"SB5B", xx, 0., bFrameWidth/4., 0, "ONLY");
825 }
6c5ddcfa 826 gMC->Gspos("S06N",2*index-1,"S06B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
827 gMC->Gspos("S06N",2*index ,"S06B", xx, 0., bFrameWidth/4., 0, "ONLY");
1e8fff9c 828 }
3c084d9f 829
830 // position the volumes approximating the circular section of the pipe
a083207d 831 Float_t yoffs = sensHeight/2. - yOverlap;
3c084d9f 832 Float_t epsilon = 0.001;
833 Int_t ndiv=6;
834 Float_t divpar[3];
835 Double_t dydiv= sensHeight/ndiv;
21a18f36 836 Double_t ydiv = yoffs -dydiv;
3c084d9f 837 Int_t imax=0;
3c084d9f 838 imax = 1;
21a18f36 839 Float_t rmin = 33.;
a083207d 840 Float_t z1 = spar[2], z2=2*spar[2]*1.01;
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) );
845 divpar[0] = (pcbLength-xdiv)/2.;
846 divpar[1] = dydiv/2. - epsilon;
847 divpar[2] = sensWidth/2.;
425ebd0a 848 Float_t xvol=(pcbLength+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
f9f7c205 889 const Int_t nSlats4 = 6; // number of slats per quadrant
425ebd0a 890 const Int_t nPCB4[nSlats4] = {4,4,5,5,4,3}; // n PCB per slat
21a18f36 891 const Float_t xpos4[nSlats4] = {38.5, 40., 0., 0., 0., 0.};
6c5ddcfa 892 Float_t slatLength4[nSlats4];
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
6c5ddcfa 901 for (i = 0; i<nSlats4; i++){
a083207d 902 slatLength4[i] = pcbLength * nPCB4[i] + 2. * dSlatLength;
903 xSlat4 = slatLength4[i]/2. - vFrameLength/2. + xpos4[i];
2724ae40 904 if (i==1) slatLength4[i] -= 2. *dSlatLength; // frame out in PCB with circular border
a083207d 905 ySlat4 = sensHeight * i - yOverlap *i;
906
907 spar[0] = slatLength4[i]/2.;
908 spar[1] = slatHeight/2.;
909 spar[2] = slatWidth/2.*1.01;
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);
914 gMC->Gsvolu(volNam7,"BOX",slatMaterial,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);
922 gMC->Gsvolu(volNam8,"BOX",slatMaterial,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
3c084d9f 934 gMC->Gsvolu("S07C","BOX",panelMaterial,panelpar,3);
935 gMC->Gsvolu("S08C","BOX",panelMaterial,panelpar,3);
a9e2aefa 936
3c084d9f 937 // create the rohacell volume
938
939 gMC->Gsvolu("S07R","BOX",rohaMaterial,rohapar,3);
940 gMC->Gsvolu("S08R","BOX",rohaMaterial,rohapar,3);
1e8fff9c 941
1e8fff9c 942 // create the insulating material volume
943
6c5ddcfa 944 gMC->Gsvolu("S07I","BOX",insuMaterial,insupar,3);
945 gMC->Gsvolu("S08I","BOX",insuMaterial,insupar,3);
1e8fff9c 946
3c084d9f 947 // create the PCB volume
1e8fff9c 948
3c084d9f 949 gMC->Gsvolu("S07P","BOX",pcbMaterial,pcbpar,3);
950 gMC->Gsvolu("S08P","BOX",pcbMaterial,pcbpar,3);
1e8fff9c 951
3c084d9f 952 // create the sensitive volumes,
953
3f08857e 954 gMC->Gsvolu("S07G","BOX",sensMaterial,dum,0);
955 gMC->Gsvolu("S08G","BOX",sensMaterial,dum,0);
1e8fff9c 956
957 // create the vertical frame volume
958
6c5ddcfa 959 gMC->Gsvolu("S07V","BOX",vFrameMaterial,vFramepar,3);
960 gMC->Gsvolu("S08V","BOX",vFrameMaterial,vFramepar,3);
1e8fff9c 961
962 // create the horizontal frame volume
963
6c5ddcfa 964 gMC->Gsvolu("S07H","BOX",hFrameMaterial,hFramepar,3);
965 gMC->Gsvolu("S08H","BOX",hFrameMaterial,hFramepar,3);
1e8fff9c 966
967 // create the horizontal border volume
968
6c5ddcfa 969 gMC->Gsvolu("S07B","BOX",bFrameMaterial,bFramepar,3);
970 gMC->Gsvolu("S08B","BOX",bFrameMaterial,bFramepar,3);
3c084d9f 971
972 index=0;
6c5ddcfa 973 for (i = 0; i<nSlats4; i++){
974 sprintf(volNam7,"S07%d",i);
975 sprintf(volNam8,"S08%d",i);
976 Float_t xvFrame = (slatLength4[i] - vFrameLength)/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
6c5ddcfa 985 for (j=0; j<nPCB4[i]; j++){
1e8fff9c 986 index++;
6c5ddcfa 987 Float_t xx = sensLength * (-nPCB4[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
1014 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
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
6c5ddcfa 1022 gMC->Gsvolu("S07N","BOX",nulocMaterial,nulocpar,3);
1023 gMC->Gsvolu("S08N","BOX",nulocMaterial,nulocpar,3);
3c084d9f 1024 index = 0;
21a18f36 1025 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
1e8fff9c 1026 index++;
6c5ddcfa 1027 gMC->Gspos("S07N",2*index-1,"S07B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1028 gMC->Gspos("S07N",2*index ,"S07B", xx, 0., bFrameWidth/4., 0, "ONLY");
1029 gMC->Gspos("S08N",2*index-1,"S08B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1030 gMC->Gspos("S08N",2*index ,"S08B", xx, 0., bFrameWidth/4., 0, "ONLY");
1e8fff9c 1031 }
a083207d 1032
1033 // position the volumes approximating the circular section of the pipe
21a18f36 1034 Float_t yoffs = sensHeight/2. - yOverlap;
a083207d 1035 Float_t epsilon = 0.001;
1036 Int_t ndiv=6;
1037 Float_t divpar[3];
1038 Double_t dydiv= sensHeight/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) );
1048 divpar[0] = (pcbLength-xdiv)/2.;
1049 divpar[1] = dydiv/2. - epsilon;
1050 divpar[2] = sensWidth/2.;
425ebd0a 1051 Float_t xvol=(pcbLength+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
1e8fff9c 1097 const Int_t nSlats5 = 7; // number of slats per quadrant
a083207d 1098 const Int_t nPCB5[nSlats5] = {5,5,6,6,5,4,3}; // n PCB per slat
21a18f36 1099 const Float_t xpos5[nSlats5] = {38.5, 40., 0., 0., 0., 0., 0.};
6c5ddcfa 1100 Float_t slatLength5[nSlats5];
6c5ddcfa 1101 char volNam9[5];
1102 char volNam10[5];
f9f7c205 1103 Float_t xSlat5;
1104 Float_t ySlat5;
1e8fff9c 1105
6c5ddcfa 1106 for (i = 0; i<nSlats5; i++){
1107 slatLength5[i] = pcbLength * nPCB5[i] + 2. * dSlatLength;
a083207d 1108 xSlat5 = slatLength5[i]/2. - vFrameLength/2. +xpos5[i];
21a18f36 1109 if (i==1 || i==0) slatLength5[i] -= 2. *dSlatLength; // frame out in PCB with circular border
f9f7c205 1110 ySlat5 = sensHeight * i - yOverlap * i;
6c5ddcfa 1111 spar[0] = slatLength5[i]/2.;
1112 spar[1] = slatHeight/2.;
3c084d9f 1113 spar[2] = slatWidth/2. * 1.01;
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);
1118 gMC->Gsvolu(volNam9,"BOX",slatMaterial,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);
1126 gMC->Gsvolu(volNam10,"BOX",slatMaterial,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
6c5ddcfa 1137 gMC->Gsvolu("S09C","BOX",panelMaterial,panelpar,3);
1138 gMC->Gsvolu("S10C","BOX",panelMaterial,panelpar,3);
3c084d9f 1139
1e8fff9c 1140 // create the rohacell volume
3c084d9f 1141
6c5ddcfa 1142 gMC->Gsvolu("S09R","BOX",rohaMaterial,rohapar,3);
1143 gMC->Gsvolu("S10R","BOX",rohaMaterial,rohapar,3);
3c084d9f 1144
1145 // create the insulating material volume
1146
1147 gMC->Gsvolu("S09I","BOX",insuMaterial,insupar,3);
1148 gMC->Gsvolu("S10I","BOX",insuMaterial,insupar,3);
1149
1150 // create the PCB volume
1151
1152 gMC->Gsvolu("S09P","BOX",pcbMaterial,pcbpar,3);
1153 gMC->Gsvolu("S10P","BOX",pcbMaterial,pcbpar,3);
1154
1155 // create the sensitive volumes,
1156
3f08857e 1157 gMC->Gsvolu("S09G","BOX",sensMaterial,dum,0);
1158 gMC->Gsvolu("S10G","BOX",sensMaterial,dum,0);
3c084d9f 1159
1e8fff9c 1160 // create the vertical frame volume
3c084d9f 1161
6c5ddcfa 1162 gMC->Gsvolu("S09V","BOX",vFrameMaterial,vFramepar,3);
1163 gMC->Gsvolu("S10V","BOX",vFrameMaterial,vFramepar,3);
1e8fff9c 1164
1165 // create the horizontal frame volume
3c084d9f 1166
6c5ddcfa 1167 gMC->Gsvolu("S09H","BOX",hFrameMaterial,hFramepar,3);
1168 gMC->Gsvolu("S10H","BOX",hFrameMaterial,hFramepar,3);
1e8fff9c 1169
1170 // create the horizontal border volume
1171
6c5ddcfa 1172 gMC->Gsvolu("S09B","BOX",bFrameMaterial,bFramepar,3);
1173 gMC->Gsvolu("S10B","BOX",bFrameMaterial,bFramepar,3);
1e8fff9c 1174
3c084d9f 1175 index=0;
6c5ddcfa 1176 for (i = 0; i<nSlats5; i++){
1177 sprintf(volNam9,"S09%d",i);
1178 sprintf(volNam10,"S10%d",i);
1179 Float_t xvFrame = (slatLength5[i] - vFrameLength)/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
6c5ddcfa 1189 for (j=0; j<nPCB5[i]; j++){
1e8fff9c 1190 index++;
3c084d9f 1191 Float_t xx = sensLength * (-nPCB5[i]/2.+j+.5);
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
1218 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
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
6c5ddcfa 1226 gMC->Gsvolu("S09N","BOX",nulocMaterial,nulocpar,3);
1227 gMC->Gsvolu("S10N","BOX",nulocMaterial,nulocpar,3);
3c084d9f 1228 index = 0;
21a18f36 1229 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
1e8fff9c 1230 index++;
6c5ddcfa 1231 gMC->Gspos("S09N",2*index-1,"S09B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1232 gMC->Gspos("S09N",2*index ,"S09B", xx, 0., bFrameWidth/4., 0, "ONLY");
1233 gMC->Gspos("S10N",2*index-1,"S10B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1234 gMC->Gspos("S10N",2*index ,"S10B", xx, 0., bFrameWidth/4., 0, "ONLY");
a9e2aefa 1235 }
a083207d 1236 // position the volumes approximating the circular section of the pipe
21a18f36 1237 Float_t yoffs = sensHeight/2. - yOverlap;
a083207d 1238 Float_t epsilon = 0.001;
1239 Int_t ndiv=6;
1240 Float_t divpar[3];
1241 Double_t dydiv= sensHeight/ndiv;
21a18f36 1242 Double_t ydiv = yoffs -dydiv;
a083207d 1243 Int_t imax=0;
1244 // for (Int_t islat=0; islat<nSlats3; islat++) imax += nPCB3[islat];
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) );
1252 divpar[0] = (pcbLength-xdiv)/2.;
1253 divpar[1] = dydiv/2. - epsilon;
1254 divpar[2] = sensWidth/2.;
425ebd0a 1255 Float_t xvol=(pcbLength+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{
1391e633 1644 if (fStepManagerVersionOld) {
c33d9661 1645 StepManagerOld();
1646 return;
1647 }
c33d9661 1648
1649 // Only charged tracks
1650 if( !(gMC->TrackCharge()) ) return;
1391e633 1651 // Only charged tracks
1652
c33d9661 1653 // Only gas gap inside chamber
1654 // Tag chambers and record hits when track enters
1391e633 1655 Int_t idvol=-1;
1656 Int_t iChamber=0;
1657 Int_t id=0;
1658 Int_t copy;
1659 const Float_t kBig = 1.e10;
1660
c33d9661 1661 id=gMC->CurrentVolID(copy);
1391e633 1662 // printf("id == %d \n",id);
c33d9661 1663 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) {
1664 if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) {
1665 iChamber = i;
1666 idvol = i-1;
1667 }
1668 }
1391e633 1669 if (idvol == -1) {
1670 return;
c33d9661 1671 }
abaf7c9d 1672
1391e633 1673 if( gMC->IsTrackEntering() ) {
1674 Float_t theta = fTrackMomentum.Theta();
b149a3db 1675 if ( (theta>=10) ) gMC->SetMaxStep(fStepMaxInActiveGas);
1391e633 1676 }
abaf7c9d 1677
1391e633 1678// if (GetDebug()) {
1679// Float_t z = ( (AliMUONChamber*)(*fChambers)[idvol])->Z() ;
1680// Info("StepManager Step","Active volume found %d chamber %d Z chamber is %f ",idvol,iChamber, z);
1681// }
1682 // Particule id and mass,
1683 Int_t ipart = gMC->TrackPid();
1684 Float_t mass = gMC->TrackMass();
1685
1686 fDestepSum[idvol]+=gMC->Edep();
1687 // Get current particle id (ipart), track position (pos) and momentum (mom)
1688 if ( fStepSum[idvol]==0.0 ) gMC->TrackMomentum(fTrackMomentum);
1689 fStepSum[idvol]+=gMC->TrackStep();
abaf7c9d 1690
1391e633 1691// if (GetDebug()) {
1692// Info("StepManager Step","iChamber %d, Particle %d, theta %f phi %f mass %f StepSum %f eloss %g",
1693// iChamber,ipart, fTrackMomentum.Theta()*kRaddeg, fTrackMomentum.Phi()*kRaddeg, mass, fStepSum[idvol], gMC->Edep());
1694// Info("StepManager Step","Track Momentum %f %f %f", fTrackMomentum.X(), fTrackMomentum.Y(), fTrackMomentum.Z()) ;
1695// gMC->TrackPosition(fTrackPosition);
1696// Info("StepManager Step","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
d08aff2d 1697// }
1391e633 1698
1699 // Track left chamber or StepSum larger than fStepMaxInActiveGas
1700 if ( gMC->IsTrackExiting() ||
1701 gMC->IsTrackStop() ||
1702 gMC->IsTrackDisappeared()||
1703 (fStepSum[idvol]>fStepMaxInActiveGas) ) {
1704
1705 if ( gMC->IsTrackExiting() ||
1706 gMC->IsTrackStop() ||
1707 gMC->IsTrackDisappeared() ) gMC->SetMaxStep(kBig);
1708
1709 gMC->TrackPosition(fTrackPosition);
1710 Float_t theta = fTrackMomentum.Theta();
1711 Float_t phi = fTrackMomentum.Phi();
1712
1713 TLorentzVector BackToWire( fStepSum[idvol]/2.*sin(theta)*cos(phi),
1714 fStepSum[idvol]/2.*sin(theta)*sin(phi),
1715 fStepSum[idvol]/2.*cos(theta),0.0 );
1716 // if (GetDebug())
1717 // Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
1718 // if (GetDebug())
1719 // Info("StepManager Exit ","Track BackToWire %f %f %f",BackToWire.X(),BackToWire.Y(),BackToWire.Z()) ;
1720 fTrackPosition-=BackToWire;
1721
1722 //-------------- Angle effect
1723 // Ratio between energy loss of particle and Mip as a function of BetaGamma of particle (Energy/Mass)
1724
1725 Float_t Beta_x_Gamma = fTrackMomentum.P()/mass;// pc/mc2
1726 Float_t SigmaEffect_10degrees;
1727 Float_t SigmaEffect_thetadegrees;
1728 Float_t ELossParticle_ELossMip;
1729 Float_t YAngleEffect=0.;
1730 Float_t theta_wires = TMath::Abs( TMath::ASin( TMath::Sin(theta) * TMath::Sin(phi) ) );
1731
1732 if ( (Beta_x_Gamma >3.2) && (theta_wires*kRaddeg<=10) ) {
1733 Beta_x_Gamma=TMath::Log(Beta_x_Gamma);
1734 ELossParticle_ELossMip = fElossRatio->Eval(Beta_x_Gamma);
1735 // 10 degrees is a reference for a model (arbitrary)
1736 SigmaEffect_10degrees=fAngleEffect10->Eval(ELossParticle_ELossMip);// in micrometers
1737 // Angle with respect to the wires assuming that chambers are perpendicular to the z axis.
1738 SigmaEffect_thetadegrees = SigmaEffect_10degrees/fAngleEffectNorma->Eval(theta_wires*kRaddeg); // For 5mm gap
1739 if ( (iChamber==1) || (iChamber==2) )
1740 SigmaEffect_thetadegrees/=(1.09833e+00+1.70000e-02*theta_wires*kRaddeg); // The gap is different (4mm)
1741 YAngleEffect=1.e-04*gRandom->Gaus(0,SigmaEffect_thetadegrees); // Error due to the angle effect in cm
1742 }
1743
1744
1745 // One hit per chamber
5d12ce38 1746 GetMUONData()->AddHit(fIshunt, gAlice->GetMCApp()->GetCurrentTrackNumber(), iChamber, ipart,
1391e633 1747 fTrackPosition.X(), fTrackPosition.Y()+YAngleEffect, fTrackPosition.Z(), 0.0,
1748 fTrackMomentum.P(),theta, phi, fStepSum[idvol], fDestepSum[idvol],
1749 fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z());
1750// if (GetDebug()){
1751// Info("StepManager Exit","Particle exiting from chamber %d",iChamber);
1752// Info("StepManager Exit","StepSum %f eloss geant %g ",fStepSum[idvol],fDestepSum[idvol]);
1753// Info("StepManager Exit","Track Position %f %f %f",fTrackPosition.X(),fTrackPosition.Y(),fTrackPosition.Z()) ;
1754// }
1755 fStepSum[idvol] =0; // Reset for the next event
1756 fDestepSum[idvol]=0; // Reset for the next event
1757 }
abaf7c9d 1758}
5f91c9e8 1759
1760//___________________________________________
c33d9661 1761void AliMUONv1::StepManagerOld()
a9e2aefa 1762{
1763 Int_t copy, id;
1764 static Int_t idvol;
1765 static Int_t vol[2];
1766 Int_t ipart;
1767 TLorentzVector pos;
1768 TLorentzVector mom;
1769 Float_t theta,phi;
1770 Float_t destep, step;
abaf7c9d 1771
1772 static Float_t Sstep;
1e8fff9c 1773 static Float_t eloss, eloss2, xhit, yhit, zhit, tof, tlength;
2eb55fab 1774 const Float_t kBig = 1.e10;
a9e2aefa 1775 static Float_t hits[15];
1776
1777 TClonesArray &lhits = *fHits;
1778
1779 //
a9e2aefa 1780 //
1781 // Only charged tracks
1782 if( !(gMC->TrackCharge()) ) return;
1783 //
1784 // Only gas gap inside chamber
1785 // Tag chambers and record hits when track enters
a9e2aefa 1786 id=gMC->CurrentVolID(copy);
5f91c9e8 1787 vol[0] = GetChamberId(id);
1788 idvol = vol[0] -1;
1789
1790 if (idvol == -1) return;
1791
a9e2aefa 1792 //
1793 // Get current particle id (ipart), track position (pos) and momentum (mom)
1794 gMC->TrackPosition(pos);
1795 gMC->TrackMomentum(mom);
1796
1797 ipart = gMC->TrackPid();
a9e2aefa 1798
1799 //
1800 // momentum loss and steplength in last step
1801 destep = gMC->Edep();
1802 step = gMC->TrackStep();
abaf7c9d 1803 // cout<<"------------"<<step<<endl;
a9e2aefa 1804 //
1805 // record hits when track enters ...
1806 if( gMC->IsTrackEntering()) {
abaf7c9d 1807
a9e2aefa 1808 gMC->SetMaxStep(fMaxStepGas);
1809 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1810 Double_t rt = TMath::Sqrt(tc);
1811 Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
2eb55fab 1812 Double_t tx = mom[0]/pmom;
1813 Double_t ty = mom[1]/pmom;
1814 Double_t tz = mom[2]/pmom;
1815 Double_t s = ((AliMUONChamber*)(*fChambers)[idvol])
a9e2aefa 1816 ->ResponseModel()
1817 ->Pitch()/tz;
1818 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1819 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1820 hits[0] = Float_t(ipart); // Geant3 particle type
2eb55fab 1821 hits[1] = pos[0]+s*tx; // X-position for hit
1822 hits[2] = pos[1]+s*ty; // Y-position for hit
1823 hits[3] = pos[2]+s*tz; // Z-position for hit
a9e2aefa 1824 hits[4] = theta; // theta angle of incidence
1825 hits[5] = phi; // phi angle of incidence
ce3f5e87 1826 hits[8] = 0;//PadHits does not exist anymore (Float_t) fNPadHits; // first padhit
a9e2aefa 1827 hits[9] = -1; // last pad hit
2eb55fab 1828 hits[10] = mom[3]; // hit momentum P
1829 hits[11] = mom[0]; // Px
1830 hits[12] = mom[1]; // Py
1831 hits[13] = mom[2]; // Pz
a9e2aefa 1832 tof=gMC->TrackTime();
2eb55fab 1833 hits[14] = tof; // Time of flight
1834 tlength = 0;
1835 eloss = 0;
1836 eloss2 = 0;
abaf7c9d 1837 Sstep=0;
2eb55fab 1838 xhit = pos[0];
1839 yhit = pos[1];
1840 zhit = pos[2];
681d067b 1841 Chamber(idvol).ChargeCorrelationInit();
a9e2aefa 1842 // Only if not trigger chamber
1e8fff9c 1843
abaf7c9d 1844// printf("---------------------------\n");
1845// printf(">>>> Y = %f \n",hits[2]);
1846// printf("---------------------------\n");
1847
1e8fff9c 1848
1849
abaf7c9d 1850 // if(idvol < AliMUONConstants::NTrackingCh()) {
1851// //
1852// // Initialize hit position (cursor) in the segmentation model
1853// ((AliMUONChamber*) (*fChambers)[idvol])
1854// ->SigGenInit(pos[0], pos[1], pos[2]);
1855// } else {
1856// //geant3->Gpcxyz();
1857// //printf("In the Trigger Chamber #%d\n",idvol-9);
1858// }
a9e2aefa 1859 }
1860 eloss2+=destep;
abaf7c9d 1861 Sstep+=step;
1862
1863 // cout<<Sstep<<endl;
1864
a9e2aefa 1865 //
1866 // Calculate the charge induced on a pad (disintegration) in case
1867 //
1868 // Mip left chamber ...
1869 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1870 gMC->SetMaxStep(kBig);
1871 eloss += destep;
1872 tlength += step;
1873
802a864d 1874 Float_t x0,y0,z0;
1875 Float_t localPos[3];
1876 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
802a864d 1877 gMC->Gmtod(globalPos,localPos,1);
1878
2eb55fab 1879 if(idvol < AliMUONConstants::NTrackingCh()) {
a9e2aefa 1880// tracking chambers
1881 x0 = 0.5*(xhit+pos[0]);
1882 y0 = 0.5*(yhit+pos[1]);
1e8fff9c 1883 z0 = 0.5*(zhit+pos[2]);
a9e2aefa 1884 } else {
1885// trigger chambers
2eb55fab 1886 x0 = xhit;
1887 y0 = yhit;
1888 z0 = 0.;
a9e2aefa 1889 }
1890
1e8fff9c 1891
ce3f5e87 1892 // if (eloss >0) MakePadHits(x0,y0,z0,eloss,tof,idvol);
a9e2aefa 1893
1894
2eb55fab 1895 hits[6] = tlength; // track length
1896 hits[7] = eloss2; // de/dx energy loss
1897
abaf7c9d 1898
ce3f5e87 1899 // if (fNPadHits > (Int_t)hits[8]) {
1900 // hits[8] = hits[8]+1;
1901 // hits[9] = 0: // PadHits does not exist anymore (Float_t) fNPadHits;
1902 //}
2eb55fab 1903//
1904// new hit
1905
a9e2aefa 1906 new(lhits[fNhits++])
5d12ce38 1907 AliMUONHit(fIshunt, gAlice->GetMCApp()->GetCurrentTrackNumber(), vol,hits);
a9e2aefa 1908 eloss = 0;
1909 //
1910 // Check additional signal generation conditions
1911 // defined by the segmentation
a75f073c 1912 // model (boundary crossing conditions)
1913 // only for tracking chambers
a9e2aefa 1914 } else if
a75f073c 1915 ((idvol < AliMUONConstants::NTrackingCh()) &&
1916 ((AliMUONChamber*) (*fChambers)[idvol])->SigGenCond(pos[0], pos[1], pos[2]))
a9e2aefa 1917 {
1918 ((AliMUONChamber*) (*fChambers)[idvol])
1919 ->SigGenInit(pos[0], pos[1], pos[2]);
802a864d 1920
1921 Float_t localPos[3];
1922 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
1923 gMC->Gmtod(globalPos,localPos,1);
1924
e0f71fb7 1925 eloss += destep;
802a864d 1926
ce3f5e87 1927 // if (eloss > 0 && idvol < AliMUONConstants::NTrackingCh())
1928 // MakePadHits(0.5*(xhit+pos[0]),0.5*(yhit+pos[1]),pos[2],eloss,tof,idvol);
a9e2aefa 1929 xhit = pos[0];
1930 yhit = pos[1];
e0f71fb7 1931 zhit = pos[2];
1932 eloss = 0;
a9e2aefa 1933 tlength += step ;
1934 //
1935 // nothing special happened, add up energy loss
1936 } else {
1937 eloss += destep;
1938 tlength += step ;
1939 }
1940}
1941
1942