]>
Commit | Line | Data |
---|---|---|
9d05ffeb | 1 | /** |
2 | * Script to analyse AOD input for flow | |
3 | * | |
4 | * @par Inputs: | |
5 | * - | |
6 | * | |
7 | * @par Outputs: | |
8 | * - | |
9 | * | |
10 | */ | |
11 | void MakeFlow(TString path = "", | |
12 | Bool_t recursive = true, | |
13 | Int_t nevents = 100, | |
14 | TString type = "", | |
15 | Int_t etabins) | |
16 | { | |
17 | Bool_t proof = false; | |
18 | ||
19 | // --- Load libs ------------------------------------------------- | |
20 | gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C"); | |
21 | ||
22 | // --- Check for proof mode, and possibly upload pars -------------- | |
23 | if (proof> 0) { | |
24 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C"); | |
25 | if (!LoadPars(proof)) { | |
26 | Error("MakeAOD", "Failed to load PARs"); | |
27 | return; | |
28 | } | |
29 | } | |
30 | ||
31 | // --- Add to chain either ESD or AOD ---------------------------- | |
32 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeChain.C"); | |
33 | TChain* chain = MakeChain("AOD", path, recursive); | |
34 | // If 0 or less events is select, choose all | |
35 | if (nevents <= 0) nevents = chain->GetEntries(); | |
36 | ||
37 | // --- Initiate the event handlers ------------------------------- | |
38 | AliAnalysisManager *mgr = new AliAnalysisManager("Forward Flow", | |
39 | "Flow in forward region"); | |
40 | mgr->SetUseProgressBar(kTRUE); | |
41 | ||
42 | // --- AOD input handler ------------------------------------------- | |
43 | AliAODInputHandler *aodInputHandler = new AliAODInputHandler(); | |
44 | mgr->SetInputEventHandler(aodInputHandler); | |
45 | ||
46 | // --- Create output handler --------------------------------------- | |
47 | AliAODHandler* aodOut = new AliAODHandler(); | |
48 | mgr->SetOutputEventHandler(aodOut); | |
49 | aodOut->SetOutputFileName("AliAODs.Flow.root"); | |
50 | ||
51 | // --- Add the tasks --------------------------------------------- | |
52 | gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskForwardFlow.C"); | |
53 | AddTaskForwardFlow(type.Data(), etabins); | |
54 | ||
55 | // --- Run the analysis -------------------------------------------- | |
56 | TStopwatch t; | |
57 | if (!mgr->InitAnalysis()) { | |
58 | Error("MakeFlow", "Failed to initialize analysis train!"); | |
59 | return; | |
60 | } | |
61 | mgr->PrintStatus(); | |
62 | ||
63 | t.Start(); | |
64 | if (nevents == 0) mgr->StartAnalysis("local", chain); | |
65 | if (nevents != 0) mgr->StartAnalysis("local", chain, nevents); | |
66 | t.Stop(); | |
67 | t.Print(); | |
68 | } | |
69 | // | |
70 | // EOF | |
71 | // |