]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/AddTaskFMD.C
Code update for handling centrality in the dN/deta analysis.
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AddTaskFMD.C
1 /** 
2  * @defgroup pwg2_forward_scripts Scripts used in the analysis
3  *
4  * @ingroup pwg2_forward
5  */
6 /**
7  * @file 
8  * @ingroup pwg2_forward_scripts
9  * 
10  */
11 /**
12  * This is the macro to include the Forward multiplicity in a train.  
13  * 
14  * @ingroup pwg2_forward_scripts
15  */
16 AliAnalysisTask*
17 AddTaskFMD(Bool_t mc, UShort_t sys=0, UShort_t sNN=0, Short_t field=0)
18 {
19   gSystem->Load("libPWG2forward2");
20
21   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
22   if (!mgr) {
23     Error("AddTaskFMD", "No analysis manager to connect to.");
24     return NULL;
25   }   
26
27   // --- Make the task and add it to the manager ---------------------
28   AliForwardMultiplicityBase* task = 0;
29   if (mc) task = new AliForwardMCMultiplicityTask("FMD");
30   else    task = new AliForwardMultiplicityTask("FMD");
31   mgr->AddTask(task);
32   
33   // --- Do a local initialisation with assumed values ---------------
34   if (sys > 0 && sNN > 0) 
35     AliForwardCorrectionManager::Instance().Init(sys,sNN,field);
36
37   // --- Configure the task ------------------------------------------
38   const char* config = gSystem->Which(gROOT->GetMacroPath(),
39                                       "ForwardAODConfig.C");
40   if (!config) 
41     Warning("AddTaskFMD", "ForwardAODConfig.C not found in %s",
42             gROOT->GetMacroPath());
43   else {
44     Info("AddTaskFMD", 
45          "Loading configuration of '%s' from %s",
46          task->ClassName(), config);
47     gROOT->Macro(Form("%s((AliForwardMultiplicityBase*)%p)", config, task));
48     delete config;
49   }
50   
51   // --- Make the output container and connect it --------------------
52   TString outputfile = AliAnalysisManager::GetCommonFileName();
53   // outputfile += ":PWG2forwardDnDeta"; 
54   // Form(":%s",pars->GetDndetaAnalysisName());
55   AliAnalysisDataContainer* histOut = 
56     mgr->CreateContainer("Forward", TList::Class(), 
57                          AliAnalysisManager::kOutputContainer,outputfile);
58   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
59   mgr->ConnectOutput(task, 1, histOut);
60
61   return task;
62 }