]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONv0.cxx
Add class AliMUONConstants with MUON specific constants using static memeber data...
[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.9  2000/06/15 07:58:49  morsch
19 Code from MUON-dev joined
20
21 Revision 1.8.4.9  2000/06/12 19:20:49  morsch
22 Constructor sets default geometry, segmentation and response parameters.
23
24 Revision 1.8.4.8  2000/06/09 21:55:28  morsch
25 Most coding rule violations corrected.
26
27 Revision 1.8.4.7  2000/05/02 13:15:18  morsch
28 Coding rule violations RS3, RN13 corected
29
30 Revision 1.8.4.6  2000/05/02 10:24:26  morsch
31 Public access to fdGas and fdAlu of AliMUONChamber replaced by getters.
32
33 Revision 1.8.4.5  2000/04/26 19:58:47  morsch
34 Obsolete reference to trig_ removed.
35
36 Revision 1.8.4.4  2000/04/19 19:42:47  morsch
37 change NCH to kNCH
38
39 Revision 1.8.4.3  2000/02/17 08:17:43  morsch
40 Gammas and neutrons are also scored in the stepmanager
41 */
42
43 /////////////////////////////////////////////////////////
44 //  Manager and hits classes for set:MUON version 0    //
45 /////////////////////////////////////////////////////////
46
47 #include <TTUBE.h>
48 #include <TNode.h> 
49 #include <TRandom.h> 
50 #include <TLorentzVector.h> 
51 #include <iostream.h>
52
53 #include "AliMUONv0.h"
54 #include "AliMUONChamber.h"
55 #include "AliRun.h"
56 #include "AliMC.h"
57 #include "AliMUONHit.h"
58 #include "AliMUONPadHit.h"
59 #include "AliCallf77.h"
60 #include "AliConst.h" 
61 #include "AliMUONResponseV0.h"
62 #include "AliMUONResponseTrigger.h"
63 #include "AliMUONSegmentationV0.h"
64 #include "AliMUONSegmentationV01.h"
65 #include "AliMUONSegmentationV02.h"
66 #include "AliMUONSegmentationV04.h"
67 #include "AliMUONSegmentationV05.h"
68 #include "AliMUONSegmentationTrigger.h"
69 #include "AliMUONSegmentationTriggerX.h"
70 #include "AliMUONSegmentationTriggerY.h"
71 #include "AliMUONConstants.h"
72
73 ClassImp(AliMUONv0)
74  
75 //___________________________________________
76 AliMUONv0::AliMUONv0() : AliMUON()
77 {
78 // Constructor
79     fChambers = 0;
80 }
81  
82 //___________________________________________
83 AliMUONv0::AliMUONv0(const char *name, const char *title)
84        : AliMUON(name,title)
85 {
86 // Constructor
87     fChambers = 0;
88
89     SetIshunt(0);
90     SetMaxStepGas(0.1);
91     SetMaxStepAlu(0.1);
92 //
93 // Version 0
94 //
95 // First define the number of planes that are segmented (1 or 2) by a call
96 // to SetNsec. 
97 // Then chose for each chamber (chamber plane) the segmentation 
98 // and response model.
99 // They should be equal for the two chambers of each station. In a future
100 // version this will be enforced.
101 //
102 //  
103     Int_t chamber;
104     Int_t station;
105 // Default response
106     AliMUONResponseV0* response0 = new AliMUONResponseV0;
107     response0->SetSqrtKx3(0.7131);
108     response0->SetKx2(1.0107);
109     response0->SetKx4(0.4036);
110     response0->SetSqrtKy3(0.7642);
111     response0->SetKy2(0.9706);
112     response0->SetKy4(0.3831);
113     response0->SetPitch(0.25);
114     response0->SetSigmaIntegration(10.);
115     response0->SetChargeSlope(50);
116     response0->SetChargeSpread(0.18, 0.18);
117     response0->SetMaxAdc(4096);
118     response0->SetZeroSuppression(6);
119 //--------------------------------------------------------
120 // Configuration for Chamber TC1/2  (Station 1) ----------           
121 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
122     Float_t rseg1[4]={17.5, 55.2, 71.3, 95.5};
123     Int_t   nseg1[4]={4, 4, 2, 1};
124 //
125     chamber=1;
126 //^^^^^^^^^
127     SetNsec(chamber-1,2);
128 //
129     AliMUONSegmentationV01 *seg11=new AliMUONSegmentationV01;
130     
131     seg11->SetSegRadii(rseg1);
132     seg11->SetPadSize(3, 0.5);
133     seg11->SetDAnod(3.0/3./4);
134     seg11->SetPadDivision(nseg1);
135     
136     SetSegmentationModel(chamber-1, 1, seg11);
137 //
138     AliMUONSegmentationV02 *seg12=new AliMUONSegmentationV02;
139     seg12->SetSegRadii(rseg1); 
140     seg12->SetPadSize(0.75, 2.0);
141     seg12->SetDAnod(3.0/3./4);
142     seg12->SetPadDivision(nseg1);
143     
144     SetSegmentationModel(chamber-1, 2, seg12);
145     
146     SetResponseModel(chamber-1, response0);         
147     
148     chamber=2;
149 //^^^^^^^^^
150 //
151     SetNsec(chamber-1,2);
152 //
153     AliMUONSegmentationV01 *seg21=new AliMUONSegmentationV01;
154     seg21->SetSegRadii(rseg1);
155     seg21->SetPadSize(3, 0.5);
156     seg21->SetDAnod(3.0/3./4);
157     seg21->SetPadDivision(nseg1);
158     SetSegmentationModel(chamber-1, 1, seg21);
159 //
160     AliMUONSegmentationV02 *seg22=new AliMUONSegmentationV02;
161     seg22->SetSegRadii(rseg1); 
162     seg22->SetPadSize(0.75, 2.);
163     seg22->SetDAnod(3.0/3./4);
164     seg22->SetPadDivision(nseg1);
165     SetSegmentationModel(chamber-1, 2, seg22);
166     
167     SetResponseModel(chamber-1, response0);         
168 //
169 //--------------------------------------------------------
170 // Configuration for Chamber TC3/4 -----------------------
171 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
172     Float_t rseg2[4]={23.5, 47.1, 87.7, 122.5};
173     Int_t   nseg2[4]={4, 4, 2, 1};
174 //
175     chamber=3;
176 //^^^^^^^^^
177     SetNsec(chamber-1,2);
178 //
179     AliMUONSegmentationV01 *seg31=new AliMUONSegmentationV01;
180     seg31->SetSegRadii(rseg2);
181     seg31->SetPadSize(6, 0.5);
182     seg31->SetDAnod(3.0/3./4);
183     seg31->SetPadDivision(nseg2);
184     SetSegmentationModel(chamber-1, 1, seg31);
185 //
186     AliMUONSegmentationV02 *seg32=new AliMUONSegmentationV02;
187     seg32->SetSegRadii(rseg2); 
188     seg32->SetPadSize(0.75, 4.);
189     seg32->SetPadDivision(nseg2);
190     seg32->SetDAnod(3.0/3./4);
191     
192     SetSegmentationModel(chamber-1, 2, seg32);
193     
194     SetResponseModel(chamber-1, response0);         
195     
196     chamber=4;
197 //^^^^^^^^^
198 //
199     SetNsec(chamber-1,2);
200 //
201     AliMUONSegmentationV01 *seg41=new AliMUONSegmentationV01;
202     seg41->SetSegRadii(rseg2);
203     seg41->SetPadSize(6, 0.5);
204     seg41->SetDAnod(3.0/3./4);
205     seg41->SetPadDivision(nseg2);
206     SetSegmentationModel(chamber-1, 1, seg41);
207 //
208     AliMUONSegmentationV02 *seg42=new AliMUONSegmentationV02;
209     seg42->SetSegRadii(rseg2); 
210     seg42->SetPadSize(0.75, 4.);
211     seg42->SetPadDivision(nseg2);
212     seg42->SetDAnod(3.0/3./4);
213     
214     SetSegmentationModel(chamber-1, 2, seg42);
215     
216     SetResponseModel(chamber-1, response0);         
217
218
219 //--------------------------------------------------------
220 // Configuration for Chamber TC5/6 -----------------------
221 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
222     chamber=5;
223 //^^^^^^^^^
224     SetNsec(chamber-1,2);
225 //
226     AliMUONSegmentationV01 *seg51=new AliMUONSegmentationV01;
227     seg51->SetSegRadii(rseg2);
228     seg51->SetPadSize(6, 0.5);
229     seg51->SetDAnod(3.0/3./4);
230     seg51->SetPadDivision(nseg2);
231     SetSegmentationModel(chamber-1, 1, seg51);
232 //
233     AliMUONSegmentationV02 *seg52=new AliMUONSegmentationV02;
234     seg52->SetSegRadii(rseg2); 
235     seg52->SetPadSize(0.75, 4.);
236     seg52->SetPadDivision(nseg2);
237     seg52->SetDAnod(3.0/3./4);
238     
239     SetSegmentationModel(chamber-1, 2, seg52);
240     SetResponseModel(chamber-1, response0);         
241     
242     chamber=6;
243 //^^^^^^^^^
244 //
245     SetNsec(chamber-1,2);
246 //
247     AliMUONSegmentationV01 *seg61=new AliMUONSegmentationV01;
248     seg61->SetSegRadii(rseg2);
249     seg61->SetPadSize(6, 0.5);
250     seg61->SetDAnod(3.0/3./4);
251     seg61->SetPadDivision(nseg2);
252     SetSegmentationModel(chamber-1, 1, seg61);
253 //
254     AliMUONSegmentationV02 *seg62=new AliMUONSegmentationV02;
255     seg62->SetSegRadii(rseg2); 
256     seg62->SetPadSize(0.75, 4.);
257     seg62->SetPadDivision(nseg2);
258     seg62->SetDAnod(3.0/3./4);
259     
260     SetSegmentationModel(chamber-1, 2, seg62);
261     
262     SetResponseModel(chamber-1, response0);         
263
264
265 //
266 // Station 3
267     station=3;
268     SetPadSize(station, 1, 0.975, 0.55);
269
270 //--------------------------------------------------------
271 // Configuration for Chamber TC7/8  (Station 4) ----------           
272 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
273
274     Int_t   nseg4[4]={4, 4, 2, 1};
275
276     chamber=7;
277 //^^^^^^^^^
278     SetNsec(chamber-1,2);
279 //
280     AliMUONSegmentationV04 *seg71=new AliMUONSegmentationV04;
281     seg71->SetPadSize(10.,0.5);
282     seg71->SetDAnod(0.25);
283     seg71->SetPadDivision(nseg4);
284     SetSegmentationModel(chamber-1, 1, seg71);
285     AliMUONSegmentationV05 *seg72=new AliMUONSegmentationV05;
286     seg72->SetPadSize(1,10);
287     seg72->SetDAnod(0.25);
288     seg72->SetPadDivision(nseg4);
289     SetSegmentationModel(chamber-1, 2, seg72);
290     
291     SetResponseModel(chamber-1, response0);         
292
293     chamber=8;
294 //^^^^^^^^^
295     SetNsec(chamber-1,2);
296     AliMUONSegmentationV04 *seg81=new AliMUONSegmentationV04;
297     seg81->SetPadSize(10., 0.5);
298     seg81->SetPadDivision(nseg4);
299     seg81->SetDAnod(0.25);
300     SetSegmentationModel(chamber-1, 1, seg81);
301     
302     AliMUONSegmentationV05 *seg82=new AliMUONSegmentationV05;
303     seg82->SetPadSize(1, 10);
304     seg82->SetPadDivision(nseg4);
305     seg82->SetDAnod(0.25);
306     SetSegmentationModel(chamber-1, 2, seg82);
307     
308     SetResponseModel(chamber-1, response0);         
309 //--------------------------------------------------------
310 // Configuration for Chamber TC9/10  (Station 5) ---------           
311 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
312     chamber=9;
313 //^^^^^^^^^
314     SetNsec(chamber-1,2);
315 //
316     AliMUONSegmentationV04 *seg91=new AliMUONSegmentationV04;
317     seg91->SetPadSize(10.,0.5);
318     seg91->SetDAnod(0.25);
319     seg91->SetPadDivision(nseg4);
320     SetSegmentationModel(chamber-1, 1, seg91);
321     
322     AliMUONSegmentationV05 *seg92=new AliMUONSegmentationV05;
323     seg92->SetPadSize(1,10);
324     seg92->SetDAnod(0.25);
325     seg92->SetPadDivision(nseg4);
326     
327     SetSegmentationModel(chamber-1, 2, seg92);
328     
329     SetResponseModel(chamber-1, response0);         
330     
331     chamber=10;
332 //^^^^^^^^^
333     SetNsec(chamber-1,2);
334     AliMUONSegmentationV04 *seg101=new AliMUONSegmentationV04;
335     seg101->SetPadSize(10., 0.5);
336     seg101->SetPadDivision(nseg4);
337     seg101->SetDAnod(0.25);
338     SetSegmentationModel(chamber-1, 1, seg101);
339     
340     AliMUONSegmentationV05 *seg102=new AliMUONSegmentationV05;
341     seg102->SetPadSize(1,10);
342     seg102->SetPadDivision(nseg4);
343     seg102->SetDAnod(0.25);
344     SetSegmentationModel(chamber-1, 2, seg102);
345     
346     SetResponseModel(chamber-1, response0);         
347
348 //--------------------------------------------------------
349 // Configuration for Trigger staions --------------------- 
350 //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
351     AliMUONResponseTrigger* responseTrigger0 =  new AliMUONResponseTrigger;
352     
353     chamber=11;
354     SetNsec(chamber-1,2);
355     AliMUONSegmentationTriggerX *seg111=new AliMUONSegmentationTriggerX;
356     SetSegmentationModel(chamber-1, 1, seg111);
357     AliMUONSegmentationTriggerY *seg112=new AliMUONSegmentationTriggerY;
358     SetSegmentationModel(chamber-1, 2, seg112);
359     
360     SetResponseModel(chamber-1, responseTrigger0);      
361     
362     chamber=12;
363     SetNsec(chamber-1,2);
364     AliMUONSegmentationTriggerX *seg121=new AliMUONSegmentationTriggerX;
365     SetSegmentationModel(chamber-1, 1, seg121);
366     AliMUONSegmentationTriggerY *seg122=new AliMUONSegmentationTriggerY;
367     SetSegmentationModel(chamber-1, 2, seg122);
368     
369     SetResponseModel(chamber-1, responseTrigger0);      
370     
371     chamber=13;
372     SetNsec(chamber-1,2);
373     AliMUONSegmentationTriggerX *seg131=new AliMUONSegmentationTriggerX;
374     SetSegmentationModel(chamber-1, 1, seg131);
375     AliMUONSegmentationTriggerY *seg132=new AliMUONSegmentationTriggerY;
376     SetSegmentationModel(chamber-1, 2, seg132);
377     SetResponseModel(chamber-1, responseTrigger0);      
378     
379     chamber=14;
380     SetNsec(chamber-1,2);
381     AliMUONSegmentationTriggerX *seg141=new AliMUONSegmentationTriggerX;
382     SetSegmentationModel(chamber-1, 1, seg141);
383     AliMUONSegmentationTriggerY *seg142=new AliMUONSegmentationTriggerY;
384     SetSegmentationModel(chamber-1, 2, seg142);
385     
386     SetResponseModel(chamber-1, responseTrigger0); 
387 }
388
389 void AliMUONv0::CreateGeometry()
390 {
391 // Creates coarse geometry for hit density simulations
392     Int_t *idtmed = fIdtmed->GetArray()-1099;
393 //
394      Float_t zpos, dAlu, tpar[3];
395      Int_t idAir=idtmed[1100];
396      Int_t idAlu=idtmed[1103];     
397
398      AliMUONChamber *iChamber;
399      // Loop over all chambers (tracking and trigger)
400      for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++) {
401          char alu[8];
402          char gas[8];
403      
404          iChamber=(AliMUONChamber*) (*fChambers)[ch];
405          // Z of the chamber
406          zpos=iChamber->Z(); 
407          dAlu=iChamber->DAlu();
408          if (ch < AliMUONConstants::NTrackingCh()) {
409            // tracking chambers
410              sprintf(alu,"CA0%1d",ch);
411              sprintf(gas,"CG0%1d",ch);   
412          } else {
413            // trigger chambers
414              sprintf(alu,"CA%2d",ch);
415              sprintf(gas,"CG%2d",ch);    
416          }
417 //
418          printf("\n %d,  %s,  %s \n ", ch, alu, gas);
419          
420          tpar[0] = iChamber->RInner(); 
421          tpar[1] = iChamber->ROuter();
422          tpar[2] = (dAlu+0.2)/2.;
423          if (ch !=4 && ch !=5) {
424              gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3);
425              tpar[2] = 0.1;
426              gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3);
427          } else {
428              gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3);
429              tpar[2] = 0.1;
430              gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3);
431          }
432          gMC->Gspos(gas, 1, alu,  0., 0., 0., 0, "ONLY");
433          gMC->Gspos(alu, 1, "ALIC", 0., 0., zpos, 0, "ONLY");
434          iChamber->SetGid(gMC->VolId(gas));
435      }
436 }
437
438 //___________________________________________
439 void AliMUONv0::CreateMaterials()
440 {
441 // Creates materials for coarse geometry
442     AliMaterial(15, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500);
443     AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
444
445     Float_t epsil  = .001; // Tracking precision, 
446     Float_t stemax = -1.;  // Maximum displacement for multiple scat 
447     Float_t tmaxfd = -20.; // Maximum angle due to field deflection 
448     Float_t deemax = -.3;  // Maximum fractional energy loss, DLS 
449     Float_t stmin  = -.8;
450     Int_t isxfld   = gAlice->Field()->Integ();
451     Float_t sxmgmx = gAlice->Field()->Max();
452
453     //
454     //    Air 
455     AliMedium(1, "AIR_CH_US         ", 15, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
456     AliMedium(4, "ALU_CH_US          ", 9, 0, isxfld, sxmgmx, tmaxfd, fMaxStepAlu, 
457             fMaxDestepAlu, epsil, stmin);
458
459 }
460
461 void AliMUONv0::Init()
462 {
463    // 
464    // Initialize Tracking Chambers
465    //
466
467    printf("\n\n\n Start Init for version 0 - CPC chamber type\n\n\n");
468    for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
469        ( (AliMUONChamber*) (*fChambers)[i])->Init();
470    }
471 }
472
473 void AliMUONv0::StepManager()
474 {
475 //
476 // Step manager for hit density simulations
477   Int_t          copy, id;
478   static Int_t   idvol;
479   static Int_t   vol[2];
480   Int_t          ipart;
481   TLorentzVector pos;
482   TLorentzVector mom;
483   Float_t        theta,phi;
484   
485   //  modifs perso
486   static Float_t hits[15];
487
488   TClonesArray &lhits = *fHits;
489   //
490   // Only gas gap inside chamber
491   // Tag chambers and record hits when track enters 
492   idvol=-1;
493   id=gMC->CurrentVolID(copy);
494   
495     for (Int_t i=1; i<=AliMUONConstants::NCh(); i++) {
496       if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()){ 
497           vol[0]=i; 
498           idvol=i-1;
499       }
500     }
501     if (idvol == -1) return;
502   //
503   // Get current particle id (ipart), track position (pos)  and momentum (mom) 
504   gMC->TrackPosition(pos);
505   gMC->TrackMomentum(mom);
506
507   ipart  = gMC->TrackPid();
508   //
509   // record hits when track enters ...
510 //  if( !(gMC->TrackCharge()) ) return; 
511   if( gMC->IsTrackEntering()) {
512       Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
513       Double_t rt = TMath::Sqrt(tc);
514       theta   = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
515       phi     = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
516       hits[0] = Float_t(ipart);             // Geant3 particle type
517       hits[1] = pos[0];                     // X-position for hit
518       hits[2] = pos[1];                     // Y-position for hit
519       hits[3] = pos[2];                     // Z-position for hit
520       hits[4] = theta;                      // theta angle of incidence
521       hits[5] = phi;                        // phi angle of incidence 
522       hits[8] = -1;                         // first padhit
523       hits[9] = -1;                         // last pad hit
524
525       // modifs personel
526       hits[10] = mom[3]; // hit Energy
527       hits[11] = mom[0]; // Px
528       hits[12] = mom[1]; // Py
529       hits[13] = mom[2]; // Pz
530       hits[14] = gMC->TrackTime();
531       
532       // fin modifs perso
533       new(lhits[fNhits++]) 
534           AliMUONHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
535
536   }
537 }
538
539
540
541
542
543
544
545
546