-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDTTnPConfig.C
104 lines (78 loc) · 3.25 KB
/
DTTnPConfig.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#include "DTTnPConfig.h"
SampleConfig::SampleConfig(boost::property_tree::ptree::value_type & vt)
{
try
{
nEvents = vt.second.get<Float_t>("nEvents");
fileNames = toArrayTS(vt.second.get<std::string>("fileName").c_str());
outputFileName = TString(vt.second.get<std::string>("outputFileName").c_str());
runs = toArrayI(vt.second.get<std::string>("runs"));
sampleName = TString(vt.first.c_str());
}
catch (boost::property_tree::ptree_bad_data bd)
{
std::cout << "[SampleConfig::SampleConfig] Can't get data : has error : "
<< bd.what() << std::endl;
throw std::runtime_error("Bad INI variables");
}
}
std::vector<int> SampleConfig::toArrayI(const std::string& entries)
{
std::vector<int> result;
std::stringstream sentries(entries);
std::string item;
while(std::getline(sentries, item, ','))
result.push_back(atoi(item.c_str()));
return result;
}
std::vector<TString> SampleConfig::toArrayTS(const std::string& entries)
{
std::vector<TString> result;
std::stringstream sentries(entries);
std::string item;
while(std::getline(sentries, item, ','))
result.push_back(TString(item.c_str()));
return result;
}
TagAndProbeConfig::TagAndProbeConfig(boost::property_tree::ptree::value_type & vt)
{
try
{
hlt_path = vt.second.get<std::string>("hlt_path");
pair_minInvMass = vt.second.get<Float_t>("pair_minInvMass");
pair_maxInvMass = vt.second.get<Float_t>("pair_maxInvMass");
pair_maxAbsDz = vt.second.get<Float_t>("pair_maxAbsDz");
pair_minDr = vt.second.get<Float_t>("pair_minDr");
tag_minPt = vt.second.get<Float_t>("tag_minPt");
tag_isoCut = vt.second.get<Float_t>("tag_isoCut");
tag_hltFilter = vt.second.get<std::string>("tag_hltFilter");
tag_hltDrCut = vt.second.get<Float_t>("tag_hltDrCut");
probe_minPt = vt.second.get<Float_t>("probe_minPt");
probe_maxAbsEta = toArray(vt.second.get<std::string>("probe_maxAbsEta"));
probe_isoCut = vt.second.get<Float_t>("probe_isoCut");
probe_minTrkLayers = vt.second.get<Int_t>("probe_minTrkLayers");
probe_minPixelHits = vt.second.get<Int_t>("probe_minPixelHits");
probe_maxBorderDx = vt.second.get<Float_t>("probe_maxBorderDx");
probe_maxBorderDy = vt.second.get<Float_t>("probe_maxBorderDy");
probe_minNMatchedSeg = vt.second.get<Int_t>("probe_minNMatchedSeg");
probe_minNRPCLayers = vt.second.get<Int_t>("probe_minNRPCLayers");
passing_probe_maxTkSegDx = vt.second.get<Float_t>("passing_probe_maxTkSegDx");
passing_probe_maxTkSegDy = vt.second.get<Float_t>("passing_probe_maxTkSegDy");
passing_probe_maxTkSegDr = vt.second.get<Float_t>("passing_probe_maxTkSegDr");
}
catch (boost::property_tree::ptree_bad_data bd)
{
std::cout << "[TagAndProbeConfig::TagAndProbeConfig] Can't get data : has error : "
<< bd.what() << std::endl;
throw std::runtime_error("Bad INI variables");
}
}
std::vector<Float_t> TagAndProbeConfig::toArray(const std::string& entries)
{
std::vector<Float_t> result;
std::stringstream sentries(entries);
std::string item;
while(std::getline(sentries, item, ','))
result.push_back(atof(item.c_str()));
return result;
}