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