]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSHit.cxx
Update for coding convensions
[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  
53
54
55 //____________________________________________________________________________
56 AliPHOSHit::AliPHOSHit(Int_t primary, Int_t id, Float_t *hits)
57 {
58   // ctor
59   
60    fId         = id ;
61    fX          = hits[0] ;
62    fY          = hits[1] ;
63    fZ          = hits[2] ;
64    fELOS       = hits[3] ;
65    fPrimary    = primary ;
66 }
67 AliPHOSHit::AliPHOSHit(Int_t Shunt, Int_t primary, Int_t Track, Int_t id, Float_t *hits) : AliHit(Shunt, Track)
68 {
69   // ctor
70   
71    fId         = id ;
72    fTrack      = Track;
73    fX          = hits[0] ;
74    fY          = hits[1] ;
75    fZ          = hits[2] ;
76    fELOS       = hits[3] ;
77    fPrimary    = primary ;
78 }
79
80
81
82 //____________________________________________________________________________
83 Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const
84
85   // Two hits are identical if they have the same Id and originate from the same primary
86
87   Bool_t rv = kFALSE ; 
88
89   if ( fId == rValue.GetId() && fPrimary == rValue.GetPrimary() ) 
90     rv = kTRUE;
91   
92   return rv;
93 }
94
95 //____________________________________________________________________________
96 AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue) const
97 {
98   // Add the energy of the hit
99   
100   AliPHOSHit added(*this);
101
102    added.fX    = rValue.fX  ;
103    added.fY    = rValue.fY ;
104    added.fZ    = rValue.fZ ;
105
106    added.fELOS += rValue.GetEnergy() ;
107     
108    return added;
109
110 }
111
112 //____________________________________________________________________________
113 ostream& operator << (ostream& out, const AliPHOSHit& hit) 
114 {
115   // Print out Id and energy 
116   
117   out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << endl ;
118   return out ;
119 }
120
121
122