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 useTuple If true, create NTuple of hits
23 * @param debug Debug level
25 * @return Newly created task
27 * @ingroup pwglf_forward_eloss
30 AddTaskFMDMCHit(Bool_t useTuple=false,
33 // --- Load libraries ----------------------------------------------
34 gROOT->LoadClass("AliFMDDigit", "FMDbase");
35 gROOT->LoadClass("AliFMDHit", "FMDsim");
36 gROOT->LoadClass("AliAODForwardMult", "PWGLFforward2");
37 gROOT->LoadClass("AliFMDMCHitEnergyFitter", "PWGLFforwardhit");
39 // --- Get analysis manager ----------------------------------------
40 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
42 Error("AddTaskFMDELoss", "No analysis manager to connect to.");
46 // --- Make the task and add it to the manager ---------------------
47 AliFMDMCHitEnergyFitterTask* task =
48 new AliFMDMCHitEnergyFitterTask("ForwardHitELoss",
50 // --- Set parameters on the algorithms ----------------------------
51 // Set the number of SPD tracklets for which we consider the event a
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
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);
84 task->SetDebug(debug);
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;
95 // --- Make the output container and connect it --------------------
98 AliAnalysisDataContainer* tuple =
99 mgr->CreateContainer("tuple", TNtuple::Class(),
100 AliAnalysisManager::kOutputContainer,
102 /*AliAnalysisManager::GetCommonFileName()*/);
103 mgr->ConnectOutput(task, 3, tuple);
106 Printf("Returning task %p", task);