2 * @file MakeELossFitsFromFile.C
3 * @author Christian Holm Christensen <cholm@dalsgaard.hehi.nbi.dk>
4 * @date Thu Jul 7 11:23:50 2011
6 * @brief This script takes the output list from a file and applies
7 * the energy fitter directly. In principle this should be done by the
8 * train via AliFMDEnergyFitterTask::Terminate but if this fails or
9 * impatience takes over this script can help...
11 * @ingroup pwglf_forward_scripts_corr
22 * @ingroup pwglf_forward_scripts_corr
24 void MakeELossFitsFromFile(const Char_t* filename="forward.root",
25 UShort_t sys=1, UShort_t sNN=900, Short_t field=5,
29 gROOT->Macro("$ALICE_ROOT/PWGLF/FORWARD/analysis2/scripts/LoadLibs.C");
31 TFile::Open(filename);
32 TList* list = (TList*)gFile->Get("Forward");
34 AliForwardCorrectionManager::Instance().Init(sys, sNN, field, mc, 0);
36 AliFMDEnergyFitter fitter("Fitter");
37 // Set the eta axis to use - note, this overrides whatever is used
38 // by the rest of the algorithms - but only for the energy fitter
40 fitter.SetEtaAxis(200, -4, 6);
41 // Set maximum energy loss to consider
43 // Set number of energy loss bins
44 fitter.SetNEbins(450);
45 // Set whether to use increasing bin sizes
46 fitter.SetUseIncreasingBins(true);
47 // Set whether to do fit the energy distributions
48 fitter.SetDoFits(kTRUE);
49 // Set whether to make the correction object
50 fitter.SetDoMakeObject(kTRUE);
51 // Set the low cut used for energy
52 fitter.SetLowCut(0.4);
53 // Set the number of bins to subtract from maximum of distributions
54 // to get the lower bound of the fit range
55 fitter.SetFitRangeBinWidth(4);
56 // Set the maximum number of landaus to try to fit (max 5)
57 fitter.SetNParticles(5);
58 // Set the minimum number of entries in the distribution before
59 // trying to fit to the data
60 fitter.SetMinEntries(1000);
61 fitter.SetMaxRelativeParameterError(0.12);
62 fitter.SetMaxChi2PerNDF(20);
63 fitter.SetMinWeight(1e-5);
64 // --- Set limits on fits the energy -------------------------------
65 // Maximum relative error on parameters
66 AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
67 // Least weight to use
68 AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
69 // Maximum value of reduced chi^2
70 AliFMDCorrELossFit::ELossFit::fgMaxChi2nu = 20;
72 TList* dummy = new TList;
73 fitter.DefineOutput(dummy);
74 TAxis a(200, -4, 6); // ignored, but needed
80 TDirectory* savdir = gDirectory;
81 TFile* tmp = TFile::Open("elossfits.root", "RECREATE");
82 list->Write(list->GetName(), TObject::kSingleKey);
83 dummy->Write("dummy", TObject::kSingleKey);