Various fixes, and possibility to set trigger efficiency
[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 */
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
19/**
a08de1fb 20 * This is the macro to include the FMD energy fitter in a train.
21 *
290052e7 22 * @param mc Assume MC input
23 * @param useCent Use centrality information
66cf95f2 24 * @param debug Debug level
290052e7 25 *
26 * @return Newly created task
27 *
bd6f5206 28 * @ingroup pwglf_forward_eloss
a08de1fb 29 */
30AliAnalysisTask*
44e2877f 31AddTaskFMDELoss(Bool_t mc, Bool_t useCent, Int_t debug=0)
a08de1fb 32{
56236b95 33 // --- Load libraries ----------------------------------------------
bd6f5206 34 gROOT->LoadClass("AliAODForwardMult", "libPWGLFforward2");
a08de1fb 35
56236b95 36 // --- Get analysis manager ----------------------------------------
a08de1fb 37 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
38 if (!mgr) {
ffca499d 39 Error("AddTaskFMDELoss", "No analysis manager to connect to.");
a08de1fb 40 return NULL;
41 }
e28f5fc5 42
a08de1fb 43 // --- Make the task and add it to the manager ---------------------
44 AliFMDEnergyFitterTask* task = new AliFMDEnergyFitterTask("fmdEnergyFitter");
9453b19e 45 // task->SetBLow(blow);
46 // task->SetBLow(bhigh);
a08de1fb 47 mgr->AddTask(task);
e28f5fc5 48
49 // --- Set parameters on the algorithms ----------------------------
a08de1fb 50 // Set the number of SPD tracklets for which we consider the event a
51 // low flux event
52 task->GetEventInspector().SetLowFluxCut(1000);
53 // Set the maximum error on v_z [cm]
54 task->GetEventInspector().SetMaxVzErr(0.2);
55 // Set the eta axis to use - note, this overrides whatever is used
56 // by the rest of the algorithms - but only for the energy fitter
57 // algorithm.
58 task->GetEnergyFitter().SetEtaAxis(200, -4, 6);
59 // Set maximum energy loss to consider
60 task->GetEnergyFitter().SetMaxE(15);
61 // Set number of energy loss bins
37079f20 62 task->GetEnergyFitter().SetNEbins(500);
a08de1fb 63 // Set whether to use increasing bin sizes
64 task->GetEnergyFitter().SetUseIncreasingBins(true);
65 // Set whether to do fit the energy distributions
66 task->GetEnergyFitter().SetDoFits(kTRUE);
67 // Set whether to make the correction object
68 task->GetEnergyFitter().SetDoMakeObject(kTRUE);
69 // Set the low cut used for energy
70 task->GetEnergyFitter().SetLowCut(0.4);
71 // Set the number of bins to subtract from maximum of distributions
72 // to get the lower bound of the fit range
73 task->GetEnergyFitter().SetFitRangeBinWidth(4);
74 // Set the maximum number of landaus to try to fit (max 5)
75 task->GetEnergyFitter().SetNParticles(5);
76 // Set the minimum number of entries in the distribution before
77 // trying to fit to the data
78 task->GetEnergyFitter().SetMinEntries(1000);
44e2877f 79 // Debug
80 task->SetDebug(debug);
81
a08de1fb 82 // --- Set limits on fits the energy -------------------------------
83 // Maximum relative error on parameters
84 AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
85 // Least weight to use
86 AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
87 // Maximum value of reduced chi^2
37079f20 88 AliFMDCorrELossFit::ELossFit::fgMaxChi2nu = 20;
a08de1fb 89
90 // --- Make the output container and connect it --------------------
a08de1fb 91 AliAnalysisDataContainer* histOut =
92 mgr->CreateContainer("Forward", TList::Class(),
03418c15 93 AliAnalysisManager::kOutputContainer,
94 AliAnalysisManager::GetCommonFileName());
95 AliAnalysisDataContainer *output =
96 mgr->CreateContainer("ForwardResults", TList::Class(),
97 AliAnalysisManager::kParamContainer,
98 AliAnalysisManager::GetCommonFileName());
a08de1fb 99 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
100 mgr->ConnectOutput(task, 1, histOut);
03418c15 101 mgr->ConnectOutput(task, 2, output);
102
a08de1fb 103
104 return task;
105}