]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/AddTaskFMD.C
9ed8eacb162fd0edc8c9c92616196cce72f1d2ab
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AddTaskFMD.C
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 Forward multiplicity in a train.  
13  * 
14  * @ingroup pwg2_forward_scripts
15  */
16 AliAnalysisTask*
17 AddTaskFMD(Bool_t mc, UShort_t sys=0, UShort_t sNN=0, Short_t field)
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   AliForwardMultiplicityBase* task = 0;
29   if (mc) task = new AliForwardMCMultiplicityTask("FMD");
30   else    task = new AliForwardMultiplicityTask("FMD");
31   mgr->AddTask(task);
32   
33   // --- Do a local initialisation with assumed values ---------------
34   if (sys > 0 && sNN > 0) 
35     AliForwardCorrectionManager::Instance().Init(sys,sNN,field);
36   
37   // Whether to enable low flux specific code 
38   task->SetEnableLowFlux(kFALSE);
39   // Set the number of SPD tracklets for which we consider the event a
40   // low flux event
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
46   // algorithm. 
47   task->GetEnergyFitter().SetEtaAxis(200, -4, 6);
48   // Set maximum energy loss to consider 
49   task->GetEnergyFitter().SetMaxE(10); 
50   // Set number of energy loss bins 
51   task->GetEnergyFitter().SetNEbins(300);
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(kFALSE);
56   // Set whether to make the correction object 
57   task->GetEnergyFitter().SetDoMakeObject(kFALSE);
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 the low cut used for sharing - overrides settings in eloss fits
69     task->GetSharingFilter().SetLowCut(0.3);
70   // Set the number of xi's (width of landau peak) to stop at 
71   task->GetSharingFilter().SetNXi(1);
72   // Set the maximum number of particle to try to reconstruct 
73   task->GetDensityCalculator().SetMaxParticles(2);
74   // Set the lower multiplicity cut.  Overrides setting in energy loss fits.
75   task->GetDensityCalculator().SetMultCut(0.3); //was 0.3
76   // Whether to use the secondary map correction
77   task->GetCorrections().SetUseSecondaryMap(true);
78   // Whether to use the vertex bias correction
79   task->GetCorrections().SetUseVertexBias(false);
80   // Whether to use the vertex bias correction
81   task->GetCorrections().SetUseAcceptance(true);
82   // Whether to use the merging efficiency correction 
83   task->GetCorrections().SetUseMergingEfficiency(false);
84   // Set the number of extra bins (beyond the secondary map border) 
85   task->GetHistCollector().SetNCutBins(2);
86   // Set the correction cut, that is, when bins in the secondary map 
87   // is smaller than this, they are considered empty 
88   task->GetHistCollector().SetCorrectionCut(0.5);
89   // Set the overall debug level (1: some output, 3: a lot of output)
90   task->SetDebug(0);
91   // Set the debug level of a single algorithm 
92   // task->GetEventInspector().SetDebug(4);
93   // --- Set limits on fits the energy -------------------------------
94   // Maximum relative error on parameters 
95   AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
96   // Least weight to use 
97   AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
98   // Maximum value of reduced chi^2 
99   AliFMDCorrELossFit::ELossFit::fgMaxChi2nu   = 5;
100
101   
102   // --- Make the output container and connect it --------------------
103   TString outputfile = AliAnalysisManager::GetCommonFileName();
104   // outputfile += ":PWG2forwardDnDeta"; 
105   // Form(":%s",pars->GetDndetaAnalysisName());
106   AliAnalysisDataContainer* histOut = 
107     mgr->CreateContainer("Forward", TList::Class(), 
108                          AliAnalysisManager::kOutputContainer,outputfile);
109   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
110   mgr->ConnectOutput(task, 1, histOut);
111
112   return task;
113 }