]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONHit.cxx
Fixes for coverity.
[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
cdd730d0 37using std::endl;
38using std::cout;
39using std::setw;
40using std::setprecision;
5398f946 41/// \cond CLASSIMP
a9e2aefa 42ClassImp(AliMUONHit)
5398f946 43/// \endcond
a9e2aefa 44
30178c30 45//___________________________________________
46AliMUONHit::AliMUONHit()
5398f946 47 : AliHit(),
5398f946 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)
30178c30 64{
5398f946 65/// Default constructor
30178c30 66}
67
a9e2aefa 68//___________________________________________
5398f946 69AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits)
70 : AliHit(shunt, track),
5398f946 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)
d59b2ec3 87{
5398f946 88/// Constructor
d59b2ec3 89
d59b2ec3 90 fX = hits[1];
91 fY = hits[2];
92 fZ = hits[3];
d59b2ec3 93}
94
d59b2ec3 95//___________________________________________
96AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t detElemId, Int_t idpart,
bf0d3528 97 Float_t x, Float_t y, Float_t z, Float_t tof, Float_t momentum,
be7a6875 98 Float_t theta, Float_t phi, Float_t length, Float_t destep)
5398f946 99 : AliHit(shunt, track),
5398f946 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)
d59b2ec3 116{
5398f946 117/// Constructor
bf0d3528 118 fX = x;
119 fY = y;
120 fZ = z;
d59b2ec3 121}
122
1391e633 123//-----------------------------------------------------------------------------------------------
d59b2ec3 124AliMUONHit::AliMUONHit(Int_t shunt, Int_t track, Int_t detElemId, Int_t idpart,
bf0d3528 125 Float_t x, Float_t y, Float_t z, Float_t tof, Float_t momentum,
d59b2ec3 126 Float_t theta, Float_t phi, Float_t length, Float_t destep,
bf0d3528 127 Float_t xref,Float_t yref,Float_t zref)
5398f946 128 : AliHit(shunt, track),
5398f946 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)),
bf0d3528 142 fXref(xref),
143 fYref(yref),
144 fZref(zref)
d59b2ec3 145{
5398f946 146/// Constructor
147
bf0d3528 148 fX = x;
149 fY = y;
150 fZ = z;
5398f946 151}
152
153//-----------------------------------------------------------------------------------------------
154AliMUONHit::~AliMUONHit()
155{
156/// Dectructor
d59b2ec3 157}
158
d59b2ec3 159//-----------------------------------------------------------------------------------------------
160Int_t AliMUONHit::Chamber() const
161{
5398f946 162/// Return chamber ID
d59b2ec3 163
be7a6875 164 return AliMpDEManager::GetChamberId(fDetElemId) + 1;
d59b2ec3 165}
a9e2aefa 166
7f97ef58 167//-----------------------------------------------------------------------------
168const char*
169AliMUONHit::GetName() const
170{
171/// Generate hit name
172
173 return Form("%s-DE%04d",ClassName(),DetElemId());
174}
175
be7a6875 176//-----------------------------------------------------------------------------------------------
6464217e 177void AliMUONHit::Print(Option_t* opt) const
178{
be7a6875 179/// Printing hit information
180/// "full" option for printing all the information about the hit
181
6464217e 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}