New makefiles for OSF and Solaris, compatibility changes in the others
[u/mrichter/AliRoot.git] / PHOS / AliPHOSHit.cxx
CommitLineData
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
38ClassImp(AliPHOSHit)
39
40//____________________________________________________________________________
31aa6d6c 41AliPHOSHit::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 ;
52
53}
54
55//____________________________________________________________________________
ff4c968a 56AliPHOSHit::AliPHOSHit(Int_t primary, Int_t id, Float_t *hits)
49cd54c0 57{
b2a60966 58 // ctor
59
ff4c968a 60 fId = id ;
61 fX = hits[0] ;
62 fY = hits[1] ;
63 fZ = hits[2] ;
64 fELOS = hits[3] ;
65 fPrimary = primary ;
49cd54c0 66}
67
68//____________________________________________________________________________
69Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const
70{
b2a60966 71 // Two hits are identical if they have the same Id and originate from the same primary
72
ff4c968a 73 Bool_t rv = kFALSE ;
74
75 if ( fId == rValue.GetId() && fPrimary == rValue.GetPrimary() )
76 rv = kTRUE;
49cd54c0 77
ff4c968a 78 return rv;
49cd54c0 79}
80
81//____________________________________________________________________________
82AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue) const
83{
b2a60966 84 // Add the energy of the hit
49cd54c0 85
86 AliPHOSHit added(*this);
87
88 added.fX = rValue.fX ;
89 added.fY = rValue.fY ;
90 added.fZ = rValue.fZ ;
91
ff4c968a 92 added.fELOS += rValue.GetEnergy() ;
93
ff4c968a 94 return added;
49cd54c0 95
96}
97
98//____________________________________________________________________________
99ostream& operator << (ostream& out, const AliPHOSHit& hit)
100{
b2a60966 101 // Print out Id and energy
102
49cd54c0 103 out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << endl ;
104 return out ;
105}
106
107
108