]> git.uio.no Git - u/mrichter/AliRoot.git/blame - CRT/AliCRThit.cxx
Set values to zero in constructor. Added print function.
[u/mrichter/AliRoot.git] / CRT / AliCRThit.cxx
CommitLineData
fb7a1f55 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
803d1ab0 16/* $Id$ */
fb7a1f55 17
fddb5247 18#include "AliCRThit.h"
19
387cc25e 20#include <TMath.h>
21
22#include "AliConst.h"
fb7a1f55 23
24ClassImp(AliCRThit)
25
fa15ea42 26//____________________________________________________________________________
27AliCRThit::AliCRThit()
387cc25e 28 : AliHit(),
29 fId(0),
30 fPx(0),
31 fPy(0),
32 fPz(0),
33 fEloss(0),
34 fMedium(0)
fa15ea42 35{
387cc25e 36 //
37 // default ctor for AliCRThit object
38 //
fa15ea42 39}
40
387cc25e 41//_____________________________________________________________________________
42AliCRThit::AliCRThit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits)
43 : AliHit(shunt, track),
44 fId(hits[0]),
45 fPx(hits[4]),
46 fPy(hits[5]),
47 fPz(hits[6]),
48 fEloss(hits[7]),
49 fMedium(vol[0])
50{
51 //
52 // Constructor of hit object
53 //
54 fX = hits[1];
55 fY = hits[2];
56 fZ = hits[3];
57}
fa15ea42 58
fb7a1f55 59//____________________________________________________________________________
60AliCRThit::AliCRThit(const AliCRThit & hit)
387cc25e 61 : AliHit(hit),
62 fId(hit.fId),
63 fPx(hit.fPx),
64 fPy(hit.fPy),
65 fPz(hit.fPz),
66 fEloss(hit.fEloss),
67 fMedium(hit.fMedium)
68{
69 //
70 // copy ctor
71 //
72 fX = hit.fX;
73 fY = hit.fY;
74 fZ = hit.fZ;
75}
76
77//_____________________________________________________________________________
78AliCRThit::~AliCRThit()
fb7a1f55 79{
387cc25e 80 //
81 // Default destructor.
82 //
83}
fa15ea42 84
387cc25e 85//_____________________________________________________________________________
86AliCRThit& AliCRThit::operator=(const AliCRThit & hit)
87{
88 //
89 // aisngment operator.
90 //
fa15ea42 91 fId = hit.fId;
92 fX = hit.fX;
93 fY = hit.fY;
94 fZ = hit.fZ;
95 fPx = hit.fPx;
96 fPy = hit.fPy;
97 fPz = hit.fPz;
387cc25e 98 fEloss = hit.fEloss;
fa15ea42 99 fMedium = hit.fMedium;
387cc25e 100 return *this;
fa15ea42 101}
102
103//_____________________________________________________________________________
387cc25e 104Float_t AliCRThit::Energy() const
fa15ea42 105{
387cc25e 106 //
107 //
108 //
109 return TMath::Sqrt(fPx*fPx + fPy*fPy + fPz*fPz);
fb7a1f55 110}
fa15ea42 111
112//_____________________________________________________________________________
387cc25e 113Float_t AliCRThit::PolarAngle() const
fb7a1f55 114{
387cc25e 115 //
116 //
117 //
118 return kRaddeg*TMath::ACos(-fPy/this->Energy());
119}
fa15ea42 120
387cc25e 121//_____________________________________________________________________________
122Float_t AliCRThit::AzimuthAngle() const
123{
124 //
125 //
126 //
127 return kRaddeg*TMath::ATan2(-fPx, -fPz);
128}
fa15ea42 129
387cc25e 130//_____________________________________________________________________________
131Bool_t AliCRThit::operator==(const AliCRThit& hit)
132{
133 //
134 //
135 //
136 Float_t energy = TMath::Sqrt(fPx*fPx + fPy*fPy + fPz*fPz);
137 Float_t energy2=TMath::Sqrt(hit.fPx*hit.fPx+hit.fPy*hit.fPy+hit.fPz*hit.fPz);
138 return (energy == energy2);
139 //return (fTrack == hit.fTrack);
fb7a1f55 140}
141
387cc25e 142//_____________________________________________________________________________
143Bool_t AliCRThit::operator<(const AliCRThit& hit)
144{
145 //
146 //
147 //
148 Float_t energy = TMath::Sqrt(fPx*fPx + fPy*fPy + fPz*fPz);
149 Float_t energy2=TMath::Sqrt(hit.fPx*hit.fPx+hit.fPy*hit.fPy+hit.fPz*hit.fPz);
150 return (energy < energy2);
151}