-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example1.cpp
122 lines (95 loc) · 3.51 KB
/
Example1.cpp
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
* Delphes: a framework for fast simulation of a generic collider experiment
* Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <utility>
#include <vector>
#include "TApplication.h"
#include "TROOT.h"
#include "TSystem.h"
#include "TString.h"
#include "TClonesArray.h"
#include "TH2.h"
#include "THStack.h"
#include "TLegend.h"
#include "TLorentzVector.h"
#include "TPaveText.h"
#include "classes/DelphesClasses.h"
#include "ExRootAnalysis/ExRootResult.h"
#include "ExRootAnalysis/ExRootTreeBranch.h"
#include "ExRootAnalysis/ExRootTreeReader.h"
#include "ExRootAnalysis/ExRootTreeWriter.h"
#include "ExRootAnalysis/ExRootUtilities.h"
using namespace std;
//------------------------------------------------------------------------------
// Here you can put your analysis macro
#include "Example1.C"
//------------------------------------------------------------------------------
void usage(){
std::cerr << " Usage: Example1 <option(s)> SOURCES"
<< "Options:\n"
<< "\t-h,--help\t\tShow this help message\n"
<< "\t-i,--input\tSpecify the input filename\n"
<< "\t-o,--output\tSpecify the output filename\n"
<< "\t-d,--debug\tEnable debug\n"
<< "\t-g,--genJet\tEnable GenJet\n"
<< std::endl;
}
int main(int argc, char *argv[])
{
char *appName = "Example1";
TString inputFile(""), outputFile("");
bool isDebug=false;
bool isGenJet=false;
for (int i = 1; i < argc; i++) {
std::string arg = argv[i];
if ((arg == "-h") || (arg == "--help")) {
usage();
return 0;
} else if ((arg == "-i") || (arg == "--input")) {
i++;
if (i < argc) inputFile = TString(argv[i]);
else {
std::cerr << "--input option requires one argument." << std::endl;
return 1;
}
}else if ((arg == "-o") || (arg == "--output")) {
i++;
if (i < argc) outputFile = TString(argv[i]);
else {
std::cerr << "--output option requires one argument." << std::endl;
return 1;
}
} else if ((arg == "-d") || (arg == "--debug")) {
isDebug = true;
} else if ((arg == "-g") || (arg == "--genJet")) {
isGenJet = true;
}
}
if(inputFile==TString("") || outputFile==TString("") ){
usage();
return 1;
}
gROOT->SetBatch();
int appargc = 1;
char *appargv[] = {appName};
TApplication app(appName, &appargc, appargv);
//------------------------------------------------------------------------------
// Here you call your macro's main function
Example1(inputFile.Data(), outputFile.Data(), isGenJet, isDebug);
//------------------------------------------------------------------------------
}