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