Adaption to new fluka common blocks (E. Futo)
[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
16/*
17$Log$
c33d9661 18Revision 1.41 2003/05/02 15:09:38 hristov
19Code for MUON Station1 (I.Hrivnacova)
20
5f91c9e8 21Revision 1.40 2003/01/28 13:21:06 morsch
22Improved response simulation for station 1.
23(M. Mac Cormick, I. Hrivnacova, D. Guez)
24
ba030c0e 25Revision 1.39 2003/01/14 10:50:19 alibrary
26Cleanup of STEER coding conventions
27
116cbefd 28Revision 1.38 2002/11/21 17:01:56 alibrary
29Removing AliMCProcess and AliMC
30
6b677e96 31Revision 1.37 2002/10/23 07:24:57 alibrary
32Introducing Riostream.h
33
70479d0e 34Revision 1.36 2002/10/14 14:57:29 hristov
35Merging the VirtualMC branch to the main development branch (HEAD)
36
b9d0a01d 37Revision 1.31.4.3 2002/10/11 06:56:48 hristov
38Updating VirtualMC to v3-09-02
39
40Revision 1.35 2002/09/02 15:51:48 morsch
41Gsbool calls added to resolve MANY. (I. Hrivnacova)
42
03da3c56 43Revision 1.31.4.2 2002/07/24 10:07:21 alibrary
44Updating VirtualMC
45
3f08857e 46Revision 1.33 2002/07/23 10:02:46 morsch
47All volume names start with "S".
48
b74f1c6a 49Revision 1.32 2002/05/02 12:51:10 morsch
50For G4: gMC->VolId(...) replaced by gAlice->GetModule(...).
51
fe713e43 52Revision 1.31 2002/03/13 07:55:04 jchudoba
53Correction of the errourness last commit.
54
4b1670dc 55Revision 1.29 2001/06/21 14:54:37 morsch
56Put volumes of station 3 into DIPO if present. (A. de Falco)
57
2724ae40 58Revision 1.28 2001/05/16 14:57:17 alibrary
59New files for folders and Stack
60
9e1a0ddb 61Revision 1.27 2001/04/06 11:24:43 morsch
62Dependency on implementations of AliSegmentation and AliMUONResponse moved to AliMUONFactory class.
63Static method Build() builds the MUON system out of chambers, segmentation and response.
64
be3bb6c1 65Revision 1.26 2001/03/17 10:07:20 morsch
66Correct inconsistent variable name / method name / comments.
67
2eb55fab 68Revision 1.25 2001/03/16 15:32:06 morsch
69Corrections of overlap with beam shield and dipole (A. de Falco)
70
21a18f36 71Revision 1.24 2001/03/14 17:22:15 pcrochet
72Geometry of the trigger chambers : a vertical gap of has been introduced around x=0 according fig.3.27 of the TDR (P.Dupieux)
73
236fe2c5 74Revision 1.23 2001/01/18 15:23:49 egangler
75Bug correction in StepManager :
76Now the systematic offset with angle is cured
77
e0f71fb7 78Revision 1.22 2001/01/17 21:01:21 hristov
79Unused variable removed
80
a7e8b51a 81Revision 1.21 2000/12/20 13:00:22 egangler
82
83Added charge correlation between cathods.
84In Config_slat.C, use
85 MUON->Chamber(chamber-1).SetChargeCorrel(0.11); to set the RMS of
86 q1/q2 to 11 % (number from Alberto)
87 This is stored in AliMUONChamber fChargeCorrel member.
88 At generation time, when a tracks enters the volume,
89 AliMUONv1::StepManager calls
90 AliMUONChamber::ChargeCorrelationInit() to set the current value of
91 fCurrentCorrel which is then used at Disintegration level to scale
92 appropriately the PadHit charges.
93
681d067b 94Revision 1.20 2000/12/04 17:48:23 gosset
95Modifications for stations 1 et 2 mainly:
96* station 1 with 4 mm gas gap and smaller cathode segmentation...
97* stations 1 and 2 with "grey" frame crosses
98* mean noise at 1.5 ADC channel
99* Ar-CO2 gas (80%+20%)
100
b64652f5 101Revision 1.19 2000/12/02 17:15:46 morsch
102Correction of dead zones in inner regions of stations 3-5
103Correction of length of slats 3 and 9 of station 4.
104
a083207d 105Revision 1.17 2000/11/24 12:57:10 morsch
106New version of geometry for stations 3-5 "Slats" (A. de Falco)
107 - sensitive region at station 3 inner radius
108 - improved volume tree structure
109
3c084d9f 110Revision 1.16 2000/11/08 13:01:40 morsch
111Chamber half-planes of stations 3-5 at different z-positions.
112
e1ad7d45 113Revision 1.15 2000/11/06 11:39:02 morsch
114Bug in StepManager() corrected.
115
e3cf5faa 116Revision 1.14 2000/11/06 09:16:50 morsch
117Avoid overlap of slat volumes.
118
2c799aa2 119Revision 1.13 2000/10/26 07:33:44 morsch
120Correct x-position of slats in station 5.
121
8013c580 122Revision 1.12 2000/10/25 19:55:35 morsch
123Switches for each station individually for debug and lego.
124
b17c0c87 125Revision 1.11 2000/10/22 16:44:01 morsch
126Update of slat geometry for stations 3,4,5 (A. deFalco)
127
f9f7c205 128Revision 1.10 2000/10/12 16:07:04 gosset
129StepManager:
130* SigGenCond only called for tracking chambers,
131 hence no more division by 0,
132 and may use last ALIROOT/dummies.C with exception handling;
133* "10" replaced by "AliMUONConstants::NTrackingCh()".
134
a75f073c 135Revision 1.9 2000/10/06 15:37:22 morsch
136Problems with variable redefinition in for-loop solved.
137Variable names starting with u-case letters changed to l-case.
138
6c5ddcfa 139Revision 1.8 2000/10/06 09:06:31 morsch
140Include Slat chambers (stations 3-5) into geometry (A. de Falco)
141
1e8fff9c 142Revision 1.7 2000/10/02 21:28:09 fca
143Removal of useless dependecies via forward declarations
144
94de3818 145Revision 1.6 2000/10/02 17:20:45 egangler
146Cleaning of the code (continued ) :
147-> coding conventions
148-> void Streamers
149-> some useless includes removed or replaced by "class" statement
150
8c449e83 151Revision 1.5 2000/06/28 15:16:35 morsch
152(1) Client code adapted to new method signatures in AliMUONSegmentation (see comments there)
153to allow development of slat-muon chamber simulation and reconstruction code in the MUON
154framework. The changes should have no side effects (mostly dummy arguments).
155(2) Hit disintegration uses 3-dim hit coordinates to allow simulation
156of chambers with overlapping modules (MakePadHits, Disintegration).
157
802a864d 158Revision 1.4 2000/06/26 14:02:38 morsch
159Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
160
f665c1ea 161Revision 1.3 2000/06/22 14:10:05 morsch
162HP scope problems corrected (PH)
163
e17592e9 164Revision 1.2 2000/06/15 07:58:49 morsch
165Code from MUON-dev joined
166
a9e2aefa 167Revision 1.1.2.14 2000/06/14 14:37:25 morsch
168Initialization of TriggerCircuit added (PC)
169
170Revision 1.1.2.13 2000/06/09 21:55:47 morsch
171Most coding rule violations corrected.
172
173Revision 1.1.2.12 2000/05/05 11:34:29 morsch
174Log inside comments.
175
176Revision 1.1.2.11 2000/05/05 10:06:48 morsch
177Coding Rule violations regarding trigger section corrected (CP)
178Log messages included.
179*/
180
181/////////////////////////////////////////////////////////
182// Manager and hits classes for set:MUON version 0 //
183/////////////////////////////////////////////////////////
184
116cbefd 185#include <Riostream.h>
186#include <TClonesArray.h>
187#include <TLorentzVector.h>
a9e2aefa 188#include <TNode.h>
189#include <TRandom.h>
116cbefd 190#include <TTUBE.h>
a9e2aefa 191
192#include "AliMUONv1.h"
193#include "AliRun.h"
94de3818 194#include "AliMagF.h"
a9e2aefa 195#include "AliCallf77.h"
196#include "AliConst.h"
197#include "AliMUONChamber.h"
198#include "AliMUONHit.h"
199#include "AliMUONPadHit.h"
f665c1ea 200#include "AliMUONConstants.h"
8c449e83 201#include "AliMUONTriggerCircuit.h"
be3bb6c1 202#include "AliMUONFactory.h"
a9e2aefa 203
204ClassImp(AliMUONv1)
205
206//___________________________________________
37c0cd40 207AliMUONv1::AliMUONv1() : AliMUON()
a9e2aefa 208{
209// Constructor
37c0cd40 210 fChambers = 0;
ba030c0e 211 fStations = 0;
c33d9661 212 fStepManagerVersionOld = kFALSE;
213 fStepMaxInActiveGas = 0.6;
a9e2aefa 214}
c33d9661 215
a9e2aefa 216
217//___________________________________________
218AliMUONv1::AliMUONv1(const char *name, const char *title)
219 : AliMUON(name,title)
220{
221// Constructor
ba030c0e 222 // By default include all stations
223 fStations = new Int_t[5];
224 for (Int_t i=0; i<5; i++) fStations[i] = 1;
225
226 AliMUONFactory factory;
227 factory.Build(this, title);
c33d9661 228
229 fStepManagerVersionOld = kFALSE;
230 fStepMaxInActiveGas = 0.6;
a9e2aefa 231}
232
233//___________________________________________
234void AliMUONv1::CreateGeometry()
235{
236//
237// Note: all chambers have the same structure, which could be
238// easily parameterised. This was intentionally not done in order
239// to give a starting point for the implementation of the actual
240// design of each station.
241 Int_t *idtmed = fIdtmed->GetArray()-1099;
242
243// Distance between Stations
244//
245 Float_t bpar[3];
246 Float_t tpar[3];
b64652f5 247// Float_t pgpar[10];
a9e2aefa 248 Float_t zpos1, zpos2, zfpos;
b64652f5 249 // Outer excess and inner recess for mother volume radius
250 // with respect to ROuter and RInner
a9e2aefa 251 Float_t dframep=.001; // Value for station 3 should be 6 ...
b64652f5 252 // Width (RdPhi) of the frame crosses for stations 1 and 2 (cm)
253// Float_t dframep1=.001;
254 Float_t dframep1 = 11.0;
255// Bool_t frameCrosses=kFALSE;
256 Bool_t frameCrosses=kTRUE;
3f08857e 257 Float_t *dum=0;
a9e2aefa 258
b64652f5 259// Float_t dframez=0.9;
260 // Half of the total thickness of frame crosses (including DAlu)
261 // for each chamber in stations 1 and 2:
262 // 3% of X0 of composite material,
263 // but taken as Aluminium here, with same thickness in number of X0
264 Float_t dframez = 3. * 8.9 / 100;
265// Float_t dr;
a9e2aefa 266 Float_t dstation;
267
268//
269// Rotation matrices in the x-y plane
270 Int_t idrotm[1199];
271// phi= 0 deg
272 AliMatrix(idrotm[1100], 90., 0., 90., 90., 0., 0.);
273// phi= 90 deg
274 AliMatrix(idrotm[1101], 90., 90., 90., 180., 0., 0.);
275// phi= 180 deg
276 AliMatrix(idrotm[1102], 90., 180., 90., 270., 0., 0.);
277// phi= 270 deg
278 AliMatrix(idrotm[1103], 90., 270., 90., 0., 0., 0.);
279//
280 Float_t phi=2*TMath::Pi()/12/2;
281
282//
283// pointer to the current chamber
284// pointer to the current chamber
b64652f5 285 Int_t idAlu1=idtmed[1103]; // medium 4
286 Int_t idAlu2=idtmed[1104]; // medium 5
a9e2aefa 287// Int_t idAlu1=idtmed[1100];
288// Int_t idAlu2=idtmed[1100];
b64652f5 289 Int_t idAir=idtmed[1100]; // medium 1
290// Int_t idGas=idtmed[1105]; // medium 6 = Ar-isoC4H10 gas
291 Int_t idGas=idtmed[1108]; // medium 9 = Ar-CO2 gas (80%+20%)
a9e2aefa 292
293
294 AliMUONChamber *iChamber, *iChamber1, *iChamber2;
ba030c0e 295
296 if (fStations[0]) {
b17c0c87 297
a9e2aefa 298//********************************************************************
299// Station 1 **
300//********************************************************************
301// CONCENTRIC
302 // indices 1 and 2 for first and second chambers in the station
303 // iChamber (first chamber) kept for other quanties than Z,
304 // assumed to be the same in both chambers
305 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[0];
306 iChamber2 =(AliMUONChamber*) (*fChambers)[1];
307 zpos1=iChamber1->Z();
308 zpos2=iChamber2->Z();
309 dstation = zpos2 - zpos1;
b64652f5 310 // DGas decreased from standard one (0.5)
311 iChamber->SetDGas(0.4); iChamber2->SetDGas(0.4);
312 // DAlu increased from standard one (3% of X0),
313 // because more electronics with smaller pads
314 iChamber->SetDAlu(3.5 * 8.9 / 100.); iChamber2->SetDAlu(3.5 * 8.9 / 100.);
a9e2aefa 315 zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
316
317//
318// Mother volume
b64652f5 319 tpar[0] = iChamber->RInner()-dframep;
320 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
2c799aa2 321 tpar[2] = dstation/5;
a9e2aefa 322
b74f1c6a 323 gMC->Gsvolu("S01M", "TUBE", idAir, tpar, 3);
324 gMC->Gsvolu("S02M", "TUBE", idAir, tpar, 3);
325 gMC->Gspos("S01M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
326 gMC->Gspos("S02M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
b64652f5 327// // Aluminium frames
328// // Outer frames
329// pgpar[0] = 360/12/2;
330// pgpar[1] = 360.;
331// pgpar[2] = 12.;
332// pgpar[3] = 2;
333// pgpar[4] = -dframez/2;
334// pgpar[5] = iChamber->ROuter();
335// pgpar[6] = pgpar[5]+dframep1;
336// pgpar[7] = +dframez/2;
337// pgpar[8] = pgpar[5];
338// pgpar[9] = pgpar[6];
b74f1c6a 339// gMC->Gsvolu("S01O", "PGON", idAlu1, pgpar, 10);
340// gMC->Gsvolu("S02O", "PGON", idAlu1, pgpar, 10);
341// gMC->Gspos("S01O",1,"S01M", 0.,0.,-zfpos, 0,"ONLY");
342// gMC->Gspos("S01O",2,"S01M", 0.,0.,+zfpos, 0,"ONLY");
343// gMC->Gspos("S02O",1,"S02M", 0.,0.,-zfpos, 0,"ONLY");
344// gMC->Gspos("S02O",2,"S02M", 0.,0.,+zfpos, 0,"ONLY");
b64652f5 345// //
346// // Inner frame
347// tpar[0]= iChamber->RInner()-dframep1;
348// tpar[1]= iChamber->RInner();
349// tpar[2]= dframez/2;
b74f1c6a 350// gMC->Gsvolu("S01I", "TUBE", idAlu1, tpar, 3);
351// gMC->Gsvolu("S02I", "TUBE", idAlu1, tpar, 3);
b64652f5 352
b74f1c6a 353// gMC->Gspos("S01I",1,"S01M", 0.,0.,-zfpos, 0,"ONLY");
354// gMC->Gspos("S01I",2,"S01M", 0.,0.,+zfpos, 0,"ONLY");
355// gMC->Gspos("S02I",1,"S02M", 0.,0.,-zfpos, 0,"ONLY");
356// gMC->Gspos("S02I",2,"S02M", 0.,0.,+zfpos, 0,"ONLY");
a9e2aefa 357//
358// Frame Crosses
b64652f5 359 if (frameCrosses) {
360 // outside gas
361 // security for inside mother volume
362 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
363 * TMath::Cos(TMath::ASin(dframep1 /
364 (iChamber->ROuter() - iChamber->RInner())))
365 / 2.0;
a9e2aefa 366 bpar[1] = dframep1/2;
b64652f5 367 // total thickness will be (4 * bpar[2]) for each chamber,
368 // which has to be equal to (2 * dframez) - DAlu
369 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
b74f1c6a 370 gMC->Gsvolu("S01B", "BOX", idAlu1, bpar, 3);
371 gMC->Gsvolu("S02B", "BOX", idAlu1, bpar, 3);
a9e2aefa 372
b74f1c6a 373 gMC->Gspos("S01B",1,"S01M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 374 idrotm[1100],"ONLY");
b74f1c6a 375 gMC->Gspos("S01B",2,"S01M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 376 idrotm[1100],"ONLY");
b74f1c6a 377 gMC->Gspos("S01B",3,"S01M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 378 idrotm[1101],"ONLY");
b74f1c6a 379 gMC->Gspos("S01B",4,"S01M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 380 idrotm[1101],"ONLY");
b74f1c6a 381 gMC->Gspos("S01B",5,"S01M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
a9e2aefa 382 idrotm[1100],"ONLY");
b74f1c6a 383 gMC->Gspos("S01B",6,"S01M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
a9e2aefa 384 idrotm[1100],"ONLY");
b74f1c6a 385 gMC->Gspos("S01B",7,"S01M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
a9e2aefa 386 idrotm[1101],"ONLY");
b74f1c6a 387 gMC->Gspos("S01B",8,"S01M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
a9e2aefa 388 idrotm[1101],"ONLY");
389
b74f1c6a 390 gMC->Gspos("S02B",1,"S02M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 391 idrotm[1100],"ONLY");
b74f1c6a 392 gMC->Gspos("S02B",2,"S02M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 393 idrotm[1100],"ONLY");
b74f1c6a 394 gMC->Gspos("S02B",3,"S02M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 395 idrotm[1101],"ONLY");
b74f1c6a 396 gMC->Gspos("S02B",4,"S02M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 397 idrotm[1101],"ONLY");
b74f1c6a 398 gMC->Gspos("S02B",5,"S02M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
a9e2aefa 399 idrotm[1100],"ONLY");
b74f1c6a 400 gMC->Gspos("S02B",6,"S02M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
a9e2aefa 401 idrotm[1100],"ONLY");
b74f1c6a 402 gMC->Gspos("S02B",7,"S02M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
a9e2aefa 403 idrotm[1101],"ONLY");
b74f1c6a 404 gMC->Gspos("S02B",8,"S02M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
a9e2aefa 405 idrotm[1101],"ONLY");
406 }
407//
408// Chamber Material represented by Alu sheet
409 tpar[0]= iChamber->RInner();
410 tpar[1]= iChamber->ROuter();
411 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
b74f1c6a 412 gMC->Gsvolu("S01A", "TUBE", idAlu2, tpar, 3);
413 gMC->Gsvolu("S02A", "TUBE",idAlu2, tpar, 3);
414 gMC->Gspos("S01A", 1, "S01M", 0., 0., 0., 0, "ONLY");
415 gMC->Gspos("S02A", 1, "S02M", 0., 0., 0., 0, "ONLY");
a9e2aefa 416//
417// Sensitive volumes
418 // tpar[2] = iChamber->DGas();
419 tpar[2] = iChamber->DGas()/2;
b74f1c6a 420 gMC->Gsvolu("S01G", "TUBE", idGas, tpar, 3);
421 gMC->Gsvolu("S02G", "TUBE", idGas, tpar, 3);
422 gMC->Gspos("S01G", 1, "S01A", 0., 0., 0., 0, "ONLY");
423 gMC->Gspos("S02G", 1, "S02A", 0., 0., 0., 0, "ONLY");
a9e2aefa 424//
b64652f5 425// Frame Crosses to be placed inside gas
426 // NONE: chambers are sensitive everywhere
427// if (frameCrosses) {
428
429// dr = (iChamber->ROuter() - iChamber->RInner());
430// bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
431// bpar[1] = dframep1/2;
432// bpar[2] = iChamber->DGas()/2;
b74f1c6a 433// gMC->Gsvolu("S01F", "BOX", idAlu1, bpar, 3);
434// gMC->Gsvolu("S02F", "BOX", idAlu1, bpar, 3);
a9e2aefa 435
b74f1c6a 436// gMC->Gspos("S01F",1,"S01G", +iChamber->RInner()+bpar[0] , 0, 0,
b64652f5 437// idrotm[1100],"ONLY");
b74f1c6a 438// gMC->Gspos("S01F",2,"S01G", -iChamber->RInner()-bpar[0] , 0, 0,
b64652f5 439// idrotm[1100],"ONLY");
b74f1c6a 440// gMC->Gspos("S01F",3,"S01G", 0, +iChamber->RInner()+bpar[0] , 0,
b64652f5 441// idrotm[1101],"ONLY");
b74f1c6a 442// gMC->Gspos("S01F",4,"S01G", 0, -iChamber->RInner()-bpar[0] , 0,
b64652f5 443// idrotm[1101],"ONLY");
a9e2aefa 444
b74f1c6a 445// gMC->Gspos("S02F",1,"S02G", +iChamber->RInner()+bpar[0] , 0, 0,
b64652f5 446// idrotm[1100],"ONLY");
b74f1c6a 447// gMC->Gspos("S02F",2,"S02G", -iChamber->RInner()-bpar[0] , 0, 0,
b64652f5 448// idrotm[1100],"ONLY");
b74f1c6a 449// gMC->Gspos("S02F",3,"S02G", 0, +iChamber->RInner()+bpar[0] , 0,
b64652f5 450// idrotm[1101],"ONLY");
b74f1c6a 451// gMC->Gspos("S02F",4,"S02G", 0, -iChamber->RInner()-bpar[0] , 0,
b64652f5 452// idrotm[1101],"ONLY");
453// }
b17c0c87 454 }
ba030c0e 455 if (fStations[1]) {
b17c0c87 456
a9e2aefa 457//********************************************************************
458// Station 2 **
459//********************************************************************
460 // indices 1 and 2 for first and second chambers in the station
461 // iChamber (first chamber) kept for other quanties than Z,
462 // assumed to be the same in both chambers
463 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[2];
464 iChamber2 =(AliMUONChamber*) (*fChambers)[3];
465 zpos1=iChamber1->Z();
466 zpos2=iChamber2->Z();
467 dstation = zpos2 - zpos1;
b64652f5 468 // DGas and DAlu not changed from standard values
a9e2aefa 469 zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2;
470
471//
472// Mother volume
473 tpar[0] = iChamber->RInner()-dframep;
474 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
2c799aa2 475 tpar[2] = dstation/5;
a9e2aefa 476
b74f1c6a 477 gMC->Gsvolu("S03M", "TUBE", idAir, tpar, 3);
478 gMC->Gsvolu("S04M", "TUBE", idAir, tpar, 3);
479 gMC->Gspos("S03M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
480 gMC->Gspos("S04M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
03da3c56 481 gMC->Gsbool("S03M", "L3DO");
482 gMC->Gsbool("S03M", "L3O1");
483 gMC->Gsbool("S03M", "L3O2");
484 gMC->Gsbool("S04M", "L3DO");
485 gMC->Gsbool("S04M", "L3O1");
486 gMC->Gsbool("S04M", "L3O2");
1e8fff9c 487
b64652f5 488// // Aluminium frames
489// // Outer frames
490// pgpar[0] = 360/12/2;
491// pgpar[1] = 360.;
492// pgpar[2] = 12.;
493// pgpar[3] = 2;
494// pgpar[4] = -dframez/2;
495// pgpar[5] = iChamber->ROuter();
496// pgpar[6] = pgpar[5]+dframep;
497// pgpar[7] = +dframez/2;
498// pgpar[8] = pgpar[5];
499// pgpar[9] = pgpar[6];
b74f1c6a 500// gMC->Gsvolu("S03O", "PGON", idAlu1, pgpar, 10);
501// gMC->Gsvolu("S04O", "PGON", idAlu1, pgpar, 10);
502// gMC->Gspos("S03O",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
503// gMC->Gspos("S03O",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
504// gMC->Gspos("S04O",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
505// gMC->Gspos("S04O",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
b64652f5 506// //
507// // Inner frame
508// tpar[0]= iChamber->RInner()-dframep;
509// tpar[1]= iChamber->RInner();
510// tpar[2]= dframez/2;
b74f1c6a 511// gMC->Gsvolu("S03I", "TUBE", idAlu1, tpar, 3);
512// gMC->Gsvolu("S04I", "TUBE", idAlu1, tpar, 3);
b64652f5 513
b74f1c6a 514// gMC->Gspos("S03I",1,"S03M", 0.,0.,-zfpos, 0,"ONLY");
515// gMC->Gspos("S03I",2,"S03M", 0.,0.,+zfpos, 0,"ONLY");
516// gMC->Gspos("S04I",1,"S04M", 0.,0.,-zfpos, 0,"ONLY");
517// gMC->Gspos("S04I",2,"S04M", 0.,0.,+zfpos, 0,"ONLY");
a9e2aefa 518//
519// Frame Crosses
b64652f5 520 if (frameCrosses) {
521 // outside gas
522 // security for inside mother volume
523 bpar[0] = (iChamber->ROuter() - iChamber->RInner())
524 * TMath::Cos(TMath::ASin(dframep1 /
525 (iChamber->ROuter() - iChamber->RInner())))
526 / 2.0;
527 bpar[1] = dframep1/2;
528 // total thickness will be (4 * bpar[2]) for each chamber,
529 // which has to be equal to (2 * dframez) - DAlu
530 bpar[2] = (2.0 * dframez - iChamber->DAlu()) / 4.0;
b74f1c6a 531 gMC->Gsvolu("S03B", "BOX", idAlu1, bpar, 3);
532 gMC->Gsvolu("S04B", "BOX", idAlu1, bpar, 3);
a9e2aefa 533
b74f1c6a 534 gMC->Gspos("S03B",1,"S03M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 535 idrotm[1100],"ONLY");
b74f1c6a 536 gMC->Gspos("S03B",2,"S03M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 537 idrotm[1100],"ONLY");
b74f1c6a 538 gMC->Gspos("S03B",3,"S03M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 539 idrotm[1101],"ONLY");
b74f1c6a 540 gMC->Gspos("S03B",4,"S03M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 541 idrotm[1101],"ONLY");
b74f1c6a 542 gMC->Gspos("S03B",5,"S03M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
a9e2aefa 543 idrotm[1100],"ONLY");
b74f1c6a 544 gMC->Gspos("S03B",6,"S03M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
a9e2aefa 545 idrotm[1100],"ONLY");
b74f1c6a 546 gMC->Gspos("S03B",7,"S03M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
a9e2aefa 547 idrotm[1101],"ONLY");
b74f1c6a 548 gMC->Gspos("S03B",8,"S03M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
a9e2aefa 549 idrotm[1101],"ONLY");
550
b74f1c6a 551 gMC->Gspos("S04B",1,"S04M", +iChamber->RInner()+bpar[0] , 0,-zfpos,
a9e2aefa 552 idrotm[1100],"ONLY");
b74f1c6a 553 gMC->Gspos("S04B",2,"S04M", -iChamber->RInner()-bpar[0] , 0,-zfpos,
a9e2aefa 554 idrotm[1100],"ONLY");
b74f1c6a 555 gMC->Gspos("S04B",3,"S04M", 0, +iChamber->RInner()+bpar[0] ,-zfpos,
a9e2aefa 556 idrotm[1101],"ONLY");
b74f1c6a 557 gMC->Gspos("S04B",4,"S04M", 0, -iChamber->RInner()-bpar[0] ,-zfpos,
a9e2aefa 558 idrotm[1101],"ONLY");
b74f1c6a 559 gMC->Gspos("S04B",5,"S04M", +iChamber->RInner()+bpar[0] , 0,+zfpos,
a9e2aefa 560 idrotm[1100],"ONLY");
b74f1c6a 561 gMC->Gspos("S04B",6,"S04M", -iChamber->RInner()-bpar[0] , 0,+zfpos,
a9e2aefa 562 idrotm[1100],"ONLY");
b74f1c6a 563 gMC->Gspos("S04B",7,"S04M", 0, +iChamber->RInner()+bpar[0] ,+zfpos,
a9e2aefa 564 idrotm[1101],"ONLY");
b74f1c6a 565 gMC->Gspos("S04B",8,"S04M", 0, -iChamber->RInner()-bpar[0] ,+zfpos,
a9e2aefa 566 idrotm[1101],"ONLY");
567 }
568//
569// Chamber Material represented by Alu sheet
570 tpar[0]= iChamber->RInner();
571 tpar[1]= iChamber->ROuter();
572 tpar[2] = (iChamber->DGas()+iChamber->DAlu())/2;
b74f1c6a 573 gMC->Gsvolu("S03A", "TUBE", idAlu2, tpar, 3);
574 gMC->Gsvolu("S04A", "TUBE", idAlu2, tpar, 3);
575 gMC->Gspos("S03A", 1, "S03M", 0., 0., 0., 0, "ONLY");
576 gMC->Gspos("S04A", 1, "S04M", 0., 0., 0., 0, "ONLY");
a9e2aefa 577//
578// Sensitive volumes
579 // tpar[2] = iChamber->DGas();
580 tpar[2] = iChamber->DGas()/2;
b74f1c6a 581 gMC->Gsvolu("S03G", "TUBE", idGas, tpar, 3);
582 gMC->Gsvolu("S04G", "TUBE", idGas, tpar, 3);
583 gMC->Gspos("S03G", 1, "S03A", 0., 0., 0., 0, "ONLY");
584 gMC->Gspos("S04G", 1, "S04A", 0., 0., 0., 0, "ONLY");
a9e2aefa 585//
586// Frame Crosses to be placed inside gas
b64652f5 587 // NONE: chambers are sensitive everywhere
588// if (frameCrosses) {
589
590// dr = (iChamber->ROuter() - iChamber->RInner());
591// bpar[0] = TMath::Sqrt(dr*dr-dframep1*dframep1/4)/2;
592// bpar[1] = dframep1/2;
593// bpar[2] = iChamber->DGas()/2;
b74f1c6a 594// gMC->Gsvolu("S03F", "BOX", idAlu1, bpar, 3);
595// gMC->Gsvolu("S04F", "BOX", idAlu1, bpar, 3);
a9e2aefa 596
b74f1c6a 597// gMC->Gspos("S03F",1,"S03G", +iChamber->RInner()+bpar[0] , 0, 0,
b64652f5 598// idrotm[1100],"ONLY");
b74f1c6a 599// gMC->Gspos("S03F",2,"S03G", -iChamber->RInner()-bpar[0] , 0, 0,
b64652f5 600// idrotm[1100],"ONLY");
b74f1c6a 601// gMC->Gspos("S03F",3,"S03G", 0, +iChamber->RInner()+bpar[0] , 0,
b64652f5 602// idrotm[1101],"ONLY");
b74f1c6a 603// gMC->Gspos("S03F",4,"S03G", 0, -iChamber->RInner()-bpar[0] , 0,
b64652f5 604// idrotm[1101],"ONLY");
a9e2aefa 605
b74f1c6a 606// gMC->Gspos("S04F",1,"S04G", +iChamber->RInner()+bpar[0] , 0, 0,
b64652f5 607// idrotm[1100],"ONLY");
b74f1c6a 608// gMC->Gspos("S04F",2,"S04G", -iChamber->RInner()-bpar[0] , 0, 0,
b64652f5 609// idrotm[1100],"ONLY");
b74f1c6a 610// gMC->Gspos("S04F",3,"S04G", 0, +iChamber->RInner()+bpar[0] , 0,
b64652f5 611// idrotm[1101],"ONLY");
b74f1c6a 612// gMC->Gspos("S04F",4,"S04G", 0, -iChamber->RInner()-bpar[0] , 0,
b64652f5 613// idrotm[1101],"ONLY");
614// }
b17c0c87 615 }
1e8fff9c 616 // define the id of tracking media:
617 Int_t idCopper = idtmed[1110];
618 Int_t idGlass = idtmed[1111];
619 Int_t idCarbon = idtmed[1112];
620 Int_t idRoha = idtmed[1113];
621
1e8fff9c 622 // sensitive area: 40*40 cm**2
6c5ddcfa 623 const Float_t sensLength = 40.;
624 const Float_t sensHeight = 40.;
625 const Float_t sensWidth = 0.5; // according to TDR fig 2.120
626 const Int_t sensMaterial = idGas;
1e8fff9c 627 const Float_t yOverlap = 1.5;
628
629 // PCB dimensions in cm; width: 30 mum copper
6c5ddcfa 630 const Float_t pcbLength = sensLength;
631 const Float_t pcbHeight = 60.;
632 const Float_t pcbWidth = 0.003;
633 const Int_t pcbMaterial = idCopper;
1e8fff9c 634
635 // Insulating material: 200 mum glass fiber glued to pcb
6c5ddcfa 636 const Float_t insuLength = pcbLength;
637 const Float_t insuHeight = pcbHeight;
638 const Float_t insuWidth = 0.020;
639 const Int_t insuMaterial = idGlass;
1e8fff9c 640
641 // Carbon fiber panels: 200mum carbon/epoxy skin
6c5ddcfa 642 const Float_t panelLength = sensLength;
643 const Float_t panelHeight = sensHeight;
644 const Float_t panelWidth = 0.020;
645 const Int_t panelMaterial = idCarbon;
1e8fff9c 646
647 // rohacell between the two carbon panels
6c5ddcfa 648 const Float_t rohaLength = sensLength;
649 const Float_t rohaHeight = sensHeight;
650 const Float_t rohaWidth = 0.5;
651 const Int_t rohaMaterial = idRoha;
1e8fff9c 652
653 // Frame around the slat: 2 sticks along length,2 along height
654 // H: the horizontal ones
6c5ddcfa 655 const Float_t hFrameLength = pcbLength;
656 const Float_t hFrameHeight = 1.5;
657 const Float_t hFrameWidth = sensWidth;
658 const Int_t hFrameMaterial = idGlass;
1e8fff9c 659
660 // V: the vertical ones
6c5ddcfa 661 const Float_t vFrameLength = 4.0;
662 const Float_t vFrameHeight = sensHeight + hFrameHeight;
663 const Float_t vFrameWidth = sensWidth;
664 const Int_t vFrameMaterial = idGlass;
1e8fff9c 665
666 // B: the horizontal border filled with rohacell
6c5ddcfa 667 const Float_t bFrameLength = hFrameLength;
668 const Float_t bFrameHeight = (pcbHeight - sensHeight)/2. - hFrameHeight;
669 const Float_t bFrameWidth = hFrameWidth;
670 const Int_t bFrameMaterial = idRoha;
1e8fff9c 671
672 // NULOC: 30 mum copper + 200 mum vetronite (same radiation length as 14mum copper)
6c5ddcfa 673 const Float_t nulocLength = 2.5;
674 const Float_t nulocHeight = 7.5;
675 const Float_t nulocWidth = 0.0030 + 0.0014; // equivalent copper width of vetronite;
676 const Int_t nulocMaterial = idCopper;
1e8fff9c 677
6c5ddcfa 678 const Float_t slatHeight = pcbHeight;
679 const Float_t slatWidth = sensWidth + 2.*(pcbWidth + insuWidth +
680 2.* panelWidth + rohaWidth);
681 const Int_t slatMaterial = idAir;
682 const Float_t dSlatLength = vFrameLength; // border on left and right
1e8fff9c 683
1e8fff9c 684 Float_t spar[3];
b17c0c87 685 Int_t i, j;
686
3c084d9f 687 // the panel volume contains the rohacell
688
689 Float_t twidth = 2 * panelWidth + rohaWidth;
690 Float_t panelpar[3] = { panelLength/2., panelHeight/2., twidth/2. };
b17c0c87 691 Float_t rohapar[3] = { rohaLength/2., rohaHeight/2., rohaWidth/2. };
3c084d9f 692
693 // insulating material contains PCB-> gas-> 2 borders filled with rohacell
694
695 twidth = 2*(insuWidth + pcbWidth) + sensWidth;
696 Float_t insupar[3] = { insuLength/2., insuHeight/2., twidth/2. };
697 twidth -= 2 * insuWidth;
698 Float_t pcbpar[3] = { pcbLength/2., pcbHeight/2., twidth/2. };
699 Float_t senspar[3] = { sensLength/2., sensHeight/2., sensWidth/2. };
700 Float_t theight = 2*hFrameHeight + sensHeight;
701 Float_t hFramepar[3]={hFrameLength/2., theight/2., hFrameWidth/2.};
b17c0c87 702 Float_t bFramepar[3]={bFrameLength/2., bFrameHeight/2., bFrameWidth/2.};
3c084d9f 703 Float_t vFramepar[3]={vFrameLength/2., vFrameHeight/2., vFrameWidth/2.};
b17c0c87 704 Float_t nulocpar[3]={nulocLength/2., nulocHeight/2., nulocWidth/2.};
b17c0c87 705 Float_t xx;
706 Float_t xxmax = (bFrameLength - nulocLength)/2.;
707 Int_t index=0;
708
ba030c0e 709 if (fStations[2]) {
b17c0c87 710
711//********************************************************************
712// Station 3 **
713//********************************************************************
714 // indices 1 and 2 for first and second chambers in the station
715 // iChamber (first chamber) kept for other quanties than Z,
716 // assumed to be the same in both chambers
717 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[4];
718 iChamber2 =(AliMUONChamber*) (*fChambers)[5];
719 zpos1=iChamber1->Z();
720 zpos2=iChamber2->Z();
721 dstation = zpos2 - zpos1;
722
b64652f5 723// zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
b17c0c87 724//
725// Mother volume
726 tpar[0] = iChamber->RInner()-dframep;
727 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
21a18f36 728 tpar[2] = dstation/5;
2724ae40 729
b74f1c6a 730 char *slats5Mother = "S05M";
731 char *slats6Mother = "S06M";
2724ae40 732 Float_t zoffs5 = 0;
733 Float_t zoffs6 = 0;
734
fe713e43 735 if (gAlice->GetModule("DIPO")) {
2724ae40 736 slats5Mother="DDIP";
737 slats6Mother="DDIP";
738
739 zoffs5 = zpos1;
740 zoffs6 = zpos2;
741 }
742 else {
b74f1c6a 743 gMC->Gsvolu("S05M", "TUBE", idAir, tpar, 3);
744 gMC->Gsvolu("S06M", "TUBE", idAir, tpar, 3);
745 gMC->Gspos("S05M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
746 gMC->Gspos("S06M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
2724ae40 747 }
748
b17c0c87 749 // volumes for slat geometry (xx=5,..,10 chamber id):
750 // Sxx0 Sxx1 Sxx2 Sxx3 --> Slat Mother volumes
751 // SxxG --> Sensitive volume (gas)
752 // SxxP --> PCB (copper)
753 // SxxI --> Insulator (vetronite)
754 // SxxC --> Carbon panel
755 // SxxR --> Rohacell
756 // SxxH, SxxV --> Horizontal and Vertical frames (vetronite)
21a18f36 757 // SB5x --> Volumes for the 35 cm long PCB
b17c0c87 758 // slat dimensions: slat is a MOTHER volume!!! made of air
759
21a18f36 760 // only for chamber 5: slat 1 has a PCB shorter by 5cm!
761
762 Float_t tlength = 35.;
763 Float_t panelpar2[3] = { tlength/2., panelpar[1], panelpar[2]};
764 Float_t rohapar2[3] = { tlength/2., rohapar[1], rohapar[2]};
765 Float_t insupar2[3] = { tlength/2., insupar[1], insupar[2]};
766 Float_t pcbpar2[3] = { tlength/2., pcbpar[1], pcbpar[2]};
767 Float_t senspar2[3] = { tlength/2., senspar[1], senspar[2]};
768 Float_t hFramepar2[3] = { tlength/2., hFramepar[1], hFramepar[2]};
769 Float_t bFramepar2[3] = { tlength/2., bFramepar[1], bFramepar[2]};
770
a083207d 771 const Int_t nSlats3 = 5; // number of slats per quadrant
772 const Int_t nPCB3[nSlats3] = {3,3,4,3,2}; // n PCB per slat
21a18f36 773 const Float_t xpos3[nSlats3] = {31., 40., 0., 0., 0.};
b17c0c87 774 Float_t slatLength3[nSlats3];
775
776 // create and position the slat (mother) volumes
777
6c5ddcfa 778 char volNam5[5];
779 char volNam6[5];
f9f7c205 780 Float_t xSlat3;
b17c0c87 781
21a18f36 782 Float_t spar2[3];
6c5ddcfa 783 for (i = 0; i<nSlats3; i++){
3c084d9f 784 slatLength3[i] = pcbLength * nPCB3[i] + 2. * dSlatLength;
a083207d 785 xSlat3 = slatLength3[i]/2. - vFrameLength/2. + xpos3[i];
21a18f36 786 if (i==1 || i==0) slatLength3[i] -= 2. *dSlatLength; // frame out in PCB with circular border
a083207d 787 Float_t ySlat31 = sensHeight * i - yOverlap * i;
788 Float_t ySlat32 = -sensHeight * i + yOverlap * i;
3c084d9f 789 spar[0] = slatLength3[i]/2.;
790 spar[1] = slatHeight/2.;
791 spar[2] = slatWidth/2. * 1.01;
21a18f36 792 // take away 5 cm from the first slat in chamber 5
793 Float_t xSlat32 = 0;
794 if (i==1 || i==2) { // 1 pcb is shortened by 5cm
795 spar2[0] = spar[0]-5./2.;
796 xSlat32 = xSlat3 - 5/2.;
797 }
798 else {
799 spar2[0] = spar[0];
800 xSlat32 = xSlat3;
801 }
802 spar2[1] = spar[1];
803 spar2[2] = spar[2];
3c084d9f 804 Float_t dzCh3=spar[2] * 1.01;
805 // zSlat to be checked (odd downstream or upstream?)
806 Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2];
807 sprintf(volNam5,"S05%d",i);
21a18f36 808 gMC->Gsvolu(volNam5,"BOX",slatMaterial,spar2,3);
2724ae40 809 gMC->Gspos(volNam5, i*4+1,slats5Mother, xSlat32, ySlat31, zoffs5+zSlat+2.*dzCh3, 0, "ONLY");
810 gMC->Gspos(volNam5, i*4+2,slats5Mother,-xSlat32, ySlat31, zoffs5+zSlat-2.*dzCh3, 0, "ONLY");
21a18f36 811
a083207d 812 if (i>0) {
2724ae40 813 gMC->Gspos(volNam5, i*4+3,slats5Mother, xSlat32, ySlat32, zoffs5+zSlat+2.*dzCh3, 0, "ONLY");
814 gMC->Gspos(volNam5, i*4+4,slats5Mother,-xSlat32, ySlat32, zoffs5+zSlat-2.*dzCh3, 0, "ONLY");
a083207d 815 }
3c084d9f 816 sprintf(volNam6,"S06%d",i);
817 gMC->Gsvolu(volNam6,"BOX",slatMaterial,spar,3);
2724ae40 818 gMC->Gspos(volNam6, i*4+1,slats6Mother, xSlat3, ySlat31, zoffs6+zSlat+2.*dzCh3, 0, "ONLY");
819 gMC->Gspos(volNam6, i*4+2,slats6Mother,-xSlat3, ySlat31, zoffs6+zSlat-2.*dzCh3, 0, "ONLY");
a083207d 820 if (i>0) {
2724ae40 821 gMC->Gspos(volNam6, i*4+3,slats6Mother, xSlat3, ySlat32, zoffs6+zSlat+2.*dzCh3, 0, "ONLY");
822 gMC->Gspos(volNam6, i*4+4,slats6Mother,-xSlat3, ySlat32, zoffs6+zSlat-2.*dzCh3, 0, "ONLY");
a083207d 823 }
3c084d9f 824 }
1e8fff9c 825
826 // create the panel volume
b17c0c87 827
6c5ddcfa 828 gMC->Gsvolu("S05C","BOX",panelMaterial,panelpar,3);
21a18f36 829 gMC->Gsvolu("SB5C","BOX",panelMaterial,panelpar2,3);
6c5ddcfa 830 gMC->Gsvolu("S06C","BOX",panelMaterial,panelpar,3);
1e8fff9c 831
832 // create the rohacell volume
b17c0c87 833
6c5ddcfa 834 gMC->Gsvolu("S05R","BOX",rohaMaterial,rohapar,3);
21a18f36 835 gMC->Gsvolu("SB5R","BOX",rohaMaterial,rohapar2,3);
6c5ddcfa 836 gMC->Gsvolu("S06R","BOX",rohaMaterial,rohapar,3);
1e8fff9c 837
3c084d9f 838 // create the insulating material volume
839
840 gMC->Gsvolu("S05I","BOX",insuMaterial,insupar,3);
21a18f36 841 gMC->Gsvolu("SB5I","BOX",insuMaterial,insupar2,3);
3c084d9f 842 gMC->Gsvolu("S06I","BOX",insuMaterial,insupar,3);
843
844 // create the PCB volume
845
846 gMC->Gsvolu("S05P","BOX",pcbMaterial,pcbpar,3);
21a18f36 847 gMC->Gsvolu("SB5P","BOX",pcbMaterial,pcbpar2,3);
3c084d9f 848 gMC->Gsvolu("S06P","BOX",pcbMaterial,pcbpar,3);
849
850 // create the sensitive volumes,
3f08857e 851 gMC->Gsvolu("S05G","BOX",sensMaterial,dum,0);
852 gMC->Gsvolu("S06G","BOX",sensMaterial,dum,0);
3c084d9f 853
854
1e8fff9c 855 // create the vertical frame volume
b17c0c87 856
6c5ddcfa 857 gMC->Gsvolu("S05V","BOX",vFrameMaterial,vFramepar,3);
858 gMC->Gsvolu("S06V","BOX",vFrameMaterial,vFramepar,3);
1e8fff9c 859
860 // create the horizontal frame volume
b17c0c87 861
6c5ddcfa 862 gMC->Gsvolu("S05H","BOX",hFrameMaterial,hFramepar,3);
21a18f36 863 gMC->Gsvolu("SB5H","BOX",hFrameMaterial,hFramepar2,3);
6c5ddcfa 864 gMC->Gsvolu("S06H","BOX",hFrameMaterial,hFramepar,3);
1e8fff9c 865
866 // create the horizontal border volume
b17c0c87 867
6c5ddcfa 868 gMC->Gsvolu("S05B","BOX",bFrameMaterial,bFramepar,3);
21a18f36 869 gMC->Gsvolu("SB5B","BOX",bFrameMaterial,bFramepar2,3);
6c5ddcfa 870 gMC->Gsvolu("S06B","BOX",bFrameMaterial,bFramepar,3);
1e8fff9c 871
b17c0c87 872 index=0;
6c5ddcfa 873 for (i = 0; i<nSlats3; i++){
874 sprintf(volNam5,"S05%d",i);
875 sprintf(volNam6,"S06%d",i);
f9f7c205 876 Float_t xvFrame = (slatLength3[i] - vFrameLength)/2.;
21a18f36 877 Float_t xvFrame2 = xvFrame;
878 if ( i==1 || i ==2 ) xvFrame2 -= 5./2.;
3c084d9f 879 // position the vertical frames
21a18f36 880 if (i!=1 && i!=0) {
881 gMC->Gspos("S05V",2*i-1,volNam5, xvFrame2, 0., 0. , 0, "ONLY");
882 gMC->Gspos("S05V",2*i ,volNam5,-xvFrame2, 0., 0. , 0, "ONLY");
3c084d9f 883 gMC->Gspos("S06V",2*i-1,volNam6, xvFrame, 0., 0. , 0, "ONLY");
884 gMC->Gspos("S06V",2*i ,volNam6,-xvFrame, 0., 0. , 0, "ONLY");
885 }
886 // position the panels and the insulating material
6c5ddcfa 887 for (j=0; j<nPCB3[i]; j++){
1e8fff9c 888 index++;
6c5ddcfa 889 Float_t xx = sensLength * (-nPCB3[i]/2.+j+.5);
21a18f36 890 Float_t xx2 = xx + 5/2.;
3c084d9f 891
892 Float_t zPanel = spar[2] - panelpar[2];
21a18f36 893 if ( (i==1 || i==2) && j == nPCB3[i]-1) { // 1 pcb is shortened by 5cm
894 gMC->Gspos("SB5C",2*index-1,volNam5, xx, 0., zPanel , 0, "ONLY");
895 gMC->Gspos("SB5C",2*index ,volNam5, xx, 0.,-zPanel , 0, "ONLY");
896 gMC->Gspos("SB5I",index ,volNam5, xx, 0., 0 , 0, "ONLY");
897 }
898 else if ( (i==1 || i==2) && j < nPCB3[i]-1) {
899 gMC->Gspos("S05C",2*index-1,volNam5, xx2, 0., zPanel , 0, "ONLY");
900 gMC->Gspos("S05C",2*index ,volNam5, xx2, 0.,-zPanel , 0, "ONLY");
901 gMC->Gspos("S05I",index ,volNam5, xx2, 0., 0 , 0, "ONLY");
902 }
903 else {
904 gMC->Gspos("S05C",2*index-1,volNam5, xx, 0., zPanel , 0, "ONLY");
905 gMC->Gspos("S05C",2*index ,volNam5, xx, 0.,-zPanel , 0, "ONLY");
906 gMC->Gspos("S05I",index ,volNam5, xx, 0., 0 , 0, "ONLY");
907 }
3c084d9f 908 gMC->Gspos("S06C",2*index-1,volNam6, xx, 0., zPanel , 0, "ONLY");
909 gMC->Gspos("S06C",2*index ,volNam6, xx, 0.,-zPanel , 0, "ONLY");
3c084d9f 910 gMC->Gspos("S06I",index,volNam6, xx, 0., 0 , 0, "ONLY");
1e8fff9c 911 }
a9e2aefa 912 }
21a18f36 913
3c084d9f 914 // position the rohacell volume inside the panel volume
915 gMC->Gspos("S05R",1,"S05C",0.,0.,0.,0,"ONLY");
21a18f36 916 gMC->Gspos("SB5R",1,"SB5C",0.,0.,0.,0,"ONLY");
3c084d9f 917 gMC->Gspos("S06R",1,"S06C",0.,0.,0.,0,"ONLY");
918
919 // position the PCB volume inside the insulating material volume
920 gMC->Gspos("S05P",1,"S05I",0.,0.,0.,0,"ONLY");
21a18f36 921 gMC->Gspos("SB5P",1,"SB5I",0.,0.,0.,0,"ONLY");
3c084d9f 922 gMC->Gspos("S06P",1,"S06I",0.,0.,0.,0,"ONLY");
923 // position the horizontal frame volume inside the PCB volume
924 gMC->Gspos("S05H",1,"S05P",0.,0.,0.,0,"ONLY");
21a18f36 925 gMC->Gspos("SB5H",1,"SB5P",0.,0.,0.,0,"ONLY");
3c084d9f 926 gMC->Gspos("S06H",1,"S06P",0.,0.,0.,0,"ONLY");
927 // position the sensitive volume inside the horizontal frame volume
928 gMC->Gsposp("S05G",1,"S05H",0.,0.,0.,0,"ONLY",senspar,3);
21a18f36 929 gMC->Gsposp("S05G",1,"SB5H",0.,0.,0.,0,"ONLY",senspar2,3);
3c084d9f 930 gMC->Gsposp("S06G",1,"S06H",0.,0.,0.,0,"ONLY",senspar,3);
931 // position the border volumes inside the PCB volume
932 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
933 gMC->Gspos("S05B",1,"S05P",0., yborder,0.,0,"ONLY");
934 gMC->Gspos("S05B",2,"S05P",0.,-yborder,0.,0,"ONLY");
21a18f36 935 gMC->Gspos("SB5B",1,"SB5P",0., yborder,0.,0,"ONLY");
936 gMC->Gspos("SB5B",2,"SB5P",0.,-yborder,0.,0,"ONLY");
3c084d9f 937 gMC->Gspos("S06B",1,"S06P",0., yborder,0.,0,"ONLY");
938 gMC->Gspos("S06B",2,"S06P",0.,-yborder,0.,0,"ONLY");
939
1e8fff9c 940 // create the NULOC volume and position it in the horizontal frame
b17c0c87 941
6c5ddcfa 942 gMC->Gsvolu("S05N","BOX",nulocMaterial,nulocpar,3);
943 gMC->Gsvolu("S06N","BOX",nulocMaterial,nulocpar,3);
6c5ddcfa 944 index = 0;
21a18f36 945 Float_t xxmax2 = xxmax - 5./2.;
946 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
1e8fff9c 947 index++;
6c5ddcfa 948 gMC->Gspos("S05N",2*index-1,"S05B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
949 gMC->Gspos("S05N",2*index ,"S05B", xx, 0., bFrameWidth/4., 0, "ONLY");
21a18f36 950 if (xx > -xxmax2 && xx< xxmax2) {
951 gMC->Gspos("S05N",2*index-1,"SB5B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
952 gMC->Gspos("S05N",2*index ,"SB5B", xx, 0., bFrameWidth/4., 0, "ONLY");
953 }
6c5ddcfa 954 gMC->Gspos("S06N",2*index-1,"S06B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
955 gMC->Gspos("S06N",2*index ,"S06B", xx, 0., bFrameWidth/4., 0, "ONLY");
1e8fff9c 956 }
3c084d9f 957
958 // position the volumes approximating the circular section of the pipe
a083207d 959 Float_t yoffs = sensHeight/2. - yOverlap;
3c084d9f 960 Float_t epsilon = 0.001;
961 Int_t ndiv=6;
962 Float_t divpar[3];
963 Double_t dydiv= sensHeight/ndiv;
21a18f36 964 Double_t ydiv = yoffs -dydiv;
3c084d9f 965 Int_t imax=0;
3c084d9f 966 imax = 1;
21a18f36 967 Float_t rmin = 33.;
a083207d 968 Float_t z1 = spar[2], z2=2*spar[2]*1.01;
3c084d9f 969 for (Int_t idiv=0;idiv<ndiv; idiv++){
970 ydiv+= dydiv;
425ebd0a 971 Float_t xdiv = 0.;
3c084d9f 972 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
973 divpar[0] = (pcbLength-xdiv)/2.;
974 divpar[1] = dydiv/2. - epsilon;
975 divpar[2] = sensWidth/2.;
425ebd0a 976 Float_t xvol=(pcbLength+xdiv)/2.+1.999;
a083207d 977 Float_t yvol=ydiv + dydiv/2.;
21a18f36 978 //printf ("y ll = %f y ur = %f \n",yvol - divpar[1], yvol + divpar[1]);
2724ae40 979 gMC->Gsposp("S05G",imax+4*idiv+1,slats5Mother, xvol, yvol, zoffs5+z1+z2, 0, "ONLY",divpar,3);
980 gMC->Gsposp("S06G",imax+4*idiv+1,slats6Mother, xvol, yvol, zoffs6+z1+z2, 0, "ONLY",divpar,3);
981 gMC->Gsposp("S05G",imax+4*idiv+2,slats5Mother, xvol,-yvol, zoffs5+z1+z2, 0, "ONLY",divpar,3);
982 gMC->Gsposp("S06G",imax+4*idiv+2,slats6Mother, xvol,-yvol, zoffs6+z1+z2, 0, "ONLY",divpar,3);
983 gMC->Gsposp("S05G",imax+4*idiv+3,slats5Mother,-xvol, yvol, zoffs5+z1-z2, 0, "ONLY",divpar,3);
984 gMC->Gsposp("S06G",imax+4*idiv+3,slats6Mother,-xvol, yvol, zoffs6+z1-z2, 0, "ONLY",divpar,3);
985 gMC->Gsposp("S05G",imax+4*idiv+4,slats5Mother,-xvol,-yvol, zoffs5+z1-z2, 0, "ONLY",divpar,3);
986 gMC->Gsposp("S06G",imax+4*idiv+4,slats6Mother,-xvol,-yvol, zoffs6+z1-z2, 0, "ONLY",divpar,3);
3c084d9f 987 }
b17c0c87 988 }
b17c0c87 989
ba030c0e 990 if (fStations[3]) {
3c084d9f 991
a9e2aefa 992//********************************************************************
993// Station 4 **
994//********************************************************************
995 // indices 1 and 2 for first and second chambers in the station
996 // iChamber (first chamber) kept for other quanties than Z,
997 // assumed to be the same in both chambers
998 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[6];
999 iChamber2 =(AliMUONChamber*) (*fChambers)[7];
1000 zpos1=iChamber1->Z();
1001 zpos2=iChamber2->Z();
1002 dstation = zpos2 - zpos1;
b64652f5 1003// zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
a9e2aefa 1004
1005//
1006// Mother volume
1007 tpar[0] = iChamber->RInner()-dframep;
1008 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
2724ae40 1009 tpar[2] = dstation/4;
a9e2aefa 1010
b74f1c6a 1011 gMC->Gsvolu("S07M", "TUBE", idAir, tpar, 3);
1012 gMC->Gsvolu("S08M", "TUBE", idAir, tpar, 3);
1013 gMC->Gspos("S07M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
1014 gMC->Gspos("S08M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
1e8fff9c 1015
a9e2aefa 1016
f9f7c205 1017 const Int_t nSlats4 = 6; // number of slats per quadrant
425ebd0a 1018 const Int_t nPCB4[nSlats4] = {4,4,5,5,4,3}; // n PCB per slat
21a18f36 1019 const Float_t xpos4[nSlats4] = {38.5, 40., 0., 0., 0., 0.};
6c5ddcfa 1020 Float_t slatLength4[nSlats4];
1e8fff9c 1021
1022 // create and position the slat (mother) volumes
1023
6c5ddcfa 1024 char volNam7[5];
1025 char volNam8[5];
1e8fff9c 1026 Float_t xSlat4;
f9f7c205 1027 Float_t ySlat4;
1e8fff9c 1028
6c5ddcfa 1029 for (i = 0; i<nSlats4; i++){
a083207d 1030 slatLength4[i] = pcbLength * nPCB4[i] + 2. * dSlatLength;
1031 xSlat4 = slatLength4[i]/2. - vFrameLength/2. + xpos4[i];
2724ae40 1032 if (i==1) slatLength4[i] -= 2. *dSlatLength; // frame out in PCB with circular border
a083207d 1033 ySlat4 = sensHeight * i - yOverlap *i;
1034
1035 spar[0] = slatLength4[i]/2.;
1036 spar[1] = slatHeight/2.;
1037 spar[2] = slatWidth/2.*1.01;
1038 Float_t dzCh4=spar[2]*1.01;
1039 // zSlat to be checked (odd downstream or upstream?)
1040 Float_t zSlat = (i%2 ==0)? spar[2] : -spar[2];
1041 sprintf(volNam7,"S07%d",i);
1042 gMC->Gsvolu(volNam7,"BOX",slatMaterial,spar,3);
b74f1c6a 1043 gMC->Gspos(volNam7, i*4+1,"S07M", xSlat4, ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
1044 gMC->Gspos(volNam7, i*4+2,"S07M",-xSlat4, ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
a083207d 1045 if (i>0) {
b74f1c6a 1046 gMC->Gspos(volNam7, i*4+3,"S07M", xSlat4,-ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
1047 gMC->Gspos(volNam7, i*4+4,"S07M",-xSlat4,-ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
a083207d 1048 }
1049 sprintf(volNam8,"S08%d",i);
1050 gMC->Gsvolu(volNam8,"BOX",slatMaterial,spar,3);
b74f1c6a 1051 gMC->Gspos(volNam8, i*4+1,"S08M", xSlat4, ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
1052 gMC->Gspos(volNam8, i*4+2,"S08M",-xSlat4, ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
a083207d 1053 if (i>0) {
b74f1c6a 1054 gMC->Gspos(volNam8, i*4+3,"S08M", xSlat4,-ySlat4, zSlat+2.*dzCh4, 0, "ONLY");
1055 gMC->Gspos(volNam8, i*4+4,"S08M",-xSlat4,-ySlat4, zSlat-2.*dzCh4, 0, "ONLY");
a083207d 1056 }
a9e2aefa 1057 }
a083207d 1058
3c084d9f 1059
1060 // create the panel volume
1e8fff9c 1061
3c084d9f 1062 gMC->Gsvolu("S07C","BOX",panelMaterial,panelpar,3);
1063 gMC->Gsvolu("S08C","BOX",panelMaterial,panelpar,3);
a9e2aefa 1064
3c084d9f 1065 // create the rohacell volume
1066
1067 gMC->Gsvolu("S07R","BOX",rohaMaterial,rohapar,3);
1068 gMC->Gsvolu("S08R","BOX",rohaMaterial,rohapar,3);
1e8fff9c 1069
1e8fff9c 1070 // create the insulating material volume
1071
6c5ddcfa 1072 gMC->Gsvolu("S07I","BOX",insuMaterial,insupar,3);
1073 gMC->Gsvolu("S08I","BOX",insuMaterial,insupar,3);
1e8fff9c 1074
3c084d9f 1075 // create the PCB volume
1e8fff9c 1076
3c084d9f 1077 gMC->Gsvolu("S07P","BOX",pcbMaterial,pcbpar,3);
1078 gMC->Gsvolu("S08P","BOX",pcbMaterial,pcbpar,3);
1e8fff9c 1079
3c084d9f 1080 // create the sensitive volumes,
1081
3f08857e 1082 gMC->Gsvolu("S07G","BOX",sensMaterial,dum,0);
1083 gMC->Gsvolu("S08G","BOX",sensMaterial,dum,0);
1e8fff9c 1084
1085 // create the vertical frame volume
1086
6c5ddcfa 1087 gMC->Gsvolu("S07V","BOX",vFrameMaterial,vFramepar,3);
1088 gMC->Gsvolu("S08V","BOX",vFrameMaterial,vFramepar,3);
1e8fff9c 1089
1090 // create the horizontal frame volume
1091
6c5ddcfa 1092 gMC->Gsvolu("S07H","BOX",hFrameMaterial,hFramepar,3);
1093 gMC->Gsvolu("S08H","BOX",hFrameMaterial,hFramepar,3);
1e8fff9c 1094
1095 // create the horizontal border volume
1096
6c5ddcfa 1097 gMC->Gsvolu("S07B","BOX",bFrameMaterial,bFramepar,3);
1098 gMC->Gsvolu("S08B","BOX",bFrameMaterial,bFramepar,3);
3c084d9f 1099
1100 index=0;
6c5ddcfa 1101 for (i = 0; i<nSlats4; i++){
1102 sprintf(volNam7,"S07%d",i);
1103 sprintf(volNam8,"S08%d",i);
1104 Float_t xvFrame = (slatLength4[i] - vFrameLength)/2.;
3c084d9f 1105 // position the vertical frames
21a18f36 1106 if (i!=1 && i!=0) {
a083207d 1107 gMC->Gspos("S07V",2*i-1,volNam7, xvFrame, 0., 0. , 0, "ONLY");
1108 gMC->Gspos("S07V",2*i ,volNam7,-xvFrame, 0., 0. , 0, "ONLY");
1109 gMC->Gspos("S08V",2*i-1,volNam8, xvFrame, 0., 0. , 0, "ONLY");
1110 gMC->Gspos("S08V",2*i ,volNam8,-xvFrame, 0., 0. , 0, "ONLY");
1111 }
3c084d9f 1112 // position the panels and the insulating material
6c5ddcfa 1113 for (j=0; j<nPCB4[i]; j++){
1e8fff9c 1114 index++;
6c5ddcfa 1115 Float_t xx = sensLength * (-nPCB4[i]/2.+j+.5);
3c084d9f 1116
1117 Float_t zPanel = spar[2] - panelpar[2];
1118 gMC->Gspos("S07C",2*index-1,volNam7, xx, 0., zPanel , 0, "ONLY");
1119 gMC->Gspos("S07C",2*index ,volNam7, xx, 0.,-zPanel , 0, "ONLY");
1120 gMC->Gspos("S08C",2*index-1,volNam8, xx, 0., zPanel , 0, "ONLY");
1121 gMC->Gspos("S08C",2*index ,volNam8, xx, 0.,-zPanel , 0, "ONLY");
1122
1123 gMC->Gspos("S07I",index,volNam7, xx, 0., 0 , 0, "ONLY");
1124 gMC->Gspos("S08I",index,volNam8, xx, 0., 0 , 0, "ONLY");
1e8fff9c 1125 }
a9e2aefa 1126 }
1e8fff9c 1127
3c084d9f 1128 // position the rohacell volume inside the panel volume
1129 gMC->Gspos("S07R",1,"S07C",0.,0.,0.,0,"ONLY");
1130 gMC->Gspos("S08R",1,"S08C",0.,0.,0.,0,"ONLY");
1131
1132 // position the PCB volume inside the insulating material volume
1133 gMC->Gspos("S07P",1,"S07I",0.,0.,0.,0,"ONLY");
1134 gMC->Gspos("S08P",1,"S08I",0.,0.,0.,0,"ONLY");
1135 // position the horizontal frame volume inside the PCB volume
1136 gMC->Gspos("S07H",1,"S07P",0.,0.,0.,0,"ONLY");
1137 gMC->Gspos("S08H",1,"S08P",0.,0.,0.,0,"ONLY");
1138 // position the sensitive volume inside the horizontal frame volume
1139 gMC->Gsposp("S07G",1,"S07H",0.,0.,0.,0,"ONLY",senspar,3);
1140 gMC->Gsposp("S08G",1,"S08H",0.,0.,0.,0,"ONLY",senspar,3);
3c084d9f 1141 // position the border volumes inside the PCB volume
1142 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
1143 gMC->Gspos("S07B",1,"S07P",0., yborder,0.,0,"ONLY");
1144 gMC->Gspos("S07B",2,"S07P",0.,-yborder,0.,0,"ONLY");
1145 gMC->Gspos("S08B",1,"S08P",0., yborder,0.,0,"ONLY");
1146 gMC->Gspos("S08B",2,"S08P",0.,-yborder,0.,0,"ONLY");
1147
1e8fff9c 1148 // create the NULOC volume and position it in the horizontal frame
3c084d9f 1149
6c5ddcfa 1150 gMC->Gsvolu("S07N","BOX",nulocMaterial,nulocpar,3);
1151 gMC->Gsvolu("S08N","BOX",nulocMaterial,nulocpar,3);
3c084d9f 1152 index = 0;
21a18f36 1153 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
1e8fff9c 1154 index++;
6c5ddcfa 1155 gMC->Gspos("S07N",2*index-1,"S07B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1156 gMC->Gspos("S07N",2*index ,"S07B", xx, 0., bFrameWidth/4., 0, "ONLY");
1157 gMC->Gspos("S08N",2*index-1,"S08B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1158 gMC->Gspos("S08N",2*index ,"S08B", xx, 0., bFrameWidth/4., 0, "ONLY");
1e8fff9c 1159 }
a083207d 1160
1161 // position the volumes approximating the circular section of the pipe
21a18f36 1162 Float_t yoffs = sensHeight/2. - yOverlap;
a083207d 1163 Float_t epsilon = 0.001;
1164 Int_t ndiv=6;
1165 Float_t divpar[3];
1166 Double_t dydiv= sensHeight/ndiv;
21a18f36 1167 Double_t ydiv = yoffs -dydiv;
a083207d 1168 Int_t imax=0;
a083207d 1169 imax = 1;
1170 Float_t rmin = 40.;
1171 Float_t z1 = -spar[2], z2=2*spar[2]*1.01;
1172 for (Int_t idiv=0;idiv<ndiv; idiv++){
1173 ydiv+= dydiv;
425ebd0a 1174 Float_t xdiv = 0.;
a083207d 1175 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
1176 divpar[0] = (pcbLength-xdiv)/2.;
1177 divpar[1] = dydiv/2. - epsilon;
1178 divpar[2] = sensWidth/2.;
425ebd0a 1179 Float_t xvol=(pcbLength+xdiv)/2.+1.999;
a083207d 1180 Float_t yvol=ydiv + dydiv/2.;
b74f1c6a 1181 gMC->Gsposp("S07G",imax+4*idiv+1,"S07M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1182 gMC->Gsposp("S08G",imax+4*idiv+1,"S08M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1183 gMC->Gsposp("S07G",imax+4*idiv+2,"S07M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1184 gMC->Gsposp("S08G",imax+4*idiv+2,"S08M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1185 gMC->Gsposp("S07G",imax+4*idiv+3,"S07M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1186 gMC->Gsposp("S08G",imax+4*idiv+3,"S08M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1187 gMC->Gsposp("S07G",imax+4*idiv+4,"S07M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
1188 gMC->Gsposp("S08G",imax+4*idiv+4,"S08M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
a083207d 1189 }
1190
1191
1192
1193
1194
b17c0c87 1195 }
3c084d9f 1196
ba030c0e 1197 if (fStations[4]) {
b17c0c87 1198
1e8fff9c 1199
a9e2aefa 1200//********************************************************************
1201// Station 5 **
1202//********************************************************************
1203 // indices 1 and 2 for first and second chambers in the station
1204 // iChamber (first chamber) kept for other quanties than Z,
1205 // assumed to be the same in both chambers
1206 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[8];
1207 iChamber2 =(AliMUONChamber*) (*fChambers)[9];
1208 zpos1=iChamber1->Z();
1209 zpos2=iChamber2->Z();
1210 dstation = zpos2 - zpos1;
b64652f5 1211// zfpos=-(iChamber->DGas()+dframez+iChamber->DAlu())/2; // not used any more
3c084d9f 1212
a9e2aefa 1213//
1214// Mother volume
1215 tpar[0] = iChamber->RInner()-dframep;
1216 tpar[1] = (iChamber->ROuter()+dframep)/TMath::Cos(phi);
3c084d9f 1217 tpar[2] = dstation/5.;
a9e2aefa 1218
b74f1c6a 1219 gMC->Gsvolu("S09M", "TUBE", idAir, tpar, 3);
1220 gMC->Gsvolu("S10M", "TUBE", idAir, tpar, 3);
1221 gMC->Gspos("S09M", 1, "ALIC", 0., 0., zpos1 , 0, "ONLY");
1222 gMC->Gspos("S10M", 1, "ALIC", 0., 0., zpos2 , 0, "ONLY");
a9e2aefa 1223
a9e2aefa 1224
1e8fff9c 1225 const Int_t nSlats5 = 7; // number of slats per quadrant
a083207d 1226 const Int_t nPCB5[nSlats5] = {5,5,6,6,5,4,3}; // n PCB per slat
21a18f36 1227 const Float_t xpos5[nSlats5] = {38.5, 40., 0., 0., 0., 0., 0.};
6c5ddcfa 1228 Float_t slatLength5[nSlats5];
6c5ddcfa 1229 char volNam9[5];
1230 char volNam10[5];
f9f7c205 1231 Float_t xSlat5;
1232 Float_t ySlat5;
1e8fff9c 1233
6c5ddcfa 1234 for (i = 0; i<nSlats5; i++){
1235 slatLength5[i] = pcbLength * nPCB5[i] + 2. * dSlatLength;
a083207d 1236 xSlat5 = slatLength5[i]/2. - vFrameLength/2. +xpos5[i];
21a18f36 1237 if (i==1 || i==0) slatLength5[i] -= 2. *dSlatLength; // frame out in PCB with circular border
f9f7c205 1238 ySlat5 = sensHeight * i - yOverlap * i;
6c5ddcfa 1239 spar[0] = slatLength5[i]/2.;
1240 spar[1] = slatHeight/2.;
3c084d9f 1241 spar[2] = slatWidth/2. * 1.01;
1242 Float_t dzCh5=spar[2]*1.01;
1e8fff9c 1243 // zSlat to be checked (odd downstream or upstream?)
3c084d9f 1244 Float_t zSlat = (i%2 ==0)? -spar[2] : spar[2];
6c5ddcfa 1245 sprintf(volNam9,"S09%d",i);
1246 gMC->Gsvolu(volNam9,"BOX",slatMaterial,spar,3);
b74f1c6a 1247 gMC->Gspos(volNam9, i*4+1,"S09M", xSlat5, ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1248 gMC->Gspos(volNam9, i*4+2,"S09M",-xSlat5, ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
f9f7c205 1249 if (i>0) {
b74f1c6a 1250 gMC->Gspos(volNam9, i*4+3,"S09M", xSlat5,-ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1251 gMC->Gspos(volNam9, i*4+4,"S09M",-xSlat5,-ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
f9f7c205 1252 }
6c5ddcfa 1253 sprintf(volNam10,"S10%d",i);
1254 gMC->Gsvolu(volNam10,"BOX",slatMaterial,spar,3);
b74f1c6a 1255 gMC->Gspos(volNam10, i*4+1,"S10M", xSlat5, ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1256 gMC->Gspos(volNam10, i*4+2,"S10M",-xSlat5, ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
f9f7c205 1257 if (i>0) {
b74f1c6a 1258 gMC->Gspos(volNam10, i*4+3,"S10M", xSlat5,-ySlat5, zSlat+2.*dzCh5, 0, "ONLY");
1259 gMC->Gspos(volNam10, i*4+4,"S10M",-xSlat5,-ySlat5, zSlat-2.*dzCh5, 0, "ONLY");
f9f7c205 1260 }
a9e2aefa 1261 }
1262
1e8fff9c 1263 // create the panel volume
3c084d9f 1264
6c5ddcfa 1265 gMC->Gsvolu("S09C","BOX",panelMaterial,panelpar,3);
1266 gMC->Gsvolu("S10C","BOX",panelMaterial,panelpar,3);
3c084d9f 1267
1e8fff9c 1268 // create the rohacell volume
3c084d9f 1269
6c5ddcfa 1270 gMC->Gsvolu("S09R","BOX",rohaMaterial,rohapar,3);
1271 gMC->Gsvolu("S10R","BOX",rohaMaterial,rohapar,3);
3c084d9f 1272
1273 // create the insulating material volume
1274
1275 gMC->Gsvolu("S09I","BOX",insuMaterial,insupar,3);
1276 gMC->Gsvolu("S10I","BOX",insuMaterial,insupar,3);
1277
1278 // create the PCB volume
1279
1280 gMC->Gsvolu("S09P","BOX",pcbMaterial,pcbpar,3);
1281 gMC->Gsvolu("S10P","BOX",pcbMaterial,pcbpar,3);
1282
1283 // create the sensitive volumes,
1284
3f08857e 1285 gMC->Gsvolu("S09G","BOX",sensMaterial,dum,0);
1286 gMC->Gsvolu("S10G","BOX",sensMaterial,dum,0);
3c084d9f 1287
1e8fff9c 1288 // create the vertical frame volume
3c084d9f 1289
6c5ddcfa 1290 gMC->Gsvolu("S09V","BOX",vFrameMaterial,vFramepar,3);
1291 gMC->Gsvolu("S10V","BOX",vFrameMaterial,vFramepar,3);
1e8fff9c 1292
1293 // create the horizontal frame volume
3c084d9f 1294
6c5ddcfa 1295 gMC->Gsvolu("S09H","BOX",hFrameMaterial,hFramepar,3);
1296 gMC->Gsvolu("S10H","BOX",hFrameMaterial,hFramepar,3);
1e8fff9c 1297
1298 // create the horizontal border volume
1299
6c5ddcfa 1300 gMC->Gsvolu("S09B","BOX",bFrameMaterial,bFramepar,3);
1301 gMC->Gsvolu("S10B","BOX",bFrameMaterial,bFramepar,3);
1e8fff9c 1302
3c084d9f 1303 index=0;
6c5ddcfa 1304 for (i = 0; i<nSlats5; i++){
1305 sprintf(volNam9,"S09%d",i);
1306 sprintf(volNam10,"S10%d",i);
1307 Float_t xvFrame = (slatLength5[i] - vFrameLength)/2.;
3c084d9f 1308 // position the vertical frames
21a18f36 1309 if (i!=1 && i!=0) {
a083207d 1310 gMC->Gspos("S09V",2*i-1,volNam9, xvFrame, 0., 0. , 0, "ONLY");
1311 gMC->Gspos("S09V",2*i ,volNam9,-xvFrame, 0., 0. , 0, "ONLY");
1312 gMC->Gspos("S10V",2*i-1,volNam10, xvFrame, 0., 0. , 0, "ONLY");
1313 gMC->Gspos("S10V",2*i ,volNam10,-xvFrame, 0., 0. , 0, "ONLY");
1314 }
3c084d9f 1315
1316 // position the panels and the insulating material
6c5ddcfa 1317 for (j=0; j<nPCB5[i]; j++){
1e8fff9c 1318 index++;
3c084d9f 1319 Float_t xx = sensLength * (-nPCB5[i]/2.+j+.5);
1320
1321 Float_t zPanel = spar[2] - panelpar[2];
1322 gMC->Gspos("S09C",2*index-1,volNam9, xx, 0., zPanel , 0, "ONLY");
1323 gMC->Gspos("S09C",2*index ,volNam9, xx, 0.,-zPanel , 0, "ONLY");
1324 gMC->Gspos("S10C",2*index-1,volNam10, xx, 0., zPanel , 0, "ONLY");
1325 gMC->Gspos("S10C",2*index ,volNam10, xx, 0.,-zPanel , 0, "ONLY");
1326
1327 gMC->Gspos("S09I",index,volNam9, xx, 0., 0 , 0, "ONLY");
1328 gMC->Gspos("S10I",index,volNam10, xx, 0., 0 , 0, "ONLY");
1e8fff9c 1329 }
1330 }
1331
3c084d9f 1332 // position the rohacell volume inside the panel volume
1333 gMC->Gspos("S09R",1,"S09C",0.,0.,0.,0,"ONLY");
1334 gMC->Gspos("S10R",1,"S10C",0.,0.,0.,0,"ONLY");
1335
1336 // position the PCB volume inside the insulating material volume
1337 gMC->Gspos("S09P",1,"S09I",0.,0.,0.,0,"ONLY");
1338 gMC->Gspos("S10P",1,"S10I",0.,0.,0.,0,"ONLY");
1339 // position the horizontal frame volume inside the PCB volume
1340 gMC->Gspos("S09H",1,"S09P",0.,0.,0.,0,"ONLY");
1341 gMC->Gspos("S10H",1,"S10P",0.,0.,0.,0,"ONLY");
1342 // position the sensitive volume inside the horizontal frame volume
1343 gMC->Gsposp("S09G",1,"S09H",0.,0.,0.,0,"ONLY",senspar,3);
1344 gMC->Gsposp("S10G",1,"S10H",0.,0.,0.,0,"ONLY",senspar,3);
3c084d9f 1345 // position the border volumes inside the PCB volume
1346 Float_t yborder = ( pcbHeight - bFrameHeight ) / 2.;
1347 gMC->Gspos("S09B",1,"S09P",0., yborder,0.,0,"ONLY");
1348 gMC->Gspos("S09B",2,"S09P",0.,-yborder,0.,0,"ONLY");
1349 gMC->Gspos("S10B",1,"S10P",0., yborder,0.,0,"ONLY");
1350 gMC->Gspos("S10B",2,"S10P",0.,-yborder,0.,0,"ONLY");
1351
1e8fff9c 1352 // create the NULOC volume and position it in the horizontal frame
3c084d9f 1353
6c5ddcfa 1354 gMC->Gsvolu("S09N","BOX",nulocMaterial,nulocpar,3);
1355 gMC->Gsvolu("S10N","BOX",nulocMaterial,nulocpar,3);
3c084d9f 1356 index = 0;
21a18f36 1357 for (xx = -xxmax; xx<=xxmax; xx+=2*nulocLength) {
1e8fff9c 1358 index++;
6c5ddcfa 1359 gMC->Gspos("S09N",2*index-1,"S09B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1360 gMC->Gspos("S09N",2*index ,"S09B", xx, 0., bFrameWidth/4., 0, "ONLY");
1361 gMC->Gspos("S10N",2*index-1,"S10B", xx, 0.,-bFrameWidth/4., 0, "ONLY");
1362 gMC->Gspos("S10N",2*index ,"S10B", xx, 0., bFrameWidth/4., 0, "ONLY");
a9e2aefa 1363 }
a083207d 1364 // position the volumes approximating the circular section of the pipe
21a18f36 1365 Float_t yoffs = sensHeight/2. - yOverlap;
a083207d 1366 Float_t epsilon = 0.001;
1367 Int_t ndiv=6;
1368 Float_t divpar[3];
1369 Double_t dydiv= sensHeight/ndiv;
21a18f36 1370 Double_t ydiv = yoffs -dydiv;
a083207d 1371 Int_t imax=0;
1372 // for (Int_t islat=0; islat<nSlats3; islat++) imax += nPCB3[islat];
1373 imax = 1;
1374 Float_t rmin = 40.;
1375 Float_t z1 = spar[2], z2=2*spar[2]*1.01;
1376 for (Int_t idiv=0;idiv<ndiv; idiv++){
1377 ydiv+= dydiv;
425ebd0a 1378 Float_t xdiv = 0.;
a083207d 1379 if (ydiv<rmin) xdiv= rmin * TMath::Sin( TMath::ACos(ydiv/rmin) );
1380 divpar[0] = (pcbLength-xdiv)/2.;
1381 divpar[1] = dydiv/2. - epsilon;
1382 divpar[2] = sensWidth/2.;
425ebd0a 1383 Float_t xvol=(pcbLength+xdiv)/2. + 1.999;
a083207d 1384 Float_t yvol=ydiv + dydiv/2.;
b74f1c6a 1385 gMC->Gsposp("S09G",imax+4*idiv+1,"S09M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1386 gMC->Gsposp("S10G",imax+4*idiv+1,"S10M", xvol, yvol, z1+z2, 0, "ONLY",divpar,3);
1387 gMC->Gsposp("S09G",imax+4*idiv+2,"S09M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1388 gMC->Gsposp("S10G",imax+4*idiv+2,"S10M", xvol,-yvol, z1+z2, 0, "ONLY",divpar,3);
1389 gMC->Gsposp("S09G",imax+4*idiv+3,"S09M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1390 gMC->Gsposp("S10G",imax+4*idiv+3,"S10M",-xvol, yvol, z1-z2, 0, "ONLY",divpar,3);
1391 gMC->Gsposp("S09G",imax+4*idiv+4,"S09M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
1392 gMC->Gsposp("S10G",imax+4*idiv+4,"S10M",-xvol,-yvol, z1-z2, 0, "ONLY",divpar,3);
a083207d 1393 }
1394
b17c0c87 1395 }
1396
1e8fff9c 1397
a9e2aefa 1398///////////////////////////////////////
1399// GEOMETRY FOR THE TRIGGER CHAMBERS //
1400///////////////////////////////////////
1401
1402// 03/00 P. Dupieux : introduce a slighly more realistic
1403// geom. of the trigger readout planes with
1404// 2 Zpos per trigger plane (alternate
1405// between left and right of the trigger)
1406
1407// Parameters of the Trigger Chambers
1408
236fe2c5 1409// DP03-01 introduce dead zone of +/- 2 cm arround x=0 (as in TDR, fig3.27)
1410 const Float_t kDXZERO=2.;
a9e2aefa 1411 const Float_t kXMC1MIN=34.;
1412 const Float_t kXMC1MED=51.;
1413 const Float_t kXMC1MAX=272.;
1414 const Float_t kYMC1MIN=34.;
1415 const Float_t kYMC1MAX=51.;
1416 const Float_t kRMIN1=50.;
236fe2c5 1417// DP03-01 const Float_t kRMAX1=62.;
1418 const Float_t kRMAX1=64.;
a9e2aefa 1419 const Float_t kRMIN2=50.;
236fe2c5 1420// DP03-01 const Float_t kRMAX2=66.;
1421 const Float_t kRMAX2=68.;
a9e2aefa 1422
1423// zposition of the middle of the gas gap in mother vol
1424 const Float_t kZMCm=-3.6;
1425 const Float_t kZMCp=+3.6;
1426
1427
1428// TRIGGER STATION 1 - TRIGGER STATION 1 - TRIGGER STATION 1
1429
1430 // iChamber 1 and 2 for first and second chambers in the station
1431 // iChamber (first chamber) kept for other quanties than Z,
1432 // assumed to be the same in both chambers
1433 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[10];
1434 iChamber2 =(AliMUONChamber*) (*fChambers)[11];
1435
1436 // 03/00
1437 // zpos1 and zpos2 are now the middle of the first and second
1438 // plane of station 1 :
1439 // zpos1=(16075+15995)/2=16035 mm, thick/2=40 mm
1440 // zpos2=(16225+16145)/2=16185 mm, thick/2=40 mm
1441 //
1442 // zpos1m=15999 mm , zpos1p=16071 mm (middles of gas gaps)
1443 // zpos2m=16149 mm , zpos2p=16221 mm (middles of gas gaps)
1444 // rem : the total thickness accounts for 1 mm of al on both
1445 // side of the RPCs (see zpos1 and zpos2), as previously
1446
1447 zpos1=iChamber1->Z();
1448 zpos2=iChamber2->Z();
1449
1450
1451// Mother volume definition
1452 tpar[0] = iChamber->RInner();
1453 tpar[1] = iChamber->ROuter();
1454 tpar[2] = 4.0;
b74f1c6a 1455 gMC->Gsvolu("SM11", "TUBE", idAir, tpar, 3);
1456 gMC->Gsvolu("SM12", "TUBE", idAir, tpar, 3);
a9e2aefa 1457
1458// Definition of the flange between the beam shielding and the RPC
1459 tpar[0]= kRMIN1;
1460 tpar[1]= kRMAX1;
1461 tpar[2]= 4.0;
1462
b74f1c6a 1463 gMC->Gsvolu("SF1A", "TUBE", idAlu1, tpar, 3); //Al
1464 gMC->Gspos("SF1A", 1, "SM11", 0., 0., 0., 0, "MANY");
03da3c56 1465
1466 gMC->Gsvolu("SF3A", "TUBE", idAlu1, tpar, 3); //Al
1467 gMC->Gspos("SF3A", 1, "SM12", 0., 0., 0., 0, "MANY");
a9e2aefa 1468
1469
1470// FIRST PLANE OF STATION 1
1471
1472// ratios of zpos1m/zpos1p and inverse for first plane
1473 Float_t zmp=(zpos1-3.6)/(zpos1+3.6);
1474 Float_t zpm=1./zmp;
1475
1476
1477// Definition of prototype for chambers in the first plane
1478
1479 tpar[0]= 0.;
1480 tpar[1]= 0.;
1481 tpar[2]= 0.;
1482
b74f1c6a 1483 gMC->Gsvolu("SC1A", "BOX ", idAlu1, tpar, 0); //Al
1484 gMC->Gsvolu("SB1A", "BOX ", idtmed[1107], tpar, 0); //Bakelite
1485 gMC->Gsvolu("SG1A", "BOX ", idtmed[1106], tpar, 0); //Gas streamer
a9e2aefa 1486
1487// chamber type A
1488 tpar[0] = -1.;
1489 tpar[1] = -1.;
1490
236fe2c5 1491// DP03-01 const Float_t kXMC1A=kXMC1MED+(kXMC1MAX-kXMC1MED)/2.;
1492 const Float_t kXMC1A=kDXZERO+kXMC1MED+(kXMC1MAX-kXMC1MED)/2.;
a9e2aefa 1493 const Float_t kYMC1Am=0.;
1494 const Float_t kYMC1Ap=0.;
1495
1496 tpar[2] = 0.1;
b74f1c6a 1497 gMC->Gsposp("SG1A", 1, "SB1A", 0., 0., 0., 0, "ONLY",tpar,3);
a9e2aefa 1498 tpar[2] = 0.3;
b74f1c6a 1499 gMC->Gsposp("SB1A", 1, "SC1A", 0., 0., 0., 0, "ONLY",tpar,3);
a9e2aefa 1500
1501 tpar[2] = 0.4;
1502 tpar[0] = (kXMC1MAX-kXMC1MED)/2.;
1503 tpar[1] = kYMC1MIN;
1504
b74f1c6a 1505 gMC->Gsposp("SC1A", 1, "SM11",kXMC1A,kYMC1Am,kZMCm, 0, "ONLY", tpar, 3);
1506 gMC->Gsposp("SC1A", 2, "SM11",-kXMC1A,kYMC1Ap,kZMCp, 0, "ONLY", tpar, 3);
03da3c56 1507 gMC->Gsbool("SC1A", "SF1A");
a9e2aefa 1508
1509// chamber type B
1510 Float_t tpar1save=tpar[1];
1511 Float_t y1msave=kYMC1Am;
1512 Float_t y1psave=kYMC1Ap;
1513
1514 tpar[0] = (kXMC1MAX-kXMC1MIN)/2.;
1515 tpar[1] = (kYMC1MAX-kYMC1MIN)/2.;
1516
236fe2c5 1517// DP03-01 const Float_t kXMC1B=kXMC1MIN+tpar[0];
1518 const Float_t kXMC1B=kDXZERO+kXMC1MIN+tpar[0];
a9e2aefa 1519 const Float_t kYMC1Bp=(y1msave+tpar1save)*zpm+tpar[1];
1520 const Float_t kYMC1Bm=(y1psave+tpar1save)*zmp+tpar[1];
1521
b74f1c6a 1522 gMC->Gsposp("SC1A", 3, "SM11",kXMC1B,kYMC1Bp,kZMCp, 0, "ONLY", tpar, 3);
1523 gMC->Gsposp("SC1A", 4, "SM11",-kXMC1B,kYMC1Bm,kZMCm, 0, "ONLY", tpar, 3);
1524 gMC->Gsposp("SC1A", 5, "SM11",kXMC1B,-kYMC1Bp,kZMCp, 0, "ONLY", tpar, 3);
1525 gMC->Gsposp("SC1A", 6, "SM11",-kXMC1B,-kYMC1Bm,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1526
1527// chamber type C (end of type B !!)
1528 tpar1save=tpar[1];
1529 y1msave=kYMC1Bm;
1530 y1psave=kYMC1Bp;
1531
1532 tpar[0] = kXMC1MAX/2;
1533 tpar[1] = kYMC1MAX/2;
1534
236fe2c5 1535
1536// DP03-01 const Float_t kXMC1C=tpar[0];
1537 const Float_t kXMC1C=kDXZERO+tpar[0];
a9e2aefa 1538// warning : same Z than type B
1539 const Float_t kYMC1Cp=(y1psave+tpar1save)*1.+tpar[1];
1540 const Float_t kYMC1Cm=(y1msave+tpar1save)*1.+tpar[1];
1541
b74f1c6a 1542 gMC->Gsposp("SC1A", 7, "SM11",kXMC1C,kYMC1Cp,kZMCp, 0, "ONLY", tpar, 3);
1543 gMC->Gsposp("SC1A", 8, "SM11",-kXMC1C,kYMC1Cm,kZMCm, 0, "ONLY", tpar, 3);
1544 gMC->Gsposp("SC1A", 9, "SM11",kXMC1C,-kYMC1Cp,kZMCp, 0, "ONLY", tpar, 3);
1545 gMC->Gsposp("SC1A", 10, "SM11",-kXMC1C,-kYMC1Cm,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1546
1547// chamber type D, E and F (same size)
1548 tpar1save=tpar[1];
1549 y1msave=kYMC1Cm;
1550 y1psave=kYMC1Cp;
1551
1552 tpar[0] = kXMC1MAX/2.;
1553 tpar[1] = kYMC1MIN;
1554
236fe2c5 1555// DP03-01 const Float_t kXMC1D=tpar[0];
1556 const Float_t kXMC1D=kDXZERO+tpar[0];
a9e2aefa 1557 const Float_t kYMC1Dp=(y1msave+tpar1save)*zpm+tpar[1];
1558 const Float_t kYMC1Dm=(y1psave+tpar1save)*zmp+tpar[1];
1559
b74f1c6a 1560 gMC->Gsposp("SC1A", 11, "SM11",kXMC1D,kYMC1Dm,kZMCm, 0, "ONLY", tpar, 3);
1561 gMC->Gsposp("SC1A", 12, "SM11",-kXMC1D,kYMC1Dp,kZMCp, 0, "ONLY", tpar, 3);
1562 gMC->Gsposp("SC1A", 13, "SM11",kXMC1D,-kYMC1Dm,kZMCm, 0, "ONLY", tpar, 3);
1563 gMC->Gsposp("SC1A", 14, "SM11",-kXMC1D,-kYMC1Dp,kZMCp, 0, "ONLY", tpar, 3);
a9e2aefa 1564
1565
1566 tpar1save=tpar[1];
1567 y1msave=kYMC1Dm;
1568 y1psave=kYMC1Dp;
1569 const Float_t kYMC1Ep=(y1msave+tpar1save)*zpm+tpar[1];
1570 const Float_t kYMC1Em=(y1psave+tpar1save)*zmp+tpar[1];
1571
b74f1c6a 1572 gMC->Gsposp("SC1A", 15, "SM11",kXMC1D,kYMC1Ep,kZMCp, 0, "ONLY", tpar, 3);
1573 gMC->Gsposp("SC1A", 16, "SM11",-kXMC1D,kYMC1Em,kZMCm, 0, "ONLY", tpar, 3);
1574 gMC->Gsposp("SC1A", 17, "SM11",kXMC1D,-kYMC1Ep,kZMCp, 0, "ONLY", tpar, 3);
1575 gMC->Gsposp("SC1A", 18, "SM11",-kXMC1D,-kYMC1Em,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1576
1577 tpar1save=tpar[1];
1578 y1msave=kYMC1Em;
1579 y1psave=kYMC1Ep;
1580 const Float_t kYMC1Fp=(y1msave+tpar1save)*zpm+tpar[1];
1581 const Float_t kYMC1Fm=(y1psave+tpar1save)*zmp+tpar[1];
1582
b74f1c6a 1583 gMC->Gsposp("SC1A", 19, "SM11",kXMC1D,kYMC1Fm,kZMCm, 0, "ONLY", tpar, 3);
1584 gMC->Gsposp("SC1A", 20, "SM11",-kXMC1D,kYMC1Fp,kZMCp, 0, "ONLY", tpar, 3);
1585 gMC->Gsposp("SC1A", 21, "SM11",kXMC1D,-kYMC1Fm,kZMCm, 0, "ONLY", tpar, 3);
1586 gMC->Gsposp("SC1A", 22, "SM11",-kXMC1D,-kYMC1Fp,kZMCp, 0, "ONLY", tpar, 3);
a9e2aefa 1587
1588// Positioning first plane in ALICE
b74f1c6a 1589 gMC->Gspos("SM11", 1, "ALIC", 0., 0., zpos1, 0, "ONLY");
a9e2aefa 1590
1591// End of geometry definition for the first plane of station 1
1592
1593
1594
1595// SECOND PLANE OF STATION 1 : proj ratio = zpos2/zpos1
1596
1597 const Float_t kZ12=zpos2/zpos1;
1598
1599// Definition of prototype for chambers in the second plane of station 1
1600
1601 tpar[0]= 0.;
1602 tpar[1]= 0.;
1603 tpar[2]= 0.;
1604
b74f1c6a 1605 gMC->Gsvolu("SC2A", "BOX ", idAlu1, tpar, 0); //Al
1606 gMC->Gsvolu("SB2A", "BOX ", idtmed[1107], tpar, 0); //Bakelite
1607 gMC->Gsvolu("SG2A", "BOX ", idtmed[1106], tpar, 0); //Gas streamer
a9e2aefa 1608
1609// chamber type A
1610 tpar[0] = -1.;
1611 tpar[1] = -1.;
1612
1613 const Float_t kXMC2A=kXMC1A*kZ12;
1614 const Float_t kYMC2Am=0.;
1615 const Float_t kYMC2Ap=0.;
1616
1617 tpar[2] = 0.1;
b74f1c6a 1618 gMC->Gsposp("SG2A", 1, "SB2A", 0., 0., 0., 0, "ONLY",tpar,3);
a9e2aefa 1619 tpar[2] = 0.3;
b74f1c6a 1620 gMC->Gsposp("SB2A", 1, "SC2A", 0., 0., 0., 0, "ONLY",tpar,3);
a9e2aefa 1621
1622 tpar[2] = 0.4;
1623 tpar[0] = ((kXMC1MAX-kXMC1MED)/2.)*kZ12;
1624 tpar[1] = kYMC1MIN*kZ12;
1625
b74f1c6a 1626 gMC->Gsposp("SC2A", 1, "SM12",kXMC2A,kYMC2Am,kZMCm, 0, "ONLY", tpar, 3);
1627 gMC->Gsposp("SC2A", 2, "SM12",-kXMC2A,kYMC2Ap,kZMCp, 0, "ONLY", tpar, 3);
03da3c56 1628 gMC->Gsbool("SC2A", "SF3A");
a9e2aefa 1629
1630
1631// chamber type B
1632
1633 tpar[0] = ((kXMC1MAX-kXMC1MIN)/2.)*kZ12;
1634 tpar[1] = ((kYMC1MAX-kYMC1MIN)/2.)*kZ12;
1635
1636 const Float_t kXMC2B=kXMC1B*kZ12;
1637 const Float_t kYMC2Bp=kYMC1Bp*kZ12;
1638 const Float_t kYMC2Bm=kYMC1Bm*kZ12;
b74f1c6a 1639 gMC->Gsposp("SC2A", 3, "SM12",kXMC2B,kYMC2Bp,kZMCp, 0, "ONLY", tpar, 3);
1640 gMC->Gsposp("SC2A", 4, "SM12",-kXMC2B,kYMC2Bm,kZMCm, 0, "ONLY", tpar, 3);
1641 gMC->Gsposp("SC2A", 5, "SM12",kXMC2B,-kYMC2Bp,kZMCp, 0, "ONLY", tpar, 3);
1642 gMC->Gsposp("SC2A", 6, "SM12",-kXMC2B,-kYMC2Bm,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1643
1644
1645// chamber type C (end of type B !!)
1646
1647 tpar[0] = (kXMC1MAX/2)*kZ12;
1648 tpar[1] = (kYMC1MAX/2)*kZ12;
1649
1650 const Float_t kXMC2C=kXMC1C*kZ12;
1651 const Float_t kYMC2Cp=kYMC1Cp*kZ12;
1652 const Float_t kYMC2Cm=kYMC1Cm*kZ12;
b74f1c6a 1653 gMC->Gsposp("SC2A", 7, "SM12",kXMC2C,kYMC2Cp,kZMCp, 0, "ONLY", tpar, 3);
1654 gMC->Gsposp("SC2A", 8, "SM12",-kXMC2C,kYMC2Cm,kZMCm, 0, "ONLY", tpar, 3);
1655 gMC->Gsposp("SC2A", 9, "SM12",kXMC2C,-kYMC2Cp,kZMCp, 0, "ONLY", tpar, 3);
1656 gMC->Gsposp("SC2A", 10, "SM12",-kXMC2C,-kYMC2Cm,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1657
1658// chamber type D, E and F (same size)
1659
1660 tpar[0] = (kXMC1MAX/2.)*kZ12;
1661 tpar[1] = kYMC1MIN*kZ12;
1662
1663 const Float_t kXMC2D=kXMC1D*kZ12;
1664 const Float_t kYMC2Dp=kYMC1Dp*kZ12;
1665 const Float_t kYMC2Dm=kYMC1Dm*kZ12;
b74f1c6a 1666 gMC->Gsposp("SC2A", 11, "SM12",kXMC2D,kYMC2Dm,kZMCm, 0, "ONLY", tpar, 3);
1667 gMC->Gsposp("SC2A", 12, "SM12",-kXMC2D,kYMC2Dp,kZMCp, 0, "ONLY", tpar, 3);
1668 gMC->Gsposp("SC2A", 13, "SM12",kXMC2D,-kYMC2Dm,kZMCm, 0, "ONLY", tpar, 3);
1669 gMC->Gsposp("SC2A", 14, "SM12",-kXMC2D,-kYMC2Dp,kZMCp, 0, "ONLY", tpar, 3);
a9e2aefa 1670
1671 const Float_t kYMC2Ep=kYMC1Ep*kZ12;
1672 const Float_t kYMC2Em=kYMC1Em*kZ12;
b74f1c6a 1673 gMC->Gsposp("SC2A", 15, "SM12",kXMC2D,kYMC2Ep,kZMCp, 0, "ONLY", tpar, 3);
1674 gMC->Gsposp("SC2A", 16, "SM12",-kXMC2D,kYMC2Em,kZMCm, 0, "ONLY", tpar, 3);
1675 gMC->Gsposp("SC2A", 17, "SM12",kXMC2D,-kYMC2Ep,kZMCp, 0, "ONLY", tpar, 3);
1676 gMC->Gsposp("SC2A", 18, "SM12",-kXMC2D,-kYMC2Em,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1677
1678
1679 const Float_t kYMC2Fp=kYMC1Fp*kZ12;
1680 const Float_t kYMC2Fm=kYMC1Fm*kZ12;
b74f1c6a 1681 gMC->Gsposp("SC2A", 19, "SM12",kXMC2D,kYMC2Fm,kZMCm, 0, "ONLY", tpar, 3);
1682 gMC->Gsposp("SC2A", 20, "SM12",-kXMC2D,kYMC2Fp,kZMCp, 0, "ONLY", tpar, 3);
1683 gMC->Gsposp("SC2A", 21, "SM12",kXMC2D,-kYMC2Fm,kZMCm, 0, "ONLY", tpar, 3);
1684 gMC->Gsposp("SC2A", 22, "SM12",-kXMC2D,-kYMC2Fp,kZMCp, 0, "ONLY", tpar, 3);
a9e2aefa 1685
1686// Positioning second plane of station 1 in ALICE
1687
b74f1c6a 1688 gMC->Gspos("SM12", 1, "ALIC", 0., 0., zpos2, 0, "ONLY");
a9e2aefa 1689
1690// End of geometry definition for the second plane of station 1
1691
1692
1693
1694// TRIGGER STATION 2 - TRIGGER STATION 2 - TRIGGER STATION 2
1695
1696 // 03/00
1697 // zpos3 and zpos4 are now the middle of the first and second
1698 // plane of station 2 :
1699 // zpos3=(17075+16995)/2=17035 mm, thick/2=40 mm
1700 // zpos4=(17225+17145)/2=17185 mm, thick/2=40 mm
1701 //
1702 // zpos3m=16999 mm , zpos3p=17071 mm (middles of gas gaps)
1703 // zpos4m=17149 mm , zpos4p=17221 mm (middles of gas gaps)
1704 // rem : the total thickness accounts for 1 mm of al on both
1705 // side of the RPCs (see zpos3 and zpos4), as previously
1706 iChamber1 = iChamber = (AliMUONChamber*) (*fChambers)[12];
1707 iChamber2 =(AliMUONChamber*) (*fChambers)[13];
1708 Float_t zpos3=iChamber1->Z();
1709 Float_t zpos4=iChamber2->Z();
1710
1711
1712// Mother volume definition
1713 tpar[0] = iChamber->RInner();
1714 tpar[1] = iChamber->ROuter();
1715 tpar[2] = 4.0;
1716
b74f1c6a 1717 gMC->Gsvolu("SM21", "TUBE", idAir, tpar, 3);
1718 gMC->Gsvolu("SM22", "TUBE", idAir, tpar, 3);
a9e2aefa 1719
1720// Definition of the flange between the beam shielding and the RPC
1721// ???? interface shielding
1722
1723 tpar[0]= kRMIN2;
1724 tpar[1]= kRMAX2;
1725 tpar[2]= 4.0;
1726
b74f1c6a 1727 gMC->Gsvolu("SF2A", "TUBE", idAlu1, tpar, 3); //Al
1728 gMC->Gspos("SF2A", 1, "SM21", 0., 0., 0., 0, "MANY");
03da3c56 1729
1730 gMC->Gsvolu("SF4A", "TUBE", idAlu1, tpar, 3); //Al
1731 gMC->Gspos("SF4A", 1, "SM22", 0., 0., 0., 0, "MANY");
a9e2aefa 1732
1733
1734
1735// FIRST PLANE OF STATION 2 : proj ratio = zpos3/zpos1
1736
1737 const Float_t kZ13=zpos3/zpos1;
1738
1739// Definition of prototype for chambers in the first plane of station 2
1740 tpar[0]= 0.;
1741 tpar[1]= 0.;
1742 tpar[2]= 0.;
1743
b74f1c6a 1744 gMC->Gsvolu("SC3A", "BOX ", idAlu1, tpar, 0); //Al
1745 gMC->Gsvolu("SB3A", "BOX ", idtmed[1107], tpar, 0); //Bakelite
1746 gMC->Gsvolu("SG3A", "BOX ", idtmed[1106], tpar, 0); //Gas streamer
a9e2aefa 1747
1748
1749// chamber type A
1750 tpar[0] = -1.;
1751 tpar[1] = -1.;
1752
1753 const Float_t kXMC3A=kXMC1A*kZ13;
1754 const Float_t kYMC3Am=0.;
1755 const Float_t kYMC3Ap=0.;
1756
1757 tpar[2] = 0.1;
b74f1c6a 1758 gMC->Gsposp("SG3A", 1, "SB3A", 0., 0., 0., 0, "ONLY",tpar,3);
a9e2aefa 1759 tpar[2] = 0.3;
b74f1c6a 1760 gMC->Gsposp("SB3A", 1, "SC3A", 0., 0., 0., 0, "ONLY",tpar,3);
a9e2aefa 1761
1762 tpar[2] = 0.4;
1763 tpar[0] = ((kXMC1MAX-kXMC1MED)/2.)*kZ13;
1764 tpar[1] = kYMC1MIN*kZ13;
b74f1c6a 1765 gMC->Gsposp("SC3A", 1, "SM21",kXMC3A,kYMC3Am,kZMCm, 0, "ONLY", tpar, 3);
1766 gMC->Gsposp("SC3A", 2, "SM21",-kXMC3A,kYMC3Ap,kZMCp, 0, "ONLY", tpar, 3);
03da3c56 1767 gMC->Gsbool("SC3A", "SF2A");
a9e2aefa 1768
1769
1770// chamber type B
1771 tpar[0] = ((kXMC1MAX-kXMC1MIN)/2.)*kZ13;
1772 tpar[1] = ((kYMC1MAX-kYMC1MIN)/2.)*kZ13;
1773
1774 const Float_t kXMC3B=kXMC1B*kZ13;
1775 const Float_t kYMC3Bp=kYMC1Bp*kZ13;
1776 const Float_t kYMC3Bm=kYMC1Bm*kZ13;
b74f1c6a 1777 gMC->Gsposp("SC3A", 3, "SM21",kXMC3B,kYMC3Bp,kZMCp, 0, "ONLY", tpar, 3);
1778 gMC->Gsposp("SC3A", 4, "SM21",-kXMC3B,kYMC3Bm,kZMCm, 0, "ONLY", tpar, 3);
1779 gMC->Gsposp("SC3A", 5, "SM21",kXMC3B,-kYMC3Bp,kZMCp, 0, "ONLY", tpar, 3);
1780 gMC->Gsposp("SC3A", 6, "SM21",-kXMC3B,-kYMC3Bm,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1781
1782
1783// chamber type C (end of type B !!)
1784 tpar[0] = (kXMC1MAX/2)*kZ13;
1785 tpar[1] = (kYMC1MAX/2)*kZ13;
1786
1787 const Float_t kXMC3C=kXMC1C*kZ13;
1788 const Float_t kYMC3Cp=kYMC1Cp*kZ13;
1789 const Float_t kYMC3Cm=kYMC1Cm*kZ13;
b74f1c6a 1790 gMC->Gsposp("SC3A", 7, "SM21",kXMC3C,kYMC3Cp,kZMCp, 0, "ONLY", tpar, 3);
1791 gMC->Gsposp("SC3A", 8, "SM21",-kXMC3C,kYMC3Cm,kZMCm, 0, "ONLY", tpar, 3);
1792 gMC->Gsposp("SC3A", 9, "SM21",kXMC3C,-kYMC3Cp,kZMCp, 0, "ONLY", tpar, 3);
1793 gMC->Gsposp("SC3A", 10, "SM21",-kXMC3C,-kYMC3Cm,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1794
1795
1796// chamber type D, E and F (same size)
1797
1798 tpar[0] = (kXMC1MAX/2.)*kZ13;
1799 tpar[1] = kYMC1MIN*kZ13;
1800
1801 const Float_t kXMC3D=kXMC1D*kZ13;
1802 const Float_t kYMC3Dp=kYMC1Dp*kZ13;
1803 const Float_t kYMC3Dm=kYMC1Dm*kZ13;
b74f1c6a 1804 gMC->Gsposp("SC3A", 11, "SM21",kXMC3D,kYMC3Dm,kZMCm, 0, "ONLY", tpar, 3);
1805 gMC->Gsposp("SC3A", 12, "SM21",-kXMC3D,kYMC3Dp,kZMCp, 0, "ONLY", tpar, 3);
1806 gMC->Gsposp("SC3A", 13, "SM21",kXMC3D,-kYMC3Dm,kZMCm, 0, "ONLY", tpar, 3);
1807 gMC->Gsposp("SC3A", 14, "SM21",-kXMC3D,-kYMC3Dp,kZMCp, 0, "ONLY", tpar, 3);
a9e2aefa 1808
1809 const Float_t kYMC3Ep=kYMC1Ep*kZ13;
1810 const Float_t kYMC3Em=kYMC1Em*kZ13;
b74f1c6a 1811 gMC->Gsposp("SC3A", 15, "SM21",kXMC3D,kYMC3Ep,kZMCp, 0, "ONLY", tpar, 3);
1812 gMC->Gsposp("SC3A", 16, "SM21",-kXMC3D,kYMC3Em,kZMCm, 0, "ONLY", tpar, 3);
1813 gMC->Gsposp("SC3A", 17, "SM21",kXMC3D,-kYMC3Ep,kZMCp, 0, "ONLY", tpar, 3);
1814 gMC->Gsposp("SC3A", 18, "SM21",-kXMC3D,-kYMC3Em,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1815
1816 const Float_t kYMC3Fp=kYMC1Fp*kZ13;
1817 const Float_t kYMC3Fm=kYMC1Fm*kZ13;
b74f1c6a 1818 gMC->Gsposp("SC3A", 19, "SM21",kXMC3D,kYMC3Fm,kZMCm, 0, "ONLY", tpar, 3);
1819 gMC->Gsposp("SC3A", 20, "SM21",-kXMC3D,kYMC3Fp,kZMCp, 0, "ONLY", tpar, 3);
1820 gMC->Gsposp("SC3A", 21, "SM21",kXMC3D,-kYMC3Fm,kZMCm, 0, "ONLY", tpar, 3);
1821 gMC->Gsposp("SC3A", 22, "SM21",-kXMC3D,-kYMC3Fp,kZMCp, 0, "ONLY", tpar, 3);
a9e2aefa 1822
1823
1824// Positioning first plane of station 2 in ALICE
1825
b74f1c6a 1826 gMC->Gspos("SM21", 1, "ALIC", 0., 0., zpos3, 0, "ONLY");
a9e2aefa 1827
1828// End of geometry definition for the first plane of station 2
1829
1830
1831
1832
1833// SECOND PLANE OF STATION 2 : proj ratio = zpos4/zpos1
1834
1835 const Float_t kZ14=zpos4/zpos1;
1836
1837// Definition of prototype for chambers in the second plane of station 2
1838
1839 tpar[0]= 0.;
1840 tpar[1]= 0.;
1841 tpar[2]= 0.;
1842
b74f1c6a 1843 gMC->Gsvolu("SC4A", "BOX ", idAlu1, tpar, 0); //Al
1844 gMC->Gsvolu("SB4A", "BOX ", idtmed[1107], tpar, 0); //Bakelite
1845 gMC->Gsvolu("SG4A", "BOX ", idtmed[1106], tpar, 0); //Gas streamer
a9e2aefa 1846
1847// chamber type A
1848 tpar[0] = -1.;
1849 tpar[1] = -1.;
1850
1851 const Float_t kXMC4A=kXMC1A*kZ14;
1852 const Float_t kYMC4Am=0.;
1853 const Float_t kYMC4Ap=0.;
1854
1855 tpar[2] = 0.1;
b74f1c6a 1856 gMC->Gsposp("SG4A", 1, "SB4A", 0., 0., 0., 0, "ONLY",tpar,3);
a9e2aefa 1857 tpar[2] = 0.3;
b74f1c6a 1858 gMC->Gsposp("SB4A", 1, "SC4A", 0., 0., 0., 0, "ONLY",tpar,3);
a9e2aefa 1859
1860 tpar[2] = 0.4;
1861 tpar[0] = ((kXMC1MAX-kXMC1MED)/2.)*kZ14;
1862 tpar[1] = kYMC1MIN*kZ14;
b74f1c6a 1863 gMC->Gsposp("SC4A", 1, "SM22",kXMC4A,kYMC4Am,kZMCm, 0, "ONLY", tpar, 3);
1864 gMC->Gsposp("SC4A", 2, "SM22",-kXMC4A,kYMC4Ap,kZMCp, 0, "ONLY", tpar, 3);
03da3c56 1865 gMC->Gsbool("SC4A", "SF4A");
a9e2aefa 1866
1867
1868// chamber type B
1869 tpar[0] = ((kXMC1MAX-kXMC1MIN)/2.)*kZ14;
1870 tpar[1] = ((kYMC1MAX-kYMC1MIN)/2.)*kZ14;
1871
1872 const Float_t kXMC4B=kXMC1B*kZ14;
1873 const Float_t kYMC4Bp=kYMC1Bp*kZ14;
1874 const Float_t kYMC4Bm=kYMC1Bm*kZ14;
b74f1c6a 1875 gMC->Gsposp("SC4A", 3, "SM22",kXMC4B,kYMC4Bp,kZMCp, 0, "ONLY", tpar, 3);
1876 gMC->Gsposp("SC4A", 4, "SM22",-kXMC4B,kYMC4Bm,kZMCm, 0, "ONLY", tpar, 3);
1877 gMC->Gsposp("SC4A", 5, "SM22",kXMC4B,-kYMC4Bp,kZMCp, 0, "ONLY", tpar, 3);
1878 gMC->Gsposp("SC4A", 6, "SM22",-kXMC4B,-kYMC4Bm,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1879
1880
1881// chamber type C (end of type B !!)
1882 tpar[0] =(kXMC1MAX/2)*kZ14;
1883 tpar[1] = (kYMC1MAX/2)*kZ14;
1884
1885 const Float_t kXMC4C=kXMC1C*kZ14;
1886 const Float_t kYMC4Cp=kYMC1Cp*kZ14;
1887 const Float_t kYMC4Cm=kYMC1Cm*kZ14;
b74f1c6a 1888 gMC->Gsposp("SC4A", 7, "SM22",kXMC4C,kYMC4Cp,kZMCp, 0, "ONLY", tpar, 3);
1889 gMC->Gsposp("SC4A", 8, "SM22",-kXMC4C,kYMC4Cm,kZMCm, 0, "ONLY", tpar, 3);
1890 gMC->Gsposp("SC4A", 9, "SM22",kXMC4C,-kYMC4Cp,kZMCp, 0, "ONLY", tpar, 3);
1891 gMC->Gsposp("SC4A", 10, "SM22",-kXMC4C,-kYMC4Cm,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1892
1893
1894// chamber type D, E and F (same size)
1895 tpar[0] = (kXMC1MAX/2.)*kZ14;
1896 tpar[1] = kYMC1MIN*kZ14;
1897
1898 const Float_t kXMC4D=kXMC1D*kZ14;
1899 const Float_t kYMC4Dp=kYMC1Dp*kZ14;
1900 const Float_t kYMC4Dm=kYMC1Dm*kZ14;
b74f1c6a 1901 gMC->Gsposp("SC4A", 11, "SM22",kXMC4D,kYMC4Dm,kZMCm, 0, "ONLY", tpar, 3);
1902 gMC->Gsposp("SC4A", 12, "SM22",-kXMC4D,kYMC4Dp,kZMCp, 0, "ONLY", tpar, 3);
1903 gMC->Gsposp("SC4A", 13, "SM22",kXMC4D,-kYMC4Dm,kZMCm, 0, "ONLY", tpar, 3);
1904 gMC->Gsposp("SC4A", 14, "SM22",-kXMC4D,-kYMC4Dp,kZMCp, 0, "ONLY", tpar, 3);
a9e2aefa 1905
1906 const Float_t kYMC4Ep=kYMC1Ep*kZ14;
1907 const Float_t kYMC4Em=kYMC1Em*kZ14;
b74f1c6a 1908 gMC->Gsposp("SC4A", 15, "SM22",kXMC4D,kYMC4Ep,kZMCp, 0, "ONLY", tpar, 3);
1909 gMC->Gsposp("SC4A", 16, "SM22",-kXMC4D,kYMC4Em,kZMCm, 0, "ONLY", tpar, 3);
1910 gMC->Gsposp("SC4A", 17, "SM22",kXMC4D,-kYMC4Ep,kZMCp, 0, "ONLY", tpar, 3);
1911 gMC->Gsposp("SC4A", 18, "SM22",-kXMC4D,-kYMC4Em,kZMCm, 0, "ONLY", tpar, 3);
a9e2aefa 1912
1913 const Float_t kYMC4Fp=kYMC1Fp*kZ14;
1914 const Float_t kYMC4Fm=kYMC1Fm*kZ14;
b74f1c6a 1915 gMC->Gsposp("SC4A", 19, "SM22",kXMC4D,kYMC4Fm,kZMCm, 0, "ONLY", tpar, 3);
1916 gMC->Gsposp("SC4A", 20, "SM22",-kXMC4D,kYMC4Fp,kZMCp, 0, "ONLY", tpar, 3);
1917 gMC->Gsposp("SC4A", 21, "SM22",kXMC4D,-kYMC4Fm,kZMCm, 0, "ONLY", tpar, 3);
1918 gMC->Gsposp("SC4A", 22, "SM22",-kXMC4D,-kYMC4Fp,kZMCp, 0, "ONLY", tpar, 3);
a9e2aefa 1919
1920
1921// Positioning second plane of station 2 in ALICE
1922
b74f1c6a 1923 gMC->Gspos("SM22", 1, "ALIC", 0., 0., zpos4, 0, "ONLY");
a9e2aefa 1924
1925// End of geometry definition for the second plane of station 2
1926
1927// End of trigger geometry definition
1928
1929}
1930
1931
1932
1933//___________________________________________
1934void AliMUONv1::CreateMaterials()
1935{
1936 // *** DEFINITION OF AVAILABLE MUON MATERIALS ***
1937 //
b64652f5 1938 // Ar-CO2 gas (80%+20%)
a9e2aefa 1939 Float_t ag1[3] = { 39.95,12.01,16. };
1940 Float_t zg1[3] = { 18.,6.,8. };
1941 Float_t wg1[3] = { .8,.0667,.13333 };
1942 Float_t dg1 = .001821;
1943 //
1944 // Ar-buthane-freon gas -- trigger chambers
1945 Float_t atr1[4] = { 39.95,12.01,1.01,19. };
1946 Float_t ztr1[4] = { 18.,6.,1.,9. };
1947 Float_t wtr1[4] = { .56,.1262857,.2857143,.028 };
1948 Float_t dtr1 = .002599;
1949 //
1950 // Ar-CO2 gas
1951 Float_t agas[3] = { 39.95,12.01,16. };
1952 Float_t zgas[3] = { 18.,6.,8. };
1953 Float_t wgas[3] = { .74,.086684,.173316 };
1954 Float_t dgas = .0018327;
1955 //
1956 // Ar-Isobutane gas (80%+20%) -- tracking
1957 Float_t ag[3] = { 39.95,12.01,1.01 };
1958 Float_t zg[3] = { 18.,6.,1. };
1959 Float_t wg[3] = { .8,.057,.143 };
1960 Float_t dg = .0019596;
1961 //
1962 // Ar-Isobutane-Forane-SF6 gas (49%+7%+40%+4%) -- trigger
1963 Float_t atrig[5] = { 39.95,12.01,1.01,19.,32.066 };
1964 Float_t ztrig[5] = { 18.,6.,1.,9.,16. };
1965 Float_t wtrig[5] = { .49,1.08,1.5,1.84,0.04 };
1966 Float_t dtrig = .0031463;
1967 //
1968 // bakelite
1969
1970 Float_t abak[3] = {12.01 , 1.01 , 16.};
1971 Float_t zbak[3] = {6. , 1. , 8.};
1972 Float_t wbak[3] = {6. , 6. , 1.};
1973 Float_t dbak = 1.4;
1974
1975 Float_t epsil, stmin, deemax, tmaxfd, stemax;
1976
1977 Int_t iSXFLD = gAlice->Field()->Integ();
1978 Float_t sXMGMX = gAlice->Field()->Max();
1979 //
1980 // --- Define the various materials for GEANT ---
1981 AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
1982 AliMaterial(10, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
1983 AliMaterial(15, "AIR$ ", 14.61, 7.3, .001205, 30423.24, 67500);
1984 AliMixture(19, "Bakelite$", abak, zbak, dbak, -3, wbak);
1985 AliMixture(20, "ArC4H10 GAS$", ag, zg, dg, 3, wg);
1986 AliMixture(21, "TRIG GAS$", atrig, ztrig, dtrig, -5, wtrig);
1987 AliMixture(22, "ArCO2 80%$", ag1, zg1, dg1, 3, wg1);
1988 AliMixture(23, "Ar-freon $", atr1, ztr1, dtr1, 4, wtr1);
1989 AliMixture(24, "ArCO2 GAS$", agas, zgas, dgas, 3, wgas);
1e8fff9c 1990 // materials for slat:
1991 // Sensitive area: gas (already defined)
1992 // PCB: copper
1993 // insulating material and frame: vetronite
1994 // walls: carbon, rohacell, carbon
1995 Float_t aglass[5]={12.01, 28.09, 16., 10.8, 23.};
1996 Float_t zglass[5]={ 6., 14., 8., 5., 11.};
1997 Float_t wglass[5]={ 0.5, 0.105, 0.355, 0.03, 0.01};
1998 Float_t dglass=1.74;
1999
2000 // rohacell: C9 H13 N1 O2
2001 Float_t arohac[4] = {12.01, 1.01, 14.010, 16.};
2002 Float_t zrohac[4] = { 6., 1., 7., 8.};
2003 Float_t wrohac[4] = { 9., 13., 1., 2.};
2004 Float_t drohac = 0.03;
2005
2006 AliMaterial(31, "COPPER$", 63.54, 29., 8.96, 1.4, 0.);
2007 AliMixture(32, "Vetronite$",aglass, zglass, dglass, 5, wglass);
2008 AliMaterial(33, "Carbon$", 12.01, 6., 2.265, 18.8, 49.9);
2009 AliMixture(34, "Rohacell$", arohac, zrohac, drohac, -4, wrohac);
2010
a9e2aefa 2011
2012 epsil = .001; // Tracking precision,
2013 stemax = -1.; // Maximum displacement for multiple scat
2014 tmaxfd = -20.; // Maximum angle due to field deflection
2015 deemax = -.3; // Maximum fractional energy loss, DLS
2016 stmin = -.8;
2017 //
2018 // Air
2019 AliMedium(1, "AIR_CH_US ", 15, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
2020 //
2021 // Aluminum
2022
2023 AliMedium(4, "ALU_CH_US ", 9, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
2024 fMaxDestepAlu, epsil, stmin);
2025 AliMedium(5, "ALU_CH_US ", 10, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
2026 fMaxDestepAlu, epsil, stmin);
2027 //
2028 // Ar-isoC4H10 gas
2029
2030 AliMedium(6, "AR_CH_US ", 20, 1, iSXFLD, sXMGMX, tmaxfd, fMaxStepGas,
2031 fMaxDestepGas, epsil, stmin);
2032//
2033 // Ar-Isobuthane-Forane-SF6 gas
2034
2035 AliMedium(7, "GAS_CH_TRIGGER ", 21, 1, iSXFLD, sXMGMX, tmaxfd, stemax, deemax, epsil, stmin);
2036
2037 AliMedium(8, "BAKE_CH_TRIGGER ", 19, 0, iSXFLD, sXMGMX, tmaxfd, fMaxStepAlu,
2038 fMaxDestepAlu, epsil, stmin);
2039
2040 AliMedium(9, "ARG_CO2 ", 22, 1, iSXFLD, sXMGMX, tmaxfd, fMaxStepGas,
2041 fMaxDestepAlu, epsil, stmin);
1e8fff9c 2042 // tracking media for slats: check the parameters!!
2043 AliMedium(11, "PCB_COPPER ", 31, 0, iSXFLD, sXMGMX, tmaxfd,
2044 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
2045 AliMedium(12, "VETRONITE ", 32, 0, iSXFLD, sXMGMX, tmaxfd,
2046 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
2047 AliMedium(13, "CARBON ", 33, 0, iSXFLD, sXMGMX, tmaxfd,
2048 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
2049 AliMedium(14, "Rohacell ", 34, 0, iSXFLD, sXMGMX, tmaxfd,
2050 fMaxStepAlu, fMaxDestepAlu, epsil, stmin);
a9e2aefa 2051}
2052
2053//___________________________________________
2054
2055void AliMUONv1::Init()
2056{
2057 //
2058 // Initialize Tracking Chambers
2059 //
2060
9e1a0ddb 2061 if(fDebug) printf("\n%s: Start Init for version 1 - CPC chamber type\n\n",ClassName());
e17592e9 2062 Int_t i;
f665c1ea 2063 for (i=0; i<AliMUONConstants::NCh(); i++) {
a9e2aefa 2064 ( (AliMUONChamber*) (*fChambers)[i])->Init();
2065 }
2066
2067 //
2068 // Set the chamber (sensitive region) GEANT identifier
b74f1c6a 2069 ((AliMUONChamber*)(*fChambers)[0])->SetGid(gMC->VolId("S01G"));
2070 ((AliMUONChamber*)(*fChambers)[1])->SetGid(gMC->VolId("S02G"));
b17c0c87 2071
b74f1c6a 2072 ((AliMUONChamber*)(*fChambers)[2])->SetGid(gMC->VolId("S03G"));
2073 ((AliMUONChamber*)(*fChambers)[3])->SetGid(gMC->VolId("S04G"));
b17c0c87 2074
1e8fff9c 2075 ((AliMUONChamber*)(*fChambers)[4])->SetGid(gMC->VolId("S05G"));
2076 ((AliMUONChamber*)(*fChambers)[5])->SetGid(gMC->VolId("S06G"));
b17c0c87 2077
1e8fff9c 2078 ((AliMUONChamber*)(*fChambers)[6])->SetGid(gMC->VolId("S07G"));
2079 ((AliMUONChamber*)(*fChambers)[7])->SetGid(gMC->VolId("S08G"));
b17c0c87 2080
1e8fff9c 2081 ((AliMUONChamber*)(*fChambers)[8])->SetGid(gMC->VolId("S09G"));
2082 ((AliMUONChamber*)(*fChambers)[9])->SetGid(gMC->VolId("S10G"));
b17c0c87 2083
b74f1c6a 2084 ((AliMUONChamber*)(*fChambers)[10])->SetGid(gMC->VolId("SG1A"));
2085 ((AliMUONChamber*)(*fChambers)[11])->SetGid(gMC->VolId("SG2A"));
2086 ((AliMUONChamber*)(*fChambers)[12])->SetGid(gMC->VolId("SG3A"));
2087 ((AliMUONChamber*)(*fChambers)[13])->SetGid(gMC->VolId("SG4A"));
a9e2aefa 2088
9e1a0ddb 2089 if(fDebug) printf("\n%s: Finished Init for version 1 - CPC chamber type\n",ClassName());
a9e2aefa 2090
2091 //cp
9e1a0ddb 2092 if(fDebug) printf("\n%s: Start Init for Trigger Circuits\n",ClassName());
f665c1ea 2093 for (i=0; i<AliMUONConstants::NTriggerCircuit(); i++) {
a9e2aefa 2094 ( (AliMUONTriggerCircuit*) (*fTriggerCircuits)[i])->Init(i);
2095 }
9e1a0ddb 2096 if(fDebug) printf("%s: Finished Init for Trigger Circuits\n",ClassName());
a9e2aefa 2097 //cp
2098
2099}
a9e2aefa 2100//___________________________________________
c33d9661 2101void AliMUONv1::StepManager()
2102{
2103 if (fStepManagerVersionOld) {
2104 StepManagerOld();
2105 return;
2106 }
2107 // Volume id
2108 Int_t copy, id;
2109 Int_t idvol;
2110 Int_t iChamber=0;
2111 // Particule id, pos and mom vectors,
2112 // theta, phi angles with respect the normal of the chamber,
2113 // spatial step, delta_energy and time of flight
2114 Int_t ipart;
2115 TLorentzVector pos, mom;
2116 Float_t theta, phi, tof;
2117 Float_t destep, step;
2118 const Float_t kBig = 1.e10;
2119
2120 // Only charged tracks
2121 if( !(gMC->TrackCharge()) ) return;
2122
2123 // Only gas gap inside chamber
2124 // Tag chambers and record hits when track enters
2125 idvol=-1;
2126 id=gMC->CurrentVolID(copy);
2127 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++) {
2128 if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) {
2129 iChamber = i;
2130 idvol = i-1;
2131 }
2132 }
2133 if (idvol == -1) return;
2134
2135
2136 // record hits when track enters ...
2137 if( gMC->IsTrackEntering()) gMC->SetMaxStep(fStepMaxInActiveGas);
2138
2139 if (gMC->TrackStep() > 0.) {
2140 // Get current particle id (ipart), track position (pos) and momentum (mom)
2141 gMC->TrackPosition(pos);
2142 gMC->TrackMomentum(mom);
2143 ipart = gMC->TrackPid();
2144 theta = mom.Theta()*kRaddeg; // theta of track
2145 phi = mom.Phi() *kRaddeg; // phi of the track
2146 tof = gMC->TrackTime(); // Time of flight
2147 //
2148 // momentum loss and steplength in last step
2149 destep = gMC->Edep();
2150 step = gMC->TrackStep();
2151 //new hit
2152 AddHit(fIshunt, gAlice->CurrentTrack(), iChamber, ipart,
2153 pos.X(), pos.Y(), pos.Z(), tof, mom.P(),
2154 theta, phi, step, destep);
2155 }
2156 // Track left chamber ...
2157 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
2158 gMC->SetMaxStep(kBig);
2159 }
2160
2161}
2162
5f91c9e8 2163Int_t AliMUONv1::GetChamberId(Int_t volId) const
2164{
2165// Check if the volume with specified volId is a sensitive volume (gas)
2166// of some chamber and returns the chamber number;
2167// if not sensitive volume - return 0.
2168// ---
2169
2170 for (Int_t i = 1; i <= AliMUONConstants::NCh(); i++)
2171 if (volId==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()) return i;
2172
2173 return 0;
2174}
2175
2176//___________________________________________
c33d9661 2177void AliMUONv1::StepManagerOld()
a9e2aefa 2178{
2179 Int_t copy, id;
2180 static Int_t idvol;
2181 static Int_t vol[2];
2182 Int_t ipart;
2183 TLorentzVector pos;
2184 TLorentzVector mom;
2185 Float_t theta,phi;
2186 Float_t destep, step;
681d067b 2187
1e8fff9c 2188 static Float_t eloss, eloss2, xhit, yhit, zhit, tof, tlength;
2eb55fab 2189 const Float_t kBig = 1.e10;
a9e2aefa 2190 static Float_t hits[15];
2191
2192 TClonesArray &lhits = *fHits;
2193
2194 //
a9e2aefa 2195 //
2196 // Only charged tracks
2197 if( !(gMC->TrackCharge()) ) return;
2198 //
2199 // Only gas gap inside chamber
2200 // Tag chambers and record hits when track enters
a9e2aefa 2201 id=gMC->CurrentVolID(copy);
5f91c9e8 2202 vol[0] = GetChamberId(id);
2203 idvol = vol[0] -1;
2204
2205 if (idvol == -1) return;
2206
a9e2aefa 2207 //
2208 // Get current particle id (ipart), track position (pos) and momentum (mom)
2209 gMC->TrackPosition(pos);
2210 gMC->TrackMomentum(mom);
2211
2212 ipart = gMC->TrackPid();
a9e2aefa 2213
2214 //
2215 // momentum loss and steplength in last step
2216 destep = gMC->Edep();
2217 step = gMC->TrackStep();
2218
2219 //
2220 // record hits when track enters ...
2221 if( gMC->IsTrackEntering()) {
2222 gMC->SetMaxStep(fMaxStepGas);
2223 Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
2224 Double_t rt = TMath::Sqrt(tc);
2225 Double_t pmom = TMath::Sqrt(tc+mom[2]*mom[2]);
2eb55fab 2226 Double_t tx = mom[0]/pmom;
2227 Double_t ty = mom[1]/pmom;
2228 Double_t tz = mom[2]/pmom;
2229 Double_t s = ((AliMUONChamber*)(*fChambers)[idvol])
a9e2aefa 2230 ->ResponseModel()
2231 ->Pitch()/tz;
2232 theta = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
2233 phi = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
2234 hits[0] = Float_t(ipart); // Geant3 particle type
2eb55fab 2235 hits[1] = pos[0]+s*tx; // X-position for hit
2236 hits[2] = pos[1]+s*ty; // Y-position for hit
2237 hits[3] = pos[2]+s*tz; // Z-position for hit
a9e2aefa 2238 hits[4] = theta; // theta angle of incidence
2239 hits[5] = phi; // phi angle of incidence
2eb55fab 2240 hits[8] = (Float_t) fNPadHits; // first padhit
a9e2aefa 2241 hits[9] = -1; // last pad hit
2eb55fab 2242 hits[10] = mom[3]; // hit momentum P
2243 hits[11] = mom[0]; // Px
2244 hits[12] = mom[1]; // Py
2245 hits[13] = mom[2]; // Pz
a9e2aefa 2246 tof=gMC->TrackTime();
2eb55fab 2247 hits[14] = tof; // Time of flight
2248 tlength = 0;
2249 eloss = 0;
2250 eloss2 = 0;
2251 xhit = pos[0];
2252 yhit = pos[1];
2253 zhit = pos[2];
681d067b 2254 Chamber(idvol).ChargeCorrelationInit();
a9e2aefa 2255 // Only if not trigger chamber
1e8fff9c 2256
2257
2258
2259
2eb55fab 2260 if(idvol < AliMUONConstants::NTrackingCh()) {
a9e2aefa 2261 //
2262 // Initialize hit position (cursor) in the segmentation model
2263 ((AliMUONChamber*) (*fChambers)[idvol])
2264 ->SigGenInit(pos[0], pos[1], pos[2]);
2265 } else {
2266 //geant3->Gpcxyz();
2267 //printf("In the Trigger Chamber #%d\n",idvol-9);
2268 }
2269 }
2270 eloss2+=destep;
2271
2272 //
2273 // Calculate the charge induced on a pad (disintegration) in case
2274 //
2275 // Mip left chamber ...
2276 if( gMC->IsTrackExiting() || gMC->IsTrackStop() || gMC->IsTrackDisappeared()){
2277 gMC->SetMaxStep(kBig);
2278 eloss += destep;
2279 tlength += step;
2280
802a864d 2281 Float_t x0,y0,z0;
2282 Float_t localPos[3];
2283 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
802a864d 2284 gMC->Gmtod(globalPos,localPos,1);
2285
2eb55fab 2286 if(idvol < AliMUONConstants::NTrackingCh()) {
a9e2aefa 2287// tracking chambers
2288 x0 = 0.5*(xhit+pos[0]);
2289 y0 = 0.5*(yhit+pos[1]);
1e8fff9c 2290 z0 = 0.5*(zhit+pos[2]);
a9e2aefa 2291 } else {
2292// trigger chambers
2eb55fab 2293 x0 = xhit;
2294 y0 = yhit;
2295 z0 = 0.;
a9e2aefa 2296 }
2297
1e8fff9c 2298
802a864d 2299 if (eloss >0) MakePadHits(x0,y0,z0,eloss,tof,idvol);
a9e2aefa 2300
2301
2eb55fab 2302 hits[6] = tlength; // track length
2303 hits[7] = eloss2; // de/dx energy loss
2304
a9e2aefa 2305 if (fNPadHits > (Int_t)hits[8]) {
2eb55fab 2306 hits[8] = hits[8]+1;
2307 hits[9] = (Float_t) fNPadHits;
a9e2aefa 2308 }
2eb55fab 2309//
2310// new hit
2311
a9e2aefa 2312 new(lhits[fNhits++])
2eb55fab 2313 AliMUONHit(fIshunt, gAlice->CurrentTrack(), vol,hits);
a9e2aefa 2314 eloss = 0;
2315 //
2316 // Check additional signal generation conditions
2317 // defined by the segmentation
a75f073c 2318 // model (boundary crossing conditions)
2319 // only for tracking chambers
a9e2aefa 2320 } else if
a75f073c 2321 ((idvol < AliMUONConstants::NTrackingCh()) &&
2322 ((AliMUONChamber*) (*fChambers)[idvol])->SigGenCond(pos[0], pos[1], pos[2]))
a9e2aefa 2323 {
2324 ((AliMUONChamber*) (*fChambers)[idvol])
2325 ->SigGenInit(pos[0], pos[1], pos[2]);
802a864d 2326
2327 Float_t localPos[3];
2328 Float_t globalPos[3] = {pos[0], pos[1], pos[2]};
2329 gMC->Gmtod(globalPos,localPos,1);
2330
e0f71fb7 2331 eloss += destep;
802a864d 2332
a75f073c 2333 if (eloss > 0 && idvol < AliMUONConstants::NTrackingCh())
1e8fff9c 2334 MakePadHits(0.5*(xhit+pos[0]),0.5*(yhit+pos[1]),pos[2],eloss,tof,idvol);
a9e2aefa 2335 xhit = pos[0];
2336 yhit = pos[1];
e0f71fb7 2337 zhit = pos[2];
2338 eloss = 0;
a9e2aefa 2339 tlength += step ;
2340 //
2341 // nothing special happened, add up energy loss
2342 } else {
2343 eloss += destep;
2344 tlength += step ;
2345 }
2346}
2347
2348