Create the magnetic field map in the reconstruction macros (Yuri)
[u/mrichter/AliRoot.git] / MUON / AliMUONHit.cxx
CommitLineData
a9e2aefa 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
88cb7938 16/* $Id$ */
0e83b872 17
3d1463c8 18//-----------------------------------------------------------------------------
5398f946 19// MUON class for MonteCarlo Hits, inherited from AliHit for the
34c512f6 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.
3d1463c8 26//-----------------------------------------------------------------------------
34c512f6 27
be7a6875 28#include "AliMUONHit.h"
29#include "AliMpDEManager.h"
30178c30 30
6464217e 31#include "AliLog.h"
6464217e 32
be7a6875 33#include <Riostream.h>
34#include <TMath.h>
35#include <TString.h>
a9e2aefa 36
5398f946 37/// \cond CLASSIMP
a9e2aefa 38ClassImp(AliMUONHit)
5398f946 39/// \endcond
a9e2aefa 40
41//___________________________________________
30178c30 42AliMUONHit::AliMUONHit()
5398f946 43 : AliHit(),
5398f946 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)
30178c30 60{
5398f946 61/// Default constructor
30178c30 62}
63
64//___________________________________________
5398f946 65AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits)
66 : AliHit(shunt, track),
5398f946 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)
d59b2ec3 83{
5398f946 84/// Constructor
d59b2ec3 85
d59b2ec3 86 fX = hits[1];
87 fY = hits[2];
88 fZ = hits[3];
d59b2ec3 89}
90
0e83b872 91//___________________________________________
d59b2ec3 92AliMUONHit::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,
be7a6875 94 Float_t theta, Float_t phi, Float_t length, Float_t destep)
5398f946 95 : AliHit(shunt, track),
5398f946 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)
d59b2ec3 112{
5398f946 113/// Constructor
d59b2ec3 114 fX = X;
115 fY = Y;
116 fZ = Z;
d59b2ec3 117}
118
1391e633 119//-----------------------------------------------------------------------------------------------
d59b2ec3 120AliMUONHit::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,
be7a6875 123 Float_t Xref,Float_t Yref,Float_t Zref)
5398f946 124 : AliHit(shunt, track),
5398f946 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)
d59b2ec3 141{
5398f946 142/// Constructor
143
d59b2ec3 144 fX = X;
145 fY = Y;
146 fZ = Z;
5398f946 147}
148
149//-----------------------------------------------------------------------------------------------
150AliMUONHit::~AliMUONHit()
151{
152/// Dectructor
d59b2ec3 153}
154
155//-----------------------------------------------------------------------------------------------
d59b2ec3 156Int_t AliMUONHit::Chamber() const
157{
5398f946 158/// Return chamber ID
d59b2ec3 159
be7a6875 160 return AliMpDEManager::GetChamberId(fDetElemId) + 1;
d59b2ec3 161}
a9e2aefa 162
7f97ef58 163//-----------------------------------------------------------------------------
164const char*
165AliMUONHit::GetName() const
166{
167/// Generate hit name
168
169 return Form("%s-DE%04d",ClassName(),DetElemId());
170}
171
be7a6875 172//-----------------------------------------------------------------------------------------------
6464217e 173void AliMUONHit::Print(Option_t* opt) const
174{
be7a6875 175/// Printing hit information
176/// "full" option for printing all the information about the hit
177
6464217e 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}