CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/DQM/EcalCommon/interface/UtilFunctions.h

Go to the documentation of this file.
00001 #ifndef DQM_ECALCOMMON_UtilFunctions_H
00002 #define DQM_ECALCOMMON_UtilFunctions_H
00003 
00012 #include <cmath>
00013 #include <iostream>
00014 
00015 #include "TH1F.h"
00016 #include "TProfile.h"
00017 #include "TClass.h"
00018 
00019 class MonitorElement;
00020 
00021 namespace ecaldqm {
00022 
00023   enum Directions {
00024     kLeft,
00025     kRight
00026   };
00027 
00028   // functions implemented here are not universal in the sense that
00029   // the input variables are changed due to efficiency of memory usage.
00030 
00031 
00032   // calculated time intervals and bin locations for time varing profiles
00033 
00034   void calcBins(int binWidth, int divisor, long int start_time, long int last_time, long int current_time,
00035                 long int & binDiff, long int & diff);
00036 
00037   // shift bins in the given direction
00038 
00039   void shift(TH1 *h, Directions d, int bins);
00040 
00041   // shift bins in histograms to the right
00042 
00043   void shift2Right(TH1* h, int bins);
00044 
00045   // shift bins in histograms to the left
00046 
00047   void shift2Left(TH1* h, int bins);
00048 
00049   // shift axis of histograms keeping the bin contents
00050 
00051   void shiftAxis(TH1 *h, Directions d, double shift);
00052 
00053   // get mean and rms of Y values from TProfile
00054 
00055   void getAverageFromTProfile(TProfile* p, double& mean, double& rms);
00056 
00057   // get mean and rms based on two histograms' difference
00058 
00059   void getMeanRms(TObject* pre, TObject* cur, double& mean, double& rms); 
00060 
00061   TObject* cloneIt(MonitorElement* me, std::string histo); 
00062 
00063 }
00064 
00065 #endif