removing PWG0depHelper
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / run.C
CommitLineData
0f67a57c 1void run(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE, Bool_t mc = kTRUE, 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");
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;
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("AlidNdEtaTask.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 AlidNdEtaTask(option);
54 task->SetTrackCuts(esdTrackCuts);
55 task->SetAnalysisMode(AlidNdEtaTask::kSPD);
56
57 if (mc)
58 task->SetReadMC();
59
60 mgr->AddTask(task);
61
62 if (mc) {
63 // Enable MC event handler
64 AliMCEventHandler* handler = new AliMCEventHandler;
65 handler->SetReadTR(kFALSE);
66 mgr->SetMCtruthEventHandler(handler);
67 }
68
69 // Add ESD handler
70 AliESDInputHandler* esdH = new AliESDInputHandler;
71 mgr->SetInputEventHandler(esdH);
72
73 // Attach input
74 cInput = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
75 mgr->ConnectInput(task, 0, cInput);
76
77 // Attach output
78 cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer);
79 mgr->ConnectOutput(task, 0, cOutput);
80
81 // Enable debug printouts
82 if (aDebug)
83 mgr->SetDebugLevel(2);
84
85 // Run analysis
86 mgr->InitAnalysis();
87 mgr->PrintStatus();
88
89 mgr->StartAnalysis((aProof) ? "proof" : "local", chain);
90}