X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=STEER%2FAOD%2FAliAODCaloCells.h;h=83d430382197639a301e9089a775a648cf3d9f5f;hp=53c05e451e4c768cda0595cd3df5746dfa645ff4;hb=77e93dc280e4a225a765e35bb2d2ea657961f6b2;hpb=93bf8b7277edf6cb42f8a5087b3104614034a2fd diff --git a/STEER/AOD/AliAODCaloCells.h b/STEER/AOD/AliAODCaloCells.h index 53c05e451e4..83d43038219 100644 --- a/STEER/AOD/AliAODCaloCells.h +++ b/STEER/AOD/AliAODCaloCells.h @@ -21,58 +21,82 @@ class AliAODCaloCells : public AliVCaloCells AliAODCaloCells(const char* name, const char* title, VCells_t ttype=kUndef); AliAODCaloCells(const AliAODCaloCells& cells); AliAODCaloCells& operator=(const AliAODCaloCells& cells); - virtual void Copy(TObject &obj) const; - virtual AliVCaloCells* CopyCaloCells(Bool_t all) const; - virtual ~AliAODCaloCells(); - void Clear(const Option_t*); - void CreateContainer(Short_t nCells); - void DeleteContainer(); - void Sort(); + virtual AliVCaloCells* CopyCaloCells(Bool_t all) const; + virtual void Copy(TObject &obj) const; + void Clear(const Option_t*); + void CreateContainer(Short_t nCells); + void DeleteContainer(); + void Sort(); - Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time = -1); + inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time, Short_t &mclabel, Double_t &efrac) const ; + Bool_t SetCell(Short_t pos, Short_t cellNumber, Double_t amplitude, Double_t time, Short_t mclabel = -1, Double_t efrac = 0.) ; + + Short_t GetNumberOfCells() const { return fNCells ; } + void SetNumberOfCells(Int_t n) { fNCells = n ; } - Short_t GetNumberOfCells() const { return fNCells; } - void SetNumberOfCells(Int_t n) { fNCells = n ; } - inline Bool_t GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t &time) const; inline Double_t GetCellAmplitude(Short_t cellNumber); inline Short_t GetCellPosition(Short_t cellNumber); + inline Double_t GetCellTime(Short_t cellNumber); + inline Double_t GetAmplitude(Short_t pos) const; - Double_t GetCellTime(Short_t /*cellNumber*/) {return -1;} inline Short_t GetCellNumber(Short_t pos) const; - Double_t GetTime(Short_t /*pos*/) const {return -1;} - Bool_t IsEMCAL() const {return (fType == kEMCALCell);} - Bool_t IsPHOS() const {return (fType == kPHOSCell);} - Char_t GetType() const { return fType;} - void SetType(Char_t ttype) { fType=ttype; } - - + inline Double_t GetTime(Short_t pos) const; + + Bool_t IsEMCAL() const { return (fType == kEMCALCell); } + Bool_t IsPHOS() const { return (fType == kPHOSCell) ; } + + Char_t GetType() const { return fType;} + void SetType(Char_t ttype) { fType=ttype; } + + // MC & embedding + inline Short_t GetCellMCLabel(Short_t cellNumber) ; + inline Short_t GetMCLabel(Short_t pos) const ; + + inline Double_t GetCellEFraction(Short_t cellNumber) ; + inline Double_t GetEFraction(Short_t pos) const ; + + inline void SetEFraction (Short_t pos, Double32_t efrac) ; + inline void SetCellEFraction(Short_t cellNumber, Double32_t efrac) ; + protected: + Int_t fNCells; // Number of cells Short_t *fCellNumber; //[fNCells] array of cell numbers Double32_t *fAmplitude; //[fNCells][0.,0.,16] array with cell amplitudes (= energy!) + Double32_t *fTime; //[fNCells][0.,0.,16] array with cell times + Double32_t *fEFraction; //[fNCells][0.,0.,16] array with fraction of MC energy and data - for embedding + Short_t *fMCLabel; //[fNCells] array of MC labels Bool_t fIsSorted; //! true if cell arrays are sorted by index Char_t fType; // Cell type + ClassDef(AliAODCaloCells, 3); - ClassDef(AliAODCaloCells, 2); }; - -Bool_t AliAODCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, Double_t& /*time*/) const +Bool_t AliAODCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &litude, + Double_t &time, Short_t & mclabel, Double_t & efrac) const { - if (pos>=0 && pos=0 && pos=0 && pos < fNCells && fCellNumber[pos] == cellNumber) { + return fTime[pos]; + } else { + return -1.; + } +} Double_t AliAODCaloCells::GetAmplitude(Short_t pos) const { if (pos>=0 && pos=0 && pos=0 && pos=0 && pos=0 && pos=0 && fCellNumber[pos] == cellNumber) { + return fMCLabel[pos]; + } else { + return 0.; + } +} + +Double_t AliAODCaloCells::GetCellEFraction(Short_t cellNumber) +{ + if(!fEFraction) return 0; + + if (!fIsSorted) { + Sort(); + fIsSorted=kTRUE; + } + + Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber); + if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber) { + return fEFraction[pos]; + } else { + return -1.; + } +} + +void AliAODCaloCells::SetEFraction(Short_t pos, Double32_t efrac) +{ + // Sets the fraction of energy from MC with respect to data at the given position + + + if (pos>=0 && pos < fNCells) + { + if(!fEFraction) fEFraction = new Double32_t[fNCells]; + fEFraction[pos] = efrac; + } +} + +void AliAODCaloCells::SetCellEFraction(Short_t cellNumber, Double32_t efrac) +{ + if (!fIsSorted) { + Sort(); + fIsSorted=kTRUE; + } + + Short_t pos = TMath::BinarySearch(fNCells, fCellNumber, cellNumber); + if (pos>=0 && pos < fNCells && fCellNumber[pos] == cellNumber) + { + if(!fEFraction) fEFraction = new Double32_t[fNCells]; + fEFraction[pos] = efrac; + } +} + #endif