ROOT logo
#ifndef ALIEMCALDIGIT_H
#define ALIEMCALDIGIT_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */

//_________________________________________________________________________
//  EMCAL digit: 
// 
//  A  Digit is the sum of energy in a Tower (Hit sum) and stores information, about primaries
//  and entering particle contributing to a Digit
//
//*-- Author: Sahal Yacoob (LBL)
// based on : AliPHOSDigit
//___________________________________________________________________________

// --- ROOT system ---

#include "TObject.h" 

// --- Standard library ---

// --- AliRoot header files ---
#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 ;}//Keep backward compatibility.
  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  ; } //old
  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); // shift to separate different TreeK in merging

  //Raw time sample
  //ALTRO
  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;
  //FALTRO, trigger. Same data members as Low Gain	
  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* /*opt*/) const;
	
 private: 
	
  Float_t  fAmpFloat;     // Cell amplitude, float
  Int_t    fNSamples;     // Number of time samples, Low Gain for ALTRO, used also for FALTRO 
  Int_t   *fSamples;	  //[fNSamples], list of time bin constents, Low Gain for ALTRO, used also for FALTRO 
  Int_t    fNSamplesHG;   // Number of time samples, High Gain for ALTRO
  Int_t   *fSamplesHG;	  //[fNSamples], list of time bin constents, High Gain for ALTRO, used also for FALTRO 
	
  Int_t    fNprimary ;    // Number of primaries
  Int_t    fNMaxPrimary ; // Max Number of primaries
  Int_t   *fPrimary ;     //[fNMaxPrimary]  Array of primaries       
  Float_t *fDEPrimary ;   //[fNMaxPrimary]  Array of primary energy contributions
    
  Int_t    fNiparent ;    // Number of initial parents 
  Int_t    fNMaxiparent ; // Max Number of parents 
  Int_t   *fIparent ;     //[fNMaxiparent] Array of parents       
  Float_t *fDEParent;     //[fNMaxiparent]  Array of parent energy contributions
  Int_t    fMaxIter  ;    // Number to Increment Maxiparent, and MaxPrimary if default is not sufficient
  Float_t  fTime ;        // Calculated time  
  Float_t  fTimeR ;       // Earliest time: to be used by Digits2Raw
  //Fit quality parameters
  Float_t  fChi2;         // Fit Chi aquare	
  Int_t    fNDF;          // Fit Number of Degrees of Freedom
	
  Int_t    fDigitType;    // This is a trigger digit(0), HG (1) or LG (3)
  Float_t  fAmpCalib;     //! Calibrated energy

  ClassDef(AliEMCALDigit,6)   // Digit in EMCAL 
} ;

#endif //  ALIEMCALDIGIT_H
 AliEMCALDigit.h:1
 AliEMCALDigit.h:2
 AliEMCALDigit.h:3
 AliEMCALDigit.h:4
 AliEMCALDigit.h:5
 AliEMCALDigit.h:6
 AliEMCALDigit.h:7
 AliEMCALDigit.h:8
 AliEMCALDigit.h:9
 AliEMCALDigit.h:10
 AliEMCALDigit.h:11
 AliEMCALDigit.h:12
 AliEMCALDigit.h:13
 AliEMCALDigit.h:14
 AliEMCALDigit.h:15
 AliEMCALDigit.h:16
 AliEMCALDigit.h:17
 AliEMCALDigit.h:18
 AliEMCALDigit.h:19
 AliEMCALDigit.h:20
 AliEMCALDigit.h:21
 AliEMCALDigit.h:22
 AliEMCALDigit.h:23
 AliEMCALDigit.h:24
 AliEMCALDigit.h:25
 AliEMCALDigit.h:26
 AliEMCALDigit.h:27
 AliEMCALDigit.h:28
 AliEMCALDigit.h:29
 AliEMCALDigit.h:30
 AliEMCALDigit.h:31
 AliEMCALDigit.h:32
 AliEMCALDigit.h:33
 AliEMCALDigit.h:34
 AliEMCALDigit.h:35
 AliEMCALDigit.h:36
 AliEMCALDigit.h:37
 AliEMCALDigit.h:38
 AliEMCALDigit.h:39
 AliEMCALDigit.h:40
 AliEMCALDigit.h:41
 AliEMCALDigit.h:42
 AliEMCALDigit.h:43
 AliEMCALDigit.h:44
 AliEMCALDigit.h:45
 AliEMCALDigit.h:46
 AliEMCALDigit.h:47
 AliEMCALDigit.h:48
 AliEMCALDigit.h:49
 AliEMCALDigit.h:50
 AliEMCALDigit.h:51
 AliEMCALDigit.h:52
 AliEMCALDigit.h:53
 AliEMCALDigit.h:54
 AliEMCALDigit.h:55
 AliEMCALDigit.h:56
 AliEMCALDigit.h:57
 AliEMCALDigit.h:58
 AliEMCALDigit.h:59
 AliEMCALDigit.h:60
 AliEMCALDigit.h:61
 AliEMCALDigit.h:62
 AliEMCALDigit.h:63
 AliEMCALDigit.h:64
 AliEMCALDigit.h:65
 AliEMCALDigit.h:66
 AliEMCALDigit.h:67
 AliEMCALDigit.h:68
 AliEMCALDigit.h:69
 AliEMCALDigit.h:70
 AliEMCALDigit.h:71
 AliEMCALDigit.h:72
 AliEMCALDigit.h:73
 AliEMCALDigit.h:74
 AliEMCALDigit.h:75
 AliEMCALDigit.h:76
 AliEMCALDigit.h:77
 AliEMCALDigit.h:78
 AliEMCALDigit.h:79
 AliEMCALDigit.h:80
 AliEMCALDigit.h:81
 AliEMCALDigit.h:82
 AliEMCALDigit.h:83
 AliEMCALDigit.h:84
 AliEMCALDigit.h:85
 AliEMCALDigit.h:86
 AliEMCALDigit.h:87
 AliEMCALDigit.h:88
 AliEMCALDigit.h:89
 AliEMCALDigit.h:90
 AliEMCALDigit.h:91
 AliEMCALDigit.h:92
 AliEMCALDigit.h:93
 AliEMCALDigit.h:94
 AliEMCALDigit.h:95
 AliEMCALDigit.h:96
 AliEMCALDigit.h:97
 AliEMCALDigit.h:98
 AliEMCALDigit.h:99
 AliEMCALDigit.h:100
 AliEMCALDigit.h:101
 AliEMCALDigit.h:102
 AliEMCALDigit.h:103
 AliEMCALDigit.h:104
 AliEMCALDigit.h:105
 AliEMCALDigit.h:106
 AliEMCALDigit.h:107
 AliEMCALDigit.h:108
 AliEMCALDigit.h:109
 AliEMCALDigit.h:110
 AliEMCALDigit.h:111
 AliEMCALDigit.h:112
 AliEMCALDigit.h:113
 AliEMCALDigit.h:114
 AliEMCALDigit.h:115
 AliEMCALDigit.h:116
 AliEMCALDigit.h:117
 AliEMCALDigit.h:118
 AliEMCALDigit.h:119
 AliEMCALDigit.h:120
 AliEMCALDigit.h:121
 AliEMCALDigit.h:122
 AliEMCALDigit.h:123
 AliEMCALDigit.h:124
 AliEMCALDigit.h:125