]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSHit.cxx
AliPHOSDigit remembers now which primary particle it comes from
[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 //_________________________________________________________________________
17 // Hit classes for PHOS
18 //*-- Author : Maxim Volkov, RRC KI
19 //////////////////////////////////////////////////////////////////////////////
20
21 // --- ROOT system ---
22
23 // --- Standard library ---
24 #include <cstdio>
25 #include <cstring>
26 #include <cstdlib>
27 #include <strstream>
28 #include <cassert>
29
30 // --- AliRoot header files ---
31 #include "AliPHOSHit.h"
32 #include "AliRun.h"
33 #include "AliConst.h"
34
35
36 ClassImp(AliPHOSHit)
37
38 //____________________________________________________________________________
39 AliPHOSHit::AliPHOSHit(Int_t primary, Int_t id, Float_t *hits)
40 {
41
42    fId         = id ;
43    fX          = hits[0] ;
44    fY          = hits[1] ;
45    fZ          = hits[2] ;
46    fELOS       = hits[3] ;
47    fPrimary    = primary ;
48 }
49
50 //____________________________________________________________________________
51 Bool_t AliPHOSHit::operator==(AliPHOSHit const &rValue) const
52
53   Bool_t rv = kFALSE ; 
54
55   if ( fId == rValue.GetId() && fPrimary == rValue.GetPrimary() ) 
56     rv = kTRUE;
57   
58   return rv;
59 }
60
61 //____________________________________________________________________________
62 AliPHOSHit AliPHOSHit::operator+(const AliPHOSHit &rValue) const
63 {
64   
65   AliPHOSHit added(*this);
66
67    added.fX    = rValue.fX  ;
68    added.fY    = rValue.fY ;
69    added.fZ    = rValue.fZ ;
70
71    added.fELOS += rValue.GetEnergy() ;
72     
73    assert ( added.fPrimary == rValue.fPrimary ) ; 
74
75    return added;
76
77 }
78
79 //____________________________________________________________________________
80 ostream& operator << (ostream& out, const AliPHOSHit& hit) 
81 {
82   out << "AliPHOSHit = " << hit.GetId() << " " << hit.GetEnergy() << endl ;
83   return out ;
84 }
85
86
87