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 = "",
36 Bool_t proof = kFALSE;
38 // --- Load libs ---------------------------------------------------
39 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
41 // --- Check for proof mode, and possibly upload pars --------------
43 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C");
44 if (!LoadPars(proof)) {
45 AliError("MakeFlow", "Failed to load PARs");
50 // --- Set the macro path ------------------------------------------
51 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWG2/FORWARD/analysis2:"
52 "$ALICE_ROOT/ANALYSIS/macros",
53 gROOT->GetMacroPath()));
55 // --- Add to chain either AOD ------------------------------------
57 AliError("You didn't add a data file");
60 TChain* chain = new TChain("aodTree");
62 if (data.Contains(".txt")) MakeChain(data, chain);
64 if (data.Contains(".root")) {
65 TFile* test = TFile::Open(data.Data())
67 AliError(Form("AOD file %s not found", data.Data()));
70 test->Close(); // Remember to close!
71 chain->Add(data.Data());
74 // --- Initiate the event handlers --------------------------------
75 AliAnalysisManager *mgr = new AliAnalysisManager("Forward Flow",
76 "Flow in the forward region");
78 // --- AOD input handler -------------------------------------------
79 AliAODInputHandler *aodInputHandler = new AliAODInputHandler();
80 mgr->SetInputEventHandler(aodInputHandler);
82 // --- Create output handler ---------------------------------------
83 AliAODHandler* aodOut = new AliAODHandler();
84 mgr->SetOutputEventHandler(aodOut);
85 aodOut->SetOutputFileName("AliAODs.Flow.root");
87 // --- Add the tasks ---------------------------------------------
88 gROOT->LoadMacro("AddTaskForwardFlow.C");
89 AddTaskForwardFlow(type, etabins, zVertex, addFlow, addFType, addFOrder);
91 // --- Run the analysis --------------------------------------------
93 if (!mgr->InitAnalysis()) {
94 Error("MakeFlow", "Failed to initialize analysis train!");
99 if (proof) mgr->SetDebugLevel(3);
100 if (mgr->GetDebugLevel() < 1 && !proof)
101 mgr->SetUseProgressBar(kTRUE,nEvents < 10000 ? 10 : 100);
104 if (nevents == 0) mgr->StartAnalysis("local", chain);
105 if (nevents != 0) mgr->StartAnalysis("local", chain, nevents);
109 //----------------------------------------------------------------
110 void MakeChain(TString data = "", TChain* chain = 0)
112 // creates chain of files in a given directory or file containing a list.
114 // Open the input stream
116 in.open(data.Data());
118 // Read the input list of files and add them to the chain
124 if (line.Length() == 0)
127 if (TFile::Open(line))