]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/AddTaskFMDELoss.C
Possiblity to use MC primary vertex in IsSelected
[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*
e28f5fc5 17AddTaskFMDELoss(Bool_t mc, Float_t blow=0, Float_t bhigh=100)
a08de1fb 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 }
e28f5fc5 26
a08de1fb 27 // --- Make the task and add it to the manager ---------------------
28 AliFMDEnergyFitterTask* task = new AliFMDEnergyFitterTask("fmdEnergyFitter");
e28f5fc5 29 task->SetBLow(blow);
30 task->SetBLow(bhigh);
a08de1fb 31 mgr->AddTask(task);
e28f5fc5 32
33 // --- Set parameters on the algorithms ----------------------------
a08de1fb 34 // Set the number of SPD tracklets for which we consider the event a
35 // low flux event
36 task->GetEventInspector().SetLowFluxCut(1000);
37 // Set the maximum error on v_z [cm]
38 task->GetEventInspector().SetMaxVzErr(0.2);
39 // Set the eta axis to use - note, this overrides whatever is used
40 // by the rest of the algorithms - but only for the energy fitter
41 // algorithm.
42 task->GetEnergyFitter().SetEtaAxis(200, -4, 6);
43 // Set maximum energy loss to consider
44 task->GetEnergyFitter().SetMaxE(15);
45 // Set number of energy loss bins
cc83fca2 46 task->GetEnergyFitter().SetNEbins(450);
a08de1fb 47 // Set whether to use increasing bin sizes
48 task->GetEnergyFitter().SetUseIncreasingBins(true);
49 // Set whether to do fit the energy distributions
50 task->GetEnergyFitter().SetDoFits(kTRUE);
51 // Set whether to make the correction object
52 task->GetEnergyFitter().SetDoMakeObject(kTRUE);
53 // Set the low cut used for energy
54 task->GetEnergyFitter().SetLowCut(0.4);
55 // Set the number of bins to subtract from maximum of distributions
56 // to get the lower bound of the fit range
57 task->GetEnergyFitter().SetFitRangeBinWidth(4);
58 // Set the maximum number of landaus to try to fit (max 5)
59 task->GetEnergyFitter().SetNParticles(5);
60 // Set the minimum number of entries in the distribution before
61 // trying to fit to the data
62 task->GetEnergyFitter().SetMinEntries(1000);
cc83fca2 63 task->GetEnergyFitter().SetMaxRelativeParameterError(0.12);
64 task->GetEnergyFitter().SetMaxChi2PerNDF(10);
65 task->GetEnergyFitter().SetMinWeight(1e-5);
a08de1fb 66 // --- Set limits on fits the energy -------------------------------
67 // Maximum relative error on parameters
68 AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
69 // Least weight to use
70 AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
71 // Maximum value of reduced chi^2
72 AliFMDCorrELossFit::ELossFit::fgMaxChi2nu = 5;
73
74 // --- Make the output container and connect it --------------------
75 TString outputfile = AliAnalysisManager::GetCommonFileName();
76 // outputfile += ":PWG2forwardDnDeta";
77 // Form(":%s",pars->GetDndetaAnalysisName());
78 AliAnalysisDataContainer* histOut =
79 mgr->CreateContainer("Forward", TList::Class(),
80 AliAnalysisManager::kOutputContainer,outputfile);
81 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
82 mgr->ConnectOutput(task, 1, histOut);
83
84 return task;
85}