]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONv0.cxx
Place station 3 inside Dipole.
[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.18  2001/04/06 11:24:43  morsch
19 Dependency on implementations of AliSegmentation and AliMUONResponse moved to AliMUONFactory class.
20 Static method Build() builds the MUON system out of chambers, segmentation and response.
21
22 Revision 1.17  2001/03/17 10:07:20  morsch
23 Correct inconsistent variable name / method name / comments.
24
25 Revision 1.16  2001/01/27 08:50:50  morsch
26 Call non default constructors of segmentation classes.
27
28 Revision 1.15  2001/01/17 20:57:45  hristov
29 Unused variable removed
30
31 Revision 1.14  2000/12/21 22:42:55  morsch
32 Constructor contains default set-up for segmentation.
33 Record charged particles only.
34
35 Revision 1.13  2000/10/06 10:03:38  morsch
36 Call to gMC->VolId() moved to Init()
37
38 Revision 1.12  2000/10/02 21:28:09  fca
39 Removal of useless dependecies via forward declarations
40
41 Revision 1.11  2000/06/27 07:31:07  morsch
42 fChambers = 0; deleted from constructor.
43
44 Revision 1.10  2000/06/26 14:02:38  morsch
45 Add class AliMUONConstants with MUON specific constants using static memeber data and access methods.
46
47 Revision 1.9  2000/06/15 07:58:49  morsch
48 Code from MUON-dev joined
49
50 Revision 1.8.4.9  2000/06/12 19:20:49  morsch
51 Constructor sets default geometry, segmentation and response parameters.
52
53 Revision 1.8.4.8  2000/06/09 21:55:28  morsch
54 Most coding rule violations corrected.
55
56 Revision 1.8.4.7  2000/05/02 13:15:18  morsch
57 Coding rule violations RS3, RN13 corected
58
59 Revision 1.8.4.6  2000/05/02 10:24:26  morsch
60 Public access to fdGas and fdAlu of AliMUONChamber replaced by getters.
61
62 Revision 1.8.4.5  2000/04/26 19:58:47  morsch
63 Obsolete reference to trig_ removed.
64
65 Revision 1.8.4.4  2000/04/19 19:42:47  morsch
66 change NCH to kNCH
67
68 Revision 1.8.4.3  2000/02/17 08:17:43  morsch
69 Gammas and neutrons are also scored in the stepmanager
70 */
71
72 /////////////////////////////////////////////////////////
73 //  Manager and hits classes for set:MUON version 0    //
74 /////////////////////////////////////////////////////////
75
76 #include <TTUBE.h>
77 #include <TNode.h> 
78 #include <TRandom.h> 
79 #include <TLorentzVector.h> 
80 #include <iostream.h>
81
82 #include "AliMUONv0.h"
83 #include "AliMUONChamber.h"
84 #include "AliRun.h"
85 #include "AliMC.h"
86 #include "AliMagF.h"
87 #include "AliMUONHit.h"
88 #include "AliMUONPadHit.h"
89 #include "AliCallf77.h"
90 #include "AliConst.h" 
91 #include "AliMUONConstants.h"
92 #include "AliMUONFactory.h"
93 ClassImp(AliMUONv0)
94  
95 //___________________________________________
96 AliMUONv0::AliMUONv0() : AliMUON()
97 {
98 // Constructor
99     fChambers = 0;
100 }
101  
102 //___________________________________________
103 AliMUONv0::AliMUONv0(const char *name, const char *title)
104        : AliMUON(name,title)
105 {
106 // Constructor
107     AliMUONFactory::Build(this, "default");
108 }
109
110 void AliMUONv0::CreateGeometry()
111 {
112 // Creates coarse geometry for hit density simulations
113     Int_t *idtmed = fIdtmed->GetArray()-1099;
114 //
115      Float_t zpos, dAlu, tpar[3];
116      Int_t idAir=idtmed[1100];
117      Int_t idAlu=idtmed[1103];     
118
119      AliMUONChamber *iChamber;
120      // Loop over all chambers (tracking and trigger)
121      for (Int_t ch = 0; ch < AliMUONConstants::NCh(); ch++) {
122          char alu[8];
123          char gas[8];
124      
125          iChamber=(AliMUONChamber*) (*fChambers)[ch];
126          // Z of the chamber
127          zpos=iChamber->Z(); 
128          dAlu=iChamber->DAlu();
129          if (ch < AliMUONConstants::NTrackingCh()) {
130            // tracking chambers
131              sprintf(alu,"CA0%1d",ch);
132              sprintf(gas,"CG0%1d",ch);   
133          } else {
134            // trigger chambers
135              sprintf(alu,"CA%2d",ch);
136              sprintf(gas,"CG%2d",ch);    
137          }
138 //
139          tpar[0] = iChamber->RInner(); 
140          tpar[1] = iChamber->ROuter();
141          tpar[2] = (dAlu+0.2)/2.;
142          if (ch !=4 && ch !=5) {
143              gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3);
144              tpar[2] = 0.1;
145              gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3);
146          } else {
147              gMC->Gsvolu(alu, "TUBE", idAlu, tpar, 3);
148              tpar[2] = 0.1;
149              gMC->Gsvolu(gas, "TUBE", idAir, tpar, 3);
150          }
151          gMC->Gspos(gas, 1, alu,  0., 0., 0., 0, "ONLY");
152          if (ch == 4 || ch ==5) {
153              gMC->Gspos(alu, 1, "DDIP", 0., 0., zpos, 0, "ONLY");
154          } else {
155              gMC->Gspos(alu, 1, "ALIC", 0., 0., zpos, 0, "ONLY");
156          }
157      }
158 }
159
160 //___________________________________________
161 void AliMUONv0::CreateMaterials()
162 {
163 // Creates materials for coarse geometry
164     AliMaterial(15, "AIR$      ", 14.61, 7.3, .001205, 30423.24, 67500);
165     AliMaterial(9, "ALUMINIUM$", 26.98, 13., 2.7, 8.9, 37.2);
166
167     Float_t epsil  = .001; // Tracking precision, 
168     Float_t stemax = -1.;  // Maximum displacement for multiple scat 
169     Float_t tmaxfd = -20.; // Maximum angle due to field deflection 
170     Float_t deemax = -.3;  // Maximum fractional energy loss, DLS 
171     Float_t stmin  = -.8;
172     Int_t isxfld   = gAlice->Field()->Integ();
173     Float_t sxmgmx = gAlice->Field()->Max();
174
175     //
176     //    Air 
177     AliMedium(1, "AIR_CH_US         ", 15, 1, isxfld, sxmgmx, tmaxfd, stemax, deemax, epsil, stmin);
178     AliMedium(4, "ALU_CH_US          ", 9, 0, isxfld, sxmgmx, tmaxfd, fMaxStepAlu, 
179             fMaxDestepAlu, epsil, stmin);
180
181 }
182
183 void AliMUONv0::Init()
184 {
185    // 
186    // Initialize Tracking Chambers
187    //
188     char vName[8];
189     printf("\n\n\n Start Init for version 0 - CPC chamber type\n\n\n");
190     for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
191 // Initialise chamber
192         ((AliMUONChamber*) (*fChambers)[i])->Init();
193 // Set sensitive volume Id
194         if (i < AliMUONConstants::NTrackingCh()) {
195             // tracking chambers
196             sprintf(vName,"CG0%1d",i);   
197         } else {
198             // trigger chambers
199             sprintf(vName,"CG%2d",i);    
200         }
201         ((AliMUONChamber*) (*fChambers)[i])->SetGid(gMC->VolId(vName));
202     }
203 }
204
205 void AliMUONv0::StepManager()
206 {
207 //
208 // Step manager for hit density simulations
209   Int_t          copy, id;
210   static Int_t   idvol;
211   static Int_t   vol[2];
212   Int_t          ipart;
213   TLorentzVector pos;
214   TLorentzVector mom;
215   Float_t        theta,phi;
216   
217   //  modifs perso
218   static Float_t hits[15];
219
220   TClonesArray &lhits = *fHits;
221   //
222   // Only gas gap inside chamber
223   // Tag chambers and record hits when track enters 
224   idvol=-1;
225   id=gMC->CurrentVolID(copy);
226   
227     for (Int_t i=1; i<=AliMUONConstants::NCh(); i++) {
228       if(id==((AliMUONChamber*)(*fChambers)[i-1])->GetGid()){ 
229           vol[0]=i; 
230           idvol=i-1;
231       }
232     }
233     if (idvol == -1) return;
234   //
235   // Get current particle id (ipart), track position (pos)  and momentum (mom) 
236   gMC->TrackPosition(pos);
237   gMC->TrackMomentum(mom);
238
239   ipart  = gMC->TrackPid();
240   //
241   // record hits when track enters ...
242   if( !(gMC->TrackCharge()) ) return; 
243   if( gMC->IsTrackEntering()) {
244       Double_t tc = mom[0]*mom[0]+mom[1]*mom[1];
245       Double_t rt = TMath::Sqrt(tc);
246       theta   = Float_t(TMath::ATan2(rt,Double_t(mom[2])))*kRaddeg;
247       phi     = Float_t(TMath::ATan2(Double_t(mom[1]),Double_t(mom[0])))*kRaddeg;
248       hits[0] = Float_t(ipart);             // Geant3 particle type
249       hits[1] = pos[0];                     // X-position for hit
250       hits[2] = pos[1];                     // Y-position for hit
251       hits[3] = pos[2];                     // Z-position for hit
252       hits[4] = theta;                      // theta angle of incidence
253       hits[5] = phi;                        // phi angle of incidence 
254       hits[8] = -1;                         // first padhit
255       hits[9] = -1;                         // last pad hit
256       hits[10] = mom[3];                    // hit Energy
257       hits[11] = mom[0];                    // Px
258       hits[12] = mom[1];                    // Py
259       hits[13] = mom[2];                    // Pz
260       hits[14] = gMC->TrackTime();          // time of flight
261       new(lhits[fNhits++]) 
262           AliMUONHit(fIshunt,gAlice->CurrentTrack(),vol,hits);
263
264   }
265 }
266
267
268
269
270
271
272
273
274