]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONv0.cxx
Correct inconsistent variable name / method name / comments.
[u/mrichter/AliRoot.git] / MUON / AliMUONv0.cxx
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     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17 $Log$
18 Revision 1.16  2001/01/27 08:50:50  morsch
19 Call non default constructors of segmentation classes.
20
21 Revision 1.15  2001/01/17 20:57:45  hristov
22 Unused variable removed
23
24 Revision 1.14  2000/12/21 22:42:55  morsch
25 Constructor contains default set-up for segmentation.
26 Record charged particles only.
27
28 Revision 1.13  2000/10/06 10:03:38  morsch
29 Call to gMC->VolId() moved to Init()
30
31 Revision 1.12  2000/10/02 21:28:09  fca
32 Removal of useless dependecies via forward declarations
33
34 Revision 1.11  2000/06/27 07:31:07  morsch
35 fChambers = 0; deleted from constructor.
36
37 Revision 1.10  2000/06/26 14:02:38  morsch
38 Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
39
40 Revision 1.9  2000/06/15 07:58:49  morsch
41 Code from MUON-dev joined
42
43 Revision 1.8.4.9  2000/06/12 19:20:49  morsch
44 Constructor sets default geometry, segmentation and response parameters.
45
46 Revision 1.8.4.8  2000/06/09 21:55:28  morsch
47 Most coding rule violations corrected.
48
49 Revision 1.8.4.7  2000/05/02 13:15:18  morsch
50 Coding rule violations RS3, RN13 corected
51
52 Revision 1.8.4.6  2000/05/02 10:24:26  morsch
53 Public access to fdGas and fdAlu of AliMUONChamber replaced by getters.
54
55 Revision 1.8.4.5  2000/04/26 19:58:47  morsch
56 Obsolete reference to trig_ removed.
57
58 Revision 1.8.4.4  2000/04/19 19:42:47  morsch
59 change NCH to kNCH
60
61 Revision 1.8.4.3  2000/02/17 08:17:43  morsch
62 Gammas and neutrons are also scored in the stepmanager
63 */
64
65 /////////////////////////////////////////////////////////
66 //  Manager and hits classes for set:MUON version 0    //
67 /////////////////////////////////////////////////////////
68
69 #include <TTUBE.h>
70 #include <TNode.h> 
71 #include <TRandom.h> 
72 #include <TLorentzVector.h> 
73 #include <iostream.h>
74
75 #include "AliMUONv0.h"
76 #include "AliMUONChamber.h"
77 #include "AliRun.h"
78 #include "AliMC.h"
79 #include "AliMagF.h"
80 #include "AliMUONHit.h"
81 #include "AliMUONPadHit.h"
82 #include "AliCallf77.h"
83 #include "AliConst.h" 
84 #include "AliMUONResponseV0.h"
85 #include "AliMUONResponseTrigger.h"
86 #include "AliMUONSegmentationV0.h"
87 #include "AliMUONSegmentationV01.h"
88 #include "AliMUONSegmentationV02.h"
89 #include "AliMUONSegmentationV04.h"
90 #include "AliMUONSegmentationV05.h"
91 #include "AliMUONSegmentationSlat.h"
92 #include "AliMUONSegmentationSlatN.h"
93 #include "AliMUONSegmentationTrigger.h"
94 #include "AliMUONSegmentationTriggerX.h"
95 #include "AliMUONSegmentationTriggerY.h"
96 #include "AliMUONConstants.h"
97
98 ClassImp(AliMUONv0)
99  
100 //___________________________________________
101 AliMUONv0::AliMUONv0() : AliMUON()
102 {
103 // Constructor
104     fChambers = 0;
105 }
106  
107 //___________________________________________
108 AliMUONv0::AliMUONv0(const char *name, const char *title)
109        : AliMUON(name,title)
110 {
111 // Constructor
112     SetIshunt(0);
113     SetMaxStepGas(0.1);
114     SetMaxStepAlu(0.1);
115     
116 //
117 // First define the number of planes that are segmented (1 or 2) by a call
118 // to SetNsec. 
119 // Then chose for each chamber (chamber plane) the segmentation 
120 // and response model.
121 // They should be equal for the two chambers of each station. In a future
122 // version this will be enforced.
123 //
124 //  
125     Int_t chamber;
126     // Default response: 5 mm of gas
127     AliMUONResponseV0* response0 = new AliMUONResponseV0;
128     response0->SetSqrtKx3AndDeriveKx2Kx4(0.7131); // sqrt(0.5085)
129     response0->SetSqrtKy3AndDeriveKy2Ky4(0.7642); // sqrt(0.5840)
130     response0->SetPitch(0.25); // anode-cathode distance
131     response0->SetSigmaIntegration(10.);
132     response0->SetChargeSlope(50);
133     response0->SetChargeSpread(0.18, 0.18);
134     response0->SetMaxAdc(4096);
135     response0->SetZeroSuppression(6);
136     
137     // Response for 4 mm of gas (station 1)
138     // automatic consistency with width of sensitive medium in CreateGeometry ????
139     AliMUONResponseV0* responseSt1 = new AliMUONResponseV0;
140     // Mathieson parameters from L.Kharmandarian's thesis, page 190
141     responseSt1->SetSqrtKx3AndDeriveKx2Kx4(0.7000); // sqrt(0.4900)
142     responseSt1->SetSqrtKy3AndDeriveKy2Ky4(0.7550); // sqrt(0.5700)
143     responseSt1->SetPitch(0.20); // anode-cathode distance
144     responseSt1->SetSigmaIntegration(10.);
145     // ChargeSlope larger to compensate for the smaller anode-cathode distance
146     // and keep the same most probable ADC channel for mip's
147     responseSt1->SetChargeSlope(62.5); 
148     // assumed proportionality to anode-cathode distance for ChargeSpread
149     responseSt1->SetChargeSpread(0.144, 0.144);
150     responseSt1->SetMaxAdc(4096);
151     responseSt1->SetZeroSuppression(6);
152     
153 //--------------------------------------------------------
154 // Configuration for Chamber TC1/2  (Station 1) ----------           
155 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
156     Float_t rseg1[4]={17.5, 55.2, 71.3, 95.5};
157     Int_t   nseg1[4]={4, 4, 2, 1};
158 //
159     chamber=1;
160 //^^^^^^^^^
161     SetNsec(chamber-1,2);
162 //
163     AliMUONSegmentationV01 *seg11=new AliMUONSegmentationV01(4);
164     
165     seg11->SetSegRadii(rseg1);
166 //  seg11->SetPadSize(3, 0.5);
167     seg11->SetPadSize(2.4, 0.4); // smaller pad size
168 //  seg11->SetDAnod(3.0/3./4);
169     seg11->SetDAnod(0.20); // smaller distance between anode wires
170     seg11->SetPadDivision(nseg1);
171     
172     SetSegmentationModel(chamber-1, 1, seg11);
173 //
174     AliMUONSegmentationV02 *seg12=new AliMUONSegmentationV02(4);
175     seg12->SetSegRadii(rseg1); 
176 //  seg12->SetPadSize(0.75, 2.0);
177     seg12->SetPadSize(0.6, 1.6); // smaller pad size
178 //  seg12->SetDAnod(3.0/3./4);
179     seg12->SetDAnod(0.20); // smaller distance between anode wires
180     seg12->SetPadDivision(nseg1);
181     
182     SetSegmentationModel(chamber-1, 2, seg12);
183     
184 //  SetResponseModel(chamber-1, response0);         
185     SetResponseModel(chamber-1, responseSt1); // special response           
186     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
187     
188     chamber=2;
189 //^^^^^^^^^
190 //
191     SetNsec(chamber-1,2);
192 //
193     AliMUONSegmentationV01 *seg21=new AliMUONSegmentationV01(4);
194     seg21->SetSegRadii(rseg1);
195 //  seg21->SetPadSize(3, 0.5);
196     seg21->SetPadSize(2.4, 0.4); // smaller pad size
197 //  seg21->SetDAnod(3.0/3./4);
198     seg21->SetDAnod(0.20); // smaller distance between anode wires
199     seg21->SetPadDivision(nseg1);
200     SetSegmentationModel(chamber-1, 1, seg21);
201 //
202     AliMUONSegmentationV02 *seg22=new AliMUONSegmentationV02(4);
203     seg22->SetSegRadii(rseg1); 
204 //  seg22->SetPadSize(0.75, 2.);
205     seg22->SetPadSize(0.6, 1.6); // smaller pad size
206 //  seg22->SetDAnod(3.0/3./4);
207     seg22->SetDAnod(0.20); // smaller distance between anode wires
208     seg22->SetPadDivision(nseg1);
209     SetSegmentationModel(chamber-1, 2, seg22);
210     
211 //  SetResponseModel(chamber-1, response0);         
212     SetResponseModel(chamber-1, responseSt1); // special response
213     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
214     
215 //
216 //--------------------------------------------------------
217 // Configuration for Chamber TC3/4 (Station 2) -----------
218 ///^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
219 // Float_t rseg2[4]={23.5, 87.7, 122.4, 122.5};
220     Float_t rseg2[4]={23.5, 47.1, 87.7, 122.5};
221     Int_t   nseg2[4]={4, 4, 2, 1};
222 //
223     chamber=3;
224 //^^^^^^^^^
225     SetNsec(chamber-1,2);
226 //
227     AliMUONSegmentationV01 *seg31=new AliMUONSegmentationV01(4);
228     seg31->SetSegRadii(rseg2);
229     seg31->SetPadSize(3.0, 0.5);
230     seg31->SetDAnod(3.0/3./4);
231     seg31->SetPadDivision(nseg2);
232     SetSegmentationModel(chamber-1, 1, seg31);
233 //
234     AliMUONSegmentationV02 *seg32=new AliMUONSegmentationV02(4);
235     seg32->SetSegRadii(rseg2); 
236     seg32->SetPadSize(0.75, 2.0);
237     seg32->SetPadDivision(nseg2);
238     seg32->SetDAnod(3.0/3./4);
239     
240     SetSegmentationModel(chamber-1, 2, seg32);
241     
242     SetResponseModel(chamber-1, response0);         
243     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
244     
245     chamber=4;
246 //^^^^^^^^^
247 //
248     SetNsec(chamber-1,2);
249 //
250     AliMUONSegmentationV01 *seg41=new AliMUONSegmentationV01(4);
251     seg41->SetSegRadii(rseg2);
252     seg41->SetPadSize(3.0, 0.5);
253     seg41->SetDAnod(3.0/3./4);
254     seg41->SetPadDivision(nseg2);
255     SetSegmentationModel(chamber-1, 1, seg41);
256 //
257     AliMUONSegmentationV02 *seg42=new AliMUONSegmentationV02(4);
258     seg42->SetSegRadii(rseg2); 
259     seg42->SetPadSize(0.75, 2.0);
260     seg42->SetPadDivision(nseg2);
261     seg42->SetDAnod(3.0/3./4);
262     
263     SetSegmentationModel(chamber-1, 2, seg42);
264     
265     SetResponseModel(chamber-1, response0);         
266     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
267     
268     
269 //--------------------------------------------------------
270 // Configuration for Chamber TC5/6  (Station 3) ----------          
271 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
272     Int_t   nseg3[4]={4, 4, 2, 1};
273     Int_t   npcb5[36] = {0,0,2,0,
274                          0,0,3,0,
275                          0,1,3,0,
276                          0,2,2,0,
277                          0,1,2,0, 
278                          0,2,2,0, 
279                          0,1,3,0, 
280                          0,0,3,0,
281                          0,0,2,0};
282
283     Float_t shift = 1.5/2.;
284     // Float_t xpos5[8]    = {2., 2., 2., 42., 42., 2., 2., 2.};
285     Float_t xpos5[9]    = {2., 2., 2., 2.,32., 2., 2., 2., 2.};
286     Float_t ypos5       = -(20.+4.*(40.-2.*shift));
287     
288     chamber=5;
289     SetNsec(chamber-1,2);
290     AliMUONSegmentationSlat *seg51=new AliMUONSegmentationSlat(4);
291     seg51->SetNSlats(9); 
292     seg51->SetShift(shift);  
293     seg51->SetNPCBperSector(npcb5); 
294     seg51->SetSlatXPositions(xpos5);
295     seg51->SetSlatYPosition(ypos5);
296     seg51->SetPadSize(10.,0.5);
297     seg51->SetDAnod(0.25);
298     seg51->SetPadDivision(nseg3);
299     SetSegmentationModel(chamber-1, 1, seg51);
300     
301     AliMUONSegmentationSlatN *seg52=new AliMUONSegmentationSlatN(4);
302     seg52->SetNSlats(9); 
303     seg52->SetShift(shift);  
304     seg52->SetNPCBperSector(npcb5); 
305     seg52->SetSlatXPositions(xpos5);
306     seg52->SetSlatYPosition(ypos5);
307     seg52->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
308     seg52->SetDAnod(0.25);
309     seg52->SetPadDivision(nseg3);
310     SetSegmentationModel(chamber-1, 2, seg52);
311     SetResponseModel(chamber-1, response0);         
312     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
313     
314     chamber=6;
315     SetNsec(chamber-1,2);
316     AliMUONSegmentationSlat *seg61=new AliMUONSegmentationSlat(4);
317     seg61->SetNSlats(9); 
318     seg61->SetShift(shift);  
319     seg61->SetNPCBperSector(npcb5); 
320     seg61->SetSlatXPositions(xpos5);
321     seg61->SetSlatYPosition(ypos5);
322     seg61->SetPadSize(10.,0.5);
323     seg61->SetDAnod(0.25);
324     seg61->SetPadDivision(nseg3);
325     SetSegmentationModel(chamber-1, 1, seg61);
326     
327     AliMUONSegmentationSlatN *seg62=new AliMUONSegmentationSlatN(4);
328     seg62->SetNSlats(9); 
329     seg62->SetShift(shift);  
330     seg62->SetNPCBperSector(npcb5); 
331     seg62->SetSlatXPositions(xpos5);
332     seg62->SetSlatYPosition(ypos5);
333     seg62->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
334     seg62->SetDAnod(0.25);
335     seg62->SetPadDivision(nseg3);
336     SetSegmentationModel(chamber-1, 2, seg62);
337     SetResponseModel(chamber-1, response0);         
338     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
339     
340 //--------------------------------------------------------
341 // Configuration for Chamber TC7/8  (Station 4) ----------           
342 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
343
344     Int_t   nseg4[4]={4, 4, 2, 1};
345
346     chamber=7;
347 //^^^^^^^^^
348
349     SetNsec(chamber-1,2);
350 //
351     AliMUONSegmentationSlat *seg71=new AliMUONSegmentationSlat(4);
352     Int_t npcb7[44] = {0,0,0,3,
353                        0,0,2,2,
354                        0,0,3,2,
355                        0,2,2,1,
356                        0,2,2,1,
357                        0,1,2,1, 
358                        0,2,2,1, 
359                        0,2,2,1, 
360                        0,0,3,2, 
361                        0,0,2,2, 
362                        0,0,0,3};
363     Float_t xpos7[11]   = {2., 2., 2., 2., 2., 39.5, 2., 2., 2., 2., 2.};
364     Float_t ypos7       = -(20.+5.*(40.-2.*shift));
365     
366     seg71->SetNSlats(11);  
367     seg71->SetShift(shift);  
368     seg71->SetNPCBperSector(npcb7); 
369     seg71->SetSlatXPositions(xpos7);
370     seg71->SetSlatYPosition(ypos7);
371     
372     seg71->SetPadSize(10.,0.5);
373     seg71->SetDAnod(0.25);
374     seg71->SetPadDivision(nseg4);
375     SetSegmentationModel(chamber-1, 1, seg71);
376     
377     AliMUONSegmentationSlatN *seg72=new AliMUONSegmentationSlatN(4);
378     
379     SetSegmentationModel(chamber-1, 2, seg72);
380     seg72->SetNSlats(11);  
381     seg72->SetShift(shift);   
382     seg72->SetNPCBperSector(npcb7); 
383     seg72->SetSlatXPositions(xpos7);
384     seg72->SetSlatYPosition(ypos7);
385     seg72->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
386     seg72->SetDAnod(0.25);
387     seg72->SetPadDivision(nseg4);
388     
389     SetResponseModel(chamber-1, response0);         
390     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
391     
392     chamber=8;
393 //^^^^^^^^^
394     SetNsec(chamber-1,2);
395 //
396     AliMUONSegmentationSlat *seg81=new AliMUONSegmentationSlat(4);
397     
398     seg81->SetNSlats(11);  
399     seg81->SetShift(shift);  
400     seg81->SetNPCBperSector(npcb7); 
401     seg81->SetSlatXPositions(xpos7);
402     seg81->SetSlatYPosition(ypos7);
403     seg81->SetPadSize(10.,0.5);
404     seg81->SetDAnod(0.25);
405     seg81->SetPadDivision(nseg4);
406     SetSegmentationModel(chamber-1, 1, seg81);
407     
408     AliMUONSegmentationSlat *seg82=new AliMUONSegmentationSlatN(4);
409
410     SetSegmentationModel(chamber-1, 2, seg82);
411     seg82->SetNSlats(11);  
412     seg82->SetShift(shift);  
413     seg82->SetNPCBperSector(npcb7); 
414     seg82->SetSlatXPositions(xpos7);
415     seg82->SetSlatYPosition(ypos7);
416     seg82->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
417     seg82->SetDAnod(0.25);
418     seg82->SetPadDivision(nseg4);
419     
420     SetResponseModel(chamber-1, response0);         
421     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
422     
423
424 //--------------------------------------------------------
425 // Configuration for Chamber TC9/10  (Station 5) ---------           
426 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
427     chamber=9;
428 //^^^^^^^^^
429     
430     SetNsec(chamber-1,2);
431 //
432     AliMUONSegmentationSlat *seg91=new AliMUONSegmentationSlat(4);
433     Int_t   npcb9[52] = {0,0,0,3,
434                          0,0,0,4,
435                          0,0,2,3,
436                          0,0,3,3,
437                          0,2,2,2,
438                          0,2,2,2,
439                          0,1,2,2, 
440                          0,2,2,2, 
441                          0,2,2,2, 
442                          0,0,3,3, 
443                          0,0,2,3, 
444                          0,0,0,4, 
445                          0,0,0,3};   
446     
447     // Float_t xpos9[13]   = {2., 2., 2., 2., 2., 2., 39.5 , 2., 2., 2., 2., 2., 2.};
448     Float_t xpos9[13]   = {2., 2., 2., 2., 2., 2., 39.5, 2., 2., 2., 2., 2., 2.};
449     Float_t ypos9       = -(20.+6.*(40.-2.*shift));
450     
451     seg91->SetNSlats(13);  
452     seg91->SetShift(shift);  
453     seg91->SetNPCBperSector(npcb9); 
454     seg91->SetSlatXPositions(xpos9);
455     seg91->SetSlatYPosition(ypos9);
456     seg91->SetPadSize(10.,0.5);
457     seg91->SetDAnod(0.25);
458     seg91->SetPadDivision(nseg4);
459     SetSegmentationModel(chamber-1, 1, seg91);
460     
461     AliMUONSegmentationSlatN *seg92=new AliMUONSegmentationSlatN(4);
462     
463     SetSegmentationModel(chamber-1, 2, seg92);
464     seg92->SetNSlats(13);  
465     seg92->SetShift(shift);   
466     seg92->SetNPCBperSector(npcb9); 
467     seg92->SetSlatXPositions(xpos9);
468     seg92->SetSlatYPosition(ypos9);
469     seg92->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
470     seg92->SetDAnod(0.25);
471     seg92->SetPadDivision(nseg4);
472     
473     SetResponseModel(chamber-1, response0);         
474     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
475     
476     chamber=10;
477 //^^^^^^^^^
478     SetNsec(chamber-1,2);
479 //
480     AliMUONSegmentationSlat *seg101=new AliMUONSegmentationSlat(4);
481     
482     seg101->SetNSlats(13);  
483     seg101->SetShift(shift);  
484     seg101->SetNPCBperSector(npcb9); 
485     seg101->SetSlatXPositions(xpos9);
486     seg101->SetSlatYPosition(ypos9);
487     seg101->SetPadSize(10.,0.5);
488     seg101->SetDAnod(0.25);
489     seg101->SetPadDivision(nseg4);
490     SetSegmentationModel(chamber-1, 1, seg101);
491     
492     AliMUONSegmentationSlatN *seg102=new AliMUONSegmentationSlatN(4);
493     
494     SetSegmentationModel(chamber-1, 2, seg102);
495     seg102->SetNSlats(13);  
496     seg102->SetShift(shift);   
497     seg102->SetNPCBperSector(npcb9); 
498     seg102->SetSlatXPositions(xpos9);
499     seg102->SetSlatYPosition(ypos9);
500     seg102->SetPadSize(1., 10.); // DeltaX(non bending) = 2 * DeltaY(bending)
501     seg102->SetDAnod(0.25);
502     seg102->SetPadDivision(nseg4);
503     
504     SetResponseModel(chamber-1, response0);         
505     Chamber(chamber-1).SetChargeCorrel(0.11); // 11% charge spread
506     
507 //--------------------------------------------------------
508 // Configuration for Trigger Stations -------------------- 
509 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
510 // Cluster-size off
511     AliMUONResponseTrigger* responseTrigger0 =  new AliMUONResponseTrigger;
512 // Cluster-size on  
513 // AliMUONResponseTriggerV1* responseTrigger0 =  new AliMUONResponseTriggerV1;
514  
515     chamber=11;
516     SetNsec(chamber-1,2);
517     AliMUONSegmentationTriggerX *seg111=new AliMUONSegmentationTriggerX;
518     SetSegmentationModel(chamber-1, 1, seg111);
519     AliMUONSegmentationTriggerY *seg112=new AliMUONSegmentationTriggerY;
520     SetSegmentationModel(chamber-1, 2, seg112);
521     
522     SetResponseModel(chamber-1, responseTrigger0);      
523     Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
524     
525  
526     chamber=12;
527     SetNsec(chamber-1,2);
528     AliMUONSegmentationTriggerX *seg121=new AliMUONSegmentationTriggerX;
529     SetSegmentationModel(chamber-1, 1, seg121);
530     AliMUONSegmentationTriggerY *seg122=new AliMUONSegmentationTriggerY;
531     SetSegmentationModel(chamber-1, 2, seg122);
532     
533     SetResponseModel(chamber-1, responseTrigger0);
534     Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
535     
536     chamber=13;
537     SetNsec(chamber-1,2);
538     AliMUONSegmentationTriggerX *seg131=new AliMUONSegmentationTriggerX;
539     SetSegmentationModel(chamber-1, 1, seg131);
540     AliMUONSegmentationTriggerY *seg132=new AliMUONSegmentationTriggerY;
541     SetSegmentationModel(chamber-1, 2, seg132);
542     SetResponseModel(chamber-1, responseTrigger0);      
543     Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
544     
545     chamber=14;
546     SetNsec(chamber-1,2);
547     AliMUONSegmentationTriggerX *seg141=new AliMUONSegmentationTriggerX;
548     SetSegmentationModel(chamber-1, 1, seg141);
549     AliMUONSegmentationTriggerY *seg142=new AliMUONSegmentationTriggerY;
550     SetSegmentationModel(chamber-1, 2, seg142);
551     
552     SetResponseModel(chamber-1, responseTrigger0); 
553     Chamber(chamber-1).SetChargeCorrel(0); // same charge on cathodes
554 }
555
556 void AliMUONv0::CreateGeometry()
557 {
558 // Creates coarse geometry for hit density simulations
559     Int_t *idtmed = fIdtmed->GetArray()-1099;
560 //
561      Float_t zpos, dAlu, tpar[3];
562      Int_t idAir=idtmed[1100];
563      Int_t idAlu=idtmed[1103];     
564
565      AliMUONChamber *iChamber;
566      // Loop over all chambers (tracking and trigger)
567      for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++) {
568          char alu[8];
569          char gas[8];
570      
571          iChamber=(AliMUONChamber*) (*fChambers)[ch];
572          // Z of the chamber
573          zpos=iChamber->Z(); 
574          dAlu=iChamber->DAlu();
575          if (ch < AliMUONConstants::NTrackingCh()) {
576            // tracking chambers
577              sprintf(alu,"CA0%1d",ch);
578              sprintf(gas,"CG0%1d",ch);   
579          } else {
580            // trigger chambers
581              sprintf(alu,"CA%2d",ch);
582              sprintf(gas,"CG%2d",ch);    
583          }
584 //
585          tpar[0] = iChamber->RInner(); 
586          tpar[1] = iChamber->ROuter();
587          tpar[2] = (dAlu+0.2)/2.;
588          if (ch !=4 && ch !=5) {
589              gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3);
590              tpar[2] = 0.1;
591              gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3);
592          } else {
593              gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3);
594              tpar[2] = 0.1;
595              gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3);
596          }
597          gMC->Gspos(gas, 1, alu,  0., 0., 0., 0, "ONLY");
598          gMC->Gspos(alu, 1, "ALIC", 0., 0., zpos, 0, "ONLY");
599      }
600 }
601
602 //___________________________________________
603 void AliMUONv0::CreateMaterials()
604 {
605 // Creates materials for coarse geometry
606     AliMaterial(15, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500);
607     AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
608
609     Float_t epsil  = .001; // Tracking precision, 
610     Float_t stemax = -1.;  // Maximum displacement for multiple scat 
611     Float_t tmaxfd = -20.; // Maximum angle due to field deflection 
612     Float_t deemax = -.3;  // Maximum fractional energy loss, DLS 
613     Float_t stmin  = -.8;
614     Int_t isxfld   = gAlice->Field()->Integ();
615     Float_t sxmgmx = gAlice->Field()->Max();
616
617     //
618     //    Air 
619     AliMedium(1, "AIR_CH_US         ", 15, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
620     AliMedium(4, "ALU_CH_US          ", 9, 0, isxfld, sxmgmx, tmaxfd, fMaxStepAlu, 
621             fMaxDestepAlu, epsil, stmin);
622
623 }
624
625 void AliMUONv0::Init()
626 {
627    // 
628    // Initialize Tracking Chambers
629    //
630     char vName[8];
631     printf("\n\n\n Start Init for version 0 - CPC chamber type\n\n\n");
632     for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
633 // Initialise chamber
634         ((AliMUONChamber*) (*fChambers)[i])->Init();
635 // Set sensitive volume Id
636         if (i < AliMUONConstants::NTrackingCh()) {
637             // tracking chambers
638             sprintf(vName,"CG0%1d",i);   
639         } else {
640             // trigger chambers
641             sprintf(vName,"CG%2d",i);    
642         }
643         ((AliMUONChamber*) (*fChambers)[i])->SetGid(gMC->VolId(vName));
644     }
645 }
646
647 void AliMUONv0::StepManager()
648 {
649 //
650 // Step manager for hit density simulations
651   Int_t          copy, id;
652   static Int_t   idvol;
653   static Int_t   vol[2];
654   Int_t          ipart;
655   TLorentzVector pos;
656   TLorentzVector mom;
657   Float_t        theta,phi;
658   
659   //  modifs perso
660   static Float_t hits[15];
661
662   TClonesArray &lhits = *fHits;
663   //
664   // Only gas gap inside chamber
665   // Tag chambers and record hits when track enters 
666   idvol=-1;
667   id=gMC->CurrentVolID(copy);
668   
669     for (Int_t i=1; i<=AliMUONConstants::NCh(); i++) {
670       if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()){ 
671           vol[0]=i; 
672           idvol=i-1;
673       }
674     }
675     if (idvol == -1) return;
676   //
677   // Get current particle id (ipart), track position (pos)  and momentum (mom) 
678   gMC->TrackPosition(pos);
679   gMC->TrackMomentum(mom);
680
681   ipart  = gMC->TrackPid();
682   //
683   // record hits when track enters ...
684   if( !(gMC->TrackCharge()) ) return; 
685   if( gMC->IsTrackEntering()) {
686       Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
687       Double_t rt = TMath::Sqrt(tc);
688       theta   = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
689       phi     = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
690       hits[0] = Float_t(ipart);             // Geant3 particle type
691       hits[1] = pos[0];                     // X-position for hit
692       hits[2] = pos[1];                     // Y-position for hit
693       hits[3] = pos[2];                     // Z-position for hit
694       hits[4] = theta;                      // theta angle of incidence
695       hits[5] = phi;                        // phi angle of incidence 
696       hits[8] = -1;                         // first padhit
697       hits[9] = -1;                         // last pad hit
698       hits[10] = mom[3];                    // hit Energy
699       hits[11] = mom[0];                    // Px
700       hits[12] = mom[1];                    // Py
701       hits[13] = mom[2];                    // Pz
702       hits[14] = gMC->TrackTime();          // time of flight
703       new(lhits[fNhits++]) 
704           AliMUONHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
705
706   }
707 }
708
709
710
711
712
713
714
715
716