CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PFEnergyCalibrationHF.cc
Go to the documentation of this file.
2 #include <TMath.h>
3 #include <cmath>
4 #include <vector>
5 #include <TF1.h>
6 
7 using namespace std;
8 using namespace edm;
9 
11  calibHF_use_ = false;
12  calibHF_eta_step_.push_back(0.00);
13  calibHF_eta_step_.push_back(2.90);
14  calibHF_eta_step_.push_back(3.00);
15  calibHF_eta_step_.push_back(3.20);
16  calibHF_eta_step_.push_back(4.20);
17  calibHF_eta_step_.push_back(4.40);
18  calibHF_eta_step_.push_back(4.60);
19  calibHF_eta_step_.push_back(4.80);
20  calibHF_eta_step_.push_back(5.20);
21  calibHF_eta_step_.push_back(5.40);
22  for (unsigned int i = 0; i < calibHF_eta_step_.size(); ++i) {
23  calibHF_a_EMonly_.push_back(1.00);
24  calibHF_b_HADonly_.push_back(1.00);
25  calibHF_a_EMHAD_.push_back(1.00);
26  calibHF_b_EMHAD_.push_back(1.00);
27  }
28 }
29 
31  const std::vector<double>& calibHF_eta_step,
32  const std::vector<double>& calibHF_a_EMonly,
33  const std::vector<double>& calibHF_b_HADonly,
34  const std::vector<double>& calibHF_a_EMHAD,
35  const std::vector<double>& calibHF_b_EMHAD) {
36  calibHF_use_ = calibHF_use;
37  calibHF_eta_step_ = calibHF_eta_step;
38  calibHF_a_EMonly_ = calibHF_a_EMonly;
39  calibHF_b_HADonly_ = calibHF_b_HADonly;
40  calibHF_a_EMHAD_ = calibHF_a_EMHAD;
41  calibHF_b_EMHAD_ = calibHF_b_EMHAD;
42 }
43 
45  //--- nothing to be done yet
46 }
47 
48 double PFEnergyCalibrationHF::energyEm(double uncalibratedEnergyECAL, double eta, double phi) {
49  double calibrated = 0.0;
50  //find eta bin. default : 0.00;2.90;3.00;3.20;4.20;4.40;4.60;4.80;5.20;5.40;
51  int ietabin = 0;
52  for (unsigned int i = 0; i < calibHF_eta_step_.size(); ++i) {
53  if ((fabs(eta)) >= calibHF_eta_step_[i]) {
54  ietabin = i;
55  }
56  }
57  calibrated = uncalibratedEnergyECAL * calibHF_a_EMonly_[ietabin];
58  return calibrated;
59 
60  // return calibrated;
61 }
62 
63 double PFEnergyCalibrationHF::energyHad(double uncalibratedEnergyHCAL, double eta, double phi) {
64  double calibrated = 0.0;
65  //find eta bin. default : 0.00;2.90;3.00;3.20;4.20;4.40;4.60;4.80;5.20;5.40;
66  int ietabin = 0;
67  for (unsigned int i = 0; i < calibHF_eta_step_.size(); ++i) {
68  if ((fabs(eta)) >= calibHF_eta_step_[i]) {
69  ietabin = i;
70  }
71  }
72  calibrated = uncalibratedEnergyHCAL * calibHF_b_HADonly_[ietabin];
73  return calibrated;
74 }
75 
76 double PFEnergyCalibrationHF::energyEmHad(double uncalibratedEnergyECAL,
77  double uncalibratedEnergyHCAL,
78  double eta,
79  double phi) {
80  double calibrated = 0.0;
81  //find eta bin. default : 0.00;2.90;3.00;3.20;4.20;4.40;4.60;4.80;5.20;5.40+;
82  int ietabin = 0;
83  for (unsigned int i = 0; i < calibHF_eta_step_.size(); ++i) {
84  if ((fabs(eta)) >= calibHF_eta_step_[i]) {
85  ietabin = i;
86  }
87  }
88  calibrated = uncalibratedEnergyECAL * calibHF_a_EMHAD_[ietabin] + uncalibratedEnergyHCAL * calibHF_b_EMHAD_[ietabin];
89  return calibrated;
90 }
91 
92 std::ostream& operator<<(std::ostream& out, const PFEnergyCalibrationHF& calib) {
93  if (!out)
94  return out;
95  out << "PFEnergyCalibrationHF -- " << endl;
96  int ii = 0;
97  for (std::vector<double>::const_iterator iteta = (calib.getcalibHF_eta_step()).begin();
98  iteta != (calib.getcalibHF_eta_step()).end();
99  ++iteta) {
100  //double currenteta = *iteta;
101  out << " i " << ii << ",";
102  out << "use " << calib.getcalibHF_use() << ",";
103  out << "currenteta " << calib.getcalibHF_eta_step()[ii] << ",";
104  out << "calibHF_a_EMonly_ " << calib.getcalibHF_a_EMonly()[ii] << ",";
105  out << "calibHF_b_HADonly_ " << calib.getcalibHF_b_HADonly()[ii] << ",";
106  out << "calibHF_a_EMHAD_ " << calib.getcalibHF_a_EMHAD()[ii] << ",";
107  out << "calibHF_b_EMHAD_ " << calib.getcalibHF_b_EMHAD()[ii] << ",";
108  out << endl;
109  ii++;
110  }
111 
112  return out;
113 }
tuple calibHF_b_EMHAD
const std::vector< double > & getcalibHF_a_EMonly() const
const std::vector< double > & getcalibHF_eta_step() const
std::ostream & operator<<(std::ostream &out, const std::tuple< Types...> &value)
Definition: Utilities.h:32
tuple calibHF_eta_step
const std::vector< double > & getcalibHF_b_EMHAD() const
tuple calibHF_b_HADonly
int ii
Definition: cuy.py:589
double energyEmHad(double uncalibratedEnergyECAL, double uncalibratedEnergyHCAL, double eta, double phi)
const std::vector< double > & getcalibHF_a_EMHAD() const
double energyEm(double uncalibratedEnergyECAL, double eta, double phi)
const bool & getcalibHF_use() const
tuple calibHF_a_EMonly
double energyHad(double uncalibratedEnergyHCAL, double eta, double phi)
tuple calibHF_a_EMHAD
string end
Definition: dataset.py:937
const std::vector< double > & getcalibHF_b_HADonly() const