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