LCOV - code coverage report
Current view: top level - HLT/EMCAL - AliHLTEMCALCaloCells.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 33 3.0 %
Date: 2016-06-14 17:26:59 Functions: 1 26 3.8 %

          Line data    Source code
       1             : #ifndef ALIHLTCALOCELLS_H
       2             : #define ALIHLTCALOCELLS_H
       3             : /* Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
       4             :  * See cxx source for full Copyright notice                               */
       5             : 
       6             : //-------------------------------------------------------------------------
       7             : /// \class AliHLTEMCALCaloCells
       8             : /// \brief Class for calorimeter cell HLT data handling
       9             : ///
      10             : /// HLT class to store calorimeter cell data.
      11             : /// This is a lightweigth version of AliESDCaloCells.
      12             : ///
      13             : /// Data is stored in different arrays, each entry of the array corresponding to a cell.
      14             : /// The data stored is the cell energy, absolute id number.
      15             : ///
      16             : ///  \author Salvatore Aiola, <salvatore.aiola@cern.ch>, Yale University
      17             : ///
      18             : //-------------------------------------------------------------------------
      19             : 
      20             : #include <AliVCaloCells.h>
      21             : #include <TMath.h>
      22             : 
      23             : class AliHLTEMCALCaloCells : public AliVCaloCells
      24             : {
      25             :  public:
      26             : 
      27             :   AliHLTEMCALCaloCells();
      28             :   AliHLTEMCALCaloCells(const char* name, const char* title, VCells_t ttype=kUndef);
      29             :   AliHLTEMCALCaloCells(const AliHLTEMCALCaloCells & cells);
      30             :   AliHLTEMCALCaloCells & operator=(const AliHLTEMCALCaloCells& source);
      31             :   virtual ~AliHLTEMCALCaloCells();
      32             :   
      33             :   virtual AliVCaloCells * CopyCaloCells(Bool_t all) const;
      34             :   virtual void    Copy(TObject &obj) const;
      35             :   void            Clear(Option_t* option = "");
      36             :   void            CreateContainer(Short_t nCells);
      37             :   void            DeleteContainer();
      38           0 :   void            Sort() {;}
      39             :   
      40           0 :   Bool_t          IsEMCAL()  const { return (fType == kEMCALCell); }
      41           0 :   Bool_t          IsPHOS()   const { return (fType == kPHOSCell) ; }
      42           0 :   Char_t          GetType()  const { return  fType               ; }
      43           0 :   void            SetType(Char_t t){ fType = t                   ; }
      44             :   
      45             :   inline Bool_t   GetCell(Short_t pos, Short_t &cellNumber, Double_t &amplitude, Double_t &time, Int_t &mclabel,      Double_t &efrac) const;
      46             :   Bool_t          SetCell(Short_t pos, Short_t  cellNumber, Double_t  amplitude, Double_t  time, Int_t  mclabel = -1, Double_t  efrac = 0., Bool_t isHG=kFALSE);
      47             :   Bool_t          AddCell(Short_t pos, Double_t  amplitude);
      48             : 
      49           0 :   Short_t         GetNumberOfCells() const  { return fNCells ; }
      50             :   void            SetNumberOfCells(Int_t n);
      51             :   
      52           0 :   inline Double_t GetCellAmplitude(Short_t cellNumber) { return GetAmplitude(cellNumber); }
      53           0 :   inline Bool_t   GetCellHighGain(Short_t cellNumber) { return kFALSE; }  //is this cell High Gain
      54           0 :   inline Short_t  GetCellPosition(Short_t cellNumber) { return cellNumber; }
      55           0 :   inline Double_t GetCellTime(Short_t cellNumber) { return -1; }
      56             :   
      57             :   inline Double_t GetAmplitude(Short_t pos) const;
      58           0 :   inline Bool_t   GetHighGain(Short_t pos) const { return kFALSE; }
      59           0 :   inline Double_t GetTime(Short_t pos) const { return -1; }
      60           0 :   inline Short_t  GetCellNumber(Short_t pos) const { return pos; }
      61             : 
      62             :   // MC & embedding
      63           0 :   inline Int_t    GetCellMCLabel(Short_t cellNumber) { return -1; }
      64           0 :   inline Int_t    GetMCLabel(Short_t pos) const { return -1; }
      65             :   
      66           0 :   inline Double_t GetCellEFraction(Short_t cellNumber) { return -1; }
      67           0 :   inline Double_t GetEFraction(Short_t pos) const { return -1; }
      68             :   
      69           0 :   inline void     SetEFraction    (Short_t /*pos*/, Double_t /*efrac*/) { ; }
      70           0 :   inline void     SetCellEFraction(Short_t /*cellNumber*/, Double_t /*efrac*/) {;}
      71             :   
      72             :  protected:
      73             :   
      74             :   Int_t       fCapacity;     ///< Total number of cells
      75             :   Int_t       fNCells;       ///< Number of cells
      76             :   
      77             :   /// Array with cell amplitudes (= energy!).
      78             :   Double_t   *fAmplitude;    //[fCapacity][0.,0.,16]
      79             :   
      80             :   Char_t      fType;         ///< Cell type.
      81             : 
      82             :   /// \cond CLASSIMP
      83           6 :   ClassDef(AliHLTEMCALCaloCells, 2) ;
      84             :   /// \endcond
      85             : };
      86             : 
      87             : ///
      88             : /// Given the position index in the array, return the cell parameters.
      89             : ///
      90             : /// \param pos: Index of cell in array
      91             : /// \param cellNumber: Absolute cell Id. number
      92             : /// \param amplitude: Cell energy
      93             : /// \param time: Cell time
      94             : /// \param mclabel: MC particle index in kine tree
      95             : /// \param efrac: Fraction of energy (embedding)
      96             : ///
      97             : /// \return True if pos is correct not negative or larger than expected.
      98             : ///
      99             : Bool_t AliHLTEMCALCaloCells::GetCell(Short_t pos, Short_t &cellNumber, Double_t &amplitude,
     100             :     Double_t & time, Int_t & mclabel, Double_t & efrac) const
     101             : { 
     102           0 :   if (pos >= 0 && pos < fCapacity) {
     103           0 :     cellNumber = pos;
     104           0 :     amplitude  = fAmplitude[pos];
     105             :     
     106           0 :     time       = -1;
     107           0 :     mclabel    = -1;
     108           0 :     efrac      = -1;
     109           0 :     return kTRUE;
     110             : 
     111             :   }
     112             :   else {
     113           0 :     return kFALSE;
     114             :   }
     115           0 : }
     116             : 
     117             : ///
     118             : /// \return Cell amplitude (GeV).
     119             : /// \param pos: Cell position in array.
     120             : ///
     121             : Double_t AliHLTEMCALCaloCells::GetAmplitude(Short_t pos) const
     122             : { 
     123           0 :   if (pos >= 0 && pos < fNCells) {
     124           0 :     return fAmplitude[pos];
     125             :   }
     126             :   else {
     127           0 :     return 0.;
     128             :   }
     129           0 : }
     130             : 
     131             : #endif

Generated by: LCOV version 1.11