]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSDigit.cxx
New Version from Alla
[u/mrichter/AliRoot.git] / PHOS / AliPHOSDigit.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 // Digit class for PHOS that contains an absolute ID and an energy
18 //*-- Author : Laurent Aphecetche  SUBATECH 
19 //////////////////////////////////////////////////////////////////////////////
20
21 // --- ROOT system ---
22
23 // --- Standard library ---
24
25 #include <iostream>
26
27 // --- AliRoot header files ---
28
29 #include "AliPHOSDigit.h"
30
31
32 ClassImp(AliPHOSDigit)
33
34 //____________________________________________________________________________
35 AliPHOSDigit::AliPHOSDigit(Int_t id, Int_t DigEnergy) : AliDigitNew( ), fId(id),fAmp(DigEnergy)
36 {  
37   // This part should be a true Digitization, but is not for the moment.
38   //  fAmp = energy ;
39   fId = id;
40   fAmp = DigEnergy ;
41 }
42
43 //____________________________________________________________________________
44 Bool_t AliPHOSDigit::operator==(AliPHOSDigit const &Digit) const 
45 {
46   if ( fId == Digit.fId ) 
47     return kTRUE ;
48   else 
49     return kFALSE ;
50 }
51
52 //____________________________________________________________________________
53 AliPHOSDigit& AliPHOSDigit::operator+(AliPHOSDigit const &Digit) 
54 {
55   fAmp += Digit.fAmp ;
56
57   return *this ;
58 }
59
60 //____________________________________________________________________________
61 ostream& operator << ( ostream& out , const AliPHOSDigit& Digit)
62 {
63   out << "ID " << Digit.fId << " Energy = " << Digit.fAmp ;
64
65   return out ;
66 }
67
68 //____________________________________________________________________________
69 Int_t AliPHOSDigit::Compare(TObject * obj)
70 {
71   Int_t rv ; 
72
73   AliPHOSDigit * digit = (AliPHOSDigit *)obj ; 
74
75   Int_t iddiff = fId - digit->GetId() ; 
76
77   if ( iddiff > 0 ) 
78     rv = 1 ;
79   else if ( iddiff < 0 )
80     rv = -1 ; 
81   else
82     rv = 0 ;
83   
84   return rv ; 
85
86 }