ROOT logo
#ifndef ALIEMCALCALIBTIMEDEPCORRECTION_H
#define ALIEMCALCALIBTIMEDEPCORRECTION_H

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

/* $Id: $ */

#include <TObject.h>
#include <TObjArray.h>
#include <TArrayF.h>
#include "AliEMCALGeoParams.h"
class TString;
class TTree;

/*
  Objects of this class contain info on time-dependent corrections
*/

// ******* internal class definition *************
// 1 SuperModule's worth of info
class AliEMCALSuperModuleCalibTimeDepCorrection : public TObject {
 public:
  AliEMCALSuperModuleCalibTimeDepCorrection(const int smNum=0) : TObject(), // just init values
    fSuperModuleNum(smNum)
    {
      for (int icol=0; icol<AliEMCALGeoParams::fgkEMCALCols; icol++) {
	for (int irow=0; irow<AliEMCALGeoParams::fgkEMCALRows; irow++) {
	  fCorrection[icol][irow].Reset();
	}
      }
    }

 public:
  void SetSuperModuleNum(Int_t i) { fSuperModuleNum = i;}; // 
  Int_t GetSuperModuleNum() const { return fSuperModuleNum;}; // 
  TArrayF * GetCorrection(int icol, int irow) 
    { return &fCorrection[icol][irow]; };

 private:
  Int_t fSuperModuleNum; // SM id
  TArrayF fCorrection[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows]; // values

  ClassDef(AliEMCALSuperModuleCalibTimeDepCorrection, 2) // help class
};
// ******* end of internal class definition *************

class AliEMCALCalibTimeDepCorrection : public TObject {
 public:
  AliEMCALCalibTimeDepCorrection(const int nSM = AliEMCALGeoParams::fgkEMCALModules);

  // interface methods; getting the whole struct should be more efficient though
  void InitCorrection(Int_t nSM, Int_t nBins, Float_t val=1.0); // assign a certain value to all 
  // use the methods below with caution: take care that your argument ranges are valid
  void SetCorrection(Int_t smIndex, Int_t iCol, Int_t iRow, Int_t iBin, Float_t val=1.0); // assign a certain value to a given bin
  Float_t GetCorrection(Int_t smIndex, Int_t iCol, Int_t iRow, Int_t iBin) const; // assign a certain value to a given bin
 
  // Read and Write txt I/O methods are normally not used, but are useful for 
  // filling the object before it is saved in OCDB 
  void ReadTextInfo(Int_t nSM, const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to fgkEMCALModules
  void WriteTextInfo(const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to fgkEMCALModules
  void ReadRootInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to fgkEMCALModules
  void ReadTreeInfo(TTree *treeGlob, TTree *treeCorr, Bool_t swapSides=kFALSE); // info file is for nSm=1 to fgkEMCALModules
  void WriteRootInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to fgkEMCALModules

  virtual ~AliEMCALCalibTimeDepCorrection();

  // pointer to stored info.
  Int_t GetNSuperModule() const { return fNSuperModule; }; 
 
  // - via the index in the stored array:
  virtual AliEMCALSuperModuleCalibTimeDepCorrection * GetSuperModuleCalibTimeDepCorrectionId(Int_t smIndex) const
    { return (AliEMCALSuperModuleCalibTimeDepCorrection*) fSuperModuleData[smIndex]; };

  // - or via the actual SM number
  virtual AliEMCALSuperModuleCalibTimeDepCorrection * GetSuperModuleCalibTimeDepCorrectionNum(Int_t smNum) const;

  void SetStartTime(UInt_t ui) { fStartTime = ui; } //
  void SetNTimeBins(Int_t i) { fNTimeBins = i; } // 
  void SetTimeBinSize(Int_t i) { fTimeBinSize = i; } // 

  Int_t GetStartTime() const { return fStartTime; } //
  Int_t GetNTimeBins() const { return fNTimeBins; } // 
  Int_t GetTimeBinSize() const { return fTimeBinSize; } // 

  static Int_t GetMaxTimeBins() { return fgkMaxTimeBins; }

protected:

  Int_t 	  fNSuperModule; // Number of supermodules.
  TObjArray fSuperModuleData; // SuperModule data

private:

  AliEMCALCalibTimeDepCorrection(const AliEMCALCalibTimeDepCorrection &);
  AliEMCALCalibTimeDepCorrection &operator = (const AliEMCALCalibTimeDepCorrection &);

  UInt_t fStartTime; // timestamp for start of run/first bin
  Int_t fNTimeBins; // how many timestamp bins do we have
  Int_t fTimeBinSize; // seconds per time-bin

  static const Int_t fgkMaxTimeBins = 50; // we are not going to have more correction time bins than this for a single runnumber.. 

  ClassDef(AliEMCALCalibTimeDepCorrection, 3) //
};

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