ROOT logo
#ifndef ALIEMCALBIASAPD_H
#define ALIEMCALBIASAPD_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 "AliEMCALGeoParams.h"
class TString;
class TTree;

/*
  Objects of this class contain info on APD bias settings/voltages
*/

// ******* internal class definition *************
// 1 SuperModule's worth of info
class AliEMCALSuperModuleBiasAPD : public TObject {
 public:
  AliEMCALSuperModuleBiasAPD(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++) {
	  fElecId[icol][irow] = 0;
	  fDAC[icol][irow] = 0;
	  fVoltage[icol][irow] = 0;
	}
      }
    }

 public:
  void SetSuperModuleNum(Int_t i) { fSuperModuleNum = i;}; // 
  Int_t GetSuperModuleNum() const { return fSuperModuleNum;}; // 
  void SetElecId(int icol, int irow, Int_t i) { fElecId[icol][irow] = i; }; //
  Int_t GetElecId(int icol, int irow) const { return fElecId[icol][irow]; }; //
  void SetDAC(int icol, int irow, Int_t i) { fDAC[icol][irow] = i; }; //
  Int_t GetDAC(int icol, int irow) const { return fDAC[icol][irow]; }; //
  void SetVoltage(int icol, int irow, Float_t f) { fVoltage[icol][irow] = f; }; //
  Float_t GetVoltage(int icol, int irow) const { return fVoltage[icol][irow]; }; //

 private:
  Int_t fSuperModuleNum; // SM index
  Int_t fElecId[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows]; // ElectronicsIndex/Address - we keep this to help ensure that the column/row info matches with electronics indices
  Int_t fDAC[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows]; // 0-0x3ff register
  Float_t fVoltage[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows]; // 210 to ca 417 V. (function of DAC setting)

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

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

  // 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 ReadTextBiasAPDInfo(Int_t nSM, const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to fgkEMCALModules
  void WriteTextBiasAPDInfo(const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to fgkEMCALModules
  void ReadRootBiasAPDInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to fgkEMCALModules
  void ReadTreeBiasAPDInfo(TTree *tree, Bool_t swapSides=kFALSE); // info file is for nSm=1 to fgkEMCALModules
  void WriteRootBiasAPDInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to fgkEMCALModules

  virtual ~AliEMCALBiasAPD();

  // pointer to stored info.
  Int_t GetNSuperModule() const { return fNSuperModule; }; 

  // - via the index in the stored array:
  virtual AliEMCALSuperModuleBiasAPD * GetSuperModuleBiasAPDId(Int_t smIndex) const
    { return (AliEMCALSuperModuleBiasAPD*) fSuperModuleData[smIndex]; };

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

protected:

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

private:

  AliEMCALBiasAPD(const AliEMCALBiasAPD &);
  AliEMCALBiasAPD &operator = (const AliEMCALBiasAPD &);

  ClassDef(AliEMCALBiasAPD, 3) //BiasAPD data info
};

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