]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONHit.cxx
New versions of GDC and CDH raw data headers. Some CDH getters are added
[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 class 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 #include "Riostream.h"
27
28 #include <TMath.h>
29 #include <TString.h>
30
31 #include "AliLog.h"
32 #include "AliMUONHit.h"
33 #include "AliMUONGeometryStore.h"
34
35
36 /// \cond CLASSIMP
37 ClassImp(AliMUONHit)
38 /// \endcond
39  
40 //___________________________________________
41 AliMUONHit::AliMUONHit()
42   : AliHit(), 
43     fIsDetElemId(kTRUE),
44     fDetElemId(0),
45     fParticle(0),
46     fTheta(0),
47     fPhi(0),
48     fTlength(0),
49     fEloss(0),
50     fAge(0),
51     fPHfirst(0),
52     fPHlast(0),
53     fPTot(0),
54     fPx(0),
55     fPy(0),
56     fPz(0),
57     fXref(0),
58     fYref(0),
59     fZref(0)
60 {
61 /// Default constructor
62 }
63
64 //___________________________________________
65 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits)
66   : AliHit(shunt, track),
67     fIsDetElemId(kFALSE),
68     fDetElemId(vol[0]),
69     fParticle(hits[0]),
70     fTheta(hits[4]),
71     fPhi(hits[5]),
72     fTlength(hits[6]),
73     fEloss(hits[7]),
74     fAge(hits[14]),
75     fPHfirst((Int_t)hits[8]),
76     fPHlast((Int_t)hits[9]),
77     fPTot(hits[10]),
78     fPx(hits[11]),
79     fPy(hits[12]),
80     fPz(hits[13]),
81     fXref(0),
82     fYref(0),
83     fZref(0)
84 {
85 /// Constructor
86 /// \deprecated TBR
87
88     fX         = hits[1];
89     fY         = hits[2];
90     fZ         = hits[3];
91 }
92
93 //___________________________________________
94 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits, 
95                        Bool_t /*isDetElemId*/)
96   : AliHit(shunt, track),
97     fIsDetElemId(kTRUE),
98     fDetElemId(vol[0]),
99     fParticle(hits[0]),
100     fTheta(hits[4]),
101     fPhi(hits[5]),
102     fTlength(hits[6]),
103     fEloss(hits[7]),
104     fAge(hits[14]),
105     fPHfirst((Int_t)hits[8]),
106     fPHlast((Int_t)hits[9]),
107     fPTot(hits[10]),
108     fPx(hits[11]),
109     fPy(hits[12]),
110     fPz(hits[13]),
111     fXref(0),
112     fYref(0),
113     fZref(0)
114 {
115 /// Constructor
116    
117     fX         = hits[1];
118     fY         = hits[2];
119     fZ         = hits[3];
120 }
121
122 //___________________________________________
123 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t iChamber, Int_t idpart, 
124                        Float_t X, Float_t Y, Float_t Z, Float_t tof, Float_t momentum, 
125                        Float_t theta, Float_t phi, Float_t length, Float_t destep)
126   : AliHit(shunt, track),
127     fIsDetElemId(kFALSE),
128     fDetElemId(iChamber),
129     fParticle(idpart),
130     fTheta(theta),
131     fPhi(phi),
132     fTlength(length),
133     fEloss(destep),
134     fAge(tof),
135     fPHfirst(0),
136     fPHlast(0),
137     fPTot(momentum),
138     fPx(momentum * TMath::Sin(theta) * TMath::Cos(phi)),
139     fPy(momentum * TMath::Sin(theta) * TMath::Sin(phi)),
140     fPz(momentum * TMath::Cos(theta)),
141     fXref(0),
142     fYref(0),
143     fZref(0)
144 {
145 /// Constructor
146 /// \deprecated TBR
147
148     fX         = X;
149     fY         = Y;
150     fZ         = Z;
151 }
152
153 //___________________________________________
154 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t detElemId, Int_t idpart, 
155                        Float_t X, Float_t Y, Float_t Z, Float_t tof, Float_t momentum, 
156                        Float_t theta, Float_t phi, Float_t length, Float_t destep,
157                        Bool_t /*isDetElemId*/)
158   : AliHit(shunt, track),
159     fIsDetElemId(kTRUE),
160     fDetElemId(detElemId),
161     fParticle(idpart),
162     fTheta(theta),
163     fPhi(phi),
164     fTlength(length),
165     fEloss(destep),
166     fAge(tof),
167     fPHfirst(0),
168     fPHlast(0),
169     fPTot(momentum),
170     fPx(momentum * TMath::Sin(theta) * TMath::Cos(phi)),
171     fPy(momentum * TMath::Sin(theta) * TMath::Sin(phi)),
172     fPz(momentum * TMath::Cos(theta)),
173     fXref(0),
174     fYref(0),
175     fZref(0)
176 {
177 /// Constructor
178     fX         = X;
179     fY         = Y;
180     fZ         = Z;
181 }
182
183 //-----------------------------------------------------------------------------------------------
184 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t iChamber, Int_t idpart, 
185                        Float_t X, Float_t Y, Float_t Z, Float_t tof, Float_t momentum, 
186                        Float_t theta, Float_t phi, Float_t length, Float_t destep,
187                        Float_t Xref,Float_t Yref,Float_t Zref)
188   : AliHit(shunt, track),
189     fIsDetElemId(kFALSE),
190     fDetElemId(iChamber),
191     fParticle(idpart),
192     fTheta(theta),
193     fPhi(phi),
194     fTlength(length),
195     fEloss(destep),
196     fAge(tof),
197     fPHfirst(0),
198     fPHlast(0),
199     fPTot(momentum),
200     fPx(momentum * TMath::Sin(theta) * TMath::Cos(phi)),
201     fPy(momentum * TMath::Sin(theta) * TMath::Sin(phi)),
202     fPz(momentum * TMath::Cos(theta)),
203     fXref(Xref),
204     fYref(Yref),
205     fZref(Zref)
206 {
207 /// Constructor
208 /// \deprecated TBR
209
210     fX         = X;
211     fY         = Y;
212     fZ         = Z;
213 }
214 //-----------------------------------------------------------------------------------------------
215 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t detElemId, Int_t idpart, 
216                        Float_t X, Float_t Y, Float_t Z, Float_t tof, Float_t momentum, 
217                        Float_t theta, Float_t phi, Float_t length, Float_t destep,
218                        Float_t Xref,Float_t Yref,Float_t Zref,
219                        Bool_t /*isDetElemId*/)
220   : AliHit(shunt, track),
221     fIsDetElemId(kTRUE),
222     fDetElemId(detElemId),
223     fParticle(idpart),
224     fTheta(theta),
225     fPhi(phi),
226     fTlength(length),
227     fEloss(destep),
228     fAge(tof),
229     fPHfirst(0),
230     fPHlast(0),
231     fPTot(momentum),
232     fPx(momentum * TMath::Sin(theta) * TMath::Cos(phi)),
233     fPy(momentum * TMath::Sin(theta) * TMath::Sin(phi)),
234     fPz(momentum * TMath::Cos(theta)),
235     fXref(Xref),
236     fYref(Yref),
237     fZref(Zref)
238 {
239 /// Constructor
240
241     fX         = X;
242     fY         = Y;
243     fZ         = Z;
244 }
245
246 //-----------------------------------------------------------------------------------------------
247 AliMUONHit::~AliMUONHit()
248 {
249 /// Dectructor
250 }
251
252 //-----------------------------------------------------------------------------------------------
253 Int_t AliMUONHit::DetElemId()const
254 {
255 /// Return detection element ID
256
257   if (!fIsDetElemId) {
258     AliWarning("Detection element Id is not defined.");
259     return 0;
260   }  
261   
262   return fDetElemId;
263 }
264
265 //-----------------------------------------------------------------------------------------------
266 Int_t  AliMUONHit::Chamber()  const
267 {  
268 /// Return chamber ID
269
270   if (!fIsDetElemId) 
271     return fDetElemId;
272   else  
273     return AliMUONGeometryStore::GetModuleId(fDetElemId)+1;  
274 }
275
276 void AliMUONHit::Print(Option_t* opt) const
277 {
278   //
279   // Printing hit information 
280   // "full" option for printing all the information about the hit
281   //
282   TString sopt(opt);
283   sopt.ToUpper();
284  
285   if ( sopt.Contains("FULL") ) { 
286     cout <<"<AliMUONHit>: Geant track="   << setw(4)  << Track() <<
287       ", DetEle="        << setw(4)  << DetElemId() <<  
288       ", (x,y,z)=(" << setw(7) << setprecision(5) << X() << "," << setw(7) << setprecision(5) << Y() <<  "," << setw(7) << setprecision(5) << Z() << 
289       " )cm, Delta E=" << setw(8) << setprecision(3) << Eloss() << " GeV" << endl;
290   }
291   else {
292     cout << "<AliMUONHit>: DetEle="        << setw(4)  << DetElemId() << 
293       ", (x,y,z)=(" << setw(7) << setprecision(5) << X() << "," << setw(7) << setprecision(5) << Y() <<  "," << setw(7) << setprecision(5) << Z() << 
294       " ) cm" <<endl;
295   }
296     
297 }