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