3 * @author Alexander Hansen
4 * @date Wed Mar 23 12:11:33 2011
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.
24 * @ingroup pwg2_forward_flow
26 void MakeFlow(TString data = "",
35 Bool_t proof = kFALSE;
37 // --- Load libs ---------------------------------------------------
38 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
40 // --- Check for proof mode, and possibly upload pars --------------
42 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C");
43 if (!LoadPars(proof)) {
44 AliError("MakeFlow", "Failed to load PARs");
49 // --- Add to chain either AOD ------------------------------------
50 if (data.Length() <= 1) {
51 AliError("You didn't add a data file");
54 TChain* chain = new TChain("aodTree");
56 if (data.Contains(".txt"))
57 MakeChain(data, chain);
59 if (data.Contains(".root")) {
60 if (!TFile::Open(data.Data())) {
61 AliError(Form("AOD file %s not found", data.Data()));
64 chain->Add(data.Data());
67 // --- Initiate the event handlers --------------------------------
68 AliAnalysisManager *mgr = new AliAnalysisManager("Forward Flow",
69 "Flow in the forward region");
70 mgr->SetUseProgressBar(kTRUE, 10);
72 // --- AOD input handler -------------------------------------------
73 AliAODInputHandler *aodInputHandler = new AliAODInputHandler();
74 mgr->SetInputEventHandler(aodInputHandler);
76 // --- Create output handler ---------------------------------------
77 AliAODHandler* aodOut = new AliAODHandler();
78 mgr->SetOutputEventHandler(aodOut);
79 aodOut->SetOutputFileName("AliAODs.Flow.root");
81 // --- Add the tasks ---------------------------------------------
82 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskForwardFlow.C");
83 AddTaskForwardFlow(type, etabins, zVertex, addFlow, addFType, addFOrder);
85 // --- Run the analysis --------------------------------------------
87 if (!mgr->InitAnalysis()) {
88 Error("MakeFlow", "Failed to initialize analysis train!");
94 if (nevents == 0) mgr->StartAnalysis("local", chain);
95 if (nevents != 0) mgr->StartAnalysis("local", chain, nevents);
99 //----------------------------------------------------------------
100 void MakeChain(TString data = "", TChain* chain = 0)
102 // creates chain of files in a given directory or file containing a list.
104 // Open the input stream
106 in.open(data.Data());
108 // Read the input list of files and add them to the chain
114 if (line.Length() == 0)
117 if (TFile::Open(line))