]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliCaloCalibSignal.h
Move geometry message from normal execution to debug
[u/mrichter/AliRoot.git] / EMCAL / AliCaloCalibSignal.h
index 578ffdaa4b6a0a310efe8688296ebf4554dc4eb3..648fbadc086dc80336f13183e896bab9ea9dd976 100644 (file)
 //   \version $Revision:  $
 //   \date $Date: $
 
-#include "TGraph.h"
-#include "TProfile.h"
+#include "TString.h"
+#include "TTree.h"
+
 class AliCaloRawStream;
+class AliCaloAltroMapping;
+class AliRawReader;
 class AliRawEventHeaderBase;
 
 class AliCaloCalibSignal : public TObject {
@@ -40,32 +43,24 @@ class AliCaloCalibSignal : public TObject {
   AliCaloCalibSignal(const AliCaloCalibSignal &sig); // copy ctor
   AliCaloCalibSignal& operator = (const  AliCaloCalibSignal &source); //!
   
+  // Event processing methods:
+  Bool_t ProcessEvent(AliRawReader *rawReader);
   Bool_t ProcessEvent(AliCaloRawStream *in, AliRawEventHeaderBase *aliHeader); // added header for time info
   Bool_t CheckFractionAboveAmp(int *AmpVal, int nTotChan); // check fraction of signals to check for LED events
 
+  // Mapping handling
+  AliCaloAltroMapping **GetAltroMapping() { return fMapping; };
+  void  SetAltroMapping(AliCaloAltroMapping **mapp) { fMapping = mapp; };
+
   ////////////////////////////
   //Simple getters
-  // need public access to the TGraphs.. 
-  TGraph * GetGraphAmpVsTimeHighGain(int imod, int icol, int irow) const // Return a pointer to the high gain graph
-    { int towId = GetTowerNum(imod, icol, irow); return fGraphAmpVsTimeHighGain[towId];}; //!
-  TGraph * GetGraphAmpVsTimeLowGain(int imod, int icol, int irow) const // Return a pointer to the low gain graph
-    {int towId = GetTowerNum(imod, icol, irow); return fGraphAmpVsTimeLowGain[towId];};        
-  TGraph * GetGraphAmpVsTimeHighGain(int towId) const // Return a pointer to the high gain graph
-    { return fGraphAmpVsTimeHighGain[towId];}; //!
-  TGraph * GetGraphAmpVsTimeLowGain(int towId) const // Return a pointer to the low gain graph
-    { return fGraphAmpVsTimeLowGain[towId];}; //!      
-
-  // and similarly for the TProfiles
-  TProfile * GetProfAmpVsTimeHighGain(int imod, int icol, int irow) const // Return a pointer to the high gain profile
-    { int towId = GetTowerNum(imod, icol, irow); return fProfAmpVsTimeHighGain[towId];}; //!   
-  TProfile * GetProfAmpVsTimeLowGain(int imod, int icol, int irow) const // Return a pointer to the low gain profile
-    { int towId = GetTowerNum(imod, icol, irow); return fProfAmpVsTimeLowGain[towId];}; //!    
-  TProfile * GetProfAmpVsTimeHighGain(int towId) const // Return a pointer to the high gain profile
-    { return fProfAmpVsTimeHighGain[towId];}; //!      
-  TProfile * GetProfAmpVsTimeLowGain(int towId) const // Return a pointer to the low gain profile
-    { return fProfAmpVsTimeLowGain[towId];}; //!       
-
-  // how many points do we have in each TGraph
+  // for TTree
+  TTree * GetTreeAmpVsTime() const { return fTreeAmpVsTime; } //!
+  TTree * GetTreeAvgAmpVsTime() const {return fTreeAvgAmpVsTime; } //!
+  TTree * GetTreeLEDAmpVsTime() const {return fTreeLEDAmpVsTime; } //!
+  TTree * GetTreeLEDAvgAmpVsTime() const {return fTreeLEDAvgAmpVsTime; } //!
+
+  // how many points do we have for each tower&gain
   int GetNHighGain(int imod, int icol, int irow) const //!
     { int towId = GetTowerNum(imod, icol, irow); return fNHighGain[towId];};   //!
   int GetNLowGain(int imod, int icol, int irow) const //!
@@ -73,13 +68,40 @@ class AliCaloCalibSignal : public TObject {
   int GetNHighGain(int towId) const { return fNHighGain[towId];};      //!
   int GetNLowGain(int towId) const { return fNLowGain[towId];};        //!
 
+  // also for LED reference
+  int GetNRef(int imod, int istripMod, int igain) const //!
+    { int refId = GetRefNum(imod, istripMod, igain); return fNRef[refId];}; //!
+  int GetNRef(int refId) const { return fNRef[refId];}; //!
+
   // Basic info: getters  
   kDetType GetDetectorType() const {return fDetType;};//Returns if this is a PHOS or EMCAL object
-  
+  TString GetCaloString() const {return fCaloString;}; //Returns if this is a PHOS or EMCAL object  
+
   int GetColumns() const {return fColumns;}; //The number of columns per module
   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 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
+
+  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
+
+  // LED reference indexing
+  int GetRefNum(int imod, int istripMod, 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
 
   // Basic Counters
   int GetNEvents() const {return fNEvents;};
@@ -93,12 +115,11 @@ class AliCaloCalibSignal : public TObject {
   void SetReqFractionAboveAmpCutVal(double d) { fReqFractionAboveAmpCutVal = d; } //!
   double GetReqFractionAboveAmpCutVal() const { return fReqFractionAboveAmpCutVal; }; //!
   void SetReqFractionAboveAmp(bool b) { fReqFractionAboveAmp = b; } //!
-  double GetReqFractionAboveAmp() const { return fReqFractionAboveAmp; }; //!
+  bool GetReqFractionAboveAmp() const { return fReqFractionAboveAmp; }; //!
 
-  // We may select to only use the averaged info in the TProfiles rather than the
-  // the full in the TGraphs
+  // We may select to get averaged info
   void SetUseAverage(bool b) { fUseAverage = b; } //!
-  double GetUseAverage() const { return fUseAverage; }; //!
+  bool GetUseAverage() const { return fUseAverage; }; //!
   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;}; //!
 
@@ -119,26 +140,28 @@ class AliCaloCalibSignal : public TObject {
 
   /////////////////////////////
   //Analysis functions
-  void Reset();//Resets the whole class.
+  void ResetInfo();// trees and counters.
   Bool_t AddInfo(const AliCaloCalibSignal *sig);//picks up new info from supplied argument  
 
   //Saving functions
-  Bool_t Save(TString fileName, Bool_t saveEmptyGraphs = kFALSE); //Saves the TGraphs to a .root file
+  Bool_t Save(TString fileName); //Saves the objects to a .root file
+  Bool_t Analyze(); // makes average tree and summary tree 
 
  private:
-
-  void ClearObjects(); // delete old objects and set pointers
+  void DeleteTrees(); // delete old objects and set pointers
   void Zero(); // set all counters to 0
-  void CreateGraphs(); //! create/setup the TGraphs
-  void CreateProfile(int imod, int icol, int irow, int towerId, int gain,
-                    int nbins, double min, double max); //! create/setup a TProfile
+  void CreateTrees(); //! create/setup the TTrees
     
  private:
 
   kDetType fDetType; //The detector type for this object
   int fColumns;        //The number of columns per module
   int fRows;   //The number of rows per module
+  int fLEDRefs;        //The number of LED references/monitors per module
   int fModules;        //The number of modules
+  TString fCaloString; // id for which detector type we have 
+  AliCaloAltroMapping **fMapping;    //! Altro Mapping object
   int fRunNumber; //The run number. Needs to be set by the user.
   int fStartTime;  // Time of first event
 
@@ -161,27 +184,34 @@ class AliCaloCalibSignal : public TObject {
   
   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 fgkNumSecInHr = 3600;  // number of seconds in an hour, for the fractional hour conversion on the time graph
   
-  TGraph *fGraphAmpVsTimeHighGain[fgkMaxTowers]; // Amplitude vs. Time Graph for each high gain channel
-  TGraph *fGraphAmpVsTimeLowGain[fgkMaxTowers]; // Amplitude vs. Time Graph for each low gain channel
-  TProfile *fProfAmpVsTimeHighGain[fgkMaxTowers]; // Amplitude vs. Time Profile for each high gain channel
-  TProfile *fProfAmpVsTimeLowGain[fgkMaxTowers]; // Amplitude vs. Time Profile for each low gain channel
-  
-  int fNHighGain[fgkMaxTowers]; // Number of points for each Amp. vs. Time graph
-  int fNLowGain[fgkMaxTowers]; // Number of points for each Amp. vs. Time graph
+  // trees
+  TTree *fTreeAmpVsTime; // stores channel, gain, amp, and time info
+  TTree *fTreeAvgAmpVsTime; // same, for averages
+  TTree *fTreeLEDAmpVsTime; // same, for LED reference
+  TTree *fTreeLEDAvgAmpVsTime; // same, for LED reference - averages
+
+  // counters
+  int fNHighGain[fgkMaxTowers]; // Number of Amp. vs. Time readings per tower
+  int fNLowGain[fgkMaxTowers]; // same, for low gain
+  int fNRef[fgkMaxRefs * 2]; // same, for LED refs; *2 for both gains
   
-  ClassDef(AliCaloCalibSignal,1)
+  ClassDef(AliCaloCalibSignal, 3) // don't forget to change version if you change class member list..
     
 };