]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALCalibAbs.h
fix coverity
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALCalibAbs.h
index 7ec3ad3572a261689c410f376a2bb73087693607..7d07b83f8691409b5188e58a156d0b51540133ea 100644 (file)
 /* $Id: $ */
 
 #include <TObject.h>
+#include <TObjArray.h>
 #include "AliEMCALGeoParams.h"
 class TString;
+class TTree;
 
 /*
   Objects of this class contain basis for absolute calibrations
-  AliEMCALCalibAbs inherits TObject only to use AliLog "functions".
 */
 
+// total calibration factor is a product of
+// a) overall calibration factor [fAbsoluteCalib]
+// b) individual gain factor per tower [fRelativeCalib]
+// c) time-dependent correction
+// In this class we store a), b) 
+
+// ******* internal class definition *************
+
+// 1 SuperModule's worth of info: info on where the different APDs are
+class AliEMCALSuperModuleCalibAbs : public TObject {
+
+ public:
+  AliEMCALSuperModuleCalibAbs(const int smNum=0) : TObject(), // just init values
+    fSuperModuleNum(smNum),
+    fCalibMethod(0),
+    fCalibPass(0),
+    fAbsoluteCalib(0)
+    {
+      for (int icol=0; icol<AliEMCALGeoParams::fgkEMCALCols; icol++) {
+       for (int irow=0; irow<AliEMCALGeoParams::fgkEMCALRows; irow++) {
+         fRelativeCalib[icol][irow] = 1.0;
+       }
+      }
+    }
+
+ public:
+  // first
+  void SetSuperModuleNum(Int_t i) { fSuperModuleNum = i;}; // 
+  Int_t GetSuperModuleNum() const { return fSuperModuleNum;}; // 
+  void SetCalibMethod(Int_t i) { fCalibMethod = i;}; // 
+  Int_t GetCalibMethod() const { return fCalibMethod;}; // 
+  void SetCalibPass(Int_t i) { fCalibPass = i;}; // 
+  Int_t GetCalibPass() const { return fCalibPass;}; // 
+  void SetAbsoluteCalib(Float_t f) { fAbsoluteCalib = f;}; // 
+  Float_t GetAbsoluteCalib() const { return fAbsoluteCalib;}; // 
+
+  // third
+  void SetRelativeCalib(int icol, int irow, Float_t f) { fRelativeCalib[icol][irow] = f; }; //
+  Float_t GetRelativeCalib(int icol, int irow) const { return fRelativeCalib[icol][irow]; }; //
+
+ private:
+  // first: overall values for the whole SuperModule
+  Int_t fSuperModuleNum; // which SuperModule is this?
+  Int_t fCalibMethod; // a la 0=cosmics, 1=pi0, 2=electrons,3=using ecore,
+  Int_t fCalibPass; // which analysis iteration is this.. 1,2,..N
+  Float_t fAbsoluteCalib; // (ADC>GeV absolute gain/conversion)
+  
+  // third: individual info for each tower
+  Float_t fRelativeCalib[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows]; // values around 1, if gains are well balanced
+
+  ClassDef(AliEMCALSuperModuleCalibAbs, 3) // help class
+};
+// ******* end of internal class definition *************
+
 class AliEMCALCalibAbs : public TObject {
 
 public:
 
   enum kProblemType {kNoLED=-999};// code in possible problems
 
-  AliEMCALCalibAbs();
+  AliEMCALCalibAbs(const int nSM = AliEMCALGeoParams::fgkEMCALModules);
 
   // Read and Write txt I/O methods are normally not used, but are useful for 
-  // debug purposes
-  void ReadCalibAbsInfo(Int_t nSM, const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
-
-  void WriteCalibAbsInfo(const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
+  // filling the object before it is saved in OCDB 
+  void ReadTextCalibAbsInfo(Int_t nSM, const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
+  void WriteTextCalibAbsInfo(const TString &txtFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
+  void ReadRootCalibAbsInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
+  void ReadTreeCalibAbsInfo(TTree *tree, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
+  void WriteRootCalibAbsInfo(const TString &rootFileName, Bool_t swapSides=kFALSE); // info file is for nSm=1 to 12 SuperModules
 
   virtual ~AliEMCALCalibAbs();
 
-  // total calibration factor is a product of
-  // a) overall calibration factor [fAbsoluteGain]
-  // b) individual gain factor per tower [fRelativeGain]
-  // c) time-dependent correction
-  // In this class we store a), b) and the needed static ingredients for c)
-
-  // values per single tower
-  struct AliEMCALCalibAbsVal {
-    Float_t fRelativeGain; // (ADC>GeV relative gain/conversion), value around 1
-    Float_t fHighLowRatio; // value around 16 or so
-    Int_t fHighLow; // 0 (low) or 1 (high) gain, used for LEDAmp info
-    Float_t fLEDAmp; // LED amplitude
-    Float_t fLEDAmpRMS; // RMS
-  };
-
-  // 1 SuperModule's worth of info: info on where the different APDs are
-  struct AliEMCALSuperModuleCalibAbs {
-    // first: overall values for the whole SuperModule
-    Int_t fSuperModuleNum; // which SuperModule is this?
-    Int_t fCalibMethod; // a la 0=cosmics, 1=pi0, 2=electrons,3=using ecore,
-    Int_t fCalibPass; // which analysis iteration is this.. 1,2,..N
-    Int_t fCalibTime; // t0, unix timestamp
-    Float_t fAbsoluteGain; // (ADC>GeV absolute gain/conversion)
-
-    // second: additional info for LED Reference and SM temperature
-    Float_t fLEDRefAmp[AliEMCALGeoParams::fgkEMCALLEDRefs]; // LED amplitude at  t0, low gain equivalent
-    Float_t fLEDRefAmpRMS[AliEMCALGeoParams::fgkEMCALLEDRefs]; // RMS
-    Float_t fLEDRefHighLowRatio[AliEMCALGeoParams::fgkEMCALLEDRefs]; // value around 16 or so
-    Int_t fLEDRefHighLow[AliEMCALGeoParams::fgkEMCALLEDRefs]; // 0 (low) or 1 (high) gain
-
-    Float_t fTemperature[AliEMCALGeoParams::fgkEMCALTempSensors]; // temperature at t0
-    Float_t fTemperatureRMS[AliEMCALGeoParams::fgkEMCALTempSensors]; // RMS
-
-    // third: individual info for each tower
-    AliEMCALCalibAbsVal fAPDVal[AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows]; // at t0
-  };
-
   // pointer to stored info.
-
   Int_t GetNSuperModule() const { return fNSuperModule; }; 
-  AliEMCALSuperModuleCalibAbs * GetSuperModuleData() const { return fSuperModuleData; };
 
   // - via the index in the stored array:
-  virtual AliEMCALSuperModuleCalibAbs GetSuperModuleCalibAbsId(Int_t smIndex) const;
+  virtual AliEMCALSuperModuleCalibAbs * GetSuperModuleCalibAbsId(Int_t smIndex) const
+   { return (AliEMCALSuperModuleCalibAbs*) fSuperModuleData[smIndex]; };
+
   // - or via the actual SM number
-  virtual AliEMCALSuperModuleCalibAbs GetSuperModuleCalibAbsNum(Int_t smNum) const;
+  virtual AliEMCALSuperModuleCalibAbs GetSuperModuleCalibAbsNum(Int_t smNum) const;
 
 protected:
 
   Int_t          fNSuperModule; // Number of supermodules.
-  AliEMCALSuperModuleCalibAbs *fSuperModuleData; // SuperModule data
+  TObjArray fSuperModuleData; // SuperModule data
 
 private:
 
   AliEMCALCalibAbs(const AliEMCALCalibAbs &);
   AliEMCALCalibAbs &operator = (const AliEMCALCalibAbs &);
 
-  ClassDef(AliEMCALCalibAbs, 1) //CalibAbs data reader
+  ClassDef(AliEMCALCalibAbs, 4) //CalibAbs data info
 };
 
 #endif