]>
Commit | Line | Data |
---|---|---|
49cd54c0 | 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 | ||
b2a60966 | 16 | /* $Id$ */ |
17 | ||
49cd54c0 | 18 | //_________________________________________________________________________ |
b2a60966 | 19 | // Hits class for PHOS |
20 | // A hit in PHOS is the sum of all hits in a single crystal | |
baef0810 | 21 | //*-- |
9688c1dd | 22 | //*-- Author: Maxime Volkov (RRC KI) & Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH) |
49cd54c0 | 23 | |
24 | // --- ROOT system --- | |
25 | ||
26 | // --- Standard library --- | |
88cb7938 | 27 | #include <string.h> |
28 | #include <stdlib.h> | |
49cd54c0 | 29 | |
30 | // --- AliRoot header files --- | |
31 | #include "AliPHOSHit.h" | |
32 | #include "AliRun.h" | |
88cb7938 | 33 | #include "AliConst.h" |
34 | #include "AliPHOSLoader.h" | |
0bc3b8ed | 35 | #include "AliPHOSGeometry.h" |
88cb7938 | 36 | #include "AliPHOS.h" |
1c75044c | 37 | |
49cd54c0 | 38 | ClassImp(AliPHOSHit) |
9688c1dd | 39 | |
40 | //____________________________________________________________________________ | |
41 | AliPHOSHit::AliPHOSHit(const AliPHOSHit & hit) | |
31aa6d6c | 42 | { |
9688c1dd | 43 | // copy ctor |
1c75044c | 44 | fX = hit.fX ; |
45 | fY = hit.fY ; | |
46 | fZ = hit.fZ ; | |
31aa6d6c | 47 | fId = hit.fId ; |
48 | fELOS = hit.fELOS ; | |
49 | fPrimary = hit.fPrimary ; | |
50 | fTrack = hit.fTrack ; | |
9688c1dd | 51 | fTime = hit.fTime ; |
52 | ||
31aa6d6c | 53 | } |
54 | ||
49cd54c0 | 55 | //____________________________________________________________________________ |
b37750a6 | 56 | AliPHOSHit::AliPHOSHit(Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits): AliHit(shunt, track) |
fb689dbe | 57 | { |
037cc66d | 58 | // |
59 | // Create a CPV hit object | |
60 | // | |
9688c1dd | 61 | |
1c75044c | 62 | fX = hits[0] ; |
63 | fY = hits[1] ; | |
64 | fZ = hits[2] ; | |
9688c1dd | 65 | fTime = hits[3] ; |
66 | fId = id ; | |
67 | fELOS = hits[4] ; | |
037cc66d | 68 | fPrimary = primary ; |
fb689dbe | 69 | } |
1c75044c | 70 | //____________________________________________________________________________ |
71 | Float_t AliPHOSHit::X() const | |
72 | { | |
9688c1dd | 73 | // if(fX < -1000.){ |
1c75044c | 74 | TVector3 pos ; |
0adeb7eb | 75 | AliPHOS * phos = static_cast<AliPHOS*> (gAlice->GetDetector("PHOS")) ; |
76 | phos->GetGeometry() ->RelPosInAlice(GetId(), pos) ; | |
77 | return pos.X() ; | |
9688c1dd | 78 | // fX = pos.X() ; |
79 | // fY = pos.Y() ; | |
80 | // fZ = pos.Z() ; | |
81 | // } | |
82 | // return fX; | |
1c75044c | 83 | } |
84 | //____________________________________________________________________________ | |
85 | Float_t AliPHOSHit::Y() const | |
86 | { | |
9688c1dd | 87 | // if(fY < -1000.){ |
1c75044c | 88 | TVector3 pos ; |
0adeb7eb | 89 | AliPHOS * phos = static_cast<AliPHOS*> (gAlice->GetDetector("PHOS")) ; |
90 | phos->GetGeometry() ->RelPosInAlice(GetId(), pos) ; | |
9688c1dd | 91 | return pos.Y(); |
92 | // fX = pos.X() ; | |
93 | // fY = pos.Y() ; | |
94 | // fZ = pos.Z() ; | |
95 | // } | |
96 | // return fY; | |
1c75044c | 97 | } |
98 | //____________________________________________________________________________ | |
99 | Float_t AliPHOSHit::Z() const | |
100 | { | |
9688c1dd | 101 | // if(fY < -1000.){ |
1c75044c | 102 | TVector3 pos ; |
0adeb7eb | 103 | AliPHOS * phos = static_cast<AliPHOS*> (gAlice->GetDetector("PHOS")) ; |
104 | phos->GetGeometry() ->RelPosInAlice(GetId(), pos) ; | |
1c75044c | 105 | return pos.Z() ; |
9688c1dd | 106 | // fX = pos.X() ; |
107 | // fY = pos.Y() ; | |
108 | // fZ = pos.Z() ; | |
109 | // } | |
110 | // return fZ; | |
1c75044c | 111 | } |
49cd54c0 | 112 | //____________________________________________________________________________ |
113 | Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const | |
114 | { | |
037cc66d | 115 | // Two hits are identical if they have the same Id and originate from the same primary |
b2a60966 | 116 | |
ff4c968a | 117 | Bool_t rv = kFALSE ; |
118 | ||
b37750a6 | 119 | if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetPrimary() ) ) |
ff4c968a | 120 | rv = kTRUE; |
49cd54c0 | 121 | |
ff4c968a | 122 | return rv; |
49cd54c0 | 123 | } |
124 | ||
125 | //____________________________________________________________________________ | |
7854a24a | 126 | AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue) |
49cd54c0 | 127 | { |
b2a60966 | 128 | // Add the energy of the hit |
49cd54c0 | 129 | |
7854a24a | 130 | fELOS += rValue.GetEnergy() ; |
9688c1dd | 131 | |
132 | if(rValue.GetTime() < fTime) | |
133 | fTime = rValue.GetTime() ; | |
ff4c968a | 134 | |
7854a24a | 135 | return *this; |
49cd54c0 | 136 | |
137 | } | |
138 | ||
139 | //____________________________________________________________________________ | |
140 | ostream& operator << (ostream& out, const AliPHOSHit& hit) | |
141 | { | |
b2a60966 | 142 | // Print out Id and energy |
143 | ||
21cd0c07 | 144 | //out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << " " << hit.GetTime() << endl ; |
145 | Warning("operator <<", "Implement differently") ; | |
49cd54c0 | 146 | return out ; |
147 | } | |
148 | ||
149 | ||
150 |