More code clean up.
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AddTaskFMD.C
CommitLineData
7e4038b5 1/**
2 * This is the macro to include the Forward multiplicity in a train.
3 *
4 * @ingroup pwg2_forward_analysis_scripts
5 */
2d68d438 6AliAnalysisTask*
c389303e 7AddTaskFMD()
7e4038b5 8{
9 AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
10 if (!mgr) {
11 Error("AddTaskFMD", "No analysis manager to connect to.");
12 return NULL;
13 }
14
6b908a3f 15 // --- Make the task and add it to the manager ---------------------
0bd4b00f 16 AliForwardMultiplicityTask* task = new AliForwardMultiplicityTask("FMD");
6b908a3f 17 mgr->AddTask(task);
18
19 // --- Set parameters on the algorithms ----------------------------
0bd4b00f 20 // Whether to enable low flux specific code
21 task->SetEnableLowFlux(kFALSE);
6b908a3f 22 // Set the number of SPD tracklets for which we consider the event a
23 // low flux event
24 task->GetEventInspector().SetLowFluxCut(1000);
25 // Set the maximum error on v_z [cm]
26 task->GetEventInspector().SetMaxVzErr(0.2);
27 // Set the eta axis to use - note, this overrides whatever is used
28 // by the rest of the algorithms - but only for the energy fitter
29 // algorithm.
30 task->GetEnergyFitter().SetEtaAxis(200, -4, 6);
c389303e 31 // Set maximum energy loss to consider
32 task->GetEnergyFitter().SetMaxE(10);
33 // Set number of energy loss bins
34 task->GetEnergyFitter().SetNEbins(300);
35 // Set whether to use increasing bin sizes
36 task->GetEnergyFitter().SetUseIncreasingBins(true);
37 // Set whether to do fit the energy distributions
0bd4b00f 38 task->GetEnergyFitter().SetDoFits(kFALSE);
39 // Set whether to make the correction object
40 task->GetEnergyFitter().SetDoMakeObject(kFALSE);
6b908a3f 41 // Set the low cut used for energy
42 task->GetEnergyFitter().SetLowCut(0.4);
43 // Set the number of bins to subtract from maximum of distributions
44 // to get the lower bound of the fit range
c389303e 45 task->GetEnergyFitter().SetFitRangeBinWidth(4);
6b908a3f 46 // Set the maximum number of landaus to try to fit (max 5)
c389303e 47 task->GetEnergyFitter().SetNParticles(5);
6b908a3f 48 // Set the minimum number of entries in the distribution before
49 // trying to fit to the data
50 task->GetEnergyFitter().SetMinEntries(1000);
0bd4b00f 51 // Set the low cut used for sharing - overrides settings in eloss fits
52 // task->GetSharingFilter().SetLowCut(0.4);
53 // Set the number of xi's (width of landau peak) to stop at
54 task->GetSharingFilter().SetNXi(1);
55 // Set the maximum number of particle to try to reconstruct
56 task->GetDensityCalculator().SetMaxParticles(2);
57 // Set the lower multiplicity cut. Overrides setting in energy loss fits.
58 // task->GetDensityCalculator().SetMultCut(0.4);
6b908a3f 59 // Set the number of extra bins (beyond the secondary map border)
c389303e 60 task->GetHistCollector().SetNCutBins(1);
6b908a3f 61 // Set the correction cut, that is, when bins in the secondary map
62 // is smaller than this, they are considered empty
c389303e 63 task->GetHistCollector().SetCorrectionCut(0.1);
6b908a3f 64 // Set the overall debug level (1: some output, 3: a lot of output)
65 task->SetDebug(0);
66 // Set the debug level of a single algorithm
0bd4b00f 67 // task->GetEventInspector().SetDebug(4);
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 = 5;
75
7e4038b5 76
0bd4b00f 77 // --- Set up the parameter manager ---------------------------------
78 // AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
7e4038b5 79 AliMCEventHandler* mcHandler =
80 dynamic_cast<AliMCEventHandler*>(mgr->GetMCtruthEventHandler());
81 Info("AddTaskFMD", "MC handler %p", mcHandler);
0bd4b00f 82 // if(mcHandler) {
83 // pars->SetRealData(kFALSE);
84 // pars->SetProcessPrimary(kTRUE);
85 // pars->SetProcessHits(kFALSE);
86 // }
87 // else {
88 // pars->SetRealData(kTRUE);
89 // pars->SetProcessPrimary(kFALSE);
90 // pars->SetProcessHits(kFALSE);
91 // }
92 // pars->Init();
7e4038b5 93
0bd4b00f 94 // --- Make the output container and connect it --------------------
7e4038b5 95 TString outputfile = AliAnalysisManager::GetCommonFileName();
0bd4b00f 96 // outputfile += ":PWG2forwardDnDeta";
97 // Form(":%s",pars->GetDndetaAnalysisName());
7e4038b5 98 AliAnalysisDataContainer* histOut =
99 mgr->CreateContainer("Forward", TList::Class(),
100 AliAnalysisManager::kOutputContainer,outputfile);
7e4038b5 101 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
102 mgr->ConnectOutput(task, 1, histOut);
103
104 return task;
105}