]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSHit.cxx
make it compile with Federico modifications
[u/mrichter/AliRoot.git] / PHOS / AliPHOSHit.cxx
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
16 /* $Id$ */
17
18 //_________________________________________________________________________
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)
23
24 // --- ROOT system ---
25
26 // --- Standard library ---
27 #include <stdio.h>
28 #include <string.h>
29 #include <stdlib.h>
30 #include <strstream.h>
31
32 // --- AliRoot header files ---
33 #include "AliPHOSHit.h"
34 #include "AliRun.h"
35 #include "AliConst.h"
36
37
38 ClassImp(AliPHOSHit)
39
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 ; 
52   fPid     = hit.fPid ;
53  
54
55
56 //____________________________________________________________________________
57 AliPHOSHit::AliPHOSHit(Int_t Shunt, Int_t primary, Int_t Track, Int_t id, Float_t *hits, Int_t pid) : AliHit(Shunt, Track)
58 {
59   // ctor
60   
61    fId         = id ;
62    fTrack      = Track;
63    fX          = hits[0] ;
64    fY          = hits[1] ;
65    fZ          = hits[2] ;
66    fELOS       = hits[3] ;
67    fPrimary    = primary ;
68    fPid        = pid ; 
69 }
70
71 //____________________________________________________________________________
72 Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const
73
74   // Two hits are identical if they have the same Id and originate from the same primary
75
76   Bool_t rv = kFALSE ; 
77
78   if ( fId == rValue.GetId() && fPrimary == rValue.GetPrimary() )
79     rv = kTRUE;
80   
81   return rv;
82 }
83
84 //____________________________________________________________________________
85 AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue) const
86 {
87   // Add the energy of the hit
88   
89   AliPHOSHit added(*this);
90
91   // the accumulated hit position is the position of the first hi
92   //    added.fX    = rValue.fX  ;
93   //    added.fY    = rValue.fY ;
94   //    added.fZ    = rValue.fZ ;
95
96    added.fELOS += rValue.GetEnergy() ;
97     
98    return added;
99
100 }
101
102 //____________________________________________________________________________
103 ostream& operator << (ostream& out, const AliPHOSHit& hit) 
104 {
105   // Print out Id and energy 
106   
107   out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << endl ;
108   return out ;
109 }
110
111
112