]>
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 | |
21 | // | |
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" | |
36 | ||
37 | ||
38 | ClassImp(AliPHOSHit) | |
39 | ||
31aa6d6c | 40 | //____________________________________________________________________________ |
41 | AliPHOSHit::AliPHOSHit(const AliPHOSHit & hit) | |
42 | { | |
43 | // copy ctor | |
44 | ||
45 | fId = hit.fId ; | |
46 | fELOS = hit.fELOS ; | |
47 | fPrimary = hit.fPrimary ; | |
48 | fTrack = hit.fTrack ; | |
49 | fX = hit.fX ; | |
50 | fY = hit.fY ; | |
51 | fZ = hit.fZ ; | |
e39caaf7 | 52 | fPid = hit.fPid ; |
31aa6d6c | 53 | |
54 | } | |
55 | ||
49cd54c0 | 56 | //____________________________________________________________________________ |
037cc66d | 57 | AliPHOSHit::AliPHOSHit(Int_t shunt, Int_t primary, Int_t track, Int_t id, Float_t *hits, Int_t pid, TLorentzVector p, Float_t *xy): AliHit(shunt, track) |
fb689dbe | 58 | { |
037cc66d | 59 | // |
60 | // Create a CPV hit object | |
61 | // | |
62 | ||
63 | fId = id ; | |
64 | fELOS = hits[3] ; | |
65 | fPrimary = primary ; | |
66 | fPid = pid ; | |
67 | fMomentum = p; | |
68 | fX = xy[0]; //position of particle first entering cristall/pad | |
69 | fY = xy[1]; | |
70 | fZ = 9999.; //Fake Z to avoid FPE | |
fb689dbe | 71 | } |
72 | ||
49cd54c0 | 73 | //____________________________________________________________________________ |
74 | Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const | |
75 | { | |
037cc66d | 76 | // Two hits are identical if they have the same Id and originate from the same primary |
b2a60966 | 77 | |
ff4c968a | 78 | Bool_t rv = kFALSE ; |
79 | ||
037cc66d | 80 | if ( (fId == rValue.GetId()) && ( fPrimary == rValue.GetPrimary() ) && (fPid*rValue.fPid ! = 0) ) |
ff4c968a | 81 | rv = kTRUE; |
49cd54c0 | 82 | |
ff4c968a | 83 | return rv; |
49cd54c0 | 84 | } |
85 | ||
86 | //____________________________________________________________________________ | |
87 | AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue) const | |
88 | { | |
b2a60966 | 89 | // Add the energy of the hit |
49cd54c0 | 90 | |
91 | AliPHOSHit added(*this); | |
92 | ||
e39caaf7 | 93 | // the accumulated hit position is the position of the first hi |
94 | // added.fX = rValue.fX ; | |
95 | // added.fY = rValue.fY ; | |
96 | // added.fZ = rValue.fZ ; | |
49cd54c0 | 97 | |
ff4c968a | 98 | added.fELOS += rValue.GetEnergy() ; |
99 | ||
037cc66d | 100 | if(fPid == 0) fPid = rValue.fPid ; |
101 | ||
ff4c968a | 102 | return added; |
49cd54c0 | 103 | |
104 | } | |
105 | ||
106 | //____________________________________________________________________________ | |
107 | ostream& operator << (ostream& out, const AliPHOSHit& hit) | |
108 | { | |
b2a60966 | 109 | // Print out Id and energy |
110 | ||
49cd54c0 | 111 | out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << endl ; |
112 | return out ; | |
113 | } | |
114 | ||
115 | ||
116 |