2 // Histogram and fit the energy loss distributions for the FMD
17 #include "AliFMDEnergyFitterTask.h"
19 #include "AliESDEvent.h"
20 #include "AliESDFMD.h"
21 #include "AliMCEvent.h"
22 #include "AliAODForwardMult.h"
23 #include "AliAnalysisManager.h"
24 #include "AliForwardCorrectionManager.h"
26 #include <TDirectory.h>
32 //====================================================================
33 AliFMDEnergyFitterTask::AliFMDEnergyFitterTask()
42 DGUARD(fDebug, 3,"Default CTOR of AliFMDEnergyFitterTask");
46 //____________________________________________________________________
47 AliFMDEnergyFitterTask::AliFMDEnergyFitterTask(const char* name)
48 : AliBaseESDTask(name, "", &(AliForwardCorrectionManager::Instance())),
49 fEventInspector("event"),
50 fEnergyFitter("energy"),
59 DGUARD(fDebug, 3,"Named CTOR of AliFMDEnergyFitterTask: %s", name);
64 //____________________________________________________________________
66 AliFMDEnergyFitterTask::SetDebug(Int_t dbg)
69 // Set the debug level
74 AliBaseESDTask::SetDebug(dbg);
75 fEnergyFitter.SetDebug(dbg);
77 //____________________________________________________________________
79 AliFMDEnergyFitterTask::DefaultEtaAxis() const
81 static TAxis* a = new TAxis(0, 0, 0);
84 //____________________________________________________________________
86 AliFMDEnergyFitterTask::DefaultVertexAxis() const
88 static TAxis* a = new TAxis(10, -10, 10);
92 //____________________________________________________________________
94 AliFMDEnergyFitterTask::Setup()
100 //____________________________________________________________________
102 AliFMDEnergyFitterTask::Book()
105 // Create output objects
108 DGUARD(fDebug,1,"Create output objects of AliFMDEnergyFitterTask");
110 // We don't need any corrections for this task
111 fNeededCorrections = 0;
112 fExtraCorrections = 0;
114 fEnergyFitter.CreateOutputObjects(fList);
116 fList->Add(AliForwardUtil::MakeParameter("onlyMB", fOnlyMB));
119 //____________________________________________________________________
121 AliFMDEnergyFitterTask::PreData(const TAxis& /*vertex*/, const TAxis& eta)
124 // Initialise the sub objects and stuff. Called on first event
127 DGUARD(fDebug,1,"Initialize subs of AliFMDEnergyFitterTask");
129 fEnergyFitter.SetupForData(eta);
134 //____________________________________________________________________
136 AliFMDEnergyFitterTask::Event(AliESDEvent& esd)
139 // Process each event
145 // static Int_t cnt = 0;
147 // Get the input data
148 DGUARD(fDebug,3,"Analyse event of AliFMDEnergyFitterTask");
149 // --- Read in the data --------------------------------------------
152 Bool_t lowFlux = kFALSE;
157 UShort_t nClusters = 0;
158 UInt_t found = fEventInspector.Process(&esd, triggers, lowFlux,
159 ivz, ip, cent, nClusters);
160 if (found & AliFMDEventInspector::kNoEvent) return false;
161 if (found & AliFMDEventInspector::kNoTriggers) return false;
162 if (found & AliFMDEventInspector::kNoSPD) return false;
163 if (found & AliFMDEventInspector::kNoFMD) return false;
164 if (found & AliFMDEventInspector::kNoVertex) return false;
165 if (found & AliFMDEventInspector::kBadVertex) return false;
167 // do not process pile-up, A, C, and E events
168 if (triggers & AliAODForwardMult::kPileUp) return false;
169 if (triggers & AliAODForwardMult::kA) return false;
170 if (triggers & AliAODForwardMult::kC) return false;
171 if (triggers & AliAODForwardMult::kE) return false;
173 // We want only the events found by off-line
174 if (!(triggers & AliAODForwardMult::kOffline)) return false;
176 // Perhaps we should also insist on MB only
177 if (fOnlyMB && (!(triggers & AliAODForwardMult::kInel))) return false;
180 // if( cent < 40 || cent >50 ) return;
181 // else std::cout<<"selecting event with cent "<<cent<<std::endl;
185 AliESDFMD* esdFMD = esd.GetFMDData();
186 // Do the energy stuff
187 if (!fEnergyFitter.Accumulate(*esdFMD, cent,
188 triggers & AliAODForwardMult::kEmpty)){
189 AliWarning("Energy fitter failed");
196 //____________________________________________________________________
198 AliFMDEnergyFitterTask::Finalize()
206 DGUARD(fDebug,1,"Processing merged output of AliFMDEnergyFitterTask");
208 AliInfo("Fitting energy loss spectra");
209 fEnergyFitter.Fit(fResults);
214 #define PFB(N,FLAG) \
216 AliForwardUtil::PrintName(N); \
217 std::cout << std::boolalpha << (FLAG) << std::noboolalpha << std::endl; \
219 //____________________________________________________________________
221 AliFMDEnergyFitterTask::Print(Option_t* option) const
229 AliBaseESDTask::Print(option);
230 gROOT->IncreaseDirLevel();
231 PFB("Only MB", fOnlyMB);
232 fEnergyFitter.Print(option);
233 gROOT->DecreaseDirLevel();