Removed call to AliRawReader::SelectEvent. Changes to obey effC++ coding
[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");
144ff489 12 gProof->UploadPackage("AOD");
13 gProof->EnablePackage("AOD");
0f67a57c 14 gProof->UploadPackage("ANALYSIS");
15 gProof->EnablePackage("ANALYSIS");
16 gProof->UploadPackage("PWG0base");
17 gProof->EnablePackage("PWG0base");
18 }
19 else
20 {
21 gSystem->Load("libVMC");
22 gSystem->Load("libTree");
23 gSystem->Load("libSTEERBase");
24 gSystem->Load("libESD");
25 gSystem->Load("libANALYSIS");
26 gSystem->Load("libPWG0base");
27 }
28
29 // Create chain of input files
30 gROOT->LoadMacro("../CreateESDChain.C");
31 chain = CreateESDChain(data, nRuns, offset);
32
33 // Create the analysis manager
34 mgr = new AliAnalysisManager;
35
36 // selection of esd tracks
37 gROOT->ProcessLine(".L CreateCuts.C");
38 AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
39 if (!esdTrackCuts)
40 {
41 printf("ERROR: esdTrackCuts could not be created\n");
42 return;
43 }
44
45 TString taskName("AlidNdEtaTask.cxx+");
46 if (aDebug)
47 taskName += "+g";
48
49 // Create, add task
50 if (aProof) {
51 gProof->Load(taskName);
52 } else
53 gROOT->Macro(taskName);
54
55 task = new AlidNdEtaTask(option);
56 task->SetTrackCuts(esdTrackCuts);
57 task->SetAnalysisMode(AlidNdEtaTask::kSPD);
58
59 if (mc)
60 task->SetReadMC();
61
62 mgr->AddTask(task);
63
64 if (mc) {
65 // Enable MC event handler
66 AliMCEventHandler* handler = new AliMCEventHandler;
67 handler->SetReadTR(kFALSE);
68 mgr->SetMCtruthEventHandler(handler);
69 }
70
71 // Add ESD handler
72 AliESDInputHandler* esdH = new AliESDInputHandler;
73 mgr->SetInputEventHandler(esdH);
74
75 // Attach input
76 cInput = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
77 mgr->ConnectInput(task, 0, cInput);
78
79 // Attach output
80 cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer);
81 mgr->ConnectOutput(task, 0, cOutput);
82
83 // Enable debug printouts
84 if (aDebug)
85 mgr->SetDebugLevel(2);
86
87 // Run analysis
88 mgr->InitAnalysis();
89 mgr->PrintStatus();
90
91 mgr->StartAnalysis((aProof) ? "proof" : "local", chain);
92}