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  //fixing divide by zero issue for brem varible, this is the case for single crystal superclusters
14  //as these "superclusters" are likely noise or spikes so setting value to 0 as the uncertainties
15  //will be incorrect regardless so doesnt matter what it is
16  float brem = superCluster.etaWidth()!=0 ? superCluster.phiWidth()/superCluster.etaWidth() : 0;
17 
18  int offset = 0;
19 
20  //if ( superCluster.algoID() == reco::CaloCluster::hybrid ) offset = 0;
21  //else if ( superCluster.algoID() == reco::CaloCluster::multi5x5 ) offset = 36;
22  // TEMPORARY FIX!!
23  if ( eta < 1.5 ) offset = 0;
24  else if ( eta >= 1.5 ) offset = 36;
25  else {
26  // not supported now
27  //std::cout << "Not supported value " << superCluster.algoID() << std::endl;
28  //std::cout << "eta = " << superCluster.eta() << std::endl;
29  //std::cout << "phi = " << superCluster.phi() << std::endl;
30  //std::cout << "En = " << superCluster.energy() << std::endl;
31  return -1;
32  }
33  if ( mode == 0 ) offset += 0; // total effective uncertainty
34  else if ( mode == -1 ) offset += 12; // negative energy uncertainty
35  else if ( mode == 1 ) offset += 24; // positive energy uncertainty
36  else {
37  // wrong input
38  return 0;
39  }
40 
41  float br0_0 = (params_->params())[offset + 0];
42  float br0_1 = (params_->params())[offset + 1];
43  float br0_2 = (params_->params())[offset + 2];
44  float br0_3 = (params_->params())[offset + 3];
45 
46  float br1_0 = (params_->params())[offset + 4];
47  float br1_1 = (params_->params())[offset + 5];
48  float br1_2 = (params_->params())[offset + 6];
49  float br1_3 = (params_->params())[offset + 7];
50 
51  float br2_0 = (params_->params())[offset + 8];
52  float br2_1 = (params_->params())[offset + 9];
53  float br2_2 = (params_->params())[offset + 10];
54  float br2_3 = (params_->params())[offset + 11];
55 
56  float p0 = (br0_0 + br0_1*brem) + (br0_2 + br0_3*brem)/et;
57  float p1 = (br1_0 + br1_1*brem) + (br1_2 + br1_3*brem)/et;
58  float p2 = (br2_0 + br2_1*brem) + (br2_2 + br2_3*brem)/et;
59  //std::cout << "====================================================" << std::endl;
60  //std::cout << "et = " << et << "\t eta = " << eta << std::endl;
61  //std::cout << "p0 = " << p0 << "\t p1 = " << p1 << "\t p2 = " << p2 << std::endl;
62  float uncertainty = en*(p0 + p1*fabs(eta) + p2*eta*eta);
63  //std::cout << uncertainty << std::endl;
64  //std::cout << std::endl;
65  return uncertainty;
66 
67 
68 }
69 
double phiWidth() const
obtain phi and eta width of the Super Cluster
Definition: SuperCluster.h:55
T eta() const
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:163
double etaWidth() const
Definition: SuperCluster.h:56
EcalFunctionParameters & params()
double energy() const
cluster energy
Definition: CaloCluster.h:121
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)