forked from UCATLAS/xAODAnaHelpers
/
test_jetPlotExample.cxx
60 lines (43 loc) · 1.7 KB
/
test_jetPlotExample.cxx
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
#include "xAODRootAccess/Init.h"
#include "SampleHandler/SampleHandler.h"
#include "SampleHandler/ToolsDiscovery.h"
#include "EventLoop/Job.h"
#include "EventLoop/DirectDriver.h"
#include "SampleHandler/DiskListLocal.h"
#include <TSystem.h>
#include <xAODAnaHelpers/JetHistsAlgo.h>
#include <xAODAnaHelpers/TreeAlgo.h>
int main( int argc, char* argv[] ) {
// Take the submit directory from the input if provided:
std::string submitDir = "submitDir";
if( argc > 1 ) submitDir = argv[ 1 ];
// Set up the job for xAOD access:
xAOD::Init().ignore();
// Construct the samples to run on:
SH::SampleHandler sh;
// get the data path for xAODAnaHelpers/data
std::string dataPath = gSystem->ExpandPathName("$ROOTCOREBIN/data");
SH::DiskListLocal list (dataPath);
SH::scanDir (sh, list, "r20test_AOD.pool.root", "xAODAnaHelpers"); // specifying one particular sample
// Set the name of the input TTree. It's always "CollectionTree"
// for xAOD files.
sh.setMetaString( "nc_tree", "CollectionTree" );
// Print what we found:
sh.print();
// Create an EventLoop job:
EL::Job job;
job.sampleHandler( sh );
// Add our analysis to the job:
JetHistsAlgo* jk_AntiKt10LC = new JetHistsAlgo();
jk_AntiKt10LC->setName("AntiKt10/")->setConfig("$ROOTCOREBIN/data/xAODAnaHelpers/test_jetPlotExample.config");
// Add example tree
TreeAlgo* tree_AntiKt10LC = new TreeAlgo();
tree_AntiKt10LC->setName("fullTree")->setConfig("$ROOTCOREBIN/data/xAODAnaHelpers/test_treeExample.config");
// Attach algorithms
job.algsAdd( jk_AntiKt10LC );
job.algsAdd( tree_AntiKt10LC );
// Run the job using the local/direct driver:
EL::DirectDriver driver;
driver.submit( job, submitDir );
return 0;
}