]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGLF/FORWARD/analysis2/AddTaskFMDMCTracks.C
Merge branch 'master' into TPCdev
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / AddTaskFMDMCTracks.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 pwglf_forward_scripts_tasks
10  */
11 /**
12  * @defgroup pwglf_forward_eloss Energy Loss Fits
13  *
14  * Fitting the energy loss @f$\Delta/\Delta_{mip}@f$ spectra 
15  *
16  * @ingroup pwglf_forward_topical
17  */
18
19 /**
20  * This is the macro to include the FMD energy fitter in a train.  
21  * 
22  * @param useTuple  If true, create NTuple of hits
23  * @param debug     Debug level
24  *
25  * @return Newly created task 
26  *
27  * @ingroup pwglf_forward_eloss
28  */
29 AliAnalysisTask*
30 AddTaskFMDMCTracks(Bool_t   useTuple=false, 
31                    UShort_t maxStrips=2,
32                    Int_t    debug=0)
33 {
34   // --- Load libraries ----------------------------------------------
35   gROOT->LoadClass("AliFMDMCTrackELoss", "PWGLFforward2");
36
37   // --- Get analysis manager ----------------------------------------
38   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
39   if (!mgr) {
40     Error("AddTaskFMDELoss", "No analysis manager to connect to.");
41     return NULL;
42   }   
43
44   // --- Make the task and add it to the manager ---------------------
45   AliFMDMCTrackInspectorTask* task = 
46     new AliFMDMCTrackInspectorTask("ForwardTracks", 
47                                      useTuple);
48   // --- Set parameters on the algorithms ----------------------------
49   // Set the number of SPD tracklets for which we consider the event a
50   // low flux event
51   task->GetEventInspector().SetLowFluxCut(1000); 
52   // Set the maximum error on v_z [cm]
53   task->GetEventInspector().SetMaxVzErr(0.2);
54   // Set the eta axis to use - note, this overrides whatever is used
55   // by the rest of the algorithms - but only for the energy fitter
56   // algorithm. 
57   task->GetTrackInspector().SetEtaAxis(100, -4, 6);
58   // Set maximum energy loss to consider 
59   task->GetTrackInspector().SetMaxE(15); 
60   // Set number of energy loss bins 
61   task->GetTrackInspector().SetNEbins(500);
62   // Set whether to use increasing bin sizes 
63   task->GetTrackInspector().SetUseIncreasingBins(true);
64   // Set whether to do fit the energy distributions 
65   task->GetTrackInspector().SetDoFits(kTRUE);
66   // Set whether to make the correction object 
67   // task->GetTrackInspector().SetDoMakeObject(kTRUE);
68   // Set the low cut used for energy
69   task->GetTrackInspector().SetLowCut(0.05);
70   // Set the number of bins to subtract from maximum of distributions
71   // to get the lower bound of the fit range
72   task->GetTrackInspector().SetFitRangeBinWidth(4);
73   // Set the maximum number of landaus to try to fit (max 5)
74   task->GetTrackInspector().SetNParticles(1);
75   // Set the minimum number of entries in the distribution before
76   // trying to fit to the data - 10K seems the absolute minimum
77   task->GetTrackInspector().SetMinEntries(3000 /*10000*/);
78   // Set maximum number of strips per 'cluster' 
79   task->GetTrackInspector().GetTracker().SetMaxConsequtiveStrips(maxStrips);
80   // If set, only collect statistics for MB.  This is to prevent a
81   // bias when looping over data where the MB trigger is downscaled.
82   // task->SetOnlyMB(onlyMB);
83   // Debug
84   task->SetDebug(debug);
85
86   // --- Set limits on fits the energy -------------------------------
87   // DO NOT CHANGE THESE UNLESS YOU KNOW WHAT YOU ARE DOING
88   // Maximum relative error on parameters 
89   // AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
90   // Least weight to use 
91   // AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
92   // Maximum value of reduced chi^2 
93   // AliFMDCorrELossFit::ELossFit::fgMaxChi2nu   = 20;
94   
95   // --- Make the output container and connect it --------------------
96   task->Connect(0,0);
97   if (useTuple) { 
98     AliAnalysisDataContainer* tuple = 
99       mgr->CreateContainer("tuple", TTree::Class(), 
100                            AliAnalysisManager::kOutputContainer,
101                            "forward_tuple.root"
102                            /*AliAnalysisManager::GetCommonFileName()*/);
103     mgr->ConnectOutput(task, 3, tuple);
104   }
105
106   Printf("Returning task %p", task);
107   return task;
108 }
109 //
110 // EOF
111 //