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 pwglf_forward_flow
26 void MakeFlow(const char* data = "",
37 // --- Load libs ---------------------------------------------------
38 gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
40 // --- Possibly use plug-in for this -------------------------------
41 if ((name && name[0] != '\0') && gSystem->Load("libRAliEn") >= 0) {
43 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/trains/TrainSetup.C+");
44 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/trains/MakeFlowTrain.C+");
46 char* tok = strtok(name, " ,:");
47 TString server = "", dataset = "", datadir = "", jobname = "";
48 if (tok[0] == NULL) Fatal("Input name invalid!");
49 if (strcmp(tok, "hehi00.nbi.dk") == 0) {
53 tok = strtok(NULL, " ,:");
56 server = Form("workers=%d", proof);
61 printf("Making flow train on server: %s\t with datadir: %s\t on dataset: %s\n",
62 server.Data(), datadir.Data(), dataset.Data());
64 MakeFlowTrain t(jobname.Data(), type.Data(), mc, addFlow.Data(), addFType, addFOrder, false);
65 t.SetProofServer(server.Data());
66 t.SetDataDir(datadir.Data());
67 t.SetDataSet(dataset.Data());
70 t.Run("proof", "full", nEvents, proof > 0);
75 // --- Set the macro path ------------------------------------------
76 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2:"
77 "$ALICE_ROOT/ANALYSIS/macros",
78 gROOT->GetMacroPath()));
80 // --- Add to chain either AOD ------------------------------------
82 AliError("You didn't add a data file");
85 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/MakeChain.C");
86 TChain* chain = MakeChain("AOD", data, true);
87 // If 0 or less events is select, choose all
88 if (nEvents <= 0) nEvents = chain->GetEntries();
90 // --- Initiate the event handlers --------------------------------
91 AliAnalysisManager *mgr = new AliAnalysisManager("Forward Flow",
92 "Flow in the forward region");
94 // --- AOD input handler -------------------------------------------
95 AliAODInputHandler *aodInputHandler = new AliAODInputHandler();
96 mgr->SetInputEventHandler(aodInputHandler);
98 // --- Add the tasks ---------------------------------------------
99 gROOT->LoadMacro("AddTaskForwardFlow.C");
100 AddTaskForwardFlow(type, mc, addFlow, addFType, addFOrder);
101 mgr->SetDebugLevel(1);
103 // --- Run the analysis --------------------------------------------
105 if (!mgr->InitAnalysis()) {
106 Error("MakeFlow", "Failed to initialize analysis train!");
110 Printf("****************************************");
111 Printf("Doing flow analysis on %d Events", nEvents);
112 Printf("****************************************");
114 mgr->SetDebugLevel(0);
115 if (mgr->GetDebugLevel() < 1)
116 mgr->SetUseProgressBar(kTRUE, nEvents < 10000 ? 100 : 1000);
118 // mgr->SetSkipTerminate(true);
121 mgr->StartAnalysis("local", chain, nEvents);
125 //----------------------------------------------------------------