]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AddTaskForwardMult.C
Fixed references from PWG2 -> PWGLF - very efficiently done using ETags.
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskForwardMult.C
CommitLineData
7c1a1f1d 1/**
bd6f5206 2 * @defgroup pwglf_forward_scripts Scripts used in the analysis
7c1a1f1d 3 *
bd6f5206 4 * @ingroup pwglf_forward
7c1a1f1d 5 */
ffca499d 6/**
bd6f5206 7 * @defgroup pwglf_forward_scripts_tasks Scripts to add tasks to manager
8 * @ingroup pwglf_forward_scripts
ffca499d 9 */
10/**
11 * @file AddTaskForwardMult.C
12 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
13 * @date Wed Mar 23 12:13:54 2011
7c1a1f1d 14 *
ffca499d 15 * @brief
16 *
17 *
bd6f5206 18 * @ingroup pwglf_forward_scripts_tasks
7c1a1f1d 19 */
7e4038b5 20/**
21 * This is the macro to include the Forward multiplicity in a train.
22 *
bd6f5206 23 * @ingroup pwglf_forward_aod
7e4038b5 24 */
2d68d438 25AliAnalysisTask*
ffca499d 26AddTaskForwardMult(Bool_t mc, UShort_t sys=0, UShort_t sNN=0, Short_t field=0)
7e4038b5 27{
56236b95 28 // --- Load libraries ----------------------------------------------
bd6f5206 29 gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
1c762251 30
56236b95 31 // --- Get analysis manager ----------------------------------------
7e4038b5 32 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
33 if (!mgr) {
ffca499d 34 Error("AddTaskForwardMult", "No analysis manager to connect to.");
7e4038b5 35 return NULL;
36 }
37
6b908a3f 38 // --- Make the task and add it to the manager ---------------------
e797efbb 39 AliForwardMultiplicityBase* task = 0;
534da20a 40
41 if (mc)
42 task = new AliForwardMCMultiplicityTask("FMD");
43 else
44 task = new AliForwardMultiplicityTask("FMD");
6b908a3f 45 mgr->AddTask(task);
3c5497d0 46
6c3615d3 47 // --- Do a local initialisation with assumed values ---------------
48 if (sys > 0 && sNN > 0)
534da20a 49 AliForwardCorrectionManager::Instance().Init(sys,sNN,field,mc);
0bd4b00f 50
9d05ffeb 51 // --- Configure the task ------------------------------------------
80dfa476 52 TString macroPath(gROOT->GetMacroPath());
bd6f5206 53 if (!macroPath.Contains("$(ALICE_ROOT)/PWGLF/FORWARD/analysis2")) {
54 macroPath.Append(":$(ALICE_ROOT)/PWGLF/FORWARD/analysis2");
80dfa476 55 gROOT->SetMacroPath(macroPath);
56 }
9d05ffeb 57 const char* config = gSystem->Which(gROOT->GetMacroPath(),
58 "ForwardAODConfig.C");
59 if (!config)
ffca499d 60 Warning("AddTaskForwardMult", "ForwardAODConfig.C not found in %s",
9d05ffeb 61 gROOT->GetMacroPath());
62 else {
ffca499d 63 Info("AddTaskForwardMult",
e1f47419 64 "Loading configuration of '%s' from %s",
65 task->ClassName(), config);
9d05ffeb 66 gROOT->Macro(Form("%s((AliForwardMultiplicityBase*)%p)", config, task));
67 delete config;
68 }
7e4038b5 69
0bd4b00f 70 // --- Make the output container and connect it --------------------
7e4038b5 71 TString outputfile = AliAnalysisManager::GetCommonFileName();
bd6f5206 72 // outputfile += ":PWGLFforwardDnDeta";
0bd4b00f 73 // Form(":%s",pars->GetDndetaAnalysisName());
7e4038b5 74 AliAnalysisDataContainer* histOut =
75 mgr->CreateContainer("Forward", TList::Class(),
76 AliAnalysisManager::kOutputContainer,outputfile);
7e4038b5 77 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
78 mgr->ConnectOutput(task, 1, histOut);
79
80 return task;
81}