]>
Commit | Line | Data |
---|---|---|
ffca499d | 1 | /** |
2 | * @file MakeFlow.C | |
3 | * @author Alexander Hansen | |
4 | * @date Wed Mar 23 12:11:33 2011 | |
5 | * | |
d226802c | 6 | * @brief |
ffca499d | 7 | * |
2b556440 | 8 | * @ingroup pwg2_forward_scripts_makers |
ffca499d | 9 | * |
10 | */ | |
9d05ffeb | 11 | /** |
58f5fae2 | 12 | * Script to analyse AOD input for flow |
13 | * | |
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. | |
9d05ffeb | 17 | * |
d226802c | 18 | * @par Inputs: |
19 | * | |
20 | * | |
21 | * @par Outputs: | |
22 | * - | |
ffca499d | 23 | * |
2b556440 | 24 | * @ingroup pwg2_forward_flow |
9d05ffeb | 25 | */ |
58f5fae2 | 26 | void MakeFlow(TString data = "", |
2b556440 | 27 | Int_t nEvents = 0, |
9d05ffeb | 28 | TString type = "", |
d226802c | 29 | Bool_t mc = kFALSE, |
2b556440 | 30 | const char* name = 0, |
31 | Int_t proof = 0, | |
58f5fae2 | 32 | TString addFlow = "", |
33 | Int_t addFType = 0, | |
9453b19e | 34 | Int_t addFOrder = 0, |
2b556440 | 35 | Bool_t gdb = kFALSE) |
9d05ffeb | 36 | { |
58f5fae2 | 37 | // --- Load libs --------------------------------------------------- |
bd6f5206 | 38 | gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C"); |
9d05ffeb | 39 | |
2b556440 | 40 | // --- Possibly use plug-in for this ------------------------------- |
41 | if ((name && name[0] != '\0') && gSystem->Load("libRAliEn") >= 0) { | |
42 | ||
43 | gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/trains/TrainSetup.C+"); | |
44 | gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/trains/MakeFlowTrain.C+"); | |
45 | ||
46 | MakeFlowTrain t(name, type.Data(), mc, addFlow.Data(), addFType, addFOrder, false); | |
47 | t.SetDataDir(data.Data()); | |
48 | t.SetDataSet(""); | |
49 | t.SetProofServer(Form("workers=%d", proof)); | |
50 | t.SetUseGDB(gdb); | |
51 | t.Run(proof > 0 ? "proof" : "local", "full", nEvents, proof > 0); | |
52 | return; | |
9d05ffeb | 53 | } |
54 | ||
9453b19e | 55 | // --- Set the macro path ------------------------------------------ |
bd6f5206 | 56 | gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2:" |
9453b19e | 57 | "$ALICE_ROOT/ANALYSIS/macros", |
58 | gROOT->GetMacroPath())); | |
59 | ||
58f5fae2 | 60 | // --- Add to chain either AOD ------------------------------------ |
d226802c | 61 | if (data.IsNull()) { |
62 | AliError("You didn't add a data file"); | |
63 | return; | |
64 | } | |
2b556440 | 65 | gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/MakeChain.C"); |
66 | TChain* chain = MakeChain("AOD", data.Data(), true); | |
67 | // If 0 or less events is select, choose all | |
68 | if (nEvents <= 0) nEvents = chain->GetEntries(); | |
58f5fae2 | 69 | |
70 | // --- Initiate the event handlers -------------------------------- | |
d226802c | 71 | AliAnalysisManager *mgr = new AliAnalysisManager("Forward Flow", |
72 | "Flow in the forward region"); | |
9d05ffeb | 73 | |
74 | // --- AOD input handler ------------------------------------------- | |
75 | AliAODInputHandler *aodInputHandler = new AliAODInputHandler(); | |
d226802c | 76 | mgr->SetInputEventHandler(aodInputHandler); |
9d05ffeb | 77 | |
9d05ffeb | 78 | // --- Add the tasks --------------------------------------------- |
9453b19e | 79 | gROOT->LoadMacro("AddTaskForwardFlow.C"); |
2b556440 | 80 | AddTaskForwardFlow(type, mc, addFlow, addFType, addFOrder); |
9d05ffeb | 81 | |
82 | // --- Run the analysis -------------------------------------------- | |
83 | TStopwatch t; | |
84 | if (!mgr->InitAnalysis()) { | |
85 | Error("MakeFlow", "Failed to initialize analysis train!"); | |
86 | return; | |
87 | } | |
88 | mgr->PrintStatus(); | |
d226802c | 89 | Printf("****************************************"); |
2b556440 | 90 | Printf("Doing flow analysis on %d Events", nEvents); |
d226802c | 91 | Printf("****************************************"); |
9453b19e | 92 | // |
2b556440 | 93 | mgr->SetDebugLevel(0); |
94 | if (mgr->GetDebugLevel() < 1) | |
95 | mgr->SetUseProgressBar(kTRUE, nEvents < 10000 ? 100 : 1000); | |
d226802c | 96 | |
97 | // mgr->SetSkipTerminate(true); | |
9d05ffeb | 98 | |
99 | t.Start(); | |
2b556440 | 100 | mgr->StartAnalysis("local", chain, nEvents); |
9d05ffeb | 101 | t.Stop(); |
102 | t.Print(); | |
103 | } | |
58f5fae2 | 104 | //---------------------------------------------------------------- |
9d05ffeb | 105 | // |
106 | // EOF | |
107 | // |