CMS 3D CMS Logo

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 &)
 
const EcalClusterEnergyUncertaintyParametersgetParameters () const
 
float getValue (const reco::BasicCluster &, const EcalRecHitCollection &) const override
 
float getValue (const reco::SuperCluster &, const int mode) 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

edm::ESHandle< EcalClusterEnergyUncertaintyParametersesParams_
 
const EcalClusterEnergyUncertaintyParametersparams_
 

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 17 of file EcalClusterEnergyUncertainty.cc.

Constructor & Destructor Documentation

◆ EcalClusterEnergyUncertainty()

EcalClusterEnergyUncertainty::EcalClusterEnergyUncertainty ( const edm::ParameterSet )
inline

Definition at line 19 of file EcalClusterEnergyUncertainty.cc.

19 {};

Member Function Documentation

◆ checkInit()

void EcalClusterEnergyUncertainty::checkInit ( ) const

Definition at line 43 of file EcalClusterEnergyUncertainty.cc.

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

References Exception, and params_.

Referenced by getValue().

◆ getParameters()

const EcalClusterEnergyUncertaintyParameters* EcalClusterEnergyUncertainty::getParameters ( ) const
inline

Definition at line 22 of file EcalClusterEnergyUncertainty.cc.

22 { return params_; }

References params_.

◆ getValue() [1/2]

float EcalClusterEnergyUncertainty::getValue ( const reco::BasicCluster ,
const EcalRecHitCollection  
) const
inlineoverridevirtual

Implements EcalClusterFunctionBaseClass.

Definition at line 28 of file EcalClusterEnergyUncertainty.cc.

28 { return 0.; };

◆ getValue() [2/2]

float EcalClusterEnergyUncertainty::getValue ( const reco::SuperCluster superCluster,
const int  mode 
) const
overridevirtual

Implements EcalClusterFunctionBaseClass.

Definition at line 52 of file EcalClusterEnergyUncertainty.cc.

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

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

◆ init()

void EcalClusterEnergyUncertainty::init ( const edm::EventSetup es)
overridevirtual

Implements EcalClusterFunctionBaseClass.

Definition at line 38 of file EcalClusterEnergyUncertainty.cc.

38  {
40  params_ = esParams_.product();
41 }

References esParams_, edm::EventSetup::get(), get, and params_.

Member Data Documentation

◆ esParams_

edm::ESHandle<EcalClusterEnergyUncertaintyParameters> EcalClusterEnergyUncertainty::esParams_
private

Definition at line 34 of file EcalClusterEnergyUncertainty.cc.

Referenced by init().

◆ params_

const EcalClusterEnergyUncertaintyParameters* EcalClusterEnergyUncertainty::params_
private

Definition at line 35 of file EcalClusterEnergyUncertainty.cc.

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

ALCARECOPromptCalibProdSiPixelAli0T_cff.mode
mode
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:96
EcalClusterEnergyUncertainty::esParams_
edm::ESHandle< EcalClusterEnergyUncertaintyParameters > esParams_
Definition: EcalClusterEnergyUncertainty.cc:34
EcalClusterEnergyUncertainty::checkInit
void checkInit() const
Definition: EcalClusterEnergyUncertainty.cc:43
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
reco::SuperCluster::phiWidth
double phiWidth() const
obtain phi and eta width of the Super Cluster
Definition: SuperCluster.h:66
PVValHelper::eta
Definition: PVValidationHelpers.h:70
p2
double p2[4]
Definition: TauolaWrapper.h:90
EcalClusterEnergyUncertaintyParametersRcd
Definition: EcalClusterEnergyUncertaintyParametersRcd.h:5
reco::CaloCluster::eta
double eta() const
pseudorapidity of cluster centroid
Definition: CaloCluster.h:181
EcalClusterEnergyUncertainty::params_
const EcalClusterEnergyUncertaintyParameters * params_
Definition: EcalClusterEnergyUncertainty.cc:35
p1
double p1[4]
Definition: TauolaWrapper.h:89
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
get
#define get
EcalFunParams::params
EcalFunctionParameters & params()
Definition: EcalFunctionParameters.h:13
Exception
Definition: hltDiff.cc:245
reco::SuperCluster::etaWidth
double etaWidth() const
Definition: SuperCluster.h:67
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
reco::CaloCluster::energy
double energy() const
cluster energy
Definition: CaloCluster.h:149