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