Compilation on Windows/Cygwin
[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
70d782ef 37 TString taskName("AliCutTask.cxx+");
38 if (aDebug)
39 taskName += "+g";
40
41 // Create, add task
42 if (aProof) {
43 gProof->Load(taskName);
44 } else
45 gROOT->Macro(taskName);
46
47 task = new AliCutTask;
8074859b 48
49 AliPWG0Helper::AnalysisMode analysisMode = AliPWG0Helper::kTPC;
50 task->SetAnalysisMode(analysisMode);
51
52 if (analysisMode != AliPWG0Helper::kSPD)
53 {
54 // selection of esd tracks
55 gROOT->ProcessLine(".L ../CreateStandardCuts.C");
56 AliESDtrackCuts* esdTrackCuts = CreateTrackCuts(analysisMode);
57 if (!esdTrackCuts)
58 {
59 printf("ERROR: esdTrackCuts could not be created\n");
60 return;
61 }
62
63 task->SetTrackCuts(esdTrackCuts);
64 }
65
70d782ef 66 mgr->AddTask(task);
67
68 // Add ESD handler
69 AliESDInputHandler* esdH = new AliESDInputHandler;
70 mgr->SetInputEventHandler(esdH);
c6d749e3 71
72 if (mc) {
73 task->EnableSecondaryStudy();
74 // Enable MC event handler
75 AliMCEventHandler* handler = new AliMCEventHandler;
76 handler->SetReadTR(kFALSE);
77 mgr->SetMCtruthEventHandler(handler);
78 }
70d782ef 79
80 // Attach input
81 cInput = mgr->CreateContainer("cInput", TChain::Class(), AliAnalysisManager::kInputContainer);
82 mgr->ConnectInput(task, 0, cInput);
83
84 // Attach output
85 cOutput = mgr->CreateContainer("cOutput", TList::Class(), AliAnalysisManager::kOutputContainer);
86 mgr->ConnectOutput(task, 0, cOutput);
87
88 // Enable debug printouts
89 if (aDebug)
90 mgr->SetDebugLevel(2);
91
92 // Run analysis
93 mgr->InitAnalysis();
94 mgr->PrintStatus();
95 mgr->StartAnalysis((aProof) ? "proof" : "local", chain);
96}