CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/RecoParticleFlow/PFClusterTools/src/PFEnergyCalibrationHF.cc

Go to the documentation of this file.
00001 #include "RecoParticleFlow/PFClusterTools/interface/PFEnergyCalibrationHF.h"
00002 #include <TMath.h>
00003 #include <math.h>
00004 #include <vector>
00005 #include <TF1.h>
00006 
00007 using namespace std;
00008 using namespace edm;
00009 
00010 PFEnergyCalibrationHF::PFEnergyCalibrationHF() {
00011 
00012   calibHF_use_ = false;
00013   calibHF_eta_step_.push_back(0.00);
00014   calibHF_eta_step_.push_back(2.90);
00015   calibHF_eta_step_.push_back(3.00);
00016   calibHF_eta_step_.push_back(3.20);
00017   calibHF_eta_step_.push_back(4.20);
00018   calibHF_eta_step_.push_back(4.40);
00019   calibHF_eta_step_.push_back(4.60);
00020   calibHF_eta_step_.push_back(4.80);
00021   calibHF_eta_step_.push_back(5.20);
00022   calibHF_eta_step_.push_back(5.40);
00023   for(unsigned int i=0;i< calibHF_eta_step_.size();++i){
00024     calibHF_a_EMonly_.push_back(1.00);
00025     calibHF_b_HADonly_.push_back(1.00);
00026     calibHF_a_EMHAD_.push_back(1.00);
00027     calibHF_b_EMHAD_.push_back(1.00);
00028   }
00029   
00030 }
00031 
00032 PFEnergyCalibrationHF::PFEnergyCalibrationHF(
00033                                              bool calibHF_use, 
00034                                              std::vector<double> calibHF_eta_step,
00035                                              std::vector<double> calibHF_a_EMonly,
00036                                              std::vector<double> calibHF_b_HADonly,
00037                                              std::vector<double> calibHF_a_EMHAD,
00038                                              std::vector<double> calibHF_b_EMHAD) {
00039 
00040   calibHF_use_ = calibHF_use    ;
00041   calibHF_eta_step_  = calibHF_eta_step;
00042   calibHF_a_EMonly_  = calibHF_a_EMonly;
00043   calibHF_b_HADonly_ = calibHF_b_HADonly;
00044   calibHF_a_EMHAD_   = calibHF_a_EMHAD;
00045   calibHF_b_EMHAD_   = calibHF_b_EMHAD;
00046 }
00047 
00048  
00049  
00050 
00051 
00052 PFEnergyCalibrationHF::~PFEnergyCalibrationHF()
00053 {
00054 //--- nothing to be done yet  
00055 }
00056 
00057 
00058 double PFEnergyCalibrationHF::energyEm(double uncalibratedEnergyECAL, 
00059                               double eta, double phi)  {
00060 
00061   double calibrated = 0.0; 
00062   //find eta bin.  default : 0.00;2.90;3.00;3.20;4.20;4.40;4.60;4.80;5.20;5.40;
00063   int ietabin = 0;
00064   for(unsigned int i=0;i< calibHF_eta_step_.size();++i){
00065     if((fabs(eta))>=calibHF_eta_step_[i]){
00066       ietabin = i;
00067     }
00068   }
00069   calibrated = uncalibratedEnergyECAL * calibHF_a_EMonly_[ietabin];
00070   return calibrated; 
00071 
00072  
00073 
00074 
00075   // return calibrated;
00076 }
00077 
00078 
00079 double PFEnergyCalibrationHF::energyHad(double uncalibratedEnergyHCAL, 
00080                               double eta, double phi)  {
00081 
00082   double calibrated = 0.0; 
00083   //find eta bin.  default : 0.00;2.90;3.00;3.20;4.20;4.40;4.60;4.80;5.20;5.40;
00084   int ietabin = 0;
00085   for(unsigned int i=0;i< calibHF_eta_step_.size();++i){
00086     if((fabs(eta))>=calibHF_eta_step_[i]){
00087       ietabin = i;
00088     }
00089   }
00090   calibrated = uncalibratedEnergyHCAL * calibHF_b_HADonly_[ietabin];
00091   return calibrated; 
00092 }
00093 
00094 double PFEnergyCalibrationHF::energyEmHad(double uncalibratedEnergyECAL, 
00095                                           double uncalibratedEnergyHCAL, 
00096                                           double eta, double phi){
00097 
00098   double calibrated = 0.0; 
00099   //find eta bin.  default : 0.00;2.90;3.00;3.20;4.20;4.40;4.60;4.80;5.20;5.40+;
00100   int ietabin = 0;
00101   for(unsigned int i=0;i< calibHF_eta_step_.size();++i){
00102     if((fabs(eta))>=calibHF_eta_step_[i]){
00103       ietabin = i;
00104     }
00105   }
00106   calibrated = uncalibratedEnergyECAL * calibHF_a_EMHAD_[ietabin] + uncalibratedEnergyHCAL * calibHF_b_EMHAD_[ietabin];
00107   return calibrated; 
00108 }
00109 
00110 std::ostream& operator<<(std::ostream& out, 
00111                          const PFEnergyCalibrationHF& calib) {
00112 
00113 
00114   if(!out ) return out;
00115   out<<"PFEnergyCalibrationHF -- "<<endl;
00116   int ii = 0;
00117   for(std::vector<double>::const_iterator iteta =(calib.getcalibHF_eta_step()).begin(); 
00118       iteta !=(calib.getcalibHF_eta_step()).end() ;++iteta){
00119     //double currenteta = *iteta;
00120     out<<" i "<<ii<<",";
00121     out<<"use "<<calib.getcalibHF_use()<<",";
00122     out<<"currenteta "<<calib.getcalibHF_eta_step()[ii]<<",";
00123     out<<"calibHF_a_EMonly_ "<<calib.getcalibHF_a_EMonly()[ii]<<",";
00124     out<<"calibHF_b_HADonly_ "<<calib.getcalibHF_b_HADonly()[ii]<<",";
00125     out<<"calibHF_a_EMHAD_ "<<calib.getcalibHF_a_EMHAD()[ii]<<",";
00126     out<<"calibHF_b_EMHAD_ "<<calib.getcalibHF_b_EMHAD()[ii]<<",";
00127     out<<endl;
00128     ii++;
00129   }
00130   
00131   
00132 
00133   return out;
00134 }
00135