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 pwg2_forward_scripts_tasks
12 * @defgroup pwg2_forward_eloss Energy Loss Fits
13 * @ingroup pwg2_forward_topical
17 * This is the macro to include the FMD energy fitter in a train.
19 * @ingroup pwg2_forward_eloss
22 AddTaskFMDELoss(Bool_t mc, Bool_t useCent)
24 gSystem->Load("libPWG2forward2");
26 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
28 Error("AddTaskFMDELoss", "No analysis manager to connect to.");
32 // --- Make the task and add it to the manager ---------------------
33 AliFMDEnergyFitterTask* task = new AliFMDEnergyFitterTask("fmdEnergyFitter");
34 // task->SetBLow(blow);
35 // task->SetBLow(bhigh);
38 // --- Set parameters on the algorithms ----------------------------
39 // Set the number of SPD tracklets for which we consider the event a
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
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
51 task->GetEnergyFitter().SetNEbins(500);
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
74 AliFMDCorrELossFit::ELossFit::fgMaxChi2nu = 20;
76 // --- Make the output container and connect it --------------------
77 TString outputfile = ;
78 // outputfile += ":PWG2forwardDnDeta";
79 // Form(":%s",pars->GetDndetaAnalysisName());
80 AliAnalysisDataContainer* histOut =
81 mgr->CreateContainer("Forward", TList::Class(),
82 AliAnalysisManager::kOutputContainer,
83 AliAnalysisManager::GetCommonFileName());
84 AliAnalysisDataContainer *output =
85 mgr->CreateContainer("ForwardResults", TList::Class(),
86 AliAnalysisManager::kParamContainer,
87 AliAnalysisManager::GetCommonFileName());
88 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
89 mgr->ConnectOutput(task, 1, histOut);
90 mgr->ConnectOutput(task, 2, output);