3 * @author Alexander Hansen
4 * @date Wed Mar 23 12:11:33 2011
6 * @brief Analyse AODs for flow
8 * @ingroup pwg2_forward_scripts_makers
12 * Script to analyse AOD input for flow
14 * Takes either a single (AOD) .root file as input or a .txt
15 * The .txt file is expected to contain the path to the files
16 * from the current directory or the absolute path.
18 * @param data Input data (directory, list, or ROOT file)
19 * @param nevents Number of events to scan
20 * @param type Type of analysis (v<n>)
21 * @param etabins How may eta bins to make
22 * @param addFlow If true, add flow to MC particles
23 * @param addFType Which type of flow to add to MC particles
24 * @param addFOrder Order of flow to add to MC particles
27 * @ingroup pwg2_forward_flow
29 void MakeFlow(TString data = "",
38 Bool_t proof = kFALSE;
40 // --- Load libs ---------------------------------------------------
41 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
43 // --- Check for proof mode, and possibly upload pars --------------
45 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C");
46 if (!LoadPars(proof)) {
47 AliError("MakeFlow", "Failed to load PARs");
52 // --- Set the macro path ------------------------------------------
53 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2:"
54 "$ALICE_ROOT/ANALYSIS/macros",
55 gROOT->GetMacroPath()));
57 // --- Add to chain either AOD ------------------------------------
58 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeChain.C");
59 TChain* chain = MakeChain("AOD", data.Data(), true);
60 // If 0 or less events is select, choose all
61 if (nEvents <= 0) nEvents = chain->GetEntries();
63 // --- Initiate the event handlers --------------------------------
64 AliAnalysisManager *mgr =
65 new AliAnalysisManager("Forward Flow",
66 "Flow in the forward region");
68 // --- AOD input handler -------------------------------------------
69 AliAODInputHandler *aodInputHandler = new AliAODInputHandler();
70 mgr->SetInputEventHandler(aodInputHandler);
72 // --- Add the tasks ---------------------------------------------
73 gROOT->LoadMacro("AddTaskForwardFlow.C");
74 AddTaskForwardFlow(type, etabins, addFlow, addFType, addFOrder);
76 // --- Run the analysis --------------------------------------------
78 if (!mgr->InitAnalysis()) {
79 Error("MakeFlow", "Failed to initialize analysis train!");
84 if (proof) mgr->SetDebugLevel(3);
85 if (mgr->GetDebugLevel() < 1 && !proof)
86 mgr->SetUseProgressBar(kTRUE,chain->GetEntries() < 10000 ? 10 : 100);
89 if (nevents == 0) mgr->StartAnalysis("local", chain);
90 if (nevents != 0) mgr->StartAnalysis("local", chain, nevents);
94 //----------------------------------------------------------------
95 void MakeChain(TString data = "", TChain* chain = 0)
97 // creates chain of files in a given directory or file containing a list.
99 // Open the input stream
101 in.open(data.Data());
103 // Read the input list of files and add them to the chain
109 if (line.Length() == 0)
112 if (TFile::Open(line))