]> git.uio.no Git - u/mrichter/AliRoot.git/blob - CRT/AliCRThit.cxx
Number of pads along z is corrected
[u/mrichter/AliRoot.git] / CRT / AliCRThit.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 #include "AliCRThit.h"
19
20 #include <TMath.h>
21
22 #include "AliConst.h"
23
24 ClassImp(AliCRThit)
25
26 //____________________________________________________________________________
27 AliCRThit::AliCRThit()
28   : AliHit(),
29     fId(0),
30     fPx(0),
31     fPy(0),
32     fPz(0),
33     fEloss(0),
34     fMedium(0)
35 {
36   //
37   // default ctor for AliCRThit object
38   //
39 }
40
41 //_____________________________________________________________________________
42 AliCRThit::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 }
58
59 //____________________________________________________________________________
60 AliCRThit::AliCRThit(const AliCRThit & hit)
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 //_____________________________________________________________________________
78 AliCRThit::~AliCRThit()
79 {
80   //
81   // Default destructor.
82   //
83 }
84
85 //_____________________________________________________________________________
86 AliCRThit& AliCRThit::operator=(const AliCRThit & hit)
87 {
88   //
89   // aisngment operator.
90   //
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;
98   fEloss  = hit.fEloss;
99   fMedium = hit.fMedium;
100   return *this;
101 }
102
103 //_____________________________________________________________________________
104 Float_t AliCRThit::Energy() const
105 {
106   //
107   //
108   //
109   return TMath::Sqrt(fPx*fPx + fPy*fPy + fPz*fPz);
110 }
111
112 //_____________________________________________________________________________
113 Float_t AliCRThit::PolarAngle() const
114 {
115   //
116   //
117   //
118   return kRaddeg*TMath::ACos(-fPy/this->Energy());
119 }
120
121 //_____________________________________________________________________________
122 Float_t AliCRThit::AzimuthAngle() const
123 {
124   //
125   //
126   //
127   return kRaddeg*TMath::ATan2(-fPx, -fPz);
128 }
129
130 //_____________________________________________________________________________
131 Bool_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);
140 }
141
142 //_____________________________________________________________________________
143 Bool_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 }