Various fixes, and possibility to set trigger efficiency
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskMCTruthdNdeta.C
CommitLineData
9ecab72f 1/**
2 * @file AddTaskForwarddNdeta.C
3 * @author Christian Holm Christensen <cholm@nbi.dk>
4 * @date Fri Jan 28 10:22:26 2011
5 *
6 * @brief Script to add a multiplicity task for the central
7 * @f$\eta@f$ region
8 *
9 *
bd6f5206 10 * @ingroup pwglf_forward_scripts_tasks
9ecab72f 11 */
12/**
13 * Create the MCTruth @f$ dN/d\eta@f$ analysis task
14 *
15 * @param trig Trigger to use
16 * @param vzMin Smallest @f$ v_z@f$
17 * @param vzMax Biggest @f$ v_z@f$
18 * @param useCent Whether to use the centrality or not
19 * @param scheme Normalisation scheme
20 * @param cutEdges Whether to cut edges when rebinning
21 *
22 * @return Newly created and configured task
23 *
bd6f5206 24 * @ingroup pwglf_forward_dndeta
9ecab72f 25 */
26AliAnalysisTask*
27AddTaskMCTruthdNdeta(const char* trig = "INEL",
28 Double_t vzMin = -10,
29 Double_t vzMax = +10,
30 Bool_t useCent = false,
31 const char* scheme = 0,
66cf95f2 32 Bool_t cutEdges = false,
33 Double_t trigEff = 1,
34 Double_t trigEff0 = 1)
9ecab72f 35{
56236b95 36 // --- Load libraries ----------------------------------------------
bd6f5206 37 gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
56236b95 38
39 // --- Get analysis manager ----------------------------------------
9ecab72f 40 AliAnalysisManager* mgr = AliAnalysisManager::GetAnalysisManager();
41
42 // --- Make our object ---------------------------------------------
43 AliMCTruthdNdetaTask* task = new AliMCTruthdNdetaTask("MCTruth");
44 // Set the vertex range to use
45 task->SetVertexRange(vzMin, vzMax);
46 // Set the trigger mask to use (INEL,INEL>0,NSD)
47 task->SetTriggerMask(trig);
48 // Set the trigger efficiency
66cf95f2 49 task->SetTriggerEff(trigEff); // 0.997535);
50 task->SetTriggerEff0(trigEff0);
9ecab72f 51 // Whether to cut edges when re-binning
52 task->SetCutEdges(cutEdges);
53 // Whether to correct for empty bins when projecting
54 task->SetCorrEmpty(true);
55 // Whether to use TH2::ProjectionX
56 task->SetUseROOTProjectX(false);
57 // Bit mask of
58 //
59 // kNone Normalise to accepted events
60 // kEventLevel Normalise to all events in selected range
61 // kAltEventLevel Normalise to all events in selected range
62 // kBackground Also correct for background triggers
63 // kShape Correct shape
64 //
65 // kNone, kEventLevel, and kAltEventLevel are mutually exclusive.
66 // If neither kEventLevel, nor kAltEventLevel is specified, then
67 // kNone is assumed. kBackground (when implemented) only makes
68 // sense with kEventLevel and kAltEventLevel. Furthermore, there
69 // are some constants that encode the common cases
70 //
71 // kFull = kEventLevel | kBackground | kShape
72 // kAltFull = kAltEventLevel | kBackground | kShape
73 //
74 // Default is kFull
75 task->SetNormalizationScheme(AliBasedNdetaTask::kFull);
76 if (scheme) task->SetNormalizationScheme(scheme);
77 // Set the centrality bins to use. These are mutually exclusive.
78 // Note, that a bin specified as a-b, covers the interval from a,
79 // inclusive to b exclusive. An upper bound of 100 is treated
80 // especially, and the upper bound is inclusive in that case .
81 if (useCent) {
82 Short_t bins[] = { 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
83 task->SetCentralityAxis(11, bins);
84 }
85 mgr->AddTask(task);
86
87 // --- create containers for input/output --------------------------
88 AliAnalysisDataContainer *sums =
89 mgr->CreateContainer("MCTruthSums", TList::Class(),
90 AliAnalysisManager::kOutputContainer,
91 AliAnalysisManager::GetCommonFileName());
92 AliAnalysisDataContainer *output =
93 mgr->CreateContainer("MCTruthResults", TList::Class(),
94 AliAnalysisManager::kParamContainer,
95 AliAnalysisManager::GetCommonFileName());
96
97 // --- connect input/output ----------------------------------------
98 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
99 mgr->ConnectOutput(task, 1, sums);
100 mgr->ConnectOutput(task, 2, output);
101
102 return task;
103}
104
105
106//________________________________________________________________________
107//
108// EOF
109//