]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/AddTaskFMDELoss.C
06b4d23f4c4abf25060ee9befcfd57883a7eb0a6
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AddTaskFMDELoss.C
1 /**
2  * @file   AddTaskFMDELoss.C
3  * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
4  * @date   Wed Mar 23 12:14:03 2011
5  * 
6  * @brief  
7  * 
8  * 
9  * @ingroup pwg2_forward_scripts_tasks
10  */
11 /**
12  * @defgroup pwg2_forward_eloss Energy Loss Fits
13  * @ingroup pwg2_forward_topical
14  */
15
16 /**
17  * This is the macro to include the FMD energy fitter in a train.  
18  * 
19  * @ingroup pwg2_forward_eloss
20  */
21 AliAnalysisTask*
22 AddTaskFMDELoss(Bool_t mc, Bool_t useCent)
23 {
24   gSystem->Load("libPWG2forward2");
25
26   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
27   if (!mgr) {
28     Error("AddTaskFMDELoss", "No analysis manager to connect to.");
29     return NULL;
30   }   
31   
32   // --- Make the task and add it to the manager ---------------------
33   AliFMDEnergyFitterTask* task = new AliFMDEnergyFitterTask("fmdEnergyFitter");
34   // task->SetBLow(blow);
35   // task->SetBLow(bhigh);
36   mgr->AddTask(task);
37   
38   // --- Set parameters on the algorithms ----------------------------
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(15); 
50   // Set number of energy loss bins 
51   task->GetEnergyFitter().SetNEbins(500);
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(kTRUE);
56   // Set whether to make the correction object 
57   task->GetEnergyFitter().SetDoMakeObject(kTRUE);
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 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   = 20;
75     
76   // --- Make the output container and connect it --------------------
77   TString outputfile = ;
78   // outputfile += ":PWG2forwardDnDeta"; 
79   // Form(":%s",pars->GetDndetaAnalysisName());
80   AliAnalysisDataContainer* histOut = 
81     mgr->CreateContainer("Forward", TList::Class(), 
82                          AliAnalysisManager::kOutputContainer,
83                          AliAnalysisManager::GetCommonFileName());
84   AliAnalysisDataContainer *output = 
85     mgr->CreateContainer("ForwardResults", TList::Class(), 
86                          AliAnalysisManager::kParamContainer, 
87                          AliAnalysisManager::GetCommonFileName());
88   mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
89   mgr->ConnectOutput(task, 1, histOut);
90   mgr->ConnectOutput(task, 2, output);
91
92
93   return task;
94 }