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()
43 DGUARD(fDebug, 3,"Default CTOR of AliFMDEnergyFitterTask");
47 //____________________________________________________________________
48 AliFMDEnergyFitterTask::AliFMDEnergyFitterTask(const char* name)
49 : AliBaseESDTask(name, "", &(AliForwardCorrectionManager::Instance())),
50 fEventInspector("event"),
51 fEnergyFitter("energy"),
61 DGUARD(fDebug, 3,"Named CTOR of AliFMDEnergyFitterTask: %s", name);
66 //____________________________________________________________________
68 AliFMDEnergyFitterTask::SetDebug(Int_t dbg)
71 // Set the debug level
76 AliBaseESDTask::SetDebug(dbg);
77 fEnergyFitter.SetDebug(dbg);
79 //____________________________________________________________________
81 AliFMDEnergyFitterTask::DefaultEtaAxis() const
83 static TAxis* a = new TAxis(0, 0, 0);
86 //____________________________________________________________________
88 AliFMDEnergyFitterTask::DefaultVertexAxis() const
90 static TAxis* a = new TAxis(10, -10, 10);
94 //____________________________________________________________________
96 AliFMDEnergyFitterTask::Book()
99 // Create output objects
102 DGUARD(fDebug,1,"Create output objects of AliFMDEnergyFitterTask");
104 // We don't need any corrections for this task
105 fNeededCorrections = 0;
106 fExtraCorrections = 0;
108 fEnergyFitter.CreateOutputObjects(fList);
112 //____________________________________________________________________
114 AliFMDEnergyFitterTask::PreData(const TAxis& /*vertex*/, const TAxis& eta)
117 // Initialise the sub objects and stuff. Called on first event
120 DGUARD(fDebug,1,"Initialize subs of AliFMDEnergyFitterTask");
122 fEnergyFitter.SetupForData(eta);
127 //____________________________________________________________________
129 AliFMDEnergyFitterTask::Event(AliESDEvent& esd)
132 // Process each event
138 // static Int_t cnt = 0;
140 // Get the input data
141 DGUARD(fDebug,3,"Analyse event of AliFMDEnergyFitterTask");
142 // --- Read in the data --------------------------------------------
145 Bool_t lowFlux = kFALSE;
150 UShort_t nClusters = 0;
151 UInt_t found = fEventInspector.Process(&esd, triggers, lowFlux,
152 ivz, ip, cent, nClusters);
153 if (found & AliFMDEventInspector::kNoEvent) return false;
154 if (found & AliFMDEventInspector::kNoTriggers) return false;
155 if (found & AliFMDEventInspector::kNoSPD) return false;
156 if (found & AliFMDEventInspector::kNoFMD) return false;
157 if (found & AliFMDEventInspector::kNoVertex) return false;
158 if (found & AliFMDEventInspector::kBadVertex) return false;
160 // do not process pile-up, A, C, and E events
161 if (triggers & AliAODForwardMult::kPileUp) return false;
162 if (triggers & AliAODForwardMult::kA) return false;
163 if (triggers & AliAODForwardMult::kC) return false;
164 if (triggers & AliAODForwardMult::kE) return false;
166 // We want only the events found by off-line
167 if (!(triggers & AliAODForwardMult::kOffline)) return false;
170 // if( cent < 40 || cent >50 ) return;
171 // else std::cout<<"selecting event with cent "<<cent<<std::endl;
175 AliESDFMD* esdFMD = esd.GetFMDData();
176 // Do the energy stuff
177 if (!fEnergyFitter.Accumulate(*esdFMD, cent,
178 triggers & AliAODForwardMult::kEmpty)){
179 AliWarning("Energy fitter failed");
186 //____________________________________________________________________
188 AliFMDEnergyFitterTask::Finalize()
196 DGUARD(fDebug,1,"Processing merged output of AliFMDEnergyFitterTask");
198 AliInfo("Fitting energy loss spectra");
199 fEnergyFitter.Fit(fResults);
204 //____________________________________________________________________
206 AliFMDEnergyFitterTask::Print(Option_t* option) const
214 AliBaseESDTask::Print(option);
215 gROOT->IncreaseDirLevel();
216 fEnergyFitter.Print(option);
217 gROOT->DecreaseDirLevel();