CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/RecoParticleFlow/PFClusterTools/src/PFSCEnergyCalibration.cc

Go to the documentation of this file.
00001 #include "RecoParticleFlow/PFClusterTools/interface/PFSCEnergyCalibration.h"
00002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00003 #include <vector>
00004 
00005 using namespace std;
00006 
00007 PFSCEnergyCalibration::PFSCEnergyCalibration() {}
00008 
00009 
00010 PFSCEnergyCalibration::PFSCEnergyCalibration(std::vector<double>& barrelCorr,
00011                                              std::vector<double>& endcapCorr):
00012   barrelCorr_(barrelCorr),
00013   endcapCorr_(endcapCorr)
00014 {
00015 
00016   // intial parameters
00017 
00018   bool log = false;
00019   
00020   
00021   if(barrelCorr_.size() != 11)
00022     edm::LogError("PFSCEnergyCalibration")<<" wrong size input paramter: calibPFSCEle_barrel read = "
00023                                           << barrelCorr_.size() << " expected = 11" << endl;
00024   
00025   
00026   if(endcapCorr_.size() != 9)
00027     edm::LogError("PFSCEnergyCalibration")<<" wrong size input parameter: calibPFSCEle_endcap read = "
00028                                      << endcapCorr_.size() << " expected = 8" << endl;
00029 
00030   
00031   if(log)
00032     cout << " ****** THE BARREL SC CORRECTIONS ******* " << barrelCorr_.size()  << endl;
00033   for(unsigned int ip = 0; ip< barrelCorr_.size(); ip++){
00034     bb[ip] = barrelCorr_[ip];
00035     if(log)
00036       cout << " bb[" << ip << "] " << " = " << bb[ip] << endl;
00037   }
00038   
00039   if(log)
00040     cout << " ****** THE ENCCAP SC CORRECTIONS ******* " << endcapCorr_.size() << endl;
00041   for(unsigned int ip = 0; ip< endcapCorr_.size(); ip++){
00042     cc[ip] = endcapCorr_[ip];
00043     if(log)
00044       cout << " cc[" << ip << "] " << " = " << cc[ip] << endl;
00045   }
00046 }
00047 PFSCEnergyCalibration::~PFSCEnergyCalibration() {}
00048 
00049 
00050 double PFSCEnergyCalibration::SCCorrEtEtaBarrel(double et, double eta) {
00051   double fCorr = 0;
00052   
00053   
00054   // 25 November Morning
00055   
00056 //   //p0  
00057 //   double bb0 = 1.03257;
00058 //   double bb1 = -1.37103e+01;
00059 //   double bb2 = 3.39716e+02;
00060 //   double bb3 = 4.86192e-01;
00061   
00062 //   //p1
00063 //   double bb4 = 1.81653e-03;
00064 //   double bb5 = 3.64445e-01;
00065 //   double bb6 = 1.41132;
00066   
00067   
00068 //   //p2
00069 //   double bb7 = 1.02061;
00070 //   double bb8 = 5.91624e-03;
00071 //   double bb9 = -5.14434e-05;
00072 //   double bb10 = 1.42516e-07; 
00073   
00074   
00075   double temp_et = et;
00076   // Avoid energy correction divergency at low Et. 
00077   if(temp_et < 2)
00078     temp_et = 2;
00079 
00080   
00081   double d0 = 15.0;     // sharpness of the curve
00082   double d1 = -0.00181;
00083   double d2 = 1.081;
00084   
00085   double p0 = bb[0] + bb[1]/(temp_et + bb[2]) - bb[3]/(temp_et) ;
00086   double p1 = bb[4] + bb[5]/(bb[6] + temp_et);
00087 
00088   
00089 
00090   // for the momentum the fixed value d2 is prefered to p2
00091   double p2 = bb[7] + bb[8]*temp_et + bb[9]*temp_et*temp_et + bb[10]*temp_et*temp_et*temp_et;
00092   
00093   if(temp_et > 130) {
00094     double y = 130;
00095     p2 = bb[7] + bb[8]*y + bb[9]*y*y + bb[10]*y*y*y;
00096   }
00097   
00098 
00099 
00100 
00101   
00102   fCorr = p0 + p1*atan(d0*(d2 - fabs(eta))) + d1*fabs(eta);
00103   
00104   return et/fCorr;
00105 }
00106 
00107 double PFSCEnergyCalibration::SCCorrEtEtaEndcap(double et, double eta) {
00108   double fCorr = 0;
00109   
00110 
00111 //   //p0
00112 //   double c0 = 9.99464e-01;
00113 //   double c1 = -1.23130e+01;
00114 //   double c2 = 2.87841;
00115   
00116 //   //p1
00117 //   double c3 = -1.05697e-04;
00118 //   double c4 = 1.02819e+01;
00119 //   double c5 = 3.05904; 
00120   
00121   
00122 //   //p2
00123 //   double c6 = 1.35017e-03;
00124 //   double c7 = -2.21845;
00125 //   double c8 = 3.42062;
00126   
00127   double temp_et = et;
00128   // Avoid energy correction divergency at low Et. 
00129   if(temp_et < 2)
00130     temp_et = 2;
00131 
00132   double p0 = cc[0] + cc[1]/(cc[2] + temp_et);
00133   double p1 = cc[3] + cc[4]/(cc[5] + temp_et);
00134   double p2 = cc[6] + cc[7]/(cc[8] + temp_et);
00135     
00136     
00137     fCorr = p0 + p1*fabs(eta) +  p2*eta*eta;
00138     
00139     return et/fCorr;
00140 }
00141