enable branches of new esd
[u/mrichter/AliRoot.git] / PWG0 / esdTrackCuts / run.C
CommitLineData
70d782ef 1void run(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE, const char* option = "")
2{
3 if (aProof)
4 {
5 TProof::Open("lxb6046");
6
7 // Enable the needed package
8 gProof->UploadPackage("STEERBase");
9 gProof->EnablePackage("STEERBase");
10 gProof->UploadPackage("ESD");
11 gProof->EnablePackage("ESD");
12 gProof->UploadPackage("ANALYSIS");
13 gProof->EnablePackage("ANALYSIS");
14 gProof->UploadPackage("PWG0base");
15 gProof->EnablePackage("PWG0base");
70d782ef 16 }
17 else
18 {
19 gSystem->Load("libVMC");
20 gSystem->Load("libTree");
21 gSystem->Load("libSTEERBase");
22 gSystem->Load("libESD");
23 gSystem->Load("libANALYSIS");
24 gSystem->Load("libPWG0base");
25 }
26
27 // Create chain of input files
28 gROOT->LoadMacro("../CreateESDChain.C");
29 chain = CreateESDChain(data, nRuns, offset);
30
31 // Create the analysis manager
32 mgr = new AliAnalysisManager("testAnalysis");
33
34 // selection of esd tracks
35 gROOT->ProcessLine(".L CreateCuts.C");
36 AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
37 if (!esdTrackCuts)
38 {
39 printf("ERROR: esdTrackCuts could not be created\n");
40 return;
41 }
42
43 TString taskName("AliCutTask.cxx+");
44 if (aDebug)
45 taskName += "+g";
46
47 // Create, add task
48 if (aProof) {
49 gProof->Load(taskName);
50 } else
51 gROOT->Macro(taskName);
52
53 task = new AliCutTask;
54 task->SetTrackCuts(esdTrackCuts);
55 mgr->AddTask(task);
56
57 // Add ESD handler
58 AliESDInputHandler* esdH = new AliESDInputHandler;
59 mgr->SetInputEventHandler(esdH);
60
61 // Attach input
62 cInput = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
63 mgr->ConnectInput(task, 0, cInput);
64
65 // Attach output
66 cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer);
67 mgr->ConnectOutput(task, 0, cOutput);
68
69 // Enable debug printouts
70 if (aDebug)
71 mgr->SetDebugLevel(2);
72
73 // Run analysis
74 mgr->InitAnalysis();
75 mgr->PrintStatus();
76 mgr->StartAnalysis((aProof) ? "proof" : "local", chain);
77}