CMS 3D CMS Logo

SignAlgoResolutions.cc

Go to the documentation of this file.
00001 #include "RecoMET/METAlgorithms/interface/SignAlgoResolutions.h"
00002 // -*- C++ -*-
00003 //
00004 // Package:    METAlgorithms
00005 // Class:      SignAlgoResolutions
00006 // 
00014 //
00015 // Original Author:  Kyle Story, Freya Blekman (Cornell University)
00016 //         Created:  Fri Apr 18 11:58:33 CEST 2008
00017 // $Id: SignAlgoResolutions.cc,v 1.1 2008/04/18 10:12:55 fblekman Exp $
00018 //
00019 //
00020 #include <math.h>
00021 
00022 
00023 double metsig::SignAlgoResolutions::eval(const resolutionType & type, const resolutionFunc & func, const double & et, const double & phi, const double & eta) const {
00024 
00025   functionPars x(3);
00026   x[0]=et;
00027   x[1]=phi;
00028   x[2]=eta;
00029   
00030   return getfunc(type,func,x);
00031 
00032 }
00033 metsig::SignAlgoResolutions::SignAlgoResolutions(const edm::ParameterSet &iConfig):functionmap_(){
00034   addResolutions(iConfig);
00035 }
00036 
00037 void metsig::SignAlgoResolutions::addResolutions(const edm::ParameterSet &iConfig){
00038   // for now: do this by hand:
00039   functionPars etparameters(3,0);
00040   functionPars phiparameters(1,0);
00041   // set the parameters per function:
00042   // ECAL, BARREL:
00043   etparameters[0]=0.2;
00044   etparameters[1]=0.03;
00045   etparameters[2]=0.005;
00046   phiparameters[0]=0.0174;
00047   addfunction(caloEB,ET,etparameters);
00048   addfunction(caloEB,PHI,phiparameters);
00049  // ECAL, ENDCAP:
00050   etparameters[0]=0.2;
00051   etparameters[1]=0.03;
00052   etparameters[2]=0.005;
00053   phiparameters[0]=0.087;
00054   addfunction(caloEE,ET,etparameters);
00055   addfunction(caloEE,PHI,phiparameters);
00056  // HCAL, BARREL:
00057   etparameters[0]=0.;
00058   etparameters[1]=1.22;
00059   etparameters[2]=0.05;
00060   phiparameters[0]=0.087;
00061   addfunction(caloHB,ET,etparameters);
00062   addfunction(caloHB,PHI,phiparameters);
00063  // HCAL, ENDCAP:
00064   etparameters[0]=0.;
00065   etparameters[1]=1.3;
00066   etparameters[2]=0.05;
00067   phiparameters[0]=0.087;
00068   addfunction(caloHE,ET,etparameters);
00069   addfunction(caloHE,PHI,phiparameters);
00070  // HCAL, Outer
00071   etparameters[0]=0.;
00072   etparameters[1]=1.3;
00073   etparameters[2]=0.005;
00074   phiparameters[0]=0.087;
00075   addfunction(caloHO,ET,etparameters);
00076   addfunction(caloHO,PHI,phiparameters);
00077  // HCAL, Forward
00078   etparameters[0]=0.;
00079   etparameters[1]=1.82;
00080   etparameters[2]=0.09;
00081   phiparameters[0]=0.174;
00082   addfunction(caloHF,ET,etparameters);
00083   addfunction(caloHF,PHI,phiparameters);
00084 
00085   return;
00086 }
00087 
00088 void metsig::SignAlgoResolutions::addfunction(resolutionType type, resolutionFunc func, functionPars parameters){
00089 
00090   //  std::cout << "adding function for " << type << " " << func << ", parameters " ;
00091   //  for(size_t ii=0; ii<parameters.size();++ii)
00092   //    std::cout << parameters[ii] << " ";
00093   //  std::cout << std::endl;
00094   functionCombo mypair(type,func);
00095   functionmap_[mypair]=parameters;
00096   
00097 }
00098 
00099 double metsig::SignAlgoResolutions::getfunc(const metsig::resolutionType & type,const metsig::resolutionFunc & func, functionPars & x) const{
00100   
00101   double result=0;
00102   functionCombo mypair(type,func);
00103   
00104  
00105   
00106   if(functionmap_.count(mypair)==0)
00107     return result;
00108   
00109   functionPars values = (functionmap_.find(mypair))->second;
00110   if(func==metsig::ET)
00111     result = EtFunction(x,values);
00112   else if(func==metsig::PHI)
00113     result = PhiFunction(x,values);
00114   
00115   // std::cout << "returning function " << type << " " << func << " " << result << " " << x[0] << std::endl; 
00116 
00117   return result;
00118 }
00119 
00120 double metsig::SignAlgoResolutions::EtFunction( const functionPars &x, const functionPars & par) const
00121 {
00122   if(par.size()<3)
00123     return 0.;
00124   if(x.size()<1)
00125     return 0.;
00126   double et=x[0];
00127   if(et<=0.)
00128     return 0.;
00129   double result = et*sqrt((par[2]*par[2])+(par[1]*par[1]/et)+(par[0]*par[0]/(et*et)));
00130   return result;
00131 }
00132 
00133 
00134 double metsig::SignAlgoResolutions::PhiFunction(const functionPars &x,const  functionPars & par) const
00135 {
00136   double et=x[0];
00137   if(et<=0.)
00138     return 0.;
00139   double result = par[0]*et;
00140   return result;
00141 
00142 }

Generated on Tue Jun 9 17:44:06 2009 for CMSSW by  doxygen 1.5.4