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