CMS 3D CMS Logo

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 }
mps_fire.i
i
Definition: mps_fire.py:355
PFEnergyCalibrationHF::~PFEnergyCalibrationHF
~PFEnergyCalibrationHF()
Definition: PFEnergyCalibrationHF.cc:44
edm
HLT enums.
Definition: AlignableModifier.h:19
PFEnergyCalibrationHF::PFEnergyCalibrationHF
PFEnergyCalibrationHF()
Definition: PFEnergyCalibrationHF.cc:10
HLT_2018_cff.calibHF_a_EMonly
calibHF_a_EMonly
Definition: HLT_2018_cff.py:12324
std::operator<<
std::ostream & operator<<(std::ostream &out, const std::tuple< Types... > &value)
Definition: Utilities.h:32
end
#define end
Definition: vmac.h:39
PVValHelper::eta
Definition: PVValidationHelpers.h:69
PFEnergyCalibrationHF::energyHad
double energyHad(double uncalibratedEnergyHCAL, double eta, double phi)
Definition: PFEnergyCalibrationHF.cc:63
HLT_2018_cff.calibHF_b_EMHAD
calibHF_b_EMHAD
Definition: HLT_2018_cff.py:12393
PFEnergyCalibrationHF::energyEmHad
double energyEmHad(double uncalibratedEnergyECAL, double uncalibratedEnergyHCAL, double eta, double phi)
Definition: PFEnergyCalibrationHF.cc:76
HLT_2018_cff.calibHF_use
calibHF_use
Definition: HLT_2018_cff.py:12301
HLT_2018_cff.calibHF_b_HADonly
calibHF_b_HADonly
Definition: HLT_2018_cff.py:12327
calib
Definition: CalibElectron.h:12
HLT_2018_cff.calibHF_eta_step
calibHF_eta_step
Definition: HLT_2018_cff.py:12396
PFEnergyCalibrationHF::energyEm
double energyEm(double uncalibratedEnergyECAL, double eta, double phi)
Definition: PFEnergyCalibrationHF.cc:48
std
Definition: JetResolutionObject.h:76
PFEnergyCalibrationHF
Definition: PFEnergyCalibrationHF.h:24
PFEnergyCalibrationHF.h
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
HLT_2018_cff.calibHF_a_EMHAD
calibHF_a_EMHAD
Definition: HLT_2018_cff.py:12402
cuy.ii
ii
Definition: cuy.py:590
begin
#define begin
Definition: vmac.h:32