CMS 3D CMS Logo

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