]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AddTaskForwardMult.C
Renamed some member functions for more logical names
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskForwardMult.C
CommitLineData
7c1a1f1d 1/**
bd6f5206 2 * @defgroup pwglf_forward_scripts Scripts used in the analysis
7c1a1f1d 3 *
290052e7 4 * These scripts add tasks to the analysis train
5 *
bd6f5206 6 * @ingroup pwglf_forward
7c1a1f1d 7 */
ffca499d 8/**
290052e7 9 * @defgroup pwglf_forward_scripts_tasks Add tasks to manager
10 *
11 * Scripts to add tasks to the analysis manager
12 *
bd6f5206 13 * @ingroup pwglf_forward_scripts
ffca499d 14 */
15/**
16 * @file AddTaskForwardMult.C
17 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
18 * @date Wed Mar 23 12:13:54 2011
7c1a1f1d 19 *
ffca499d 20 * @brief
21 *
22 *
bd6f5206 23 * @ingroup pwglf_forward_scripts_tasks
7c1a1f1d 24 */
7e4038b5 25/**
4bcdcbc1 26 * This is the script to include the Forward multiplicity in a train.
7e4038b5 27 *
290052e7 28 * @param mc Define as true for MC input.
29 * @param sys Collision system (0: deduce, 1: pp, 2: pbpb, 3:pA)
30 * @param sNN Collision energy
31 * @param field L3 field setting.
32 * @param config Configuration file to use
4bcdcbc1 33 *
34 * @return newly allocated analysis task
35 *
bd6f5206 36 * @ingroup pwglf_forward_aod
7e4038b5 37 */
2d68d438 38AliAnalysisTask*
2a276c75 39AddTaskForwardMult(Bool_t mc,
40 UShort_t sys=0,
41 UShort_t sNN=0,
42 Short_t field=0,
9201c66b 43 const char* config="ForwardAODConfig.C",
44 const char* corrs=0)
7e4038b5 45{
56236b95 46 // --- Load libraries ----------------------------------------------
bd6f5206 47 gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
1c762251 48
56236b95 49 // --- Get analysis manager ----------------------------------------
7e4038b5 50 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
51 if (!mgr) {
ffca499d 52 Error("AddTaskForwardMult", "No analysis manager to connect to.");
7e4038b5 53 return NULL;
54 }
55
6b908a3f 56 // --- Make the task and add it to the manager ---------------------
e797efbb 57 AliForwardMultiplicityBase* task = 0;
2a276c75 58 if (mc) task = new AliForwardMCMultiplicityTask("FMD");
59 else task = new AliForwardMultiplicityTask("FMD");
290052e7 60 task->Configure(config);
6b908a3f 61 mgr->AddTask(task);
3c5497d0 62
9201c66b 63 // --- Set alternative corrections path ----------------------------
64 AliForwardCorrectionManager& cm = AliForwardCorrectionManager::Instance();
65 if (corrs && corrs[0] != '\0') cm.SetPrefix(corrs);
66
6c3615d3 67 // --- Do a local initialisation with assumed values ---------------
2a276c75 68 if (sys > 0 && sNN > 0) {
69 UInt_t what = AliForwardCorrectionManager::kAll;
70 what ^= AliForwardCorrectionManager::kDoubleHit;
71 what ^= AliForwardCorrectionManager::kVertexBias;
72 what ^= AliForwardCorrectionManager::kMergingEfficiency;
5934a3e3 73 what ^= AliForwardCorrectionManager::kAcceptance;
9201c66b 74 if (!cm.Init(sys,sNN,field,mc,what))
2a276c75 75 Fatal("AddTaskForwardMult", "Failed to initialize corrections");
9d05ffeb 76 }
7e4038b5 77
0bd4b00f 78 // --- Make the output container and connect it --------------------
7e4038b5 79 AliAnalysisDataContainer* histOut =
80 mgr->CreateContainer("Forward", TList::Class(),
5934a3e3 81 AliAnalysisManager::kOutputContainer,
82 AliAnalysisManager::GetCommonFileName());
83 AliAnalysisDataContainer *output =
84 mgr->CreateContainer("ForwardResults", TList::Class(),
85 AliAnalysisManager::kParamContainer,
86 AliAnalysisManager::GetCommonFileName());
87
7e4038b5 88 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
89 mgr->ConnectOutput(task, 1, histOut);
5934a3e3 90 mgr->ConnectOutput(task, 2, output);
7e4038b5 91
92 return task;
93}
4bcdcbc1 94
95/**
96 * This is the script to include the Forward multiplicity in a train.
97 *
98 * @param type Data type (if it contains MC, assume MC input):
99 * - ppb, p-pb, pa, p-a: proton-lead
100 * - pp, p-p: proton-proton
101 * - pbpb, pb-pb, a-a: lead-lead
102 *
103 * @param energy Collision energy in GeV
104 * @param bfield L3 field setting in kG (-5, 0, 5)
105 *
106 * @return newly allocated analysis task
107 *
108 * @ingroup pwglf_forward_aod
109 */
110AliAnalysisTask*
111AddTaskForwardMult(const Char_t* type,
112 Float_t energy=0,
113 Float_t bfield=0)
114{
115 // --- Load libraries ----------------------------------------------
116 gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
117
118 // --- Deduce parameters -------------------------------------------
119 TString t(type);
120 Bool_t mc = t.Contains("MC", TString::kIgnoreCase);
121 UShort_t sys = AliForwardUtil::ParseCollisionSystem(type);
122 UShort_t sNN = AliForwardUtil::ParseCenterOfMassEnergy(sys, energy);
123 Short_t field = AliForwardUtil::ParseMagneticField(field);
124
125 return AddTaskForwardMult(mc, sys, sNN, field);
126}
127//
128// EOF
129//