-
Notifications
You must be signed in to change notification settings - Fork 0
/
JECUncertainty_Sapta_New.C
66 lines (54 loc) · 1.45 KB
/
JECUncertainty_Sapta_New.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
bool JecUnc(double jetPt, double jetEta, double &jecUp, double &jecDown)
{
if (jetPt<10.0 || abs(jetEta)>5.4) return false;
float jetEtalow;
float jetEtahigh;
std::ifstream file("Summer13_V5_DATA_UncertaintySources_AK5PF.txt");
std::string s;
while (!file.eof())
{
if (!getline(file, s)) break;
std::stringstream ss(s);
std::vector<std::string> line;
while (ss)
{
std::string number;
if (!getline(ss, number, ' ')) break;
line.push_back(number);
}
jetEtalow = atof(line.at(0).c_str());
jetEtahigh = atof(line.at(1).c_str());
if(jetEta>=jetEtalow && jetEta<jetEtahigh)
{
cout << "jetEta = " << jetEtalow << " , " << jetEtahigh << jetPt << endl;
for(int i=0; i<43; i++)
{
if(jetPt>=atof(line.at(3*i+3).c_str()) && jetPt<=atof(line.at(3*i+6).c_str()))
{
jecUp = atof(line.at(3*i+4).c_str());
jecDown = atof(line.at(3*i+5).c_str());
return true;
}
}
jecUp = atof(line.at(133).c_str());
jecDown = atof(line.at(134).c_str());
return true;
}
}
}
void JecUnc_Sapta()
{
double thisJetpT = 4000;
double thisJeteta = 1.3;
double jecUp = 0;
double jecDown = 0;
if(JecUnc(thisJetpT, thisJeteta, jecUp, jecDown)){
cout << "jecUp = " << jecUp << endl;
cout << "jecDown = " << jecDown << endl;
}
}