Mior fixes
[u/mrichter/AliRoot.git] / PWG2 / 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 *
ffca499d 9 * @ingroup pwg2_forward_scripts_tasks
a08de1fb 10 */
ffca499d 11/**
12 * @defgroup pwg2_forward_eloss Energy Loss Fits
13 * @ingroup pwg2_forward_topical
14 */
15
a08de1fb 16/**
17 * This is the macro to include the FMD energy fitter in a train.
18 *
ffca499d 19 * @ingroup pwg2_forward_eloss
a08de1fb 20 */
21AliAnalysisTask*
9453b19e 22AddTaskFMDELoss(Bool_t mc, Bool_t useCent)
a08de1fb 23{
24 gSystem->Load("libPWG2forward2");
25
26 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
27 if (!mgr) {
ffca499d 28 Error("AddTaskFMDELoss", "No analysis manager to connect to.");
a08de1fb 29 return NULL;
30 }
e28f5fc5 31
a08de1fb 32 // --- Make the task and add it to the manager ---------------------
33 AliFMDEnergyFitterTask* task = new AliFMDEnergyFitterTask("fmdEnergyFitter");
9453b19e 34 // task->SetBLow(blow);
35 // task->SetBLow(bhigh);
a08de1fb 36 mgr->AddTask(task);
e28f5fc5 37
38 // --- Set parameters on the algorithms ----------------------------
a08de1fb 39 // Set the number of SPD tracklets for which we consider the event a
40 // low flux event
41 task->GetEventInspector().SetLowFluxCut(1000);
42 // Set the maximum error on v_z [cm]
43 task->GetEventInspector().SetMaxVzErr(0.2);
44 // Set the eta axis to use - note, this overrides whatever is used
45 // by the rest of the algorithms - but only for the energy fitter
46 // algorithm.
47 task->GetEnergyFitter().SetEtaAxis(200, -4, 6);
48 // Set maximum energy loss to consider
49 task->GetEnergyFitter().SetMaxE(15);
50 // Set number of energy loss bins
37079f20 51 task->GetEnergyFitter().SetNEbins(500);
a08de1fb 52 // Set whether to use increasing bin sizes
53 task->GetEnergyFitter().SetUseIncreasingBins(true);
54 // Set whether to do fit the energy distributions
55 task->GetEnergyFitter().SetDoFits(kTRUE);
56 // Set whether to make the correction object
57 task->GetEnergyFitter().SetDoMakeObject(kTRUE);
58 // Set the low cut used for energy
59 task->GetEnergyFitter().SetLowCut(0.4);
60 // Set the number of bins to subtract from maximum of distributions
61 // to get the lower bound of the fit range
62 task->GetEnergyFitter().SetFitRangeBinWidth(4);
63 // Set the maximum number of landaus to try to fit (max 5)
64 task->GetEnergyFitter().SetNParticles(5);
65 // Set the minimum number of entries in the distribution before
66 // trying to fit to the data
67 task->GetEnergyFitter().SetMinEntries(1000);
68 // --- Set limits on fits the energy -------------------------------
69 // Maximum relative error on parameters
70 AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
71 // Least weight to use
72 AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
73 // Maximum value of reduced chi^2
37079f20 74 AliFMDCorrELossFit::ELossFit::fgMaxChi2nu = 20;
a08de1fb 75
76 // --- Make the output container and connect it --------------------
03418c15 77 TString outputfile = ;
a08de1fb 78 // outputfile += ":PWG2forwardDnDeta";
79 // Form(":%s",pars->GetDndetaAnalysisName());
80 AliAnalysisDataContainer* histOut =
81 mgr->CreateContainer("Forward", TList::Class(),
03418c15 82 AliAnalysisManager::kOutputContainer,
83 AliAnalysisManager::GetCommonFileName());
84 AliAnalysisDataContainer *output =
85 mgr->CreateContainer("ForwardResults", TList::Class(),
86 AliAnalysisManager::kParamContainer,
87 AliAnalysisManager::GetCommonFileName());
a08de1fb 88 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
89 mgr->ConnectOutput(task, 1, histOut);
03418c15 90 mgr->ConnectOutput(task, 2, output);
91
a08de1fb 92
93 return task;
94}