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