CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalClusterEnergyUncertainty.cc
Go to the documentation of this file.
2 
3 
4 float EcalClusterEnergyUncertainty::getValue( const reco::SuperCluster & superCluster, const int mode ) const
5 {
6  checkInit();
7  // mode = -1 returns negative energy uncertainty
8  // = +1 returns positive energy uncertainty
9  // = 0 (default) returns overall energy uncertainty
10  float en = superCluster.energy();
11  float eta = fabs(superCluster.eta());
12  float et = en/cosh(eta);
13  float brem = superCluster.phiWidth()/superCluster.etaWidth();
14 
15  int offset = 0;
16 
17  //if ( superCluster.algoID() == reco::CaloCluster::hybrid ) offset = 0;
18  //else if ( superCluster.algoID() == reco::CaloCluster::multi5x5 ) offset = 36;
19  // TEMPORARY FIX!!
20  if ( eta < 1.5 ) offset = 0;
21  else if ( eta >= 1.5 ) offset = 36;
22  else {
23  // not supported now
24  //std::cout << "Not supported value " << superCluster.algoID() << std::endl;
25  //std::cout << "eta = " << superCluster.eta() << std::endl;
26  //std::cout << "phi = " << superCluster.phi() << std::endl;
27  //std::cout << "En = " << superCluster.energy() << std::endl;
28  return -1;
29  }
30  if ( mode == 0 ) offset += 0; // total effective uncertainty
31  else if ( mode == -1 ) offset += 12; // negative energy uncertainty
32  else if ( mode == 1 ) offset += 24; // positive energy uncertainty
33  else {
34  // wrong input
35  return 0;
36  }
37 
38  float br0_0 = (params_->params())[offset + 0];
39  float br0_1 = (params_->params())[offset + 1];
40  float br0_2 = (params_->params())[offset + 2];
41  float br0_3 = (params_->params())[offset + 3];
42 
43  float br1_0 = (params_->params())[offset + 4];
44  float br1_1 = (params_->params())[offset + 5];
45  float br1_2 = (params_->params())[offset + 6];
46  float br1_3 = (params_->params())[offset + 7];
47 
48  float br2_0 = (params_->params())[offset + 8];
49  float br2_1 = (params_->params())[offset + 9];
50  float br2_2 = (params_->params())[offset + 10];
51  float br2_3 = (params_->params())[offset + 11];
52 
53  float p0 = (br0_0 + br0_1*brem) + (br0_2 + br0_3*brem)/et;
54  float p1 = (br1_0 + br1_1*brem) + (br1_2 + br1_3*brem)/et;
55  float p2 = (br2_0 + br2_1*brem) + (br2_2 + br2_3*brem)/et;
56  //std::cout << "====================================================" << std::endl;
57  //std::cout << "et = " << et << "\t eta = " << eta << std::endl;
58  //std::cout << "p0 = " << p0 << "\t p1 = " << p1 << "\t p2 = " << p2 << std::endl;
59  float uncertainty = en*(p0 + p1*fabs(eta) + p2*eta*eta);
60  //std::cout << uncertainty << std::endl;
61  //std::cout << std::endl;
62  return uncertainty;
63 
64 
65 }
66 
double phiWidth() const
obtain phi and eta width of the Super Cluster
Definition: SuperCluster.h:53
T eta() const
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:160
double etaWidth() const
Definition: SuperCluster.h:54
EcalFunctionParameters & params()
double energy() const
cluster energy
Definition: CaloCluster.h:120
unsigned int offset(bool)
double p2[4]
Definition: TauolaWrapper.h:90
virtual float getValue(const reco::SuperCluster &, const int mode) const
const EcalClusterEnergyUncertaintyParameters * params_
double p1[4]
Definition: TauolaWrapper.h:89
#define DEFINE_EDM_PLUGIN(factory, type, name)