2 * @file MakeForwardQA.C
3 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
4 * @date Wed Mar 23 14:08:14 2011
6 * @brief Generate energy loss fits
8 * @ingroup pwglf_forward_scripts_makers
11 * Run a pass on ESD data to produce the energ loss fits
13 * If the ROOT AliEn interface library (libRAliEn) can be loaded,
14 * and the parameter @a name is not empty, then use the plugin to do
15 * the analysis. Note that in this case, the output is placed
16 * in a sub-directory named by @a name after escaping spaces and special
19 * If PROOF mode is selected, then Terminate will be run on the master node
22 * @param esddir ESD input directory. Any file matching the pattern
23 * *AliESDs*.root are added to the chain
24 * @param nEvents Number of events to process. If 0 or less, then
25 * all events are analysed
26 * @param proof If larger then 1, run in PROOF-Lite mode with this
27 * many number of workers.
28 * @param mc Data is assumed to be from simulations
29 * @param cent Whether to use centrality or not
30 * @param name Name of train - free form. This will be the name
31 * of the output directory if the plug-in is used
33 * @ingroup pwglf_forward_eloss
35 void MakeForwardQA(const char* esddir,
42 // --- Possibly use plug-in for this -------------------------------
43 if ((name && name[0] != '\0') && gSystem->Load("libRAliEn") >= 0) {
45 "$(ALICE_ROOT)/PWGLF/FORWARD/analysis2/trains/BuildTrain.C";
46 gROOT->LoadMacro(builder);
48 BuildTrain("MakeQATrain");
50 MakeQATrain t(name, cent, false);
53 t.SetProofServer(Form("workers=%d",proof));
54 t.Run(proof > 0 ? "PROOF" : "LOCAL", "FULL", nEvents, mc, proof > 0);
58 // --- Libraries to load -------------------------------------------
59 gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
61 // --- Check for proof mode, and possibly upload pars --------------
63 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadPars.C");
67 // --- Our data chain ----------------------------------------------
68 gROOT->LoadMacro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/MakeChain.C");
69 TChain* chain = MakeChain("ESD",esddir, true);
70 // If 0 or less events is select, choose all
71 if (nEvents <= 0) nEvents = chain->GetEntries();
72 Info("MakeForwardQA", "Will analyse %d events", nEvents);
74 // --- Set the macro path ------------------------------------------
75 gROOT->SetMacroPath(Form("%s:$(ALICE_ROOT)/PWGLF/FORWARD/analysis2:"
76 "$ALICE_ROOT/ANALYSIS/macros",
77 gROOT->GetMacroPath()));
79 // --- Creating the manager and handlers ---------------------------
80 AliAnalysisManager *mgr = new AliAnalysisManager("Forward QA Train",
82 AliAnalysisManager::SetCommonFileName("forward_qa.root");
84 // --- ESD input handler -------------------------------------------
85 AliESDInputHandler *esdHandler = new AliESDInputHandler();
86 mgr->SetInputEventHandler(esdHandler);
88 // --- Monte Carlo handler -----------------------------------------
90 AliMCEventHandler* mcHandler = new AliMCEventHandler();
91 mgr->SetMCtruthEventHandler(mcHandler);
92 mcHandler->SetReadTR(true);
95 // --- Add tasks ---------------------------------------------------
96 gROOT->LoadMacro("AddTaskPhysicsSelection.C");
97 AddTaskPhysicsSelection(mc, kTRUE, kFALSE);
101 gROOT->LoadMacro("AddTaskCentrality.C");
106 gROOT->LoadMacro("AddTaskForwardQA.C");
107 AddTaskForwardQA(mc, cent);
109 // --- Run the analysis --------------------------------------------
111 if (!mgr->InitAnalysis()) {
112 Error("RunManager", "Failed to initialize analysis train!");
115 // Some informative output
117 // mgr->SetDebugLevel(3);
118 if (mgr->GetDebugLevel() < 1 && proof <= 0)
119 mgr->SetUseProgressBar(kTRUE,100);
123 Printf("=== RUNNING ANALYSIS on %9d events ========================",nEvents);
124 mgr->StartAnalysis(proof > 0 ? "proof" : "local", chain, nEvents);