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