]>
Commit | Line | Data |
---|---|---|
7c1a1f1d | 1 | /** |
2 | * @defgroup pwg2_forward_scripts Scripts used in the analysis | |
3 | * | |
4 | * @ingroup pwg2_forward | |
5 | */ | |
ffca499d | 6 | /** |
7 | * @defgroup pwg2_forward_scripts_tasks Scripts to add tasks to manager | |
7c1a1f1d | 8 | * @ingroup pwg2_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 | * | |
18 | * @ingroup pwg2_forward_scripts_tasks | |
7c1a1f1d | 19 | */ |
7e4038b5 | 20 | /** |
21 | * This is the macro to include the Forward multiplicity in a train. | |
22 | * | |
ffca499d | 23 | * @ingroup pwg2_forward_aod |
7e4038b5 | 24 | */ |
2d68d438 | 25 | AliAnalysisTask* |
ffca499d | 26 | AddTaskForwardMult(Bool_t mc, UShort_t sys=0, UShort_t sNN=0, Short_t field=0) |
7e4038b5 | 27 | { |
56236b95 | 28 | // --- Load libraries ---------------------------------------------- |
29 | gROOT->LoadClass("AliAODForwardMult", "libPWG2forward2"); | |
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 ------------------------------------------ |
9d05ffeb | 52 | const char* config = gSystem->Which(gROOT->GetMacroPath(), |
53 | "ForwardAODConfig.C"); | |
54 | if (!config) | |
ffca499d | 55 | Warning("AddTaskForwardMult", "ForwardAODConfig.C not found in %s", |
9d05ffeb | 56 | gROOT->GetMacroPath()); |
57 | else { | |
ffca499d | 58 | Info("AddTaskForwardMult", |
e1f47419 | 59 | "Loading configuration of '%s' from %s", |
60 | task->ClassName(), config); | |
9d05ffeb | 61 | gROOT->Macro(Form("%s((AliForwardMultiplicityBase*)%p)", config, task)); |
62 | delete config; | |
63 | } | |
7e4038b5 | 64 | |
0bd4b00f | 65 | // --- Make the output container and connect it -------------------- |
7e4038b5 | 66 | TString outputfile = AliAnalysisManager::GetCommonFileName(); |
0bd4b00f | 67 | // outputfile += ":PWG2forwardDnDeta"; |
68 | // Form(":%s",pars->GetDndetaAnalysisName()); | |
7e4038b5 | 69 | AliAnalysisDataContainer* histOut = |
70 | mgr->CreateContainer("Forward", TList::Class(), | |
71 | AliAnalysisManager::kOutputContainer,outputfile); | |
7e4038b5 | 72 | mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer()); |
73 | mgr->ConnectOutput(task, 1, histOut); | |
74 | ||
75 | return task; | |
76 | } |