CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/RecoLocalCalo/HcalRecAlgos/interface/HBHETimeProfileStatusBitSetter.h

Go to the documentation of this file.
00001 #ifndef HCALHBHETIMESTATUSFROMDIGIS_H
00002 #define HCALHBHETIMESTATUSFROMDIGIS_H 1
00003 
00004 #include "DataFormats/HcalDigi/interface/HBHEDataFrame.h"
00005 #include "DataFormats/HcalRecHit/interface/HBHERecHit.h"
00006 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00007 
00017 class HBHETimeProfileStatusBitSetter {
00018 public:
00020   HBHETimeProfileStatusBitSetter();
00021   HBHETimeProfileStatusBitSetter(double R1Min, double R1Max, 
00022                                  double R2Min, double R2Max, 
00023                                  double FracLeaderMin, double FracLeaderMax, 
00024                                  double SlopeMin, double SlopeMax, 
00025                                  double OuterMin, double OuterMax, double EnergyThreshold); 
00026   
00027   // Destructor
00028   ~HBHETimeProfileStatusBitSetter();
00029 
00030   // Methods for setting the status flag values
00031   void hbheSetTimeFlagsFromDigi(HBHERecHitCollection *, std::vector<HBHEDataFrame>, std::vector<int>);
00032 
00033 
00034 
00035 
00036   // setter functions
00037   void SetExpLimits(double R1Min, double R1Max, double R2Min, double R2Max)
00038     { R1Min_ = R1Min; R1Max_ = R1Max;  R2Min_ = R2Max; R2Max_ = R2Max; }
00039   void SetFracLeaderLimits(double FracLeaderMin, double FracLeaderMax)
00040     { FracLeaderMin_ = FracLeaderMin; FracLeaderMax_ = FracLeaderMax;}
00041   void SetSlopeLimits(double SlopeMin, double SlopeMax)
00042     { SlopeMin_ = SlopeMin; SlopeMax_ = SlopeMax;}
00043   void SetOuterLimits(double OuterMin, double OuterMax)
00044     { OuterMin_ = OuterMin; OuterMax_ = OuterMax;}
00045   double EnergyThreshold(){return EnergyThreshold_;}
00046 
00047 private:
00048   // variables for cfg files
00049   double R1Min_, R1Max_, R2Min_, R2Max_;
00050   double FracLeaderMin_,FracLeaderMax_;
00051   double SlopeMin_,SlopeMax_;
00052   double OuterMin_,OuterMax_;
00053   double EnergyThreshold_;
00054   struct compare_digi_energy : public std::binary_function<HBHEDataFrame, HBHEDataFrame, bool> {
00055     bool operator()(const HBHEDataFrame& x, const HBHEDataFrame& y) {
00056       double TotalX=0, TotalY=0;
00057       for(int i=0; i!=x.size(); TotalX += x.sample(i++).nominal_fC());
00058       for(int i=0; i!=y.size(); TotalY += y.sample(i++).nominal_fC());
00059 
00060       return (TotalX>TotalY) ;
00061 
00062     }
00063   };
00064  
00065   double TotalEnergyInDataFrame(HBHEDataFrame x) {
00066     double Total=0;
00067     for(int i=0; i!=x.size(); Total += x.sample(i++).nominal_fC());
00068     return Total;
00069   }
00070       
00071 
00072 };
00073 
00074 #endif