-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParse_and_search.cc
More file actions
77 lines (61 loc) · 1.52 KB
/
Copy pathParse_and_search.cc
File metadata and controls
77 lines (61 loc) · 1.52 KB
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
// system include files
#include <memory>
#include <vector>
#include <algorithm>
#include <iostream>
#include <fstream>
std::vector<float> parse2(std::istream& in)
{
std::vector<float> output;
float num;
while( in ) {
std::cin >> num; // throwaway 1
std::cin >> num; // data2
output.push_back(num);
}
return output;
}
std::vector<int> parse1(std::istream& in)
{
std::
vector<int> output;
int num;
while( in ) {
std::cin >> num; // throwaway 1
output.push_back(num);
std::cin >> num; // data2
}
return output;
}
int main()
{
using namespace std;
//using namespace boost;
parse1(std::cin);
parse2(std::cin);
std::ifstream file("scoutinglumi.tsv");
//initialize vectors which will hold the run number and run luminosity.
vector<int> runs;
vector<float> runlumi;
runs = parse1(file);
runlumi = parse2(file);
//get the run number. This is some magic function defined in one of the libraries we're using, set to some number to run
int runNumber;
runNumber = 193833;
// Set the cuttoff Luminosity for the run
int lumiCutoff;
lumiCutoff = 100000;
//find the interator corresponding to the run number
int runtag;
runtag = find(runs.begin(),runs.end(), runNumber);
float luminosity;
luminosity = runlumi.at(runtag);
if(luminosity>lumiCutoff)
{
return;
}
//rest of the code goes here
//just a test output
cout << "Luminosity for run" << runNumber << "is" << luminosity;
return 0;
}