2 * @file AddTaskFMDELoss.C
3 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
4 * @date Wed Mar 23 12:14:03 2011
9 * @ingroup pwglf_forward_scripts_tasks
12 * @defgroup pwglf_forward_eloss Energy Loss Fits
14 * Fitting the energy loss @f$\Delta/\Delta_{mip}@f$ spectra
16 * @ingroup pwglf_forward_topical
20 * This is the macro to include the FMD energy fitter in a train.
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
26 * @param residuals If set, also do residuals
28 * @return Newly created task
30 * @ingroup pwglf_forward_eloss
33 AddTaskFMDELoss(Bool_t mc,
37 const Char_t* residuals="")
39 // --- Load libraries ----------------------------------------------
40 gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
42 // --- Get analysis manager ----------------------------------------
43 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
45 Error("AddTaskFMDELoss", "No analysis manager to connect to.");
49 // --- Make the task and add it to the manager ---------------------
50 AliFMDEnergyFitterTask* task = new AliFMDEnergyFitterTask("ForwardELoss");
51 // --- Set parameters on the algorithms ----------------------------
52 // Set the number of SPD tracklets for which we consider the event a
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
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
64 task->GetEnergyFitter().SetNEbins(500);
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
79 // trying to fit to the data - 10K seems the absolute minimum
80 task->GetEnergyFitter().SetMinEntries(10000);
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);
85 task->SetDebug(debug);
87 TString resi(residuals);
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;
98 task->GetEnergyFitter().SetStoreResiduals(rm);
100 // --- Set limits on fits the energy -------------------------------
101 // DO NOT CHANGE THESE UNLESS YOU KNOW WHAT YOU ARE DOING
102 // Maximum relative error on parameters
103 // AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
104 // Least weight to use
105 // AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
106 // Maximum value of reduced chi^2
107 // AliFMDCorrELossFit::ELossFit::fgMaxChi2nu = 20;
109 // --- Make the output container and connect it --------------------
112 Printf("Returning task %p", task);