-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlotMakingTools.C
More file actions
56 lines (52 loc) · 1.6 KB
/
PlotMakingTools.C
File metadata and controls
56 lines (52 loc) · 1.6 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
#ifndef MAKEPLOTTOOLS_H
#define MAKEPLOTTOOLS_H
#include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include "TH1F.h"
#include "TCanvas.h"
#include "THStack.h"
#include "TStyle.h"
#include "TLegend.h"
#include "TLine.h"
#include "TLatex.h"
#include "TChain.h"
#include "TColor.h"
#include "TCut.h"
#include "TROOT.h"
//Parse Parameters from options input string
std::vector <std::string> GetParms(std::string blah){
int a = -1;
int length = blah.length();
std::vector <std::string> options;
while (a < length){
int temp = a;
a = blah.find("--", temp+1);
if (a <= temp) break;
int b = blah.find("--", a+3)-1;
unsigned int myLength = b - a - 2;
std::string mySubstring;
if (a + 2 + myLength > blah.length()) mySubstring = blah.substr(a+2);
else mySubstring = blah.substr(a+2, b-a-2);
options.push_back(mySubstring);
}
return options;
}
//Turn parsed argument from string into const char*. Remove leading and trailing whitespace
std::string getString(std::string initial, std::string result){
int temp = initial.find(result);
std::string substring = initial.substr(temp+result.length());
while (substring[0] == ' '){
std::string temp2 = substring.substr(1,substring.length()-1);
substring = temp2;
}
while (substring[substring.length()-1] == ' '){
std::string temp2 = substring.substr(0,substring.length()-1);
substring = temp2;
}
if (substring.length() > 4 && substring.substr(substring.length()-4, substring.length()-1) == ".pdf") substring = substring.substr(0, substring.length()-4);
return substring;
}
#endif