emcGainBaseLineCalculator.h

Go to the documentation of this file.
00001 #ifndef __EMCGAINBASELINECALCULATOR_H__
00002 #define __EMCGAINBASELINECALCULATOR_H__
00003 
00004 #include <map>
00005 #include <set>
00006 #include <string>
00007 #include <vector>
00008 
00009 class TH1;
00010 class TH2;
00011 class emcCalibrationDataHelper;
00012 class emcFEMList;
00013 
00014 class emcGainBaseLineCalculator
00015 {
00016  public:
00017 
00018   static void deleteHistos();
00019 
00020   static void histogramming(bool onoff);
00021 
00022   static bool getBaseLine(emcCalibrationDataHelper* cdh,
00023                           int isector, const char* details,
00024                           float& value, 
00025                           float& error_on_value,
00026                           float& skewness,
00027                           float& kurtosis);
00028   
00029 
00030   static void write(bool make_subdirectories);
00031 
00032   class Tuple
00033   {
00034   public:
00035     Tuple() : index_(0), towerid_(-1), value_(0) 
00036     {}
00037     
00038     Tuple(int index, int towerid, float value) : index_(index), towerid_(towerid), value_(value)
00039     {}
00040     
00041     int index() const
00042     {
00043       return index_;
00044     }
00045     float value() const
00046     {
00047       return value_;
00048     }
00049     int towerid() const
00050     {
00051       return towerid_;
00052     }
00053   private:
00054     int index_;
00055     int towerid_;
00056     float value_;
00057   };
00058 
00059  private:
00060   
00061   static void createOneHistoPair(const std::string& basename,
00062                                  const std::string& suffix,
00063                                  int nx,
00064                                  double xmin, double xmax);
00065 
00066   static void createHistos(int isector, const char* details);
00067 
00068   static bool get(const std::string& sname,
00069                   std::vector<Tuple>& values,
00070                   emcCalibrationDataHelper& cdh,
00071                   const emcFEMList& femlist,
00072                   const std::set<int>& femsToDiscard,
00073                   const int xminxmax);
00074 
00075   static TH1* getHisto(int isector, const char* details,
00076                        const std::string& suffix);
00077 
00078   static void fillHistograms(int isector, const char* details,
00079                              const std::vector<Tuple>& gt,
00080                              const std::vector<Tuple>& gt0,
00081                              const std::vector<int>& reject);
00082 
00083  private:
00084 
00085   static std::map<std::string,TH1*> fHistos;
00086 
00087   static int fRefRunNumber;
00088   static int fCurrentRunNumber;
00089 
00090   static emcCalibrationDataHelper* fCDH0;
00091 
00092   static bool fHistogramming;
00093 };
00094 
00095 inline bool operator<(const emcGainBaseLineCalculator::Tuple& fp1, 
00096                       const emcGainBaseLineCalculator::Tuple& fp2)
00097 {
00098   return fp1.value() < fp2.value();
00099 }
00100 
00101 #endif