]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONHit.cxx
debug message removed
[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 //-----------------------------------------------------------------------------
19 // MUON class for MonteCarlo Hits, inherited from AliHit for the 
20 // In addition to the ALiHit data member fX, fY, fZ and fTrack, AliMUONHit contains some info about the particle crossing the chamber:
21 // Impulsion: fPtot, fPx, fPy and fPz
22 // Reference position at the center of the chamber (wire plane) fXref, fYref and fZref
23 // Cumulated path along the active volume fTlength for spliting of hits for very inclined tracks 
24 // Energy loss of the particle inside the gas active volume.
25 // Incident fTheta and fPhi angle with respect of the wire plane of the chamber.
26 //-----------------------------------------------------------------------------
27
28 #include "AliMUONHit.h"
29 #include "AliMpDEManager.h"
30
31 #include "AliLog.h"
32
33 #include <Riostream.h>
34 #include <TMath.h>
35 #include <TString.h>
36
37 using std::endl;
38 using std::cout;
39 using std::setw;
40 using std::setprecision;
41 /// \cond CLASSIMP
42 ClassImp(AliMUONHit)
43 /// \endcond
44  
45 //___________________________________________
46 AliMUONHit::AliMUONHit()
47   : AliHit(), 
48     fDetElemId(0),
49     fParticle(0),
50     fTheta(0),
51     fPhi(0),
52     fTlength(0),
53     fEloss(0),
54     fAge(0),
55     fPHfirst(0),
56     fPHlast(0),
57     fPTot(0),
58     fPx(0),
59     fPy(0),
60     fPz(0),
61     fXref(0),
62     fYref(0),
63     fZref(0)
64 {
65 /// Default constructor
66 }
67
68 //___________________________________________
69 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits)
70   : AliHit(shunt, track),
71     fDetElemId(vol[0]),
72     fParticle(hits[0]),
73     fTheta(hits[4]),
74     fPhi(hits[5]),
75     fTlength(hits[6]),
76     fEloss(hits[7]),
77     fAge(hits[14]),
78     fPHfirst((Int_t)hits[8]),
79     fPHlast((Int_t)hits[9]),
80     fPTot(hits[10]),
81     fPx(hits[11]),
82     fPy(hits[12]),
83     fPz(hits[13]),
84     fXref(0),
85     fYref(0),
86     fZref(0)
87 {
88 /// Constructor
89    
90     fX         = hits[1];
91     fY         = hits[2];
92     fZ         = hits[3];
93 }
94
95 //___________________________________________
96 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t detElemId, Int_t idpart, 
97                        Float_t x, Float_t y, Float_t z, Float_t tof, Float_t momentum, 
98                        Float_t theta, Float_t phi, Float_t length, Float_t destep)
99   : AliHit(shunt, track),
100     fDetElemId(detElemId),
101     fParticle(idpart),
102     fTheta(theta),
103     fPhi(phi),
104     fTlength(length),
105     fEloss(destep),
106     fAge(tof),
107     fPHfirst(0),
108     fPHlast(0),
109     fPTot(momentum),
110     fPx(momentum * TMath::Sin(theta) * TMath::Cos(phi)),
111     fPy(momentum * TMath::Sin(theta) * TMath::Sin(phi)),
112     fPz(momentum * TMath::Cos(theta)),
113     fXref(0),
114     fYref(0),
115     fZref(0)
116 {
117 /// Constructor
118     fX         = x;
119     fY         = y;
120     fZ         = z;
121 }
122
123 //-----------------------------------------------------------------------------------------------
124 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t detElemId, Int_t idpart, 
125                        Float_t x, Float_t y, Float_t z, Float_t tof, Float_t momentum, 
126                        Float_t theta, Float_t phi, Float_t length, Float_t destep,
127                        Float_t xref,Float_t yref,Float_t zref)
128   : AliHit(shunt, track),
129     fDetElemId(detElemId),
130     fParticle(idpart),
131     fTheta(theta),
132     fPhi(phi),
133     fTlength(length),
134     fEloss(destep),
135     fAge(tof),
136     fPHfirst(0),
137     fPHlast(0),
138     fPTot(momentum),
139     fPx(momentum * TMath::Sin(theta) * TMath::Cos(phi)),
140     fPy(momentum * TMath::Sin(theta) * TMath::Sin(phi)),
141     fPz(momentum * TMath::Cos(theta)),
142     fXref(xref),
143     fYref(yref),
144     fZref(zref)
145 {
146 /// Constructor
147
148     fX         = x;
149     fY         = y;
150     fZ         = z;
151 }
152
153 //-----------------------------------------------------------------------------------------------
154 AliMUONHit::~AliMUONHit()
155 {
156 /// Dectructor
157 }
158
159 //-----------------------------------------------------------------------------------------------
160 Int_t  AliMUONHit::Chamber()  const
161 {  
162 /// Return chamber ID
163
164   return AliMpDEManager::GetChamberId(fDetElemId) + 1;  
165 }
166
167 //-----------------------------------------------------------------------------
168 const char*
169 AliMUONHit::GetName() const
170 {
171 /// Generate hit name
172
173   return Form("%s-DE%04d",ClassName(),DetElemId());
174 }
175
176 //-----------------------------------------------------------------------------------------------
177 void AliMUONHit::Print(Option_t* opt) const
178 {
179 /// Printing hit information 
180 /// "full" option for printing all the information about the hit
181
182   TString sopt(opt);
183   sopt.ToUpper();
184  
185   if ( sopt.Contains("FULL") ) { 
186     cout <<"<AliMUONHit>: Geant track="   << setw(4)  << Track() <<
187       ", DetEle="        << setw(4)  << DetElemId() <<  
188       ", (x,y,z)=(" << setw(7) << setprecision(5) << X() << "," << setw(7) << setprecision(5) << Y() <<  "," << setw(7) << setprecision(5) << Z() << 
189       " )cm, Delta E=" << setw(8) << setprecision(3) << Eloss() << " GeV" << endl;
190   }
191   else {
192     cout << "<AliMUONHit>: DetEle="        << setw(4)  << DetElemId() << 
193       ", (x,y,z)=(" << setw(7) << setprecision(5) << X() << "," << setw(7) << setprecision(5) << Y() <<  "," << setw(7) << setprecision(5) << Z() << 
194       " ) cm" <<endl;
195   }
196     
197 }