forked from reanahub/reana-demo-alice-pt-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrunEx01.C
102 lines (88 loc) · 3.67 KB
/
runEx01.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
// run.C
//
// Template run macro for AliBasicTask.cxx/.h with example layout of
// physics selections and options, in macro and task.
//
// Author: Arvinder Palaha
//
class AliAnalysisGrid;
//______________________________________________________________________________
void runEx01()
{
// load libraries
gSystem->Load("libCore.so");
gSystem->Load("libGeom.so");
gSystem->Load("libVMC.so");
gSystem->Load("libPhysics.so");
gSystem->Load("libTree.so");
gSystem->Load("libMinuit.so");
gSystem->Load("libProof.so");
gSystem->Load("libSTEERBase.so");
gSystem->Load("libESD.so");
gSystem->Load("libAOD.so");
gSystem->Load("libCDB.so");
gSystem->Load("libANALYSIS.so");
gSystem->Load("libOADB.so");
gSystem->Load("libANALYSISalice.so");
gSystem->Load("libRAWDatabase.so");
gSystem->Load("libRAWDatarec.so");
gSystem->Load("libSTEER.so");
gSystem->Load("libHLTbase.so");
gSystem->Load("libTRDbase.so");
gSystem->Load("libTPCbase.so");
gSystem->Load("libTPCrec.so");
// add aliroot indlude path
gROOT->ProcessLine(Form(".include %s/include",gSystem->ExpandPathName("$ALICE_ROOT")));
gROOT->SetStyle("Plain");
// analysis manager
AliAnalysisManager* mgr = new AliAnalysisManager("Example01");
// create the alien handler and attach it to the manager
AliAnalysisGrid *plugin = CreateAlienHandler();
mgr->SetGridHandler(plugin);
AliVEventHandler* iH = new AliESDInputHandler();
// AliAODInputHandler* iH = new AliAODInputHandler();
// iH->SetInactiveBranches("tracks. vertices. v0s. cascades. jets. caloClusters. fmdClusters. pmdClusters. dimuons. AliAODZDC");
// iH->SetInactiveBranches("*");
// iH->SetCheckStatistics(kTRUE);
mgr->SetInputEventHandler(iH);
// create task
gROOT->LoadMacro("AliAnalysisTaskEx01.cxx+g");
AliAnalysisTaskSE* task = new AliAnalysisTaskEx01("taskpt");
task->SelectCollisionCandidates(AliVEvent::kMB); // if physics selection performed in UserExec(), this line should be commented
mgr->AddTask(task);
// set output root file name for different analysis
TString outfilename = "AnalysisResults.root";
// create containers for input/output
AliAnalysisDataContainer *cinput = mgr->GetCommonInputContainer();
AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("coutput1", TList::Class(), AliAnalysisManager::kOutputContainer, outfilename);
// connect input/output
mgr->ConnectInput(task, 0, cinput);
mgr->ConnectOutput(task, 1, coutput1);
// enable debug printouts
mgr->SetDebugLevel(1);
// mgr->SetNSysInfo(100);
if (!mgr->InitAnalysis()) return;
mgr->PrintStatus();
// Mag field
AliCDBManager *cdb = AliCDBManager::Instance();
cdb->SetDefaultStorage("local://");
cdb->SetRun(0);
cdb->InitFromSnapshot("OCDB.root");
AliGRPManager *grp= new AliGRPManager();
printf("#### Loading GRP to init B-field...\n");
if(!grp->ReadGRPEntry()) AliFatal("Cannot get GRP entry");
if(!grp->SetMagField()) AliFatal("Problem with magnetic field setup");
// start analysis
Printf("Starting Analysis....");
mgr->StartAnalysis("local");
}
//______________________________________________________________________________
AliAnalysisGrid* CreateAlienHandler()
{
AliAnalysisAlien *plugin = new AliAnalysisAlien();
// Set the run mode (can be "full", "test", "offline", "submit" or "terminate")
plugin->SetRunMode("test");
// Plugin test mode works only providing a file containing test file locations, used in "local" mode also
plugin->SetFileForTestMode("data.txt"); // file should contain path name to a local directory containg *ESDs.root etc
return plugin;
}