]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AddTaskFMDMCHit.C
Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskFMDMCHit.C
CommitLineData
0b7de667 1/**
2 * @file AddTaskFMDELoss.C
3 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
4 * @date Wed Mar 23 12:14:03 2011
5 *
6 * @brief
7 *
8 *
9 * @ingroup pwglf_forward_scripts_tasks
10 */
11/**
12 * @defgroup pwglf_forward_eloss Energy Loss Fits
13 *
14 * Fitting the energy loss @f$\Delta/\Delta_{mip}@f$ spectra
15 *
16 * @ingroup pwglf_forward_topical
17 */
18
19/**
20 * This is the macro to include the FMD energy fitter in a train.
21 *
22 * @param useTuple If true, create NTuple of hits
23 * @param debug Debug level
24 *
25 * @return Newly created task
26 *
27 * @ingroup pwglf_forward_eloss
28 */
29AliAnalysisTask*
30AddTaskFMDMCHit(Bool_t useTuple=false,
31 Int_t debug=0)
32{
33 // --- Load libraries ----------------------------------------------
34 gROOT->LoadClass("AliFMDDigit", "FMDbase");
35 gROOT->LoadClass("AliFMDHit", "FMDsim");
36 gROOT->LoadClass("AliAODForwardMult", "PWGLFforward2");
37 gROOT->LoadClass("AliFMDMCHitEnergyFitter", "PWGLFforwardhit");
38
39 // --- Get analysis manager ----------------------------------------
40 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
41 if (!mgr) {
42 Error("AddTaskFMDELoss", "No analysis manager to connect to.");
43 return NULL;
44 }
45
46 // --- Make the task and add it to the manager ---------------------
47 AliFMDMCHitEnergyFitterTask* task =
48 new AliFMDMCHitEnergyFitterTask("ForwardHitELoss",
49 useTuple);
50 // --- Set parameters on the algorithms ----------------------------
51 // Set the number of SPD tracklets for which we consider the event a
52 // low flux event
53 task->GetEventInspector().SetLowFluxCut(1000);
54 // Set the maximum error on v_z [cm]
55 task->GetEventInspector().SetMaxVzErr(0.2);
56 // Set the eta axis to use - note, this overrides whatever is used
57 // by the rest of the algorithms - but only for the energy fitter
58 // algorithm.
59 task->GetEnergyFitter().SetEtaAxis(100, -4, 6);
60 // Set maximum energy loss to consider
61 task->GetEnergyFitter().SetMaxE(15);
62 // Set number of energy loss bins
63 task->GetEnergyFitter().SetNEbins(500);
64 // Set whether to use increasing bin sizes
65 task->GetEnergyFitter().SetUseIncreasingBins(true);
66 // Set whether to do fit the energy distributions
67 task->GetEnergyFitter().SetDoFits(kTRUE);
68 // Set whether to make the correction object
69 // task->GetEnergyFitter().SetDoMakeObject(kTRUE);
70 // Set the low cut used for energy
71 task->GetEnergyFitter().SetLowCut(0.05);
72 // Set the number of bins to subtract from maximum of distributions
73 // to get the lower bound of the fit range
74 task->GetEnergyFitter().SetFitRangeBinWidth(4);
75 // Set the maximum number of landaus to try to fit (max 5)
76 task->GetEnergyFitter().SetNParticles(1);
77 // Set the minimum number of entries in the distribution before
78 // trying to fit to the data - 10K seems the absolute minimum
79 task->GetEnergyFitter().SetMinEntries(3000 /*10000*/);
80 // If set, only collect statistics for MB. This is to prevent a
81 // bias when looping over data where the MB trigger is downscaled.
82 // task->SetOnlyMB(onlyMB);
83 // Debug
84 task->SetDebug(debug);
85
86 // --- Set limits on fits the energy -------------------------------
87 // DO NOT CHANGE THESE UNLESS YOU KNOW WHAT YOU ARE DOING
88 // Maximum relative error on parameters
89 // AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
90 // Least weight to use
91 // AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
92 // Maximum value of reduced chi^2
93 // AliFMDCorrELossFit::ELossFit::fgMaxChi2nu = 20;
94
95 // --- Make the output container and connect it --------------------
96 task->Connect(0,0);
97 if (useTuple) {
98 AliAnalysisDataContainer* tuple =
99 mgr->CreateContainer("tuple", TNtuple::Class(),
100 AliAnalysisManager::kOutputContainer,
101 "forward_tuple.root"
102 /*AliAnalysisManager::GetCommonFileName()*/);
103 mgr->ConnectOutput(task, 3, tuple);
104 }
105
106 Printf("Returning task %p", task);
107 return task;
108}
109//
110// EOF
111//