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