CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
EcalClusterEnergyUncertainty Class Reference
Inheritance diagram for EcalClusterEnergyUncertainty:
EcalClusterFunctionBaseClass

Public Member Functions

void checkInit () const
 
 EcalClusterEnergyUncertainty (const edm::ParameterSet &, edm::ConsumesCollector iC)
 
const
EcalClusterEnergyUncertaintyParameters
getParameters () const
 
float getValue (const reco::SuperCluster &, const int mode) const override
 
float getValue (const reco::BasicCluster &, const EcalRecHitCollection &) const override
 
void init (const edm::EventSetup &es) override
 
- Public Member Functions inherited from EcalClusterFunctionBaseClass
virtual float getValue (const reco::CaloCluster &) const
 
virtual ~EcalClusterFunctionBaseClass ()
 

Private Attributes

const
EcalClusterEnergyUncertaintyParameters
params_ = nullptr
 
const edm::ESGetToken
< EcalClusterEnergyUncertaintyParameters,
EcalClusterEnergyUncertaintyParametersRcd
paramsToken_
 

Detailed Description

Function that provides uncertainty on supercluster energy measurement Available numbers: total effective uncertainty (in GeV) assymetric uncertainties (positive and negative)

$Id: EcalClusterEnergyUncertainty.h $Date: $Revision:

Author
Yurii Maravin, KSU, March 2009

Definition at line 18 of file EcalClusterEnergyUncertainty.cc.

Constructor & Destructor Documentation

EcalClusterEnergyUncertainty::EcalClusterEnergyUncertainty ( const edm::ParameterSet ,
edm::ConsumesCollector  iC 
)
inline

Definition at line 20 of file EcalClusterEnergyUncertainty.cc.

20 : paramsToken_(iC.esConsumes()) {}
const edm::ESGetToken< EcalClusterEnergyUncertaintyParameters, EcalClusterEnergyUncertaintyParametersRcd > paramsToken_

Member Function Documentation

void EcalClusterEnergyUncertainty::checkInit ( ) const

Definition at line 41 of file EcalClusterEnergyUncertainty.cc.

References Exception, and params_.

Referenced by getValue().

41  {
42  if (!params_) {
43  // non-initialized function parameters: throw exception
44  throw cms::Exception("EcalClusterEnergyUncertainty::checkInit()")
45  << "Trying to access an uninitialized crack correction function.\n"
46  "Please call `init( edm::EventSetup &)' before any use of the function.\n";
47  }
48 }
const EcalClusterEnergyUncertaintyParameters * params_
const EcalClusterEnergyUncertaintyParameters* EcalClusterEnergyUncertainty::getParameters ( ) const
inline

Definition at line 23 of file EcalClusterEnergyUncertainty.cc.

References params_.

23 { return params_; }
const EcalClusterEnergyUncertaintyParameters * params_
float EcalClusterEnergyUncertainty::getValue ( const reco::SuperCluster superCluster,
const int  mode 
) const
overridevirtual

Implements EcalClusterFunctionBaseClass.

Definition at line 50 of file EcalClusterEnergyUncertainty.cc.

References checkInit(), reco::CaloCluster::energy(), PVValHelper::eta, reco::CaloCluster::eta(), reco::SuperCluster::etaWidth(), hltrates_dqm_sourceclient-live_cfg::offset, fireworks::p1, fireworks::p2, EcalFunParams::params(), params_, and reco::SuperCluster::phiWidth().

50  {
51  checkInit();
52  // mode = -1 returns negative energy uncertainty
53  // = +1 returns positive energy uncertainty
54  // = 0 (default) returns overall energy uncertainty
55  float en = superCluster.energy();
56  float eta = fabs(superCluster.eta());
57  float et = en / cosh(eta);
58  //fixing divide by zero issue for brem varible, this is the case for single crystal superclusters
59  //as these "superclusters" are likely noise or spikes so setting value to 0 as the uncertainties
60  //will be incorrect regardless so doesnt matter what it is
61  float brem = superCluster.etaWidth() != 0 ? superCluster.phiWidth() / superCluster.etaWidth() : 0;
62 
63  int offset = 0;
64 
65  //if ( superCluster.algoID() == reco::CaloCluster::hybrid ) offset = 0;
66  //else if ( superCluster.algoID() == reco::CaloCluster::multi5x5 ) offset = 36;
67  // TEMPORARY FIX!!
68  if (eta < 1.5)
69  offset = 0;
70  else if (eta >= 1.5)
71  offset = 36;
72  else {
73  // not supported now
74  //std::cout << "Not supported value " << superCluster.algoID() << std::endl;
75  //std::cout << "eta = " << superCluster.eta() << std::endl;
76  //std::cout << "phi = " << superCluster.phi() << std::endl;
77  //std::cout << "En = " << superCluster.energy() << std::endl;
78  return -1;
79  }
80  if (mode == 0)
81  offset += 0; // total effective uncertainty
82  else if (mode == -1)
83  offset += 12; // negative energy uncertainty
84  else if (mode == 1)
85  offset += 24; // positive energy uncertainty
86  else {
87  // wrong input
88  return 0;
89  }
90 
91  float br0_0 = (params_->params())[offset + 0];
92  float br0_1 = (params_->params())[offset + 1];
93  float br0_2 = (params_->params())[offset + 2];
94  float br0_3 = (params_->params())[offset + 3];
95 
96  float br1_0 = (params_->params())[offset + 4];
97  float br1_1 = (params_->params())[offset + 5];
98  float br1_2 = (params_->params())[offset + 6];
99  float br1_3 = (params_->params())[offset + 7];
100 
101  float br2_0 = (params_->params())[offset + 8];
102  float br2_1 = (params_->params())[offset + 9];
103  float br2_2 = (params_->params())[offset + 10];
104  float br2_3 = (params_->params())[offset + 11];
105 
106  float p0 = (br0_0 + br0_1 * brem) + (br0_2 + br0_3 * brem) / et;
107  float p1 = (br1_0 + br1_1 * brem) + (br1_2 + br1_3 * brem) / et;
108  float p2 = (br2_0 + br2_1 * brem) + (br2_2 + br2_3 * brem) / et;
109  //std::cout << "====================================================" << std::endl;
110  //std::cout << "et = " << et << "\t eta = " << eta << std::endl;
111  //std::cout << "p0 = " << p0 << "\t p1 = " << p1 << "\t p2 = " << p2 << std::endl;
112  float uncertainty = en * (p0 + p1 * fabs(eta) + p2 * eta * eta);
113  //std::cout << uncertainty << std::endl;
114  //std::cout << std::endl;
115  return uncertainty;
116 }
const TString p2
Definition: fwPaths.cc:13
double phiWidth() const
obtain phi and eta width of the Super Cluster
Definition: SuperCluster.h:66
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
double etaWidth() const
Definition: SuperCluster.h:67
EcalFunctionParameters & params()
const TString p1
Definition: fwPaths.cc:12
double energy() const
cluster energy
Definition: CaloCluster.h:149
const EcalClusterEnergyUncertaintyParameters * params_
float EcalClusterEnergyUncertainty::getValue ( const reco::BasicCluster ,
const EcalRecHitCollection  
) const
inlineoverridevirtual

Implements EcalClusterFunctionBaseClass.

Definition at line 29 of file EcalClusterEnergyUncertainty.cc.

29 { return 0.; };
void EcalClusterEnergyUncertainty::init ( const edm::EventSetup es)
overridevirtual

Implements EcalClusterFunctionBaseClass.

Definition at line 39 of file EcalClusterEnergyUncertainty.cc.

References edm::EventSetup::getData(), params_, and paramsToken_.

39 { params_ = &es.getData(paramsToken_); }
bool getData(T &iHolder) const
Definition: EventSetup.h:128
const EcalClusterEnergyUncertaintyParameters * params_
const edm::ESGetToken< EcalClusterEnergyUncertaintyParameters, EcalClusterEnergyUncertaintyParametersRcd > paramsToken_

Member Data Documentation

const EcalClusterEnergyUncertaintyParameters* EcalClusterEnergyUncertainty::params_ = nullptr
private

Definition at line 36 of file EcalClusterEnergyUncertainty.cc.

Referenced by checkInit(), getParameters(), getValue(), and init().

const edm::ESGetToken<EcalClusterEnergyUncertaintyParameters, EcalClusterEnergyUncertaintyParametersRcd> EcalClusterEnergyUncertainty::paramsToken_
private

Definition at line 35 of file EcalClusterEnergyUncertainty.cc.

Referenced by init().