CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyUncertainty.cc

Go to the documentation of this file.
00001 #include "RecoEcal/EgammaCoreTools/plugins/EcalClusterEnergyUncertainty.h"
00002 
00003 
00004 float EcalClusterEnergyUncertainty::getValue( const reco::SuperCluster & superCluster, const int mode ) const
00005 {
00006         checkInit();
00007         // mode  = -1 returns negative energy uncertainty 
00008         //       = +1 returns positive energy uncertainty 
00009         //       =  0 (default) returns overall  energy uncertainty 
00010         float en = superCluster.energy(); 
00011         float eta = fabs(superCluster.eta()); 
00012         float et = en/cosh(eta); 
00013         float brem = superCluster.phiWidth()/superCluster.etaWidth(); 
00014         
00015         int offset = 0; 
00016         
00017         //if ( superCluster.algoID() == reco::CaloCluster::hybrid ) offset = 0; 
00018         //else if ( superCluster.algoID() == reco::CaloCluster::multi5x5 ) offset = 36; 
00019         // TEMPORARY FIX!!
00020         if ( eta < 1.5 ) offset = 0; 
00021         else if ( eta >= 1.5 ) offset = 36; 
00022         else { 
00023           // not supported now 
00024           //std::cout << "Not supported value " << superCluster.algoID() << std::endl;
00025           //std::cout << "eta = " << superCluster.eta() << std::endl;
00026           //std::cout << "phi = " << superCluster.phi() << std::endl;
00027           //std::cout << "En  = " << superCluster.energy() << std::endl;
00028           return -1; 
00029         }
00030         if ( mode ==  0 ) offset += 0; // total effective uncertainty 
00031         else if ( mode == -1 ) offset += 12;  // negative energy uncertainty 
00032         else if ( mode ==  1 ) offset += 24;  // positive energy uncertainty 
00033         else {
00034           // wrong input
00035           return 0;
00036         }
00037 
00038         float br0_0 = (params_->params())[offset + 0]; 
00039         float br0_1 = (params_->params())[offset + 1]; 
00040         float br0_2 = (params_->params())[offset + 2]; 
00041         float br0_3 = (params_->params())[offset + 3]; 
00042         
00043         float br1_0 = (params_->params())[offset + 4];  
00044         float br1_1 = (params_->params())[offset + 5];  
00045         float br1_2 = (params_->params())[offset + 6];  
00046         float br1_3 = (params_->params())[offset + 7];  
00047         
00048         float br2_0 = (params_->params())[offset + 8];  
00049         float br2_1 = (params_->params())[offset + 9];  
00050         float br2_2 = (params_->params())[offset + 10];  
00051         float br2_3 = (params_->params())[offset + 11];  
00052         
00053         float p0 = (br0_0 + br0_1*brem) + (br0_2 + br0_3*brem)/et;  
00054         float p1 = (br1_0 + br1_1*brem) + (br1_2 + br1_3*brem)/et;  
00055         float p2 = (br2_0 + br2_1*brem) + (br2_2 + br2_3*brem)/et;  
00056         //std::cout << "====================================================" << std::endl;
00057         //std::cout << "et = " << et << "\t eta = " << eta << std::endl;
00058         //std::cout << "p0 = " << p0 << "\t p1 = " << p1 << "\t p2 = " << p2 << std::endl;
00059         float uncertainty = en*(p0 + p1*fabs(eta) + p2*eta*eta);  
00060         //std::cout << uncertainty << std::endl;
00061         //std::cout << std::endl;
00062         return uncertainty;  
00063 
00064 
00065 }
00066 
00067 #include "RecoEcal/EgammaCoreTools/interface/EcalClusterFunctionFactory.h"
00068 DEFINE_EDM_PLUGIN( EcalClusterFunctionFactory, EcalClusterEnergyUncertainty, "EcalClusterEnergyUncertainty");