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