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