Merging changes: Trigger, muondata and new step manager
[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();
154 dstation = 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
b74f1c6a 218 gMC->Gspos("S01B",1,"S01M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 219 idrotm[1100],"ONLY");
b74f1c6a 220 gMC->Gspos("S01B",2,"S01M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 221 idrotm[1100],"ONLY");
b74f1c6a 222 gMC->Gspos("S01B",3,"S01M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 223 idrotm[1101],"ONLY");
b74f1c6a 224 gMC->Gspos("S01B",4,"S01M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 225 idrotm[1101],"ONLY");
b74f1c6a 226 gMC->Gspos("S01B",5,"S01M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
a9e2aefa 227 idrotm[1100],"ONLY");
b74f1c6a 228 gMC->Gspos("S01B",6,"S01M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
a9e2aefa 229 idrotm[1100],"ONLY");
b74f1c6a 230 gMC->Gspos("S01B",7,"S01M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
a9e2aefa 231 idrotm[1101],"ONLY");
b74f1c6a 232 gMC->Gspos("S01B",8,"S01M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
a9e2aefa 233 idrotm[1101],"ONLY");
234
b74f1c6a 235 gMC->Gspos("S02B",1,"S02M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 236 idrotm[1100],"ONLY");
b74f1c6a 237 gMC->Gspos("S02B",2,"S02M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 238 idrotm[1100],"ONLY");
b74f1c6a 239 gMC->Gspos("S02B",3,"S02M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 240 idrotm[1101],"ONLY");
b74f1c6a 241 gMC->Gspos("S02B",4,"S02M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 242 idrotm[1101],"ONLY");
b74f1c6a 243 gMC->Gspos("S02B",5,"S02M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
a9e2aefa 244 idrotm[1100],"ONLY");
b74f1c6a 245 gMC->Gspos("S02B",6,"S02M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
a9e2aefa 246 idrotm[1100],"ONLY");
b74f1c6a 247 gMC->Gspos("S02B",7,"S02M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
a9e2aefa 248 idrotm[1101],"ONLY");
b74f1c6a 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();
312 dstation = 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
b74f1c6a 379 gMC->Gspos("S03B",1,"S03M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 380 idrotm[1100],"ONLY");
b74f1c6a 381 gMC->Gspos("S03B",2,"S03M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 382 idrotm[1100],"ONLY");
b74f1c6a 383 gMC->Gspos("S03B",3,"S03M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 384 idrotm[1101],"ONLY");
b74f1c6a 385 gMC->Gspos("S03B",4,"S03M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 386 idrotm[1101],"ONLY");
b74f1c6a 387 gMC->Gspos("S03B",5,"S03M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
a9e2aefa 388 idrotm[1100],"ONLY");
b74f1c6a 389 gMC->Gspos("S03B",6,"S03M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
a9e2aefa 390 idrotm[1100],"ONLY");
b74f1c6a 391 gMC->Gspos("S03B",7,"S03M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
a9e2aefa 392 idrotm[1101],"ONLY");
b74f1c6a 393 gMC->Gspos("S03B",8,"S03M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
a9e2aefa 394 idrotm[1101],"ONLY");
395
b74f1c6a 396 gMC->Gspos("S04B",1,"S04M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 397 idrotm[1100],"ONLY");
b74f1c6a 398 gMC->Gspos("S04B",2,"S04M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 399 idrotm[1100],"ONLY");
b74f1c6a 400 gMC->Gspos("S04B",3,"S04M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 401 idrotm[1101],"ONLY");
b74f1c6a 402 gMC->Gspos("S04B",4,"S04M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 403 idrotm[1101],"ONLY");
b74f1c6a 404 gMC->Gspos("S04B",5,"S04M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
a9e2aefa 405 idrotm[1100],"ONLY");
b74f1c6a 406 gMC->Gspos("S04B",6,"S04M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
a9e2aefa 407 idrotm[1100],"ONLY");
b74f1c6a 408 gMC->Gspos("S04B",7,"S04M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
a9e2aefa 409 idrotm[1101],"ONLY");
b74f1c6a 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();
566 dstation = zpos2 - zpos1;
567
b64652f5 568// zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
b17c0c87 569//
570// Mother volume
571 tpar[0] = iChamber->RInner()-dframep;
572 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
21a18f36 573 tpar[2] = dstation/5;
2724ae40 574
b74f1c6a 575 char *slats5Mother = "S05M";
576 char *slats6Mother = "S06M";
2724ae40 577 Float_t zoffs5 = 0;
578 Float_t zoffs6 = 0;
579
fe713e43 580 if (gAlice->GetModule("DIPO")) {
2724ae40 581 slats5Mother="DDIP";
582 slats6Mother="DDIP";
583
584 zoffs5 = zpos1;
585 zoffs6 = zpos2;
586 }
587 else {
b74f1c6a 588 gMC->Gsvolu("S05M", "TUBE", idAir, tpar, 3);
589 gMC->Gsvolu("S06M", "TUBE", idAir, tpar, 3);
590 gMC->Gspos("S05M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
591 gMC->Gspos("S06M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
2724ae40 592 }
593
b17c0c87 594 // volumes for slat geometry (xx=5,..,10 chamber id):
595 // Sxx0 Sxx1 Sxx2 Sxx3 --> Slat Mother volumes
596 // SxxG --> Sensitive volume (gas)
597 // SxxP --> PCB (copper)
598 // SxxI --> Insulator (vetronite)
599 // SxxC --> Carbon panel
600 // SxxR --> Rohacell
601 // SxxH, SxxV --> Horizontal and Vertical frames (vetronite)
21a18f36 602 // SB5x --> Volumes for the 35 cm long PCB
b17c0c87 603 // slat dimensions: slat is a MOTHER volume!!! made of air
604
21a18f36 605 // only for chamber 5: slat 1 has a PCB shorter by 5cm!
606
607 Float_t tlength = 35.;
608 Float_t panelpar2[3] = { tlength/2., panelpar[1], panelpar[2]};
609 Float_t rohapar2[3] = { tlength/2., rohapar[1], rohapar[2]};
610 Float_t insupar2[3] = { tlength/2., insupar[1], insupar[2]};
611 Float_t pcbpar2[3] = { tlength/2., pcbpar[1], pcbpar[2]};
612 Float_t senspar2[3] = { tlength/2., senspar[1], senspar[2]};
613 Float_t hFramepar2[3] = { tlength/2., hFramepar[1], hFramepar[2]};
614 Float_t bFramepar2[3] = { tlength/2., bFramepar[1], bFramepar[2]};
615
a083207d 616 const Int_t nSlats3 = 5; // number of slats per quadrant
617 const Int_t nPCB3[nSlats3] = {3,3,4,3,2}; // n PCB per slat
21a18f36 618 const Float_t xpos3[nSlats3] = {31., 40., 0., 0., 0.};
b17c0c87 619 Float_t slatLength3[nSlats3];
620
621 // create and position the slat (mother) volumes
622
6c5ddcfa 623 char volNam5[5];
624 char volNam6[5];
f9f7c205 625 Float_t xSlat3;
b17c0c87 626
21a18f36 627 Float_t spar2[3];
6c5ddcfa 628 for (i = 0; i<nSlats3; i++){
3c084d9f 629 slatLength3[i] = pcbLength * nPCB3[i] + 2. * dSlatLength;
a083207d 630 xSlat3 = slatLength3[i]/2. - vFrameLength/2. + xpos3[i];
21a18f36 631 if (i==1 || i==0) slatLength3[i] -= 2. *dSlatLength; // frame out in PCB with circular border
a083207d 632 Float_t ySlat31 = sensHeight * i - yOverlap * i;
633 Float_t ySlat32 = -sensHeight * i + yOverlap * i;
3c084d9f 634 spar[0] = slatLength3[i]/2.;
635 spar[1] = slatHeight/2.;
636 spar[2] = slatWidth/2. * 1.01;
21a18f36 637 // take away 5 cm from the first slat in chamber 5
638 Float_t xSlat32 = 0;
639 if (i==1 || i==2) { // 1 pcb is shortened by 5cm
640 spar2[0] = spar[0]-5./2.;
641 xSlat32 = xSlat3 - 5/2.;
642 }
643 else {
644 spar2[0] = spar[0];
645 xSlat32 = xSlat3;
646 }
647 spar2[1] = spar[1];
648 spar2[2] = spar[2];
3c084d9f 649 Float_t dzCh3=spar[2] * 1.01;
650 // zSlat to be checked (odd downstream or upstream?)
651 Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2];
652 sprintf(volNam5,"S05%d",i);
21a18f36 653 gMC->Gsvolu(volNam5,"BOX",slatMaterial,spar2,3);
2724ae40 654 gMC->Gspos(volNam5, i*4+1,slats5Mother, xSlat32, ySlat31, zoffs5+zSlat+2.*dzCh3, 0, "ONLY");
655 gMC->Gspos(volNam5, i*4+2,slats5Mother,-xSlat32, ySlat31, zoffs5+zSlat-2.*dzCh3, 0, "ONLY");
21a18f36 656
a083207d 657 if (i>0) {
2724ae40 658 gMC->Gspos(volNam5, i*4+3,slats5Mother, xSlat32, ySlat32, zoffs5+zSlat+2.*dzCh3, 0, "ONLY");
659 gMC->Gspos(volNam5, i*4+4,slats5Mother,-xSlat32, ySlat32, zoffs5+zSlat-2.*dzCh3, 0, "ONLY");
a083207d 660 }
3c084d9f 661 sprintf(volNam6,"S06%d",i);
662 gMC->Gsvolu(volNam6,"BOX",slatMaterial,spar,3);
2724ae40 663 gMC->Gspos(volNam6, i*4+1,slats6Mother, xSlat3, ySlat31, zoffs6+zSlat+2.*dzCh3, 0, "ONLY");
664 gMC->Gspos(volNam6, i*4+2,slats6Mother,-xSlat3, ySlat31, zoffs6+zSlat-2.*dzCh3, 0, "ONLY");
a083207d 665 if (i>0) {
2724ae40 666 gMC->Gspos(volNam6, i*4+3,slats6Mother, xSlat3, ySlat32, zoffs6+zSlat+2.*dzCh3, 0, "ONLY");
667 gMC->Gspos(volNam6, i*4+4,slats6Mother,-xSlat3, ySlat32, zoffs6+zSlat-2.*dzCh3, 0, "ONLY");
a083207d 668 }
3c084d9f 669 }
1e8fff9c 670
671 // create the panel volume
b17c0c87 672
6c5ddcfa 673 gMC->Gsvolu("S05C","BOX",panelMaterial,panelpar,3);
21a18f36 674 gMC->Gsvolu("SB5C","BOX",panelMaterial,panelpar2,3);
6c5ddcfa 675 gMC->Gsvolu("S06C","BOX",panelMaterial,panelpar,3);
1e8fff9c 676
677 // create the rohacell volume
b17c0c87 678
6c5ddcfa 679 gMC->Gsvolu("S05R","BOX",rohaMaterial,rohapar,3);
21a18f36 680 gMC->Gsvolu("SB5R","BOX",rohaMaterial,rohapar2,3);
6c5ddcfa 681 gMC->Gsvolu("S06R","BOX",rohaMaterial,rohapar,3);
1e8fff9c 682
3c084d9f 683 // create the insulating material volume
684
685 gMC->Gsvolu("S05I","BOX",insuMaterial,insupar,3);
21a18f36 686 gMC->Gsvolu("SB5I","BOX",insuMaterial,insupar2,3);
3c084d9f 687 gMC->Gsvolu("S06I","BOX",insuMaterial,insupar,3);
688
689 // create the PCB volume
690
691 gMC->Gsvolu("S05P","BOX",pcbMaterial,pcbpar,3);
21a18f36 692 gMC->Gsvolu("SB5P","BOX",pcbMaterial,pcbpar2,3);
3c084d9f 693 gMC->Gsvolu("S06P","BOX",pcbMaterial,pcbpar,3);
694
695 // create the sensitive volumes,
3f08857e 696 gMC->Gsvolu("S05G","BOX",sensMaterial,dum,0);
697 gMC->Gsvolu("S06G","BOX",sensMaterial,dum,0);
3c084d9f 698
699
1e8fff9c 700 // create the vertical frame volume
b17c0c87 701
6c5ddcfa 702 gMC->Gsvolu("S05V","BOX",vFrameMaterial,vFramepar,3);
703 gMC->Gsvolu("S06V","BOX",vFrameMaterial,vFramepar,3);
1e8fff9c 704
705 // create the horizontal frame volume
b17c0c87 706
6c5ddcfa 707 gMC->Gsvolu("S05H","BOX",hFrameMaterial,hFramepar,3);
21a18f36 708 gMC->Gsvolu("SB5H","BOX",hFrameMaterial,hFramepar2,3);
6c5ddcfa 709 gMC->Gsvolu("S06H","BOX",hFrameMaterial,hFramepar,3);
1e8fff9c 710
711 // create the horizontal border volume
b17c0c87 712
6c5ddcfa 713 gMC->Gsvolu("S05B","BOX",bFrameMaterial,bFramepar,3);
21a18f36 714 gMC->Gsvolu("SB5B","BOX",bFrameMaterial,bFramepar2,3);
6c5ddcfa 715 gMC->Gsvolu("S06B","BOX",bFrameMaterial,bFramepar,3);
1e8fff9c 716
b17c0c87 717 index=0;
6c5ddcfa 718 for (i = 0; i<nSlats3; i++){
719 sprintf(volNam5,"S05%d",i);
720 sprintf(volNam6,"S06%d",i);
f9f7c205 721 Float_t xvFrame = (slatLength3[i] - vFrameLength)/2.;
21a18f36 722 Float_t xvFrame2 = xvFrame;
723 if ( i==1 || i ==2 ) xvFrame2 -= 5./2.;
3c084d9f 724 // position the vertical frames
21a18f36 725 if (i!=1 && i!=0) {
726 gMC->Gspos("S05V",2*i-1,volNam5, xvFrame2, 0., 0. , 0, "ONLY");
727 gMC->Gspos("S05V",2*i ,volNam5,-xvFrame2, 0., 0. , 0, "ONLY");
3c084d9f 728 gMC->Gspos("S06V",2*i-1,volNam6, xvFrame, 0., 0. , 0, "ONLY");
729 gMC->Gspos("S06V",2*i ,volNam6,-xvFrame, 0., 0. , 0, "ONLY");
730 }
731 // position the panels and the insulating material
6c5ddcfa 732 for (j=0; j<nPCB3[i]; j++){
1e8fff9c 733 index++;
6c5ddcfa 734 Float_t xx = sensLength * (-nPCB3[i]/2.+j+.5);
21a18f36 735 Float_t xx2 = xx + 5/2.;
3c084d9f 736
737 Float_t zPanel = spar[2] - panelpar[2];
21a18f36 738 if ( (i==1 || i==2) && j == nPCB3[i]-1) { // 1 pcb is shortened by 5cm
739 gMC->Gspos("SB5C",2*index-1,volNam5, xx, 0., zPanel , 0, "ONLY");
740 gMC->Gspos("SB5C",2*index ,volNam5, xx, 0.,-zPanel , 0, "ONLY");
741 gMC->Gspos("SB5I",index ,volNam5, xx, 0., 0 , 0, "ONLY");
742 }
743 else if ( (i==1 || i==2) && j < nPCB3[i]-1) {
744 gMC->Gspos("S05C",2*index-1,volNam5, xx2, 0., zPanel , 0, "ONLY");
745 gMC->Gspos("S05C",2*index ,volNam5, xx2, 0.,-zPanel , 0, "ONLY");
746 gMC->Gspos("S05I",index ,volNam5, xx2, 0., 0 , 0, "ONLY");
747 }
748 else {
749 gMC->Gspos("S05C",2*index-1,volNam5, xx, 0., zPanel , 0, "ONLY");
750 gMC->Gspos("S05C",2*index ,volNam5, xx, 0.,-zPanel , 0, "ONLY");
751 gMC->Gspos("S05I",index ,volNam5, xx, 0., 0 , 0, "ONLY");
752 }
3c084d9f 753 gMC->Gspos("S06C",2*index-1,volNam6, xx, 0., zPanel , 0, "ONLY");
754 gMC->Gspos("S06C",2*index ,volNam6, xx, 0.,-zPanel , 0, "ONLY");
3c084d9f 755 gMC->Gspos("S06I",index,volNam6, xx, 0., 0 , 0, "ONLY");
1e8fff9c 756 }
a9e2aefa 757 }
21a18f36 758
3c084d9f 759 // position the rohacell volume inside the panel volume
760 gMC->Gspos("S05R",1,"S05C",0.,0.,0.,0,"ONLY");
21a18f36 761 gMC->Gspos("SB5R",1,"SB5C",0.,0.,0.,0,"ONLY");
3c084d9f 762 gMC->Gspos("S06R",1,"S06C",0.,0.,0.,0,"ONLY");
763
764 // position the PCB volume inside the insulating material volume
765 gMC->Gspos("S05P",1,"S05I",0.,0.,0.,0,"ONLY");
21a18f36 766 gMC->Gspos("SB5P",1,"SB5I",0.,0.,0.,0,"ONLY");
3c084d9f 767 gMC->Gspos("S06P",1,"S06I",0.,0.,0.,0,"ONLY");
768 // position the horizontal frame volume inside the PCB volume
769 gMC->Gspos("S05H",1,"S05P",0.,0.,0.,0,"ONLY");
21a18f36 770 gMC->Gspos("SB5H",1,"SB5P",0.,0.,0.,0,"ONLY");
3c084d9f 771 gMC->Gspos("S06H",1,"S06P",0.,0.,0.,0,"ONLY");
772 // position the sensitive volume inside the horizontal frame volume
773 gMC->Gsposp("S05G",1,"S05H",0.,0.,0.,0,"ONLY",senspar,3);
21a18f36 774 gMC->Gsposp("S05G",1,"SB5H",0.,0.,0.,0,"ONLY",senspar2,3);
3c084d9f 775 gMC->Gsposp("S06G",1,"S06H",0.,0.,0.,0,"ONLY",senspar,3);
776 // position the border volumes inside the PCB volume
777 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
778 gMC->Gspos("S05B",1,"S05P",0., yborder,0.,0,"ONLY");
779 gMC->Gspos("S05B",2,"S05P",0.,-yborder,0.,0,"ONLY");
21a18f36 780 gMC->Gspos("SB5B",1,"SB5P",0., yborder,0.,0,"ONLY");
781 gMC->Gspos("SB5B",2,"SB5P",0.,-yborder,0.,0,"ONLY");
3c084d9f 782 gMC->Gspos("S06B",1,"S06P",0., yborder,0.,0,"ONLY");
783 gMC->Gspos("S06B",2,"S06P",0.,-yborder,0.,0,"ONLY");
784
1e8fff9c 785 // create the NULOC volume and position it in the horizontal frame
b17c0c87 786
6c5ddcfa 787 gMC->Gsvolu("S05N","BOX",nulocMaterial,nulocpar,3);
788 gMC->Gsvolu("S06N","BOX",nulocMaterial,nulocpar,3);
6c5ddcfa 789 index = 0;
21a18f36 790 Float_t xxmax2 = xxmax - 5./2.;
791 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
1e8fff9c 792 index++;
6c5ddcfa 793 gMC->Gspos("S05N",2*index-1,"S05B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
794 gMC->Gspos("S05N",2*index ,"S05B", xx, 0., bFrameWidth/4., 0, "ONLY");
21a18f36 795 if (xx > -xxmax2 && xx< xxmax2) {
796 gMC->Gspos("S05N",2*index-1,"SB5B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
797 gMC->Gspos("S05N",2*index ,"SB5B", xx, 0., bFrameWidth/4., 0, "ONLY");
798 }
6c5ddcfa 799 gMC->Gspos("S06N",2*index-1,"S06B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
800 gMC->Gspos("S06N",2*index ,"S06B", xx, 0., bFrameWidth/4., 0, "ONLY");
1e8fff9c 801 }
3c084d9f 802
803 // position the volumes approximating the circular section of the pipe
a083207d 804 Float_t yoffs = sensHeight/2. - yOverlap;
3c084d9f 805 Float_t epsilon = 0.001;
806 Int_t ndiv=6;
807 Float_t divpar[3];
808 Double_t dydiv= sensHeight/ndiv;
21a18f36 809 Double_t ydiv = yoffs -dydiv;
3c084d9f 810 Int_t imax=0;
3c084d9f 811 imax = 1;
21a18f36 812 Float_t rmin = 33.;
a083207d 813 Float_t z1 = spar[2], z2=2*spar[2]*1.01;
3c084d9f 814 for (Int_t idiv=0;idiv<ndiv; idiv++){
815 ydiv+= dydiv;
425ebd0a 816 Float_t xdiv = 0.;
3c084d9f 817 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
818 divpar[0] = (pcbLength-xdiv)/2.;
819 divpar[1] = dydiv/2. - epsilon;
820 divpar[2] = sensWidth/2.;
425ebd0a 821 Float_t xvol=(pcbLength+xdiv)/2.+1.999;
a083207d 822 Float_t yvol=ydiv + dydiv/2.;
21a18f36 823 //printf ("y ll = %f y ur = %f \n",yvol - divpar[1], yvol + divpar[1]);
2724ae40 824 gMC->Gsposp("S05G",imax+4*idiv+1,slats5Mother, xvol, yvol, zoffs5+z1+z2, 0, "ONLY",divpar,3);
825 gMC->Gsposp("S06G",imax+4*idiv+1,slats6Mother, xvol, yvol, zoffs6+z1+z2, 0, "ONLY",divpar,3);
826 gMC->Gsposp("S05G",imax+4*idiv+2,slats5Mother, xvol,-yvol, zoffs5+z1+z2, 0, "ONLY",divpar,3);
827 gMC->Gsposp("S06G",imax+4*idiv+2,slats6Mother, xvol,-yvol, zoffs6+z1+z2, 0, "ONLY",divpar,3);
828 gMC->Gsposp("S05G",imax+4*idiv+3,slats5Mother,-xvol, yvol, zoffs5+z1-z2, 0, "ONLY",divpar,3);
829 gMC->Gsposp("S06G",imax+4*idiv+3,slats6Mother,-xvol, yvol, zoffs6+z1-z2, 0, "ONLY",divpar,3);
830 gMC->Gsposp("S05G",imax+4*idiv+4,slats5Mother,-xvol,-yvol, zoffs5+z1-z2, 0, "ONLY",divpar,3);
831 gMC->Gsposp("S06G",imax+4*idiv+4,slats6Mother,-xvol,-yvol, zoffs6+z1-z2, 0, "ONLY",divpar,3);
3c084d9f 832 }
b17c0c87 833 }
b17c0c87 834
ba030c0e 835 if (fStations[3]) {
3c084d9f 836
a9e2aefa 837//********************************************************************
838// Station 4 **
839//********************************************************************
840 // indices 1 and 2 for first and second chambers in the station
841 // iChamber (first chamber) kept for other quanties than Z,
842 // assumed to be the same in both chambers
843 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[6];
844 iChamber2 =(AliMUONChamber*) (*fChambers)[7];
845 zpos1=iChamber1->Z();
846 zpos2=iChamber2->Z();
847 dstation = zpos2 - zpos1;
b64652f5 848// zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
a9e2aefa 849
850//
851// Mother volume
852 tpar[0] = iChamber->RInner()-dframep;
853 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
2724ae40 854 tpar[2] = dstation/4;
a9e2aefa 855
b74f1c6a 856 gMC->Gsvolu("S07M", "TUBE", idAir, tpar, 3);
857 gMC->Gsvolu("S08M", "TUBE", idAir, tpar, 3);
858 gMC->Gspos("S07M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
859 gMC->Gspos("S08M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
1e8fff9c 860
a9e2aefa 861
f9f7c205 862 const Int_t nSlats4 = 6; // number of slats per quadrant
425ebd0a 863 const Int_t nPCB4[nSlats4] = {4,4,5,5,4,3}; // n PCB per slat
21a18f36 864 const Float_t xpos4[nSlats4] = {38.5, 40., 0., 0., 0., 0.};
6c5ddcfa 865 Float_t slatLength4[nSlats4];
1e8fff9c 866
867 // create and position the slat (mother) volumes
868
6c5ddcfa 869 char volNam7[5];
870 char volNam8[5];
1e8fff9c 871 Float_t xSlat4;
f9f7c205 872 Float_t ySlat4;
1e8fff9c 873
6c5ddcfa 874 for (i = 0; i<nSlats4; i++){
a083207d 875 slatLength4[i] = pcbLength * nPCB4[i] + 2. * dSlatLength;
876 xSlat4 = slatLength4[i]/2. - vFrameLength/2. + xpos4[i];
2724ae40 877 if (i==1) slatLength4[i] -= 2. *dSlatLength; // frame out in PCB with circular border
a083207d 878 ySlat4 = sensHeight * i - yOverlap *i;
879
880 spar[0] = slatLength4[i]/2.;
881 spar[1] = slatHeight/2.;
882 spar[2] = slatWidth/2.*1.01;
883 Float_t dzCh4=spar[2]*1.01;
884 // zSlat to be checked (odd downstream or upstream?)
885 Float_t zSlat = (i%2 ==0)? spar[2] : -spar[2];
886 sprintf(volNam7,"S07%d",i);
887 gMC->Gsvolu(volNam7,"BOX",slatMaterial,spar,3);
b74f1c6a 888 gMC->Gspos(volNam7, i*4+1,"S07M", xSlat4, ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
889 gMC->Gspos(volNam7, i*4+2,"S07M",-xSlat4, ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
a083207d 890 if (i>0) {
b74f1c6a 891 gMC->Gspos(volNam7, i*4+3,"S07M", xSlat4,-ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
892 gMC->Gspos(volNam7, i*4+4,"S07M",-xSlat4,-ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
a083207d 893 }
894 sprintf(volNam8,"S08%d",i);
895 gMC->Gsvolu(volNam8,"BOX",slatMaterial,spar,3);
b74f1c6a 896 gMC->Gspos(volNam8, i*4+1,"S08M", xSlat4, ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
897 gMC->Gspos(volNam8, i*4+2,"S08M",-xSlat4, ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
a083207d 898 if (i>0) {
b74f1c6a 899 gMC->Gspos(volNam8, i*4+3,"S08M", xSlat4,-ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
900 gMC->Gspos(volNam8, i*4+4,"S08M",-xSlat4,-ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
a083207d 901 }
a9e2aefa 902 }
a083207d 903
3c084d9f 904
905 // create the panel volume
1e8fff9c 906
3c084d9f 907 gMC->Gsvolu("S07C","BOX",panelMaterial,panelpar,3);
908 gMC->Gsvolu("S08C","BOX",panelMaterial,panelpar,3);
a9e2aefa 909
3c084d9f 910 // create the rohacell volume
911
912 gMC->Gsvolu("S07R","BOX",rohaMaterial,rohapar,3);
913 gMC->Gsvolu("S08R","BOX",rohaMaterial,rohapar,3);
1e8fff9c 914
1e8fff9c 915 // create the insulating material volume
916
6c5ddcfa 917 gMC->Gsvolu("S07I","BOX",insuMaterial,insupar,3);
918 gMC->Gsvolu("S08I","BOX",insuMaterial,insupar,3);
1e8fff9c 919
3c084d9f 920 // create the PCB volume
1e8fff9c 921
3c084d9f 922 gMC->Gsvolu("S07P","BOX",pcbMaterial,pcbpar,3);
923 gMC->Gsvolu("S08P","BOX",pcbMaterial,pcbpar,3);
1e8fff9c 924
3c084d9f 925 // create the sensitive volumes,
926
3f08857e 927 gMC->Gsvolu("S07G","BOX",sensMaterial,dum,0);
928 gMC->Gsvolu("S08G","BOX",sensMaterial,dum,0);
1e8fff9c 929
930 // create the vertical frame volume
931
6c5ddcfa 932 gMC->Gsvolu("S07V","BOX",vFrameMaterial,vFramepar,3);
933 gMC->Gsvolu("S08V","BOX",vFrameMaterial,vFramepar,3);
1e8fff9c 934
935 // create the horizontal frame volume
936
6c5ddcfa 937 gMC->Gsvolu("S07H","BOX",hFrameMaterial,hFramepar,3);
938 gMC->Gsvolu("S08H","BOX",hFrameMaterial,hFramepar,3);
1e8fff9c 939
940 // create the horizontal border volume
941
6c5ddcfa 942 gMC->Gsvolu("S07B","BOX",bFrameMaterial,bFramepar,3);
943 gMC->Gsvolu("S08B","BOX",bFrameMaterial,bFramepar,3);
3c084d9f 944
945 index=0;
6c5ddcfa 946 for (i = 0; i<nSlats4; i++){
947 sprintf(volNam7,"S07%d",i);
948 sprintf(volNam8,"S08%d",i);
949 Float_t xvFrame = (slatLength4[i] - vFrameLength)/2.;
3c084d9f 950 // position the vertical frames
21a18f36 951 if (i!=1 && i!=0) {
a083207d 952 gMC->Gspos("S07V",2*i-1,volNam7, xvFrame, 0., 0. , 0, "ONLY");
953 gMC->Gspos("S07V",2*i ,volNam7,-xvFrame, 0., 0. , 0, "ONLY");
954 gMC->Gspos("S08V",2*i-1,volNam8, xvFrame, 0., 0. , 0, "ONLY");
955 gMC->Gspos("S08V",2*i ,volNam8,-xvFrame, 0., 0. , 0, "ONLY");
956 }
3c084d9f 957 // position the panels and the insulating material
6c5ddcfa 958 for (j=0; j<nPCB4[i]; j++){
1e8fff9c 959 index++;
6c5ddcfa 960 Float_t xx = sensLength * (-nPCB4[i]/2.+j+.5);
3c084d9f 961
962 Float_t zPanel = spar[2] - panelpar[2];
963 gMC->Gspos("S07C",2*index-1,volNam7, xx, 0., zPanel , 0, "ONLY");
964 gMC->Gspos("S07C",2*index ,volNam7, xx, 0.,-zPanel , 0, "ONLY");
965 gMC->Gspos("S08C",2*index-1,volNam8, xx, 0., zPanel , 0, "ONLY");
966 gMC->Gspos("S08C",2*index ,volNam8, xx, 0.,-zPanel , 0, "ONLY");
967
968 gMC->Gspos("S07I",index,volNam7, xx, 0., 0 , 0, "ONLY");
969 gMC->Gspos("S08I",index,volNam8, xx, 0., 0 , 0, "ONLY");
1e8fff9c 970 }
a9e2aefa 971 }
1e8fff9c 972
3c084d9f 973 // position the rohacell volume inside the panel volume
974 gMC->Gspos("S07R",1,"S07C",0.,0.,0.,0,"ONLY");
975 gMC->Gspos("S08R",1,"S08C",0.,0.,0.,0,"ONLY");
976
977 // position the PCB volume inside the insulating material volume
978 gMC->Gspos("S07P",1,"S07I",0.,0.,0.,0,"ONLY");
979 gMC->Gspos("S08P",1,"S08I",0.,0.,0.,0,"ONLY");
980 // position the horizontal frame volume inside the PCB volume
981 gMC->Gspos("S07H",1,"S07P",0.,0.,0.,0,"ONLY");
982 gMC->Gspos("S08H",1,"S08P",0.,0.,0.,0,"ONLY");
983 // position the sensitive volume inside the horizontal frame volume
984 gMC->Gsposp("S07G",1,"S07H",0.,0.,0.,0,"ONLY",senspar,3);
985 gMC->Gsposp("S08G",1,"S08H",0.,0.,0.,0,"ONLY",senspar,3);
3c084d9f 986 // position the border volumes inside the PCB volume
987 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
988 gMC->Gspos("S07B",1,"S07P",0., yborder,0.,0,"ONLY");
989 gMC->Gspos("S07B",2,"S07P",0.,-yborder,0.,0,"ONLY");
990 gMC->Gspos("S08B",1,"S08P",0., yborder,0.,0,"ONLY");
991 gMC->Gspos("S08B",2,"S08P",0.,-yborder,0.,0,"ONLY");
992
1e8fff9c 993 // create the NULOC volume and position it in the horizontal frame
3c084d9f 994
6c5ddcfa 995 gMC->Gsvolu("S07N","BOX",nulocMaterial,nulocpar,3);
996 gMC->Gsvolu("S08N","BOX",nulocMaterial,nulocpar,3);
3c084d9f 997 index = 0;
21a18f36 998 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
1e8fff9c 999 index++;
6c5ddcfa 1000 gMC->Gspos("S07N",2*index-1,"S07B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1001 gMC->Gspos("S07N",2*index ,"S07B", xx, 0., bFrameWidth/4., 0, "ONLY");
1002 gMC->Gspos("S08N",2*index-1,"S08B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1003 gMC->Gspos("S08N",2*index ,"S08B", xx, 0., bFrameWidth/4., 0, "ONLY");
1e8fff9c 1004 }
a083207d 1005
1006 // position the volumes approximating the circular section of the pipe
21a18f36 1007 Float_t yoffs = sensHeight/2. - yOverlap;
a083207d 1008 Float_t epsilon = 0.001;
1009 Int_t ndiv=6;
1010 Float_t divpar[3];
1011 Double_t dydiv= sensHeight/ndiv;
21a18f36 1012 Double_t ydiv = yoffs -dydiv;
a083207d 1013 Int_t imax=0;
a083207d 1014 imax = 1;
1015 Float_t rmin = 40.;
1016 Float_t z1 = -spar[2], z2=2*spar[2]*1.01;
1017 for (Int_t idiv=0;idiv<ndiv; idiv++){
1018 ydiv+= dydiv;
425ebd0a 1019 Float_t xdiv = 0.;
a083207d 1020 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
1021 divpar[0] = (pcbLength-xdiv)/2.;
1022 divpar[1] = dydiv/2. - epsilon;
1023 divpar[2] = sensWidth/2.;
425ebd0a 1024 Float_t xvol=(pcbLength+xdiv)/2.+1.999;
a083207d 1025 Float_t yvol=ydiv + dydiv/2.;
b74f1c6a 1026 gMC->Gsposp("S07G",imax+4*idiv+1,"S07M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1027 gMC->Gsposp("S08G",imax+4*idiv+1,"S08M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1028 gMC->Gsposp("S07G",imax+4*idiv+2,"S07M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1029 gMC->Gsposp("S08G",imax+4*idiv+2,"S08M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1030 gMC->Gsposp("S07G",imax+4*idiv+3,"S07M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1031 gMC->Gsposp("S08G",imax+4*idiv+3,"S08M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1032 gMC->Gsposp("S07G",imax+4*idiv+4,"S07M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
1033 gMC->Gsposp("S08G",imax+4*idiv+4,"S08M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
a083207d 1034 }
1035
1036
1037
1038
1039
b17c0c87 1040 }
3c084d9f 1041
ba030c0e 1042 if (fStations[4]) {
b17c0c87 1043
1e8fff9c 1044
a9e2aefa 1045//********************************************************************
1046// Station 5 **
1047//********************************************************************
1048 // indices 1 and 2 for first and second chambers in the station
1049 // iChamber (first chamber) kept for other quanties than Z,
1050 // assumed to be the same in both chambers
1051 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[8];
1052 iChamber2 =(AliMUONChamber*) (*fChambers)[9];
1053 zpos1=iChamber1->Z();
1054 zpos2=iChamber2->Z();
1055 dstation = zpos2 - zpos1;
b64652f5 1056// zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
3c084d9f 1057
a9e2aefa 1058//
1059// Mother volume
1060 tpar[0] = iChamber->RInner()-dframep;
1061 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
3c084d9f 1062 tpar[2] = dstation/5.;
a9e2aefa 1063
b74f1c6a 1064 gMC->Gsvolu("S09M", "TUBE", idAir, tpar, 3);
1065 gMC->Gsvolu("S10M", "TUBE", idAir, tpar, 3);
1066 gMC->Gspos("S09M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
1067 gMC->Gspos("S10M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
a9e2aefa 1068
a9e2aefa 1069
1e8fff9c 1070 const Int_t nSlats5 = 7; // number of slats per quadrant
a083207d 1071 const Int_t nPCB5[nSlats5] = {5,5,6,6,5,4,3}; // n PCB per slat
21a18f36 1072 const Float_t xpos5[nSlats5] = {38.5, 40., 0., 0., 0., 0., 0.};
6c5ddcfa 1073 Float_t slatLength5[nSlats5];
6c5ddcfa 1074 char volNam9[5];
1075 char volNam10[5];
f9f7c205 1076 Float_t xSlat5;
1077 Float_t ySlat5;
1e8fff9c 1078
6c5ddcfa 1079 for (i = 0; i<nSlats5; i++){
1080 slatLength5[i] = pcbLength * nPCB5[i] + 2. * dSlatLength;
a083207d 1081 xSlat5 = slatLength5[i]/2. - vFrameLength/2. +xpos5[i];
21a18f36 1082 if (i==1 || i==0) slatLength5[i] -= 2. *dSlatLength; // frame out in PCB with circular border
f9f7c205 1083 ySlat5 = sensHeight * i - yOverlap * i;
6c5ddcfa 1084 spar[0] = slatLength5[i]/2.;
1085 spar[1] = slatHeight/2.;
3c084d9f 1086 spar[2] = slatWidth/2. * 1.01;
1087 Float_t dzCh5=spar[2]*1.01;
1e8fff9c 1088 // zSlat to be checked (odd downstream or upstream?)
3c084d9f 1089 Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2];
6c5ddcfa 1090 sprintf(volNam9,"S09%d",i);
1091 gMC->Gsvolu(volNam9,"BOX",slatMaterial,spar,3);
b74f1c6a 1092 gMC->Gspos(volNam9, i*4+1,"S09M", xSlat5, ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1093 gMC->Gspos(volNam9, i*4+2,"S09M",-xSlat5, ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
f9f7c205 1094 if (i>0) {
b74f1c6a 1095 gMC->Gspos(volNam9, i*4+3,"S09M", xSlat5,-ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1096 gMC->Gspos(volNam9, i*4+4,"S09M",-xSlat5,-ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
f9f7c205 1097 }
6c5ddcfa 1098 sprintf(volNam10,"S10%d",i);
1099 gMC->Gsvolu(volNam10,"BOX",slatMaterial,spar,3);
b74f1c6a 1100 gMC->Gspos(volNam10, i*4+1,"S10M", xSlat5, ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1101 gMC->Gspos(volNam10, i*4+2,"S10M",-xSlat5, ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
f9f7c205 1102 if (i>0) {
b74f1c6a 1103 gMC->Gspos(volNam10, i*4+3,"S10M", xSlat5,-ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1104 gMC->Gspos(volNam10, i*4+4,"S10M",-xSlat5,-ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
f9f7c205 1105 }
a9e2aefa 1106 }
1107
1e8fff9c 1108 // create the panel volume
3c084d9f 1109
6c5ddcfa 1110 gMC->Gsvolu("S09C","BOX",panelMaterial,panelpar,3);
1111 gMC->Gsvolu("S10C","BOX",panelMaterial,panelpar,3);
3c084d9f 1112
1e8fff9c 1113 // create the rohacell volume
3c084d9f 1114
6c5ddcfa 1115 gMC->Gsvolu("S09R","BOX",rohaMaterial,rohapar,3);
1116 gMC->Gsvolu("S10R","BOX",rohaMaterial,rohapar,3);
3c084d9f 1117
1118 // create the insulating material volume
1119
1120 gMC->Gsvolu("S09I","BOX",insuMaterial,insupar,3);
1121 gMC->Gsvolu("S10I","BOX",insuMaterial,insupar,3);
1122
1123 // create the PCB volume
1124
1125 gMC->Gsvolu("S09P","BOX",pcbMaterial,pcbpar,3);
1126 gMC->Gsvolu("S10P","BOX",pcbMaterial,pcbpar,3);
1127
1128 // create the sensitive volumes,
1129
3f08857e 1130 gMC->Gsvolu("S09G","BOX",sensMaterial,dum,0);
1131 gMC->Gsvolu("S10G","BOX",sensMaterial,dum,0);
3c084d9f 1132
1e8fff9c 1133 // create the vertical frame volume
3c084d9f 1134
6c5ddcfa 1135 gMC->Gsvolu("S09V","BOX",vFrameMaterial,vFramepar,3);
1136 gMC->Gsvolu("S10V","BOX",vFrameMaterial,vFramepar,3);
1e8fff9c 1137
1138 // create the horizontal frame volume
3c084d9f 1139
6c5ddcfa 1140 gMC->Gsvolu("S09H","BOX",hFrameMaterial,hFramepar,3);
1141 gMC->Gsvolu("S10H","BOX",hFrameMaterial,hFramepar,3);
1e8fff9c 1142
1143 // create the horizontal border volume
1144
6c5ddcfa 1145 gMC->Gsvolu("S09B","BOX",bFrameMaterial,bFramepar,3);
1146 gMC->Gsvolu("S10B","BOX",bFrameMaterial,bFramepar,3);
1e8fff9c 1147
3c084d9f 1148 index=0;
6c5ddcfa 1149 for (i = 0; i<nSlats5; i++){
1150 sprintf(volNam9,"S09%d",i);
1151 sprintf(volNam10,"S10%d",i);
1152 Float_t xvFrame = (slatLength5[i] - vFrameLength)/2.;
3c084d9f 1153 // position the vertical frames
21a18f36 1154 if (i!=1 && i!=0) {
a083207d 1155 gMC->Gspos("S09V",2*i-1,volNam9, xvFrame, 0., 0. , 0, "ONLY");
1156 gMC->Gspos("S09V",2*i ,volNam9,-xvFrame, 0., 0. , 0, "ONLY");
1157 gMC->Gspos("S10V",2*i-1,volNam10, xvFrame, 0., 0. , 0, "ONLY");
1158 gMC->Gspos("S10V",2*i ,volNam10,-xvFrame, 0., 0. , 0, "ONLY");
1159 }
3c084d9f 1160
1161 // position the panels and the insulating material
6c5ddcfa 1162 for (j=0; j<nPCB5[i]; j++){
1e8fff9c 1163 index++;
3c084d9f 1164 Float_t xx = sensLength * (-nPCB5[i]/2.+j+.5);
1165
1166 Float_t zPanel = spar[2] - panelpar[2];
1167 gMC->Gspos("S09C",2*index-1,volNam9, xx, 0., zPanel , 0, "ONLY");
1168 gMC->Gspos("S09C",2*index ,volNam9, xx, 0.,-zPanel , 0, "ONLY");
1169 gMC->Gspos("S10C",2*index-1,volNam10, xx, 0., zPanel , 0, "ONLY");
1170 gMC->Gspos("S10C",2*index ,volNam10, xx, 0.,-zPanel , 0, "ONLY");
1171
1172 gMC->Gspos("S09I",index,volNam9, xx, 0., 0 , 0, "ONLY");
1173 gMC->Gspos("S10I",index,volNam10, xx, 0., 0 , 0, "ONLY");
1e8fff9c 1174 }
1175 }
1176
3c084d9f 1177 // position the rohacell volume inside the panel volume
1178 gMC->Gspos("S09R",1,"S09C",0.,0.,0.,0,"ONLY");
1179 gMC->Gspos("S10R",1,"S10C",0.,0.,0.,0,"ONLY");
1180
1181 // position the PCB volume inside the insulating material volume
1182 gMC->Gspos("S09P",1,"S09I",0.,0.,0.,0,"ONLY");
1183 gMC->Gspos("S10P",1,"S10I",0.,0.,0.,0,"ONLY");
1184 // position the horizontal frame volume inside the PCB volume
1185 gMC->Gspos("S09H",1,"S09P",0.,0.,0.,0,"ONLY");
1186 gMC->Gspos("S10H",1,"S10P",0.,0.,0.,0,"ONLY");
1187 // position the sensitive volume inside the horizontal frame volume
1188 gMC->Gsposp("S09G",1,"S09H",0.,0.,0.,0,"ONLY",senspar,3);
1189 gMC->Gsposp("S10G",1,"S10H",0.,0.,0.,0,"ONLY",senspar,3);
3c084d9f 1190 // position the border volumes inside the PCB volume
1191 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
1192 gMC->Gspos("S09B",1,"S09P",0., yborder,0.,0,"ONLY");
1193 gMC->Gspos("S09B",2,"S09P",0.,-yborder,0.,0,"ONLY");
1194 gMC->Gspos("S10B",1,"S10P",0., yborder,0.,0,"ONLY");
1195 gMC->Gspos("S10B",2,"S10P",0.,-yborder,0.,0,"ONLY");
1196
1e8fff9c 1197 // create the NULOC volume and position it in the horizontal frame
3c084d9f 1198
6c5ddcfa 1199 gMC->Gsvolu("S09N","BOX",nulocMaterial,nulocpar,3);
1200 gMC->Gsvolu("S10N","BOX",nulocMaterial,nulocpar,3);
3c084d9f 1201 index = 0;
21a18f36 1202 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
1e8fff9c 1203 index++;
6c5ddcfa 1204 gMC->Gspos("S09N",2*index-1,"S09B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1205 gMC->Gspos("S09N",2*index ,"S09B", xx, 0., bFrameWidth/4., 0, "ONLY");
1206 gMC->Gspos("S10N",2*index-1,"S10B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1207 gMC->Gspos("S10N",2*index ,"S10B", xx, 0., bFrameWidth/4., 0, "ONLY");
a9e2aefa 1208 }
a083207d 1209 // position the volumes approximating the circular section of the pipe
21a18f36 1210 Float_t yoffs = sensHeight/2. - yOverlap;
a083207d 1211 Float_t epsilon = 0.001;
1212 Int_t ndiv=6;
1213 Float_t divpar[3];
1214 Double_t dydiv= sensHeight/ndiv;
21a18f36 1215 Double_t ydiv = yoffs -dydiv;
a083207d 1216 Int_t imax=0;
1217 // for (Int_t islat=0; islat<nSlats3; islat++) imax += nPCB3[islat];
1218 imax = 1;
1219 Float_t rmin = 40.;
1220 Float_t z1 = spar[2], z2=2*spar[2]*1.01;
1221 for (Int_t idiv=0;idiv<ndiv; idiv++){
1222 ydiv+= dydiv;
425ebd0a 1223 Float_t xdiv = 0.;
a083207d 1224 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
1225 divpar[0] = (pcbLength-xdiv)/2.;
1226 divpar[1] = dydiv/2. - epsilon;
1227 divpar[2] = sensWidth/2.;
425ebd0a 1228 Float_t xvol=(pcbLength+xdiv)/2. + 1.999;
a083207d 1229 Float_t yvol=ydiv + dydiv/2.;
b74f1c6a 1230 gMC->Gsposp("S09G",imax+4*idiv+1,"S09M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1231 gMC->Gsposp("S10G",imax+4*idiv+1,"S10M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1232 gMC->Gsposp("S09G",imax+4*idiv+2,"S09M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1233 gMC->Gsposp("S10G",imax+4*idiv+2,"S10M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1234 gMC->Gsposp("S09G",imax+4*idiv+3,"S09M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1235 gMC->Gsposp("S10G",imax+4*idiv+3,"S10M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1236 gMC->Gsposp("S09G",imax+4*idiv+4,"S09M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
1237 gMC->Gsposp("S10G",imax+4*idiv+4,"S10M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
a083207d 1238 }
1239
b17c0c87 1240 }
1241
1e8fff9c 1242
7e33ffcb 1243//********************************************************************
1244// Trigger **
1245//********************************************************************
7e33ffcb 1246 /*
1247 zpos1 and zpos2 are the middle of the first and second
1248 planes of station 1 (+1m for second station):
1249 zpos1=(zpos1m+zpos1p)/2=(15999+16071)/2=16035 mm, thick/2=40 mm
1250 zpos2=(zpos2m+zpos2p)/2=(16169+16241)/2=16205 mm, thick/2=40 mm
1251 zposxm and zposxp= middles of gaz gaps within a detection plane
1252 rem: the total thickness accounts for 1 mm of al on both
1253 side of the RPCs (see zpos1 and zpos2)
1254 */
1255
1256// vertical gap between right and left chambers (kDXZERO*2=4cm)
1257 const Float_t kDXZERO=2.;
1258// main distances for chamber definition in first plane/first station
1259 const Float_t kXMIN=34.;
1260 const Float_t kXMED=51.;
1261 const Float_t kXMAX=272.;
1262// kXMAX will become 255. in real life. segmentation to be updated accordingly
1263// (see fig.2-4 & 2-5 of Local Trigger Board PRR)
1264 const Float_t kYMIN=34.;
1265 const Float_t kYMAX=51.;
1266// inner/outer radius of flange between beam shield. and chambers (1/station)
1267 const Float_t kRMIN[2]={50.,50.};
1268 const Float_t kRMAX[2]={64.,68.};
1269// z position of the middle of the gas gap in mother vol
1270 const Float_t kZm=-3.6;
1271 const Float_t kZp=+3.6;
a9e2aefa 1272
7e33ffcb 1273 iChamber1 = (AliMUONChamber*) (*fChambers)[10];
1274 zpos1 = iChamber1->Z();
a9e2aefa 1275
7e33ffcb 1276// ratio of zpos1m/zpos1p and inverse for first plane
1277 Float_t zmp=(zpos1-3.6)/(zpos1+3.6);
1278 Float_t zpm=1./zmp;
a9e2aefa 1279
7e33ffcb 1280 Int_t icount=0; // chamber counter (0 1 2 3)
1281
1282 for (Int_t istation=0; istation<2; istation++) { // loop on stations
1283 for (Int_t iplane=0; iplane<2; iplane++) { // loop on detection planes
1284
1285 Int_t iVolNum=1; // counter Volume Number
1286 icount = Int_t(iplane*TMath::Power(2,0))+
1287 Int_t(istation*TMath::Power(2,1));
1288
1289 char volPlane[5];
1290 sprintf(volPlane,"SM%d%d",istation+1,iplane+1);
1291
1292 iChamber = (AliMUONChamber*) (*fChambers)[10+icount];
1293 Float_t zpos = iChamber->Z();
1294
1295// mother volume
1296 tpar[0] = iChamber->RInner();
1297 tpar[1] = iChamber->ROuter();
1298 tpar[2] = 4.0;
1299 gMC->Gsvolu(volPlane,"TUBE",idAir,tpar,3);
1300
1301// Flange between beam shielding and RPC
1302 tpar[0]= kRMIN[istation];
1303 tpar[1]= kRMAX[istation];
1304 tpar[2]= 4.0;
1305
1306 char volFlange[5];
1307 sprintf(volFlange,"SF%dA",icount+1);
1308 gMC->Gsvolu(volFlange,"TUBE",idAlu1,tpar,3); //Al
1309 gMC->Gspos(volFlange,1,volPlane,0.,0.,0.,0,"MANY");
1310
1311// scaling factor
1312 Float_t zRatio = zpos / zpos1;
1313
1314// chamber prototype
1315 tpar[0]= 0.;
1316 tpar[1]= 0.;
1317 tpar[2]= 0.;
1318
1319 char volAlu[5]; // Alu
1320 char volBak[5]; // Bakelite
1321 char volGaz[5]; // Gas streamer
1322
1323 sprintf(volAlu,"SC%dA",icount+1);
1324 sprintf(volBak,"SB%dA",icount+1);
1325 sprintf(volGaz,"SG%dA",icount+1);
1326
1327 gMC->Gsvolu(volAlu,"BOX",idAlu1,tpar,0); // Al
1328 gMC->Gsvolu(volBak,"BOX",idtmed[1107],tpar,0); // Bakelite
1329 gMC->Gsvolu(volGaz,"BOX",idtmed[1106],tpar,0); // Gas streamer
1330
a9e2aefa 1331// chamber type A
7e33ffcb 1332 tpar[0] = -1.;
1333 tpar[1] = -1.;
1334
1335 Float_t xA=(kDXZERO+kXMED+(kXMAX-kXMED)/2.)*zRatio;
1336 Float_t yAm=0.;
1337 Float_t yAp=0.;
1338
1339 tpar[2] = 0.1;
1340 gMC->Gsposp(volGaz,1,volBak,0.,0.,0.,0,"ONLY",tpar,3);
1341 tpar[2] = 0.3;
1342 gMC->Gsposp(volBak,1,volAlu,0.,0.,0.,0,"ONLY",tpar,3);
1343
1344 tpar[2] = 0.4;
1345 tpar[0] = ((kXMAX-kXMED)/2.)*zRatio;
1346 tpar[1] = kYMIN*zRatio;
1347
1348 gMC->Gsposp(volAlu,iVolNum++,volPlane, xA,yAm,kZm,0,"ONLY",tpar,3);
1349 gMC->Gsposp(volAlu,iVolNum++,volPlane,-xA,yAp,kZp,0,"ONLY",tpar,3);
1350 gMC->Gsbool(volAlu,volFlange);
1351
1352// chamber type B
1353 Float_t tpar1save=tpar[1];
1354 Float_t y1msave=yAm;
1355 Float_t y1psave=yAp;
1356
1357 tpar[0] = ((kXMAX-kXMIN)/2.) * zRatio;
1358 tpar[1] = ((kYMAX-kYMIN)/2.) * zRatio;
1359
1360 Float_t xB=(kDXZERO+kXMIN)*zRatio+tpar[0];
1361 Float_t yBp=(y1msave+tpar1save)*zpm+tpar[1];
1362 Float_t yBm=(y1psave+tpar1save)*zmp+tpar[1];
1363
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);
1366 gMC->Gsposp(volAlu,iVolNum++,volPlane, xB,-yBp,kZp,0,"ONLY",tpar,3);
1367 gMC->Gsposp(volAlu,iVolNum++,volPlane,-xB,-yBm,kZm,0,"ONLY",tpar,3);
1368
1369// chamber type C (note : same Z than type B)
1370 tpar1save=tpar[1];
1371 y1msave=yBm;
1372 y1psave=yBp;
1373
1374 tpar[0] = (kXMAX/2)*zRatio;
1375 tpar[1] = (kYMAX/2)*zRatio;
1376
1377 Float_t xC=kDXZERO*zRatio+tpar[0];
1378 Float_t yCp=(y1psave+tpar1save)*1.+tpar[1];
1379 Float_t yCm=(y1msave+tpar1save)*1.+tpar[1];
1380
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);
1383 gMC->Gsposp(volAlu,iVolNum++,volPlane, xC,-yCp,kZp,0,"ONLY",tpar,3);
1384 gMC->Gsposp(volAlu,iVolNum++,volPlane,-xC,-yCm,kZm,0,"ONLY",tpar,3);
1385
1386// chamber type D, E and F (same size)
1387 tpar1save=tpar[1];
1388 y1msave=yCm;
1389 y1psave=yCp;
1390
1391 tpar[0] = (kXMAX/2.)*zRatio;
1392 tpar[1] = kYMIN*zRatio;
1393
1394 Float_t xD=kDXZERO*zRatio+tpar[0];
1395 Float_t yDp=(y1msave+tpar1save)*zpm+tpar[1];
1396 Float_t yDm=(y1psave+tpar1save)*zmp+tpar[1];
1397
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);
1400 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD,-yDm,kZm,0,"ONLY",tpar,3);
1401 gMC->Gsposp(volAlu,iVolNum++,volPlane,-xD,-yDp,kZp,0,"ONLY",tpar,3);
1402
1403 tpar1save=tpar[1];
1404 y1msave=yDm;
1405 y1psave=yDp;
1406 Float_t yEp=(y1msave+tpar1save)*zpm+tpar[1];
1407 Float_t yEm=(y1psave+tpar1save)*zmp+tpar[1];
1408
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);
1411 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD,-yEp,kZp,0,"ONLY",tpar,3);
1412 gMC->Gsposp(volAlu,iVolNum++,volPlane,-xD,-yEm,kZm,0,"ONLY",tpar,3);
1413
1414 tpar1save=tpar[1];
1415 y1msave=yEm;
1416 y1psave=yEp;
1417 Float_t yFp=(y1msave+tpar1save)*zpm+tpar[1];
1418 Float_t yFm=(y1psave+tpar1save)*zmp+tpar[1];
1419
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);
1422 gMC->Gsposp(volAlu,iVolNum++,volPlane, xD,-yFm,kZm,0,"ONLY",tpar,3);
1423 gMC->Gsposp(volAlu,iVolNum++,volPlane,-xD,-yFp,kZp,0,"ONLY",tpar,3);
a9e2aefa 1424
7e33ffcb 1425// Positioning plane in ALICE
1426 gMC->Gspos(volPlane,1,"ALIC",0.,0.,zpos,0,"ONLY");
1427
1428 } // end loop on detection planes
1429 } // end loop on stations
a9e2aefa 1430
1431}
1432
a9e2aefa 1433
1434//___________________________________________
1435void AliMUONv1::CreateMaterials()
1436{
1437 // *** DEFINITION OF AVAILABLE MUON MATERIALS ***
1438 //
b64652f5 1439 // Ar-CO2 gas (80%+20%)
a9e2aefa 1440 Float_t ag1[3] = { 39.95,12.01,16. };
1441 Float_t zg1[3] = { 18.,6.,8. };
1442 Float_t wg1[3] = { .8,.0667,.13333 };
1443 Float_t dg1 = .001821;
1444 //
1445 // Ar-buthane-freon gas -- trigger chambers
1446 Float_t atr1[4] = { 39.95,12.01,1.01,19. };
1447 Float_t ztr1[4] = { 18.,6.,1.,9. };
1448 Float_t wtr1[4] = { .56,.1262857,.2857143,.028 };
1449 Float_t dtr1 = .002599;
1450 //
1451 // Ar-CO2 gas
1452 Float_t agas[3] = { 39.95,12.01,16. };
1453 Float_t zgas[3] = { 18.,6.,8. };
1454 Float_t wgas[3] = { .74,.086684,.173316 };
1455 Float_t dgas = .0018327;
1456 //
1457 // Ar-Isobutane gas (80%+20%) -- tracking
1458 Float_t ag[3] = { 39.95,12.01,1.01 };
1459 Float_t zg[3] = { 18.,6.,1. };
1460 Float_t wg[3] = { .8,.057,.143 };
1461 Float_t dg = .0019596;
1462 //
1463 // Ar-Isobutane-Forane-SF6 gas (49%+7%+40%+4%) -- trigger
1464 Float_t atrig[5] = { 39.95,12.01,1.01,19.,32.066 };
1465 Float_t ztrig[5] = { 18.,6.,1.,9.,16. };
1466 Float_t wtrig[5] = { .49,1.08,1.5,1.84,0.04 };
1467 Float_t dtrig = .0031463;
1468 //
1469 // bakelite
1470
1471 Float_t abak[3] = {12.01 , 1.01 , 16.};
1472 Float_t zbak[3] = {6. , 1. , 8.};
1473 Float_t wbak[3] = {6. , 6. , 1.};
1474 Float_t dbak = 1.4;
1475
1476 Float_t epsil, stmin, deemax, tmaxfd, stemax;
1477
1478 Int_t iSXFLD = gAlice->Field()->Integ();
1479 Float_t sXMGMX = gAlice->Field()->Max();
1480 //
1481 // --- Define the various materials for GEANT ---
1482 AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
1483 AliMaterial(10, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
1484 AliMaterial(15, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500);
1485 AliMixture(19, "Bakelite$", abak, zbak, dbak, -3, wbak);
1486 AliMixture(20, "ArC4H10 GAS$", ag, zg, dg, 3, wg);
1487 AliMixture(21, "TRIG GAS$", atrig, ztrig, dtrig, -5, wtrig);
1488 AliMixture(22, "ArCO2 80%$", ag1, zg1, dg1, 3, wg1);
1489 AliMixture(23, "Ar-freon $", atr1, ztr1, dtr1, 4, wtr1);
1490 AliMixture(24, "ArCO2 GAS$", agas, zgas, dgas, 3, wgas);
1e8fff9c 1491 // materials for slat:
1492 // Sensitive area: gas (already defined)
1493 // PCB: copper
1494 // insulating material and frame: vetronite
1495 // walls: carbon, rohacell, carbon
1496 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
1497 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
1498 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
1499 Float_t dglass=1.74;
1500
1501 // rohacell: C9 H13 N1 O2
1502 Float_t arohac[4] = {12.01, 1.01, 14.010, 16.};
1503 Float_t zrohac[4] = { 6., 1., 7., 8.};
1504 Float_t wrohac[4] = { 9., 13., 1., 2.};
1505 Float_t drohac = 0.03;
1506
1507 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
1508 AliMixture(32, "Vetronite$",aglass, zglass, dglass, 5, wglass);
1509 AliMaterial(33, "Carbon$", 12.01, 6., 2.265, 18.8, 49.9);
1510 AliMixture(34, "Rohacell$", arohac, zrohac, drohac, -4, wrohac);
1511
a9e2aefa 1512
1513 epsil = .001; // Tracking precision,
1514 stemax = -1.; // Maximum displacement for multiple scat
1515 tmaxfd = -20.; // Maximum angle due to field deflection
1516 deemax = -.3; // Maximum fractional energy loss, DLS
1517 stmin = -.8;
1518 //
1519 // Air
1520 AliMedium(1, "AIR_CH_US ", 15, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1521 //
1522 // Aluminum
1523
1524 AliMedium(4, "ALU_CH_US ", 9, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
1525 fMaxDestepAlu, epsil, stmin);
1526 AliMedium(5, "ALU_CH_US ", 10, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
1527 fMaxDestepAlu, epsil, stmin);
1528 //
1529 // Ar-isoC4H10 gas
1530
1531 AliMedium(6, "AR_CH_US ", 20, 1, iSXFLD, sXMGMX, tmaxfd, fMaxStepGas,
1532 fMaxDestepGas, epsil, stmin);
1533//
1534 // Ar-Isobuthane-Forane-SF6 gas
1535
1536 AliMedium(7, "GAS_CH_TRIGGER ", 21, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
1537
1538 AliMedium(8, "BAKE_CH_TRIGGER ", 19, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
1539 fMaxDestepAlu, epsil, stmin);
1540
1541 AliMedium(9, "ARG_CO2 ", 22, 1, iSXFLD, sXMGMX, tmaxfd, fMaxStepGas,
1542 fMaxDestepAlu, epsil, stmin);
1e8fff9c 1543 // tracking media for slats: check the parameters!!
1544 AliMedium(11, "PCB_COPPER ", 31, 0, iSXFLD, sXMGMX, tmaxfd,
1545 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
1546 AliMedium(12, "VETRONITE ", 32, 0, iSXFLD, sXMGMX, tmaxfd,
1547 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
1548 AliMedium(13, "CARBON ", 33, 0, iSXFLD, sXMGMX, tmaxfd,
1549 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
1550 AliMedium(14, "Rohacell ", 34, 0, iSXFLD, sXMGMX, tmaxfd,
1551 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
a9e2aefa 1552}
1553
1554//___________________________________________
1555
1556void AliMUONv1::Init()
1557{
1558 //
1559 // Initialize Tracking Chambers
1560 //
1561
9e1a0ddb 1562 if(fDebug) printf("\n%s: Start Init for version 1 - CPC chamber type\n\n",ClassName());
e17592e9 1563 Int_t i;
f665c1ea 1564 for (i=0; i<AliMUONConstants::NCh(); i++) {
a9e2aefa 1565 ( (AliMUONChamber*) (*fChambers)[i])->Init();
1566 }
1567
1568 //
1569 // Set the chamber (sensitive region) GEANT identifier
b74f1c6a 1570 ((AliMUONChamber*)(*fChambers)[0])->SetGid(gMC->VolId("S01G"));
1571 ((AliMUONChamber*)(*fChambers)[1])->SetGid(gMC->VolId("S02G"));
b17c0c87 1572
b74f1c6a 1573 ((AliMUONChamber*)(*fChambers)[2])->SetGid(gMC->VolId("S03G"));
1574 ((AliMUONChamber*)(*fChambers)[3])->SetGid(gMC->VolId("S04G"));
b17c0c87 1575
1e8fff9c 1576 ((AliMUONChamber*)(*fChambers)[4])->SetGid(gMC->VolId("S05G"));
1577 ((AliMUONChamber*)(*fChambers)[5])->SetGid(gMC->VolId("S06G"));
b17c0c87 1578
1e8fff9c 1579 ((AliMUONChamber*)(*fChambers)[6])->SetGid(gMC->VolId("S07G"));
1580 ((AliMUONChamber*)(*fChambers)[7])->SetGid(gMC->VolId("S08G"));
b17c0c87 1581
1e8fff9c 1582 ((AliMUONChamber*)(*fChambers)[8])->SetGid(gMC->VolId("S09G"));
1583 ((AliMUONChamber*)(*fChambers)[9])->SetGid(gMC->VolId("S10G"));
b17c0c87 1584
b74f1c6a 1585 ((AliMUONChamber*)(*fChambers)[10])->SetGid(gMC->VolId("SG1A"));
1586 ((AliMUONChamber*)(*fChambers)[11])->SetGid(gMC->VolId("SG2A"));
1587 ((AliMUONChamber*)(*fChambers)[12])->SetGid(gMC->VolId("SG3A"));
1588 ((AliMUONChamber*)(*fChambers)[13])->SetGid(gMC->VolId("SG4A"));
a9e2aefa 1589
9e1a0ddb 1590 if(fDebug) printf("\n%s: Finished Init for version 1 - CPC chamber type\n",ClassName());
a9e2aefa 1591
1592 //cp
9e1a0ddb 1593 if(fDebug) printf("\n%s: Start Init for Trigger Circuits\n",ClassName());
f665c1ea 1594 for (i=0; i<AliMUONConstants::NTriggerCircuit(); i++) {
a9e2aefa 1595 ( (AliMUONTriggerCircuit*) (*fTriggerCircuits)[i])->Init(i);
1596 }
9e1a0ddb 1597 if(fDebug) printf("%s: Finished Init for Trigger Circuits\n",ClassName());
a9e2aefa 1598 //cp
1599
1600}
5f91c9e8 1601//___________________________________________
c33d9661 1602void AliMUONv1::StepManager()
1603{
1604 if (fStepManagerVersionOld) {
1605 StepManagerOld();
1606 return;
1607 }
abaf7c9d 1608 if (fStepManagerVersionNew) {
1609 StepManagerNew();
1610 return;
1611 }
1612
1613 if (fStepManagerVersionTest) {
1614 StepManagerTest();
1615 return;
1616 }
1617
1618
c33d9661 1619 // Volume id
1620 Int_t copy, id;
1621 Int_t idvol;
1622 Int_t iChamber=0;
1623 // Particule id, pos and mom vectors,
1624 // theta, phi angles with respect the normal of the chamber,
1625 // spatial step, delta_energy and time of flight
1626 Int_t ipart;
1627 TLorentzVector pos, mom;
1628 Float_t theta, phi, tof;
1629 Float_t destep, step;
1630 const Float_t kBig = 1.e10;
1631
1632 // Only charged tracks
1633 if( !(gMC->TrackCharge()) ) return;
1634
1635 // Only gas gap inside chamber
1636 // Tag chambers and record hits when track enters
1637 idvol=-1;
1638 id=gMC->CurrentVolID(copy);
1639 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) {
1640 if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) {
1641 iChamber = i;
1642 idvol = i-1;
1643 }
1644 }
1645 if (idvol == -1) return;
1646
abaf7c9d 1647 printf(">>>> This Chamber %d\n",iChamber);
c33d9661 1648
1649 // record hits when track enters ...
1650 if( gMC->IsTrackEntering()) gMC->SetMaxStep(fStepMaxInActiveGas);
1651
1652 if (gMC->TrackStep() > 0.) {
1653 // Get current particle id (ipart), track position (pos) and momentum (mom)
1654 gMC->TrackPosition(pos);
1655 gMC->TrackMomentum(mom);
1656 ipart = gMC->TrackPid();
1657 theta = mom.Theta()*kRaddeg; // theta of track
1658 phi = mom.Phi() *kRaddeg; // phi of the track
1659 tof = gMC->TrackTime(); // Time of flight
1660 //
1661 // momentum loss and steplength in last step
1662 destep = gMC->Edep();
1663 step = gMC->TrackStep();
ce3f5e87 1664
abaf7c9d 1665 //new hit
ce3f5e87 1666 GetMUONData()->AddHit(fIshunt, gAlice->GetCurrentTrackNumber(), iChamber, ipart,
1667 pos.X(), pos.Y(), pos.Z(), tof, mom.P(),
1668 theta, phi, step, destep);
c33d9661 1669 }
1670 // Track left chamber ...
1671 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1672 gMC->SetMaxStep(kBig);
1673 }
c33d9661 1674}
1675
abaf7c9d 1676
5f91c9e8 1677Int_t AliMUONv1::GetChamberId(Int_t volId) const
1678{
1679// Check if the volume with specified volId is a sensitive volume (gas)
1680// of some chamber and returns the chamber number;
1681// if not sensitive volume - return 0.
1682// ---
1683
1684 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++)
1685 if (volId==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) return i;
1686
1687 return 0;
1688}
abaf7c9d 1689//__
1690
1691
1692
1693void AliMUONv1::StepManagerTest()
1694{
1695 return;
1696}
1697//________________________________________
1698void AliMUONv1::StepManagerNew()
1699{
1700
1701
1702
1703
1704
1705 // Volume id
1706 Int_t copy, id;
1707 Int_t idvol;
1708 Int_t iChamber=0;
1709 // Particule id, pos and mom vectors,
1710 // theta, phi angles with respect the normal of the chamber,
1711 // spatial step, delta_energy and time of flight
1712 Int_t ipart;
1713 TLorentzVector pos, mom;
1714 Float_t theta, phi, tof;
1715 Float_t destep, step;
1716 const Float_t kBig = 1.e10;
1717
1718 // Only charged tracks
1719 if( !(gMC->TrackCharge()) ) return;
1720
1721 // Only gas gap inside chamber
1722 // Tag chambers and record hits when track enters
1723 idvol=-1;
1724 id=gMC->CurrentVolID(copy);
1725 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) {
1726 if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) {
1727 iChamber = i;
1728 idvol = i-1;
1729 }
1730 }
1731 static Float_t Sstep[20]; // Sum of steps per chamber
1732 // static Float_t Sdestep[20]; // Sum of eloss per chamber
1733 Float_t GAP;
1734 Float_t TEST;
1735
1736 if (idvol == -1) return;
1737
1738 // printf(">>>> This Chamber %d\n",iChamber);
1739
1740 // record hits when track enters ...
1741 //if( gMC->IsTrackEntering()) gMC->SetMaxStep(fStepMaxInActiveGas);
1742
1743 if (gMC->TrackStep() > 0.) {
1744 // Get current particle id (ipart), track position (pos) and momentum (mom)
1745 gMC->TrackPosition(pos);
1746 gMC->TrackMomentum(mom);
1747 ipart = gMC->TrackPid(); // Particle
1748 theta = mom.Theta()*kRaddeg; // theta of track
1749 phi = mom.Phi() *kRaddeg; // phi of the track
1750 tof = gMC->TrackTime(); // Time of flight
1751 //
1752 // momentum loss and steplength in last step
1753 destep = gMC->Edep();
1754 step = gMC->TrackStep();
1755
1756 Sstep[iChamber]+=step;
1757 // Sdestep[iChamber]+=destep;
1758
1759 }
1760
1761 step = Sstep[iChamber]; // Total step >= gap
1762 // destep = Sdestep[iChamber]; // Total eloss
1763
1764
1765 // Track left chamber ...
1766 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1767 gMC->SetMaxStep(kBig);
1768
1769 Sstep[iChamber]=0; // Reset for the next event
1770 //Sdestep[iChamber]=0; // Reset for the next event
1771
1772 if (iChamber>=1 && iChamber<=2) GAP=0.4;
1773 if (iChamber>=11 && iChamber<=14) GAP=0.2;
1774 if (iChamber>=3 && iChamber<=10) GAP=0.5;
1775
1776 TF1 *ELOSS1 = new TF1("Gauss1","exp(-((x-4.13727e+01)**2)/(2*1.42223e+01**2))",0,75);
1777 TF1 *ELOSS2 = new TF1("Gauss2","exp(-((x+6.83795e+02)**2)/(2*4.48415e+02**2))",75,350);
1778 TEST=gRandom->Rndm();
1779 if (TEST <=0.89) destep=ELOSS1->GetRandom();
1780 else destep=ELOSS2->GetRandom();
1781 destep*=pow(10,-6)*0.0274;
1782 destep*=GAP/0.5;
1783
1784 // One hit per chamber
1785 GetMUONData()->AddHit(fIshunt, gAlice->GetCurrentTrackNumber(), iChamber, ipart,
1786 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);
1787
1788 }
1789}
5f91c9e8 1790
a9e2aefa 1791//___________________________________________
c33d9661 1792void AliMUONv1::StepManagerOld()
a9e2aefa 1793{
1794 Int_t copy, id;
1795 static Int_t idvol;
1796 static Int_t vol[2];
1797 Int_t ipart;
1798 TLorentzVector pos;
1799 TLorentzVector mom;
1800 Float_t theta,phi;
1801 Float_t destep, step;
abaf7c9d 1802
1803 static Float_t Sstep;
1e8fff9c 1804 static Float_t eloss, eloss2, xhit, yhit, zhit, tof, tlength;
2eb55fab 1805 const Float_t kBig = 1.e10;
a9e2aefa 1806 static Float_t hits[15];
1807
1808 TClonesArray &lhits = *fHits;
1809
1810 //
a9e2aefa 1811 //
1812 // Only charged tracks
1813 if( !(gMC->TrackCharge()) ) return;
1814 //
1815 // Only gas gap inside chamber
1816 // Tag chambers and record hits when track enters
a9e2aefa 1817 id=gMC->CurrentVolID(copy);
5f91c9e8 1818 vol[0] = GetChamberId(id);
1819 idvol = vol[0] -1;
1820
1821 if (idvol == -1) return;
1822
a9e2aefa 1823 //
1824 // Get current particle id (ipart), track position (pos) and momentum (mom)
1825 gMC->TrackPosition(pos);
1826 gMC->TrackMomentum(mom);
1827
1828 ipart = gMC->TrackPid();
a9e2aefa 1829
1830 //
1831 // momentum loss and steplength in last step
1832 destep = gMC->Edep();
1833 step = gMC->TrackStep();
abaf7c9d 1834 // cout<<"------------"<<step<<endl;
a9e2aefa 1835 //
1836 // record hits when track enters ...
1837 if( gMC->IsTrackEntering()) {
abaf7c9d 1838
a9e2aefa 1839 gMC->SetMaxStep(fMaxStepGas);
1840 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
1841 Double_t rt = TMath::Sqrt(tc);
1842 Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
2eb55fab 1843 Double_t tx = mom[0]/pmom;
1844 Double_t ty = mom[1]/pmom;
1845 Double_t tz = mom[2]/pmom;
1846 Double_t s = ((AliMUONChamber*)(*fChambers)[idvol])
a9e2aefa 1847 ->ResponseModel()
1848 ->Pitch()/tz;
1849 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
1850 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
1851 hits[0] = Float_t(ipart); // Geant3 particle type
2eb55fab 1852 hits[1] = pos[0]+s*tx; // X-position for hit
1853 hits[2] = pos[1]+s*ty; // Y-position for hit
1854 hits[3] = pos[2]+s*tz; // Z-position for hit
a9e2aefa 1855 hits[4] = theta; // theta angle of incidence
1856 hits[5] = phi; // phi angle of incidence
ce3f5e87 1857 hits[8] = 0;//PadHits does not exist anymore (Float_t) fNPadHits; // first padhit
a9e2aefa 1858 hits[9] = -1; // last pad hit
2eb55fab 1859 hits[10] = mom[3]; // hit momentum P
1860 hits[11] = mom[0]; // Px
1861 hits[12] = mom[1]; // Py
1862 hits[13] = mom[2]; // Pz
a9e2aefa 1863 tof=gMC->TrackTime();
2eb55fab 1864 hits[14] = tof; // Time of flight
1865 tlength = 0;
1866 eloss = 0;
1867 eloss2 = 0;
abaf7c9d 1868 Sstep=0;
2eb55fab 1869 xhit = pos[0];
1870 yhit = pos[1];
1871 zhit = pos[2];
681d067b 1872 Chamber(idvol).ChargeCorrelationInit();
a9e2aefa 1873 // Only if not trigger chamber
1e8fff9c 1874
abaf7c9d 1875// printf("---------------------------\n");
1876// printf(">>>> Y = %f \n",hits[2]);
1877// printf("---------------------------\n");
1878
1e8fff9c 1879
1880
abaf7c9d 1881 // if(idvol < AliMUONConstants::NTrackingCh()) {
1882// //
1883// // Initialize hit position (cursor) in the segmentation model
1884// ((AliMUONChamber*) (*fChambers)[idvol])
1885// ->SigGenInit(pos[0], pos[1], pos[2]);
1886// } else {
1887// //geant3->Gpcxyz();
1888// //printf("In the Trigger Chamber #%d\n",idvol-9);
1889// }
a9e2aefa 1890 }
1891 eloss2+=destep;
abaf7c9d 1892 Sstep+=step;
1893
1894 // cout<<Sstep<<endl;
1895
a9e2aefa 1896 //
1897 // Calculate the charge induced on a pad (disintegration) in case
1898 //
1899 // Mip left chamber ...
1900 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
1901 gMC->SetMaxStep(kBig);
1902 eloss += destep;
1903 tlength += step;
1904
802a864d 1905 Float_t x0,y0,z0;
1906 Float_t localPos[3];
1907 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
802a864d 1908 gMC->Gmtod(globalPos,localPos,1);
1909
2eb55fab 1910 if(idvol < AliMUONConstants::NTrackingCh()) {
a9e2aefa 1911// tracking chambers
1912 x0 = 0.5*(xhit+pos[0]);
1913 y0 = 0.5*(yhit+pos[1]);
1e8fff9c 1914 z0 = 0.5*(zhit+pos[2]);
a9e2aefa 1915 } else {
1916// trigger chambers
2eb55fab 1917 x0 = xhit;
1918 y0 = yhit;
1919 z0 = 0.;
a9e2aefa 1920 }
1921
1e8fff9c 1922
ce3f5e87 1923 // if (eloss >0) MakePadHits(x0,y0,z0,eloss,tof,idvol);
a9e2aefa 1924
1925
2eb55fab 1926 hits[6] = tlength; // track length
1927 hits[7] = eloss2; // de/dx energy loss
1928
abaf7c9d 1929
ce3f5e87 1930 // if (fNPadHits > (Int_t)hits[8]) {
1931 // hits[8] = hits[8]+1;
1932 // hits[9] = 0: // PadHits does not exist anymore (Float_t) fNPadHits;
1933 //}
2eb55fab 1934//
1935// new hit
1936
a9e2aefa 1937 new(lhits[fNhits++])
642f15cf 1938 AliMUONHit(fIshunt, gAlice->GetCurrentTrackNumber(), vol,hits);
a9e2aefa 1939 eloss = 0;
1940 //
1941 // Check additional signal generation conditions
1942 // defined by the segmentation
a75f073c 1943 // model (boundary crossing conditions)
1944 // only for tracking chambers
a9e2aefa 1945 } else if
a75f073c 1946 ((idvol < AliMUONConstants::NTrackingCh()) &&
1947 ((AliMUONChamber*) (*fChambers)[idvol])->SigGenCond(pos[0], pos[1], pos[2]))
a9e2aefa 1948 {
1949 ((AliMUONChamber*) (*fChambers)[idvol])
1950 ->SigGenInit(pos[0], pos[1], pos[2]);
802a864d 1951
1952 Float_t localPos[3];
1953 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
1954 gMC->Gmtod(globalPos,localPos,1);
1955
e0f71fb7 1956 eloss += destep;
802a864d 1957
ce3f5e87 1958 // if (eloss > 0 && idvol < AliMUONConstants::NTrackingCh())
1959 // MakePadHits(0.5*(xhit+pos[0]),0.5*(yhit+pos[1]),pos[2],eloss,tof,idvol);
a9e2aefa 1960 xhit = pos[0];
1961 yhit = pos[1];
e0f71fb7 1962 zhit = pos[2];
1963 eloss = 0;
a9e2aefa 1964 tlength += step ;
1965 //
1966 // nothing special happened, add up energy loss
1967 } else {
1968 eloss += destep;
1969 tlength += step ;
1970 }
1971}
1972
1973