4 * @ingroup pwg2_forward_scripts
7 * Run a pass on ESD data to produce the energ loss fits
10 * @ingroup pwg2_forward_scripts
12 void MakeELossFits(const char* esddir,
17 // --- Libraries to load -------------------------------------------
18 gROOT->Macro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadLibs.C");
20 // --- Check for proof mode, and possibly upload pars --------------
22 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/LoadPars.C");
26 // --- Our data chain ----------------------------------------------
27 gROOT->LoadMacro("$ALICE_ROOT/PWG2/FORWARD/analysis2/scripts/MakeESDChain.C");
28 TChain* chain = MakeESDChain(esddir, true);
29 // If 0 or less events is select, choose all
30 if (nEvents <= 0) nEvents = chain->GetEntries();
31 Info("MakeELossFits", "Will analyse %d events", nEvents);
33 // --- Creating the manager and handlers ---------------------------
34 AliAnalysisManager *mgr = new AliAnalysisManager("Analysis Train",
35 "FMD analysis train");
37 AliESDInputHandler *esdHandler = new AliESDInputHandler();
38 esdHandler->SetInactiveBranches("AliESDACORDE "
39 "AliRawDataErrorLogs "
50 mgr->SetInputEventHandler(esdHandler);
53 AliAODHandler* aodHandler = new AliAODHandler();
54 mgr->SetOutputEventHandler(aodHandler);
55 aodHandler->SetOutputFileName("AliAODs.root");
57 // --- Add tasks ---------------------------------------------------
58 gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
59 AddTaskPhysicsSelection(mc, kTRUE, kTRUE);
60 AliFMDEnergyFitterTask* task = new AliFMDEnergyFitterTask("fmdEnergyFitter");
63 // --- Make the output container and connect it --------------------
64 TString outputfile = "energyFits.root";
65 AliAnalysisDataContainer* histOut =
66 mgr->CreateContainer("Forward", TList::Class(),
67 AliAnalysisManager::kOutputContainer,outputfile);
68 mgr->ConnectInput(task, 0, mgr->GetCommonInputContainer());
69 mgr->ConnectOutput(task, 1, histOut);
71 // --- Set parameters on the algorithms ----------------------------
72 // Set the number of SPD tracklets for which we consider the event a
74 task->GetEventInspector().SetLowFluxCut(1000);
75 // Set the maximum error on v_z [cm]
76 task->GetEventInspector().SetMaxVzErr(0.2);
77 // Set the eta axis to use - note, this overrides whatever is used
78 // by the rest of the algorithms - but only for the energy fitter
80 task->GetEnergyFitter().SetEtaAxis(200, -4, 6);
81 // Set maximum energy loss to consider
82 task->GetEnergyFitter().SetMaxE(15);
83 // Set number of energy loss bins
84 task->GetEnergyFitter().SetNEbins(100);
85 // Set whether to use increasing bin sizes
86 task->GetEnergyFitter().SetUseIncreasingBins(true);
87 // Set whether to do fit the energy distributions
88 task->GetEnergyFitter().SetDoFits(kTRUE);
89 // Set whether to make the correction object
90 task->GetEnergyFitter().SetDoMakeObject(kTRUE);
91 // Set the low cut used for energy
92 task->GetEnergyFitter().SetLowCut(0.4);
93 // Set the number of bins to subtract from maximum of distributions
94 // to get the lower bound of the fit range
95 task->GetEnergyFitter().SetFitRangeBinWidth(4);
96 // Set the maximum number of landaus to try to fit (max 5)
97 task->GetEnergyFitter().SetNParticles(5);
98 // Set the minimum number of entries in the distribution before
99 // trying to fit to the data
100 task->GetEnergyFitter().SetMinEntries(1000);
101 // --- Set limits on fits the energy -------------------------------
102 // Maximum relative error on parameters
103 AliFMDCorrELossFit::ELossFit::fgMaxRelError = .12;
104 // Least weight to use
105 AliFMDCorrELossFit::ELossFit::fgLeastWeight = 1e-5;
106 // Maximum value of reduced chi^2
107 AliFMDCorrELossFit::ELossFit::fgMaxChi2nu = 5;
109 // --- Run the analysis --------------------------------------------
111 if (!mgr->InitAnalysis()) {
112 Error("RunManager", "Failed to initialize analysis train!");
115 // Some informative output
117 // mgr->SetDebugLevel(3);
118 if (mgr->GetDebugLevel() < 1 && proof <= 0) mgr->SetUseProgressBar(kTRUE);
122 Printf("=== RUNNING ANALYSIS ==================================");
123 mgr->StartAnalysis(proof > 0 ? "proof" : "local", chain, nEvents);