2 * Flags for the analysis
4 * @ingroup pwg2_forward_analysis_scripts
7 kMC = 0x01, // MC input
8 kProof = 0x02, // Run in proof mode
9 kFull = 0x04, // Do full analysis - including terminate
10 kAnalyse = 0x08, // Run the analysis
11 kTerminate = 0x10 // Run only terminate
15 * Run first pass of the analysis - that is read in ESD and produce AOD
17 * @param esddir ESD input directory. Any file matching the pattern
18 * *AliESDs*.root are added to the chain
19 * @param nEvents Number of events to process. If 0 or less, then
20 * all events are analysed
21 * @param flags Job flags. A bit mask of
22 * - 0x01 (MC) Monte-Carlo truth handler installed
23 * - 0x02 (PROOF) Proof mode
24 * - 0x04 (FULL) Run full analysis - including terminate
25 * - 0x08 (ANALYSE) Run only analysis - not terminate
26 * - 0x10 (TERMINATE) Run no analysis - just terminate.
28 * of these, PROOF, FULL, ANALYSE, and TERMINATE are mutually exclusive.
30 * If PROOF mode is selected, then Terminate will be run on the master node
33 * If FULL is selected, then the full analysis is done. Note that
34 * this can be combined with PROOF but with no effect.
36 * ANALYSE cannot be combined with FULL, PROOF, or TERMINATE. In a
37 * local job, the output AnalysisResults.root will still be made, but
38 * terminate is not called.
40 * In TERMINATE, the file AnalysisResults.root is opened and all
41 * containers found are connected to the tasks. The terminate member
42 * function is then called
45 * @ingroup pwg2_forward_analysis_scripts
47 void RunManager(const char* esddir,
51 // --- Libraries to load -------------------------------------------
52 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
54 // --- Check for proof mode, and possibly upload pars --------------
56 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C");
58 // --- Our data chain ----------------------------------------------
59 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeESDChain.C");
60 TChain* chain = MakeESDChain(esddir);
61 // If 0 or less events is select, choose all
62 if (nEvents <= 0) nEvents = chain->GetEntries();
64 // --- Creating the manager and handlers ---------------------------
65 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train",
66 "FMD analysis train");
68 AliESDInputHandler *esdHandler = new AliESDInputHandler();
69 esdHandler->SetInactiveBranches("AliESDACORDE "
70 "AliRawDataErrorLogs "
81 mgr->SetInputEventHandler(esdHandler);
83 // Monte Carlo handler
85 AliMCEventHandler* mcHandler = new AliMCEventHandler();
86 mgr->SetMCtruthEventHandler(mcHandler);
87 mcHandler->SetReadTR(readTR);
91 AliAODHandler* aodHandler = new AliAODHandler();
92 mgr->SetOutputEventHandler(aodHandler);
93 aodHandler->SetOutputFileName("AliAODs.root");
95 // --- Add tasks ---------------------------------------------------
96 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/AddTaskFMD.C");
97 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
98 AliAnalysisTask* task = AddTaskFMD();
99 // mgr->ConnectOutput(task, 0, mgr->GetCommonOutputContainer());
101 task = AddTaskPhysicsSelection((flags & kMC), kTRUE, kTRUE);
102 // mgr->ConnectOutput(task, 0, mgr->GetCommonOutputContainer());
104 // --- Run the analysis --------------------------------------------
106 if (!mgr->InitAnalysis()) {
107 Error("RunManager", "Failed to initialize analysis train!");
110 // Skip terminate if we're so requested and not in Proof or full mode
111 mgr->SetSkipTerminate(!(flags & kProof) &&
114 // Some informative output
116 // mgr->SetDebugLevel(3);
117 if (mgr->GetDebugLevel() < 1 && !(flags & kProof))
118 mgr->SetUseProgressBar(kTRUE);
122 if (!(flags & kTerminate)) {
123 Printf("=== RUNNING ANALYSIS ==================================");
124 mgr->StartAnalysis((flags & kProof) ? "proof" : "local", chain, nEvents);
127 Printf("=== RUNNING TERMINATE =================================");
128 // mgr->ImportWrappers(0);