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