Added some more scripts
[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 ---------------------
7e4038b5 16 AliForwardMultiplicity* task = new AliForwardMultiplicity("FMD");
6b908a3f 17 mgr->AddTask(task);
18
19 // --- Set parameters on the algorithms ----------------------------
20 // Set the number of SPD tracklets for which we consider the event a
21 // low flux event
22 task->GetEventInspector().SetLowFluxCut(1000);
23 // Set the maximum error on v_z [cm]
24 task->GetEventInspector().SetMaxVzErr(0.2);
25 // Set the eta axis to use - note, this overrides whatever is used
26 // by the rest of the algorithms - but only for the energy fitter
27 // algorithm.
28 task->GetEnergyFitter().SetEtaAxis(200, -4, 6);
c389303e 29 // Set maximum energy loss to consider
30 task->GetEnergyFitter().SetMaxE(10);
31 // Set number of energy loss bins
32 task->GetEnergyFitter().SetNEbins(300);
33 // Set whether to use increasing bin sizes
34 task->GetEnergyFitter().SetUseIncreasingBins(true);
35 // Set whether to do fit the energy distributions
36 task->GetEnergyFitter().SetDoFits(kTRUE);
6b908a3f 37 // Set the low cut used for energy
38 task->GetEnergyFitter().SetLowCut(0.4);
39 // Set the number of bins to subtract from maximum of distributions
40 // to get the lower bound of the fit range
c389303e 41 task->GetEnergyFitter().SetFitRangeBinWidth(4);
6b908a3f 42 // Set the maximum number of landaus to try to fit (max 5)
c389303e 43 task->GetEnergyFitter().SetNParticles(5);
6b908a3f 44 // Set the minimum number of entries in the distribution before
45 // trying to fit to the data
46 task->GetEnergyFitter().SetMinEntries(1000);
6b908a3f 47 // Set the low cut used for sharing
48 task->GetSharingFilter().SetLowCut(0.3);
49 // Set the number of extra bins (beyond the secondary map border)
c389303e 50 task->GetHistCollector().SetNCutBins(1);
6b908a3f 51 // Set the correction cut, that is, when bins in the secondary map
52 // is smaller than this, they are considered empty
c389303e 53 task->GetHistCollector().SetCorrectionCut(0.1);
6b908a3f 54 // Set the overall debug level (1: some output, 3: a lot of output)
55 task->SetDebug(0);
56 // Set the debug level of a single algorithm
57 task->GetEnergyFitter().SetDebug(3);
7e4038b5 58
6b908a3f 59 // --- Set up the parameer manager ---------------------------------
7e4038b5 60 AliFMDAnaParameters* pars = AliFMDAnaParameters::Instance();
61 AliMCEventHandler* mcHandler =
62 dynamic_cast<AliMCEventHandler*>(mgr->GetMCtruthEventHandler());
63 Info("AddTaskFMD", "MC handler %p", mcHandler);
64 if(mcHandler) {
65 pars->SetRealData(kFALSE);
66 pars->SetProcessPrimary(kTRUE);
67 pars->SetProcessHits(kFALSE);
68 }
69 else {
70 pars->SetRealData(kTRUE);
71 pars->SetProcessPrimary(kFALSE);
72 pars->SetProcessHits(kFALSE);
73 }
74 pars->Init();
75
6b908a3f 76 // --- Makek the output container and connect it -------------------
7e4038b5 77 TString outputfile = AliAnalysisManager::GetCommonFileName();
78 outputfile += Form(":%s",pars->GetDndetaAnalysisName());
79 AliAnalysisDataContainer* histOut =
80 mgr->CreateContainer("Forward", TList::Class(),
81 AliAnalysisManager::kOutputContainer,outputfile);
7e4038b5 82 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
83 mgr->ConnectOutput(task, 1, histOut);
84
85 return task;
86}