]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliCaloCalibSignal.h
Merge remote-tracking branch 'origin/master' into mergingFlat
[u/mrichter/AliRoot.git] / EMCAL / AliCaloCalibSignal.h
index f00e96d590fc8cf14295e57b77366d850ac450ce..166425985c718f0a14fa53ed3c70760c5bdaaab7 100644 (file)
 
 #include "TString.h"
 #include "TTree.h"
-
+#include "AliEMCALGeoParams.h"
 class AliCaloRawStreamV3;
 class AliCaloAltroMapping;
 class AliRawReader;
-class AliRawEventHeaderBase;
+class AliCaloRawAnalyzer;
 
 class AliCaloCalibSignal : public TObject {
   
@@ -39,19 +39,31 @@ class AliCaloCalibSignal : public TObject {
   AliCaloCalibSignal(kDetType detectorType = kPhos); //ctor
   virtual ~AliCaloCalibSignal(); //dtor
 
-  // copy ctor, and '=' operator, are not fully tested/debugged yet
-  AliCaloCalibSignal(const AliCaloCalibSignal &sig); // copy ctor
-  AliCaloCalibSignal& operator = (const  AliCaloCalibSignal &source); //!
+private:
+  //Just declare them, avoid compilation warning
+  AliCaloCalibSignal(const AliCaloCalibSignal & /*sig*/); // copy ctor
+  AliCaloCalibSignal& operator = (const  AliCaloCalibSignal &/*source*/); // assing operator
   
+public:
   // Event processing methods:
   Bool_t ProcessEvent(AliRawReader *rawReader);
-  Bool_t ProcessEvent(AliCaloRawStreamV3 *in, AliRawEventHeaderBase *aliHeader); // added header for time info
-  Bool_t CheckFractionAboveAmp(int *AmpVal, int nTotChan); // check fraction of signals to check for LED events
+  Bool_t ProcessEvent(AliCaloRawStreamV3 *in, UInt_t Timestamp); // added header for time info
+  Bool_t CheckFractionAboveAmp(const int *AmpVal, int resultArray[]) const; // check fraction of signals to check for LED events
+  Bool_t CheckLEDRefAboveAmp(const int *AmpVal, int resultArray[]) const; // check if LED Ref is also above cut
 
   // Mapping handling
-  AliCaloAltroMapping **GetAltroMapping() { return fMapping; };
+  AliCaloAltroMapping **GetAltroMapping() const { return fMapping; };
   void  SetAltroMapping(AliCaloAltroMapping **mapp) { fMapping = mapp; };
 
+  // Fitter / Analyzer
+  Int_t    GetFittingAlgorithm()  const {return fFittingAlgorithm; }
+  void SetFittingAlgorithm(Int_t val) ;         
+  AliCaloRawAnalyzer *GetRawAnalyzer()  const { return fRawAnalyzer;}  
+
+  // Parameter/cut handling
+  void SetParametersFromFile(const char *parameterFile);
+  void WriteParametersToFile(const char *parameterFile);
+
   ////////////////////////////
   //Simple getters
   // for TTree
@@ -69,7 +81,7 @@ class AliCaloCalibSignal : public TObject {
   int GetNLowGain(int towId) const { return fNLowGain[towId];};        //!
 
   // also for LED reference
-  int GetNRef(int imod, int istripMod, int igain) const //!
+  int GetNRef(const int imod, const int istripMod, const int igain) const //!
     { int refId = GetRefNum(imod, istripMod, igain); return fNRef[refId];}; //!
   int GetNRef(int refId) const { return fNRef[refId];}; //!
 
@@ -81,27 +93,19 @@ class AliCaloCalibSignal : public TObject {
   int GetRows() const {return fRows;}; //The number of rows per module
   int GetLEDRefs() const {return fLEDRefs;}; //The number of LED references/monitors per module
   int GetModules() const {return fModules;}; //The number of modules
-  int GetTowerNum(int imod, int icol, int irow) const { return (imod*fColumns*fRows + icol*fRows + irow);}; // help index
 
-  int GetChannelNum(int imod, int icol, int irow, int igain) const { return (igain*fModules*fColumns*fRows + imod*fColumns*fRows + icol*fRows + irow);}; // channel number with gain included
+  int GetTowerNum(const int imod, const int icol, const int irow) const { return (imod*fColumns*fRows + icol*fRows + irow);}; // help index
 
-  Bool_t DecodeChannelNum(int chanId, int *imod, int *icol, int *irow, int *igain) const {
-    *igain = chanId/(fModules*fColumns*fRows);
-    *imod = (chanId/(fColumns*fRows)) % fModules;
-    *icol = (chanId/fRows) % fColumns;
-    *irow = chanId % fRows;
-    return kTRUE;
-  }; // return the module, column, row, and gain for a given channel number
+  int GetChannelNum(const int imod, const int icol, const int irow, const int igain) const { return (igain*fModules*fColumns*fRows + imod*fColumns*fRows + icol*fRows + irow);}; // channel number with gain included
+
+  Bool_t DecodeChannelNum(const int chanId, 
+                         int *imod, int *icol, int *irow, int *igain) const; // return the module, column, row, and gain for a given channel number
 
   // LED reference indexing
-  int GetRefNum(int imod, int istripMod, int igain) const { return (igain*fModules*fLEDRefs + imod*fLEDRefs + istripMod);}; // channel number with gain included
+  int GetRefNum(const int imod, const int istripMod, const int igain) const { return (igain*fModules*fLEDRefs + imod*fLEDRefs + istripMod);}; // channel number with gain included
 
-  Bool_t DecodeRefNum(int refId, int *imod, int *istripMod, int *igain) const {
-    *igain = refId/(fModules*fLEDRefs);
-    *imod = (refId/(fLEDRefs)) % fModules;
-    *istripMod = refId % fLEDRefs;
-    return kTRUE;
-  }; // return the module, stripModule, and gain for a given reference number
+  Bool_t DecodeRefNum(const int refId, 
+                     int *imod, int *istripMod, int *igain) const; // return the module, stripModule, and gain for a given reference number
 
   // Basic Counters
   int GetNEvents() const {return fNEvents;};
@@ -116,6 +120,11 @@ class AliCaloCalibSignal : public TObject {
   double GetReqFractionAboveAmpCutVal() const { return fReqFractionAboveAmpCutVal; }; //!
   void SetReqFractionAboveAmp(bool b) { fReqFractionAboveAmp = b; } //!
   bool GetReqFractionAboveAmp() const { return fReqFractionAboveAmp; }; //!
+  // also for LED Reference/Mon channels
+  void SetAmpCutLEDRef(double d) { fAmpCutLEDRef = d; } //!
+  double GetAmpCutLEDRef() const { return fAmpCutLEDRef; }; //!
+  void SetReqLEDRefAboveAmpCutVal(bool b) { fReqLEDRefAboveAmpCutVal = b; } //!
+  bool GetReqLEDRefAboveAmpCutVal() const { return fReqLEDRefAboveAmpCutVal; }; //!
 
   // We may select to get averaged info
   void SetUseAverage(bool b) { fUseAverage = b; } //!
@@ -123,6 +132,9 @@ class AliCaloCalibSignal : public TObject {
   void SetSecInAverage(int secInAverage) {fSecInAverage = secInAverage;}; // length of the interval that should be used for the average calculation (determines number of bins in TProfile)
   int GetSecInAverage() const {return fSecInAverage;}; //!
 
+  void SetDownscale(int i) {fDownscale = i;}; //!
+  int GetDownscale() const {return fDownscale;}; //!
+
   // Info on time since start of run
   double GetHour() const { return fHour; }; // time info for current event
   double GetCurrentHour() const { return fHour; }; // time info for current event (same as GetHour(), just more explicitly named)
@@ -162,6 +174,8 @@ class AliCaloCalibSignal : public TObject {
   int fModules;        //The number of modules
   TString fCaloString; // id for which detector type we have 
   AliCaloAltroMapping **fMapping;    //! Altro Mapping object
+  Int_t   fFittingAlgorithm;            // select the fitting algorithm
+  AliCaloRawAnalyzer *fRawAnalyzer;     //! e.g. for sample selection for fits
   int fRunNumber; //The run number. Needs to be set by the user.
   int fStartTime;  // Time of first event
 
@@ -169,34 +183,31 @@ class AliCaloCalibSignal : public TObject {
   double fReqFractionAboveAmpCutVal; // required fraction that should be above cut
   bool fReqFractionAboveAmp; // flag to select if we should do some event selection based on amplitudes
 
+  double fAmpCutLEDRef; // amplitude cut value for LED reference
+  bool fReqLEDRefAboveAmpCutVal; // flag to select if we should require that signal is also seen in LED Reference/Monitoring channel
+
   double fHour; // fraction of hour since beginning of run, for amp vs. time graphs, for current event
   double fLatestHour; // largest fraction of hour since beginning of run, for amp vs. time graphs
   bool fUseAverage; // flag to average graph points into over a time interval
   int fSecInAverage; // time interval for the graph averaging
 
+  int fDownscale; // to select 1 out every N (fDownscale) events
+
   // status counters
   int fNEvents; // # events processed
   int fNAcceptedEvents; // # events accepted
 
-  //Constants needed by the class
-  static const int fgkSampleMax = 1023; // highest possible sample value (10-bit = 0x3ff)
-  static const int fgkSampleMin = 0; // lowest possible sample value 
-  
+  //Constants needed by the class: EMCAL ones are kept in AliEMCALGeoParams.h
   static const int fgkPhosRows = 64; // number of rows per module for PHOS
   static const int fgkPhosCols = 56; // number of columns per module for PHOS
   static const int fgkPhosLEDRefs = 0; // no LED monitor channels for PHOS
   static const int fgkPhosModules = 5; // number of modules for PHOS
   
-  static const int fgkEmCalRows = 24; // number of rows per module for EMCAL
-  static const int fgkEmCalCols = 48; // number of columns per module for EMCAL
-  static const int fgkEmCalLEDRefs = 24; // number of LEDs (reference/monitors) per module for EMCAL; one per StripModule
-  static const int fgkEmCalModules = 12; // number of modules for EMCAL
-
   // From numbers above: PHOS has more possible towers (17920) than EMCAL (13824) 
   // so use PHOS numbers to set max. array sizes
   static const int fgkMaxTowers = 17920; // fgkPhosModules * fgkPhosCols * fgkPhosRows; 
   // for LED references; maximum from EMCAL
-  static const int fgkMaxRefs = 288; // fgkEmCalModules * fgkEmCalLEDRefs
+  static const int fgkMaxRefs = 288; // AliEMCALGeoParams::fgkEMCALModules * AliEMCALGeoParams::fgkEMCALLEDRefs
 
   static const int fgkNumSecInHr = 3600;  // number of seconds in an hour, for the fractional hour conversion on the time graph
   
@@ -211,7 +222,7 @@ class AliCaloCalibSignal : public TObject {
   int fNLowGain[fgkMaxTowers]; // same, for low gain
   int fNRef[fgkMaxRefs * 2]; // same, for LED refs; *2 for both gains
   
-  ClassDef(AliCaloCalibSignal, 3) // don't forget to change version if you change class member list..
+  ClassDef(AliCaloCalibSignal, 8) // don't forget to change version if you change class member list..
     
 };