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