#ifndef ALIEMCALDIGIT_H
#define ALIEMCALDIGIT_H
#include "TObject.h"
#include "AliDigitNew.h"
using std::ostream;
class AliEMCALDigit : public AliDigitNew {
friend ostream& operator << ( ostream& , const AliEMCALDigit&) ;
public:
AliEMCALDigit() ;
AliEMCALDigit(Int_t primary, Int_t iparent, Int_t id, Float_t digEnergy, Float_t time, Int_t type,Int_t index = -1, Float_t chi2=0, Int_t ndf=0, Float_t dE = 0) ;
AliEMCALDigit(const AliEMCALDigit & digit) ;
virtual ~AliEMCALDigit() ;
Bool_t operator==(const AliEMCALDigit &rValue) const;
AliEMCALDigit operator+(const AliEMCALDigit &rValue) ;
AliEMCALDigit operator*(Float_t factor) ;
AliEMCALDigit& operator = (const AliEMCALDigit & digit) ;
enum digitType{kUnknown=-1, kHG=0, kLG=1, kLGnoHG=2, kTrigger=3, kEmbedded = 4};
void Clear(const Option_t*) ;
Int_t Compare(const TObject * obj) const ;
Float_t GetAmplitude() const { if(!fAmp)return fAmpFloat ; else return fAmp ;}
Float_t GetEta() const ;
Int_t GetNprimary() const { return fNprimary ;}
Int_t GetPrimary(Int_t index) const ;
Float_t GetDEPrimary(Int_t index) const ;
Int_t GetNiparent() const { return fNiparent ;}
Int_t GetIparent(Int_t index) const ;
Float_t GetDEParent(Int_t index) const ;
Float_t GetPhi() const ;
Float_t GetTime(void) const { return fTime ;}
Float_t GetTimeR(void) const { return fTimeR ;}
Float_t GetChi2(void) const { return fChi2 ;}
Int_t GetNDF(void) const { return fNDF ;}
Bool_t IsSortable() const { return kTRUE ;}
Int_t GetType() const { return fDigitType ;}
void SetAmp(Int_t amp) { fAmp = amp ; }
void SetAmplitude(Float_t amp) { fAmpFloat = amp ; }
void SetId(Int_t idt) { fId = idt ; }
void SetTime(Float_t time) { fTime = time ; }
void SetTimeR(Float_t time) { fTimeR = time ; }
void SetChi2(Float_t chi) { fChi2 = chi ; }
void SetNDF(Int_t ndf) { fNDF = ndf ; }
void SetType(Int_t t) { fDigitType = t ; }
void ShiftPrimary(Int_t shift);
Int_t GetNALTROSamplesLG() const {if(fDigitType==kLG) return fNSamples; else return 0 ; }
Bool_t GetALTROSampleLG(const Int_t iSample, Int_t& timeBin, Int_t& amp) const;
Int_t GetNALTROSamplesHG() const {if(fDigitType==kHG) return fNSamplesHG; else return 0 ; }
Bool_t GetALTROSampleHG(const Int_t iSample, Int_t& timeBin, Int_t& amp) const;
Int_t GetNFALTROSamples() const {if(fDigitType==kTrigger) return fNSamples; else return 0 ; }
Bool_t GetFALTROSample(const Int_t iSample, Int_t& timeBin, Int_t& amp) const ;
void SetALTROSamplesHG (const Int_t nSamplesHG, Int_t *samplesHG);
void SetALTROSamplesLG (const Int_t nSamplesLG, Int_t *samplesLG);
void SetFALTROSamples (const Int_t nSamples, Int_t *samples)
{ if(fDigitType==kTrigger) SetALTROSamplesLG(nSamples, samples) ; }
void SetCalibAmp(Float_t amp) { fAmpCalib = amp ; }
Double_t GetCalibAmp() const { return fAmpCalib ; }
void Print(const Option_t* ) const;
private:
Float_t fAmpFloat;
Int_t fNSamples;
Int_t *fSamples;
Int_t fNSamplesHG;
Int_t *fSamplesHG;
Int_t fNprimary ;
Int_t fNMaxPrimary ;
Int_t *fPrimary ;
Float_t *fDEPrimary ;
Int_t fNiparent ;
Int_t fNMaxiparent ;
Int_t *fIparent ;
Float_t *fDEParent;
Int_t fMaxIter ;
Float_t fTime ;
Float_t fTimeR ;
Float_t fChi2;
Int_t fNDF;
Int_t fDigitType;
Float_t fAmpCalib;
ClassDef(AliEMCALDigit,6)
} ;
#endif // ALIEMCALDIGIT_H