]>
Commit | Line | Data |
---|---|---|
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 | 17 | AliAnalysisTask* |
8e400b14 | 18 | AddTaskCentralMult(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 ------------------------------------------ |
80dfa476 | 40 | TString macroPath(gROOT->GetMacroPath()); |
41 | if (!macroPath.Contains("$(ALICE_ROOT)/PWG2/FORWARD/analysis2")) { | |
42 | macroPath.Append(":$(ALICE_ROOT)/PWG2/FORWARD/analysis2"); | |
43 | gROOT->SetMacroPath(macroPath); | |
44 | } | |
b2eb1e87 | 45 | const char* config = gSystem->Which(gROOT->GetMacroPath(), |
46 | "CentralAODConfig.C"); | |
47 | if (!config) | |
48 | Warning("AddTaskCentralMult", "CentralAODConfig.C not found in %s", | |
49 | gROOT->GetMacroPath()); | |
50 | else { | |
51 | Info("AddTaskCentralMult", | |
52 | "Loading configuration of '%s' from %s", | |
53 | task->ClassName(), config); | |
54 | gROOT->Macro(Form("%s((AliCentralMultiplicityTask*)%p)", config, task)); | |
55 | delete config; | |
56 | } | |
8e400b14 | 57 | |
4010aa17 | 58 | // --- Make the output container and connect it -------------------- |
59 | TString outputfile = AliAnalysisManager::GetCommonFileName(); | |
3a08cca0 | 60 | |
4010aa17 | 61 | AliAnalysisDataContainer* histOut = |
3a08cca0 | 62 | mgr->CreateContainer("Central", TList::Class(), |
4010aa17 | 63 | AliAnalysisManager::kOutputContainer,outputfile); |
3a08cca0 | 64 | mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); |
4010aa17 | 65 | mgr->ConnectOutput(task, 1, histOut); |
66 | ||
3a08cca0 | 67 | return task; |
68 | } | |
3a08cca0 | 69 | // |
70 | // EOF | |
4010aa17 | 71 | // |