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