]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONHit.cxx
macro and flowevent maker to run part of the code in root
[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 /// \cond CLASSIMP
38 ClassImp(AliMUONHit)
39 /// \endcond
40  
41 //___________________________________________
42 AliMUONHit::AliMUONHit()
43   : AliHit(), 
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     fDetElemId(vol[0]),
68     fParticle(hits[0]),
69     fTheta(hits[4]),
70     fPhi(hits[5]),
71     fTlength(hits[6]),
72     fEloss(hits[7]),
73     fAge(hits[14]),
74     fPHfirst((Int_t)hits[8]),
75     fPHlast((Int_t)hits[9]),
76     fPTot(hits[10]),
77     fPx(hits[11]),
78     fPy(hits[12]),
79     fPz(hits[13]),
80     fXref(0),
81     fYref(0),
82     fZref(0)
83 {
84 /// Constructor
85    
86     fX         = hits[1];
87     fY         = hits[2];
88     fZ         = hits[3];
89 }
90
91 //___________________________________________
92 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t detElemId, Int_t idpart, 
93                        Float_t x, Float_t y, Float_t z, Float_t tof, Float_t momentum, 
94                        Float_t theta, Float_t phi, Float_t length, Float_t destep)
95   : AliHit(shunt, track),
96     fDetElemId(detElemId),
97     fParticle(idpart),
98     fTheta(theta),
99     fPhi(phi),
100     fTlength(length),
101     fEloss(destep),
102     fAge(tof),
103     fPHfirst(0),
104     fPHlast(0),
105     fPTot(momentum),
106     fPx(momentum * TMath::Sin(theta) * TMath::Cos(phi)),
107     fPy(momentum * TMath::Sin(theta) * TMath::Sin(phi)),
108     fPz(momentum * TMath::Cos(theta)),
109     fXref(0),
110     fYref(0),
111     fZref(0)
112 {
113 /// Constructor
114     fX         = x;
115     fY         = y;
116     fZ         = z;
117 }
118
119 //-----------------------------------------------------------------------------------------------
120 AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t detElemId, Int_t idpart, 
121                        Float_t x, Float_t y, Float_t z, Float_t tof, Float_t momentum, 
122                        Float_t theta, Float_t phi, Float_t length, Float_t destep,
123                        Float_t xref,Float_t yref,Float_t zref)
124   : AliHit(shunt, track),
125     fDetElemId(detElemId),
126     fParticle(idpart),
127     fTheta(theta),
128     fPhi(phi),
129     fTlength(length),
130     fEloss(destep),
131     fAge(tof),
132     fPHfirst(0),
133     fPHlast(0),
134     fPTot(momentum),
135     fPx(momentum * TMath::Sin(theta) * TMath::Cos(phi)),
136     fPy(momentum * TMath::Sin(theta) * TMath::Sin(phi)),
137     fPz(momentum * TMath::Cos(theta)),
138     fXref(xref),
139     fYref(yref),
140     fZref(zref)
141 {
142 /// Constructor
143
144     fX         = x;
145     fY         = y;
146     fZ         = z;
147 }
148
149 //-----------------------------------------------------------------------------------------------
150 AliMUONHit::~AliMUONHit()
151 {
152 /// Dectructor
153 }
154
155 //-----------------------------------------------------------------------------------------------
156 Int_t  AliMUONHit::Chamber()  const
157 {  
158 /// Return chamber ID
159
160   return AliMpDEManager::GetChamberId(fDetElemId) + 1;  
161 }
162
163 //-----------------------------------------------------------------------------
164 const char*
165 AliMUONHit::GetName() const
166 {
167 /// Generate hit name
168
169   return Form("%s-DE%04d",ClassName(),DetElemId());
170 }
171
172 //-----------------------------------------------------------------------------------------------
173 void AliMUONHit::Print(Option_t* opt) const
174 {
175 /// Printing hit information 
176 /// "full" option for printing all the information about the hit
177
178   TString sopt(opt);
179   sopt.ToUpper();
180  
181   if ( sopt.Contains("FULL") ) { 
182     cout <<"<AliMUONHit>: Geant track="   << setw(4)  << Track() <<
183       ", DetEle="        << setw(4)  << DetElemId() <<  
184       ", (x,y,z)=(" << setw(7) << setprecision(5) << X() << "," << setw(7) << setprecision(5) << Y() <<  "," << setw(7) << setprecision(5) << Z() << 
185       " )cm, Delta E=" << setw(8) << setprecision(3) << Eloss() << " GeV" << endl;
186   }
187   else {
188     cout << "<AliMUONHit>: DetEle="        << setw(4)  << DetElemId() << 
189       ", (x,y,z)=(" << setw(7) << setprecision(5) << X() << "," << setw(7) << setprecision(5) << Y() <<  "," << setw(7) << setprecision(5) << Z() << 
190       " ) cm" <<endl;
191   }
192     
193 }