]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONHit.cxx
Introduce extern for the common block references
[u/mrichter/AliRoot.git] / MUON / AliMUONHit.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 /* $Id$ */
17
18 // MUON classe for MonteCarlo Hits, inherited from AliHit for the 
19 // In addition to the ALiHit data member fX, fY, fZ and fTrack, AliMUONHit contains some info about the particle crossing the chamber:
20 // Impulsion: fPtot, fPx, fPy and fPz
21 // Reference position at the center of the chamber (wire plane) fXref, fYref and fZref
22 // Cumulated path along the active volume fTlength for spliting of hits for very inclined tracks 
23 // Energy loss of the particle inside the gas active volume.
24 // Incident fTheta and fPhi angle with respect of the wire plane of the chamber.
25 //
26
27 #include <TMath.h>
28
29 #include "AliMUONHit.h"
30 #include "AliMUONVGeometryDEIndexing.h"
31 #include "AliLog.h"
32
33 ClassImp(AliMUONHit)
34  
35 //___________________________________________
36 AliMUONHit::AliMUONHit()
37   : AliHit() 
38 {
39 // Default constructor
40 }
41
42 //___________________________________________
43 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
44         AliHit(shunt, track)
45 {
46 // Constructor
47 // TBR
48    
49     fIsDetElemId = kFALSE;
50     fDetElemId = vol[0];
51     fParticle  = hits[0];
52     fX         = hits[1];
53     fY         = hits[2];
54     fZ         = hits[3];
55     fTheta     = hits[4];
56     fPhi       = hits[5];
57     fTlength   = hits[6];
58     fEloss     = hits[7];
59     fPHfirst   = (Int_t) hits[8];
60     fPHlast    = (Int_t) hits[9];
61     fPTot      = hits[10];
62     fPx        = hits[11];
63     fPy        = hits[12];
64     fPz        = hits[13];
65     fAge       = hits[14];
66     fXref      = 0.;
67     fYref      = 0.;
68     fZref      = 0.;
69 }
70
71 //___________________________________________
72 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits, 
73                        Bool_t /*isDetElemId*/) :
74         AliHit(shunt, track)
75 {
76 // Constructor
77    
78     fIsDetElemId = kTRUE;
79     fDetElemId = vol[0];
80     fParticle  = hits[0];
81     fX         = hits[1];
82     fY         = hits[2];
83     fZ         = hits[3];
84     fTheta     = hits[4];
85     fPhi       = hits[5];
86     fTlength   = hits[6];
87     fEloss     = hits[7];
88     fPHfirst   = (Int_t) hits[8];
89     fPHlast    = (Int_t) hits[9];
90     fPTot      = hits[10];
91     fPx        = hits[11];
92     fPy        = hits[12];
93     fPz        = hits[13];
94     fAge       = hits[14];
95     fXref      = 0.;
96     fYref      = 0.;
97     fZref      = 0.;
98 }
99
100 //___________________________________________
101 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t iChamber, Int_t idpart, 
102                        Float_t X, Float_t Y, Float_t Z, Float_t tof, Float_t momentum, 
103                        Float_t theta, Float_t phi, Float_t length, Float_t destep):
104         AliHit(shunt, track)
105 {
106 // Constructor
107 // TBR
108
109     fIsDetElemId = kFALSE;
110     fDetElemId = iChamber;
111     fParticle  = idpart;
112     fX         = X;
113     fY         = Y;
114     fZ         = Z;
115     fTheta     = theta;
116     fPhi       = phi;
117     fTlength   = length;
118     fEloss     = destep;
119     fPHfirst   = 0;
120     fPHlast    = 0;
121     fPTot      = momentum;
122     fPx        = momentum * TMath::Sin(theta) * TMath::Cos(phi);
123     fPy        = momentum * TMath::Sin(theta) * TMath::Sin(phi);
124     fPz        = momentum * TMath::Cos(theta) ;
125     fAge       = tof;
126     fXref      = 0.;
127     fYref      = 0.;
128     fZref      = 0.;
129 }
130
131 //___________________________________________
132 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t detElemId, Int_t idpart, 
133                        Float_t X, Float_t Y, Float_t Z, Float_t tof, Float_t momentum, 
134                        Float_t theta, Float_t phi, Float_t length, Float_t destep,
135                        Bool_t /*isDetElemId*/):
136         AliHit(shunt, track)
137 {
138 // Constructor
139     fIsDetElemId = kTRUE;
140     fDetElemId = detElemId;
141     fParticle  = idpart;
142     fX         = X;
143     fY         = Y;
144     fZ         = Z;
145     fTheta     = theta;
146     fPhi       = phi;
147     fTlength   = length;
148     fEloss     = destep;
149     fPHfirst   = 0;
150     fPHlast    = 0;
151     fPTot      = momentum;
152     fPx        = momentum * TMath::Sin(theta) * TMath::Cos(phi);
153     fPy        = momentum * TMath::Sin(theta) * TMath::Sin(phi);
154     fPz        = momentum * TMath::Cos(theta) ;
155     fAge       = tof;
156     fXref      = 0.;
157     fYref      = 0.;
158     fZref      = 0.;
159 }
160
161 //-----------------------------------------------------------------------------------------------
162 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t iChamber, Int_t idpart, 
163                        Float_t X, Float_t Y, Float_t Z, Float_t tof, Float_t momentum, 
164                        Float_t theta, Float_t phi, Float_t length, Float_t destep,
165                        Float_t Xref,Float_t Yref,Float_t Zref):
166         AliHit(shunt, track)
167 {
168 // Constructor
169 // TBR
170
171     fIsDetElemId = kFALSE;
172     fDetElemId = iChamber;
173     fParticle  = idpart;
174     fX         = X;
175     fY         = Y;
176     fZ         = Z;
177     fTheta     = theta;
178     fPhi       = phi;
179     fTlength   = length;
180     fEloss     = destep;
181     fPHfirst   = 0;
182     fPHlast    = 0;
183     fPTot      = momentum;
184     fPx        = momentum * TMath::Sin(theta) * TMath::Cos(phi);
185     fPy        = momentum * TMath::Sin(theta) * TMath::Sin(phi);
186     fPz        = momentum * TMath::Cos(theta) ;
187     fAge       = tof;
188     fXref      = Xref;
189     fYref      = Yref;
190     fZref      = Zref;
191 }
192 //-----------------------------------------------------------------------------------------------
193 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t detElemId, Int_t idpart, 
194                        Float_t X, Float_t Y, Float_t Z, Float_t tof, Float_t momentum, 
195                        Float_t theta, Float_t phi, Float_t length, Float_t destep,
196                        Float_t Xref,Float_t Yref,Float_t Zref,
197                        Bool_t /*isDetElemId*/):
198         AliHit(shunt, track)
199 {
200 // Constructor
201     fIsDetElemId = kTRUE;
202     fDetElemId = detElemId;
203     fParticle  = idpart;
204     fX         = X;
205     fY         = Y;
206     fZ         = Z;
207     fTheta     = theta;
208     fPhi       = phi;
209     fTlength   = length;
210     fEloss     = destep;
211     fPHfirst   = 0;
212     fPHlast    = 0;
213     fPTot      = momentum;
214     fPx        = momentum * TMath::Sin(theta) * TMath::Cos(phi);
215     fPy        = momentum * TMath::Sin(theta) * TMath::Sin(phi);
216     fPz        = momentum * TMath::Cos(theta) ;
217     fAge       = tof;
218     fXref      = Xref;
219     fYref      = Yref;
220     fZref      = Zref;
221 }
222
223 //-----------------------------------------------------------------------------------------------
224 Int_t AliMUONHit::DetElemId()const
225 {
226 // Return detection element ID
227
228   if (!fIsDetElemId) {
229     AliWarning("Detection element Id is not defined.");
230     return 0;
231   }  
232   // end of TBR
233   
234   return fDetElemId;
235 }
236
237 //-----------------------------------------------------------------------------------------------
238 Int_t  AliMUONHit::Chamber()  const
239 {  
240 // Return chamber ID
241
242   if (!fIsDetElemId) 
243     return fDetElemId;
244   else  
245     return AliMUONVGeometryDEIndexing::GetModuleId(fDetElemId)+1;  
246 }
247