Adding pt and eta control plots, increasing ClassDef version
[u/mrichter/AliRoot.git] / PWG0 / esdTrackCuts / run.C
CommitLineData
c6d749e3 1void run(Char_t* data, Int_t nRuns=20, Int_t offset=0, Bool_t aDebug = kFALSE, Bool_t aProof = kFALSE, Bool_t mc = kFALSE, const char* option = "")
70d782ef 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");
70d782ef 14 gProof->UploadPackage("ANALYSIS");
15 gProof->EnablePackage("ANALYSIS");
16 gProof->UploadPackage("PWG0base");
17 gProof->EnablePackage("PWG0base");
70d782ef 18 }
19 else
20 {
21 gSystem->Load("libVMC");
22 gSystem->Load("libTree");
23 gSystem->Load("libSTEERBase");
24 gSystem->Load("libESD");
144ff489 25 gSystem->Load("libAOD");
70d782ef 26 gSystem->Load("libANALYSIS");
27 gSystem->Load("libPWG0base");
28 }
29
30 // Create chain of input files
31 gROOT->LoadMacro("../CreateESDChain.C");
32 chain = CreateESDChain(data, nRuns, offset);
33
34 // Create the analysis manager
35 mgr = new AliAnalysisManager("testAnalysis");
36
37 // selection of esd tracks
38 gROOT->ProcessLine(".L CreateCuts.C");
39 AliESDtrackCuts* esdTrackCuts = CreateTrackCuts();
40 if (!esdTrackCuts)
41 {
42 printf("ERROR: esdTrackCuts could not be created\n");
43 return;
44 }
45
46 TString taskName("AliCutTask.cxx+");
47 if (aDebug)
48 taskName += "+g";
49
50 // Create, add task
51 if (aProof) {
52 gProof->Load(taskName);
53 } else
54 gROOT->Macro(taskName);
55
56 task = new AliCutTask;
57 task->SetTrackCuts(esdTrackCuts);
58 mgr->AddTask(task);
59
60 // Add ESD handler
61 AliESDInputHandler* esdH = new AliESDInputHandler;
62 mgr->SetInputEventHandler(esdH);
c6d749e3 63
64 if (mc) {
65 task->EnableSecondaryStudy();
66 // Enable MC event handler
67 AliMCEventHandler* handler = new AliMCEventHandler;
68 handler->SetReadTR(kFALSE);
69 mgr->SetMCtruthEventHandler(handler);
70 }
70d782ef 71
72 // Attach input
73 cInput = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
74 mgr->ConnectInput(task, 0, cInput);
75
76 // Attach output
77 cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer);
78 mgr->ConnectOutput(task, 0, cOutput);
79
80 // Enable debug printouts
81 if (aDebug)
82 mgr->SetDebugLevel(2);
83
84 // Run analysis
85 mgr->InitAnalysis();
86 mgr->PrintStatus();
87 mgr->StartAnalysis((aProof) ? "proof" : "local", chain);
88}