]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/AddTaskFMDELoss.C
Minor fixes
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskFMDELoss.C
CommitLineData
a08de1fb 1/**
ffca499d 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 *
a08de1fb 8 *
bd6f5206 9 * @ingroup pwglf_forward_scripts_tasks
a08de1fb 10 */
ffca499d 11/**
bd6f5206 12 * @defgroup pwglf_forward_eloss Energy Loss Fits
290052e7 13 *
14 * Fitting the energy loss @f$\Delta/\Delta_{mip}@f$ spectra
15 *
bd6f5206 16 * @ingroup pwglf_forward_topical
ffca499d 17 */
18
a08de1fb 19/**
20 * This is the macro to include the FMD energy fitter in a train.
21 *
a03f01f7 22 * @param mc Assume MC input
23 * @param useCent Use centrality information
24 * @param onlyMB Only collect statistics for MB (INEL) events
25 * @param debug Debug level
c8b1a7db 26 * @param residuals If set, also do residuals
290052e7 27 *
28 * @return Newly created task
29 *
bd6f5206 30 * @ingroup pwglf_forward_eloss
a08de1fb 31 */
32AliAnalysisTask*
a03f01f7 33AddTaskFMDELoss(Bool_t mc,
34 Bool_t useCent,
35 Bool_t onlyMB=false,
36 Int_t debug=0,
e65b8b56 37 const Char_t* residuals="")
a08de1fb 38{
56236b95 39 // --- Load libraries ----------------------------------------------
bd6f5206 40 gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
a08de1fb 41
56236b95 42 // --- Get analysis manager ----------------------------------------
a08de1fb 43 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
44 if (!mgr) {
ffca499d 45 Error("AddTaskFMDELoss", "No analysis manager to connect to.");
a08de1fb 46 return NULL;
47 }
e28f5fc5 48
a08de1fb 49 // --- Make the task and add it to the manager ---------------------
c8b1a7db 50 AliFMDEnergyFitterTask* task = new AliFMDEnergyFitterTask("ForwardELoss");
e28f5fc5 51 // --- Set parameters on the algorithms ----------------------------
a08de1fb 52 // Set the number of SPD tracklets for which we consider the event a
53 // low flux event
54 task->GetEventInspector().SetLowFluxCut(1000);
55 // Set the maximum error on v_z [cm]
56 task->GetEventInspector().SetMaxVzErr(0.2);
57 // Set the eta axis to use - note, this overrides whatever is used
58 // by the rest of the algorithms - but only for the energy fitter
59 // algorithm.
60 task->GetEnergyFitter().SetEtaAxis(200, -4, 6);
61 // Set maximum energy loss to consider
62 task->GetEnergyFitter().SetMaxE(15);
63 // Set number of energy loss bins
37079f20 64 task->GetEnergyFitter().SetNEbins(500);
a08de1fb 65 // Set whether to use increasing bin sizes
66 task->GetEnergyFitter().SetUseIncreasingBins(true);
67 // Set whether to do fit the energy distributions
68 task->GetEnergyFitter().SetDoFits(kTRUE);
69 // Set whether to make the correction object
70 task->GetEnergyFitter().SetDoMakeObject(kTRUE);
71 // Set the low cut used for energy
72 task->GetEnergyFitter().SetLowCut(0.4);
73 // Set the number of bins to subtract from maximum of distributions
74 // to get the lower bound of the fit range
75 task->GetEnergyFitter().SetFitRangeBinWidth(4);
76 // Set the maximum number of landaus to try to fit (max 5)
77 task->GetEnergyFitter().SetNParticles(5);
78 // Set the minimum number of entries in the distribution before
81775aba 79 // trying to fit to the data - 10K seems the absolute minimum
80 task->GetEnergyFitter().SetMinEntries(10000);
a03f01f7 81 // If set, only collect statistics for MB. This is to prevent a
82 // bias when looping over data where the MB trigger is downscaled.
83 task->SetOnlyMB(onlyMB);
84 // Debug
44e2877f 85 task->SetDebug(debug);
86
e65b8b56 87 TString resi(residuals);
88 resi.ToUpper();
89 AliFMDEnergyFitter::EResidualMethod rm = AliFMDEnergyFitter::kNoResiduals;
90 if (!resi.IsNull() && !resi.BeginsWith("no")) {
91 if (resi.BeginsWith("square"))
92 rm = AliFMDEnergyFitter::kResidualSquareDifference;
93 else if (resi.BeginsWith("scale"))
94 rm = AliFMDEnergyFitter::kResidualScaledDifference;
95 else // Anything else gives plain difference and errors in errors
96 rm = AliFMDEnergyFitter::kResidualDifference;
97 }
e65b8b56 98 task->GetEnergyFitter().SetStoreResiduals(rm);
99
a08de1fb 100 // --- Set limits on fits the energy -------------------------------
81775aba 101 // DO NOT CHANGE THESE UNLESS YOU KNOW WHAT YOU ARE DOING
a08de1fb 102 // Maximum relative error on parameters
81775aba 103 // AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
a08de1fb 104 // Least weight to use
81775aba 105 // AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
a08de1fb 106 // Maximum value of reduced chi^2
81775aba 107 // AliFMDCorrELossFit::ELossFit::fgMaxChi2nu = 20;
108
a08de1fb 109 // --- Make the output container and connect it --------------------
c8b1a7db 110 task->Connect(0,0);
a08de1fb 111
0b7de667 112 Printf("Returning task %p", task);
a08de1fb 113 return task;
114}
0b7de667 115//
116// EOF
117//