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