]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AddTaskForwardMult.C
Maker scripts now use TrainSetup exclusively.
[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,
290052e7 43 const char* config="ForwardAODConfig.C")
7e4038b5 44{
56236b95 45 // --- Load libraries ----------------------------------------------
bd6f5206 46 gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
1c762251 47
56236b95 48 // --- Get analysis manager ----------------------------------------
7e4038b5 49 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
50 if (!mgr) {
ffca499d 51 Error("AddTaskForwardMult", "No analysis manager to connect to.");
7e4038b5 52 return NULL;
53 }
54
6b908a3f 55 // --- Make the task and add it to the manager ---------------------
e797efbb 56 AliForwardMultiplicityBase* task = 0;
2a276c75 57 if (mc) task = new AliForwardMCMultiplicityTask("FMD");
58 else task = new AliForwardMultiplicityTask("FMD");
290052e7 59 task->Configure(config);
6b908a3f 60 mgr->AddTask(task);
3c5497d0 61
6c3615d3 62 // --- Do a local initialisation with assumed values ---------------
2a276c75 63 if (sys > 0 && sNN > 0) {
64 UInt_t what = AliForwardCorrectionManager::kAll;
65 what ^= AliForwardCorrectionManager::kDoubleHit;
66 what ^= AliForwardCorrectionManager::kVertexBias;
67 what ^= AliForwardCorrectionManager::kMergingEfficiency;
68 if (!AliForwardCorrectionManager::Instance().Init(sys,sNN,field,mc,what))
69 Fatal("AddTaskForwardMult", "Failed to initialize corrections");
9d05ffeb 70 }
7e4038b5 71
0bd4b00f 72 // --- Make the output container and connect it --------------------
7e4038b5 73 TString outputfile = AliAnalysisManager::GetCommonFileName();
bd6f5206 74 // outputfile += ":PWGLFforwardDnDeta";
0bd4b00f 75 // Form(":%s",pars->GetDndetaAnalysisName());
7e4038b5 76 AliAnalysisDataContainer* histOut =
77 mgr->CreateContainer("Forward", TList::Class(),
78 AliAnalysisManager::kOutputContainer,outputfile);
7e4038b5 79 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
80 mgr->ConnectOutput(task, 1, histOut);
81
82 return task;
83}
4bcdcbc1 84
85/**
86 * This is the script to include the Forward multiplicity in a train.
87 *
88 * @param type Data type (if it contains MC, assume MC input):
89 * - ppb, p-pb, pa, p-a: proton-lead
90 * - pp, p-p: proton-proton
91 * - pbpb, pb-pb, a-a: lead-lead
92 *
93 * @param energy Collision energy in GeV
94 * @param bfield L3 field setting in kG (-5, 0, 5)
95 *
96 * @return newly allocated analysis task
97 *
98 * @ingroup pwglf_forward_aod
99 */
100AliAnalysisTask*
101AddTaskForwardMult(const Char_t* type,
102 Float_t energy=0,
103 Float_t bfield=0)
104{
105 // --- Load libraries ----------------------------------------------
106 gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
107
108 // --- Deduce parameters -------------------------------------------
109 TString t(type);
110 Bool_t mc = t.Contains("MC", TString::kIgnoreCase);
111 UShort_t sys = AliForwardUtil::ParseCollisionSystem(type);
112 UShort_t sNN = AliForwardUtil::ParseCenterOfMassEnergy(sys, energy);
113 Short_t field = AliForwardUtil::ParseMagneticField(field);
114
115 return AddTaskForwardMult(mc, sys, sNN, field);
116}
117//
118// EOF
119//