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