]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/AddTaskCentralMult.C
Updates to scripts. Mostly documentation and some new functionalities
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AddTaskCentralMult.C
CommitLineData
3a08cca0 1/**
0be6c8cd 2 * @file AddTaskCentralMult.C
3a08cca0 3 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
4010aa17 4 * @date Wed Mar 23 12:13:25 2011
3a08cca0 5 *
4010aa17 6 * @brief
3a08cca0 7 *
8 *
4010aa17 9 * @ingroup pwg2_forward_scripts_tasks
3a08cca0 10 */
3a08cca0 11
12/**
4010aa17 13 * This is the macro to include the Central multiplicity in a train.
3a08cca0 14 *
ffca499d 15 * @ingroup pwg2_forward_aod
3a08cca0 16 */
0be6c8cd 17AliAnalysisTask*
8e400b14 18AddTaskCentralMult(Bool_t mc=false,
19 UShort_t sys=0, UShort_t sNN=0, Short_t field=0)
3a08cca0 20{
56236b95 21 // --- Load libraries ----------------------------------------------
22 gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2");
3a08cca0 23
56236b95 24 // --- Get analysis manager ----------------------------------------
4010aa17 25 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
26 if (!mgr) {
0be6c8cd 27 Error("AddTaskCentralMult", "No analysis manager to connect to.");
4010aa17 28 return NULL;
29 }
3a08cca0 30
4010aa17 31 // --- Make the task and add it to the manager ---------------------
8e400b14 32 AliCentralMultiplicityTask* task = 0;
33 if (!mc) task = new AliCentralMultiplicityTask("Central");
34 else task = new AliCentralMCMultiplicityTask("Central");
4010aa17 35 if(sys>0 && sNN > 0)
36 task->GetManager().Init(sys, sNN, field);
37 mgr->AddTask(task);
8e400b14 38
b2eb1e87 39 // --- Configure the task ------------------------------------------
40 const char* config = gSystem->Which(gROOT->GetMacroPath(),
41 "CentralAODConfig.C");
42 if (!config)
43 Warning("AddTaskCentralMult", "CentralAODConfig.C not found in %s",
44 gROOT->GetMacroPath());
45 else {
46 Info("AddTaskCentralMult",
47 "Loading configuration of '%s' from %s",
48 task->ClassName(), config);
49 gROOT->Macro(Form("%s((AliCentralMultiplicityTask*)%p)", config, task));
50 delete config;
51 }
8e400b14 52
4010aa17 53 // --- Make the output container and connect it --------------------
54 TString outputfile = AliAnalysisManager::GetCommonFileName();
3a08cca0 55
4010aa17 56 AliAnalysisDataContainer* histOut =
3a08cca0 57 mgr->CreateContainer("Central", TList::Class(),
4010aa17 58 AliAnalysisManager::kOutputContainer,outputfile);
3a08cca0 59 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
4010aa17 60 mgr->ConnectOutput(task, 1, histOut);
61
3a08cca0 62 return task;
63}
3a08cca0 64//
65// EOF
4010aa17 66//