]>
Commit | Line | Data |
---|---|---|
96624385 | 1 | // |
2 | // Calculate the multiplicity in the forward regions event-by-event | |
3 | // | |
4 | // Inputs: | |
5 | // - AliESDEvent | |
6 | // | |
7 | // Outputs: | |
8 | // - AliAODForwardMult | |
9 | // | |
10 | // Histograms | |
11 | // | |
12 | // Corrections used | |
13 | // | |
14 | #include "AliForwardQATask.h" | |
15 | #include "AliForwardUtil.h" | |
16 | #include "AliTriggerAnalysis.h" | |
17 | #include "AliPhysicsSelection.h" | |
18 | #include "AliLog.h" | |
19 | #include "AliESDEvent.h" | |
20 | #include "AliAODHandler.h" | |
21 | #include "AliMultiplicity.h" | |
22 | #include "AliInputEventHandler.h" | |
23 | #include "AliForwardCorrectionManager.h" | |
24 | #include "AliAnalysisManager.h" | |
25 | #include "AliAODForwardMult.h" | |
26 | #include <TH1.h> | |
27 | #include <TDirectory.h> | |
28 | #include <TTree.h> | |
29 | #include <TROOT.h> | |
e2213ed5 | 30 | #include <TStopwatch.h> |
96624385 | 31 | |
32 | //==================================================================== | |
33 | AliForwardQATask::AliForwardQATask() | |
c8b1a7db | 34 | : AliBaseESDTask(), |
96624385 | 35 | fEnableLowFlux(false), |
96624385 | 36 | fESDFMD(), |
37 | fHistos(), | |
38 | fEventInspector(), | |
39 | fEnergyFitter(), | |
40 | fSharingFilter(), | |
c8b1a7db | 41 | fDensityCalculator() |
96624385 | 42 | { |
43 | // | |
44 | // Constructor | |
45 | // | |
c8b1a7db | 46 | fCloneList = true; |
96624385 | 47 | } |
48 | ||
49 | //____________________________________________________________________ | |
50 | AliForwardQATask::AliForwardQATask(const char* name) | |
c8b1a7db | 51 | : AliBaseESDTask(name, "", &(AliForwardCorrectionManager::Instance())), |
96624385 | 52 | fEnableLowFlux(false), |
96624385 | 53 | fESDFMD(), |
54 | fHistos(), | |
55 | fEventInspector("event"), | |
56 | fEnergyFitter("energy"), | |
57 | fSharingFilter("sharing"), | |
c8b1a7db | 58 | fDensityCalculator("density") |
96624385 | 59 | { |
60 | // | |
61 | // Constructor | |
62 | // | |
63 | // Parameters: | |
64 | // name Name of task | |
65 | // | |
96624385 | 66 | fEnergyFitter.SetNParticles(1); // Just find the 1st peak |
67 | fEnergyFitter.SetDoMakeObject(false); | |
68 | fEnergyFitter.SetUseIncreasingBins(true); | |
69 | fEnergyFitter.SetDoFits(kTRUE); | |
70 | fEnergyFitter.SetLowCut(0.4); | |
71 | fEnergyFitter.SetFitRangeBinWidth(4); | |
72 | fEnergyFitter.SetMinEntries(1000); | |
c8b1a7db | 73 | fCloneList = true; |
96624385 | 74 | } |
96624385 | 75 | //____________________________________________________________________ |
76 | void | |
77 | AliForwardQATask::SetDebug(Int_t dbg) | |
78 | { | |
79 | // | |
80 | // Set debug level | |
81 | // | |
82 | // Parameters: | |
83 | // dbg Debug level | |
84 | // | |
c8b1a7db | 85 | AliBaseESDTask:: SetDebug(dbg); |
86 | GetEnergyFitter() .SetDebug(dbg); | |
87 | GetSharingFilter() .SetDebug(dbg); | |
88 | GetDensityCalculator().SetDebug(dbg); | |
96624385 | 89 | } |
90 | ||
91 | //____________________________________________________________________ | |
c8b1a7db | 92 | TAxis* |
93 | AliForwardQATask::DefaultEtaAxis() const | |
96624385 | 94 | { |
c8b1a7db | 95 | static TAxis* a = new TAxis(240, -6, 6); |
96 | return a; | |
97 | } | |
98 | //____________________________________________________________________ | |
99 | TAxis* | |
100 | AliForwardQATask::DefaultVertexAxis() const | |
101 | { | |
102 | static TAxis* a = new TAxis(10, -10, 10); | |
103 | return a; | |
96624385 | 104 | } |
105 | ||
0b7de667 | 106 | //____________________________________________________________________ |
107 | Bool_t | |
108 | AliForwardQATask::Setup() | |
109 | { | |
110 | fEnergyFitter.Init(); | |
111 | return true; | |
112 | } | |
113 | ||
96624385 | 114 | //____________________________________________________________________ |
115 | Bool_t | |
c8b1a7db | 116 | AliForwardQATask::Book() |
96624385 | 117 | { |
c8b1a7db | 118 | // |
119 | // Create output objects | |
120 | // | |
96624385 | 121 | // |
122 | UInt_t what = AliForwardCorrectionManager::kAll; | |
123 | what ^= AliForwardCorrectionManager::kDoubleHit; | |
124 | what ^= AliForwardCorrectionManager::kVertexBias; | |
125 | what ^= AliForwardCorrectionManager::kAcceptance; | |
126 | what ^= AliForwardCorrectionManager::kMergingEfficiency; | |
c8b1a7db | 127 | what ^= AliForwardCorrectionManager::kELossFits; |
128 | fNeededCorrections = what; | |
129 | fExtraCorrections = AliForwardCorrectionManager::kELossFits; | |
130 | ||
131 | fEnergyFitter.CreateOutputObjects(fList); | |
132 | fSharingFilter.CreateOutputObjects(fList); | |
133 | fDensityCalculator.CreateOutputObjects(fList); | |
134 | ||
96624385 | 135 | return true; |
136 | } | |
96624385 | 137 | //____________________________________________________________________ |
422a78c8 | 138 | Bool_t |
c8b1a7db | 139 | AliForwardQATask::PreData(const TAxis& /*vertex*/, const TAxis& eta) |
96624385 | 140 | { |
141 | // | |
142 | // Initialise the sub objects and stuff. Called on first event | |
143 | // | |
144 | // | |
c8b1a7db | 145 | AliForwardCorrectionManager& fcm = AliForwardCorrectionManager::Instance(); |
146 | // We allow fall-back queries so that we may proceed in case we have no | |
147 | // valid corrections | |
148 | if (!fcm.GetELossFit()) { | |
149 | AliWarning("No energy loss fits"); | |
150 | ||
151 | // Fall-back values if we do not have the energy loss fits | |
152 | AliFMDMultCuts& sfLCuts = GetSharingFilter().GetLCuts(); | |
153 | if (sfLCuts.GetMethod() != AliFMDMultCuts::kFixed) { | |
154 | Double_t cut = 0.3; | |
155 | AliWarningF("Using fixed cut @ %f for the lower bound " | |
156 | "of the sharing filter", cut); | |
157 | sfLCuts.SetMultCuts(cut); | |
158 | } | |
159 | AliFMDMultCuts& sfHCuts = GetSharingFilter().GetHCuts(); | |
160 | if (sfHCuts.GetMethod() != AliFMDMultCuts::kFixed) { | |
161 | Double_t cut = 100; | |
162 | AliWarningF("Using fixed cut @ %f for the upper bound " | |
163 | "of the sharing filter", cut); | |
164 | sfHCuts.SetMultCuts(cut); | |
165 | } | |
166 | AliFMDMultCuts& dcCuts = GetDensityCalculator().GetCuts(); | |
167 | if (dcCuts.GetMethod() != AliFMDMultCuts::kFixed) { | |
168 | Double_t cut = 0.3; | |
169 | AliWarningF("Using fixed cut @ %f for the lower bound " | |
170 | "of the density calculator", cut); | |
171 | dcCuts.SetMultCuts(cut); | |
172 | } | |
460a5c02 | 173 | } |
c8b1a7db | 174 | else |
175 | fcm.GetELossFit()->CacheBins(GetDensityCalculator().GetMinQuality()); | |
96624385 | 176 | |
c8b1a7db | 177 | fHistos.Init(eta); |
96624385 | 178 | |
c8b1a7db | 179 | // GetEventInspector().SetupForData(vertex); |
180 | GetEnergyFitter() .SetupForData(eta); | |
181 | GetSharingFilter() .SetupForData(eta); | |
182 | GetDensityCalculator().SetupForData(eta); | |
422a78c8 | 183 | |
184 | return true; | |
96624385 | 185 | } |
186 | ||
187 | //____________________________________________________________________ | |
c8b1a7db | 188 | Bool_t |
189 | AliForwardQATask::PreEvent() | |
96624385 | 190 | { |
c8b1a7db | 191 | // Clear stuff |
192 | fHistos.Clear(); | |
193 | fESDFMD.Clear(); | |
194 | return true; | |
96624385 | 195 | } |
196 | //____________________________________________________________________ | |
c8b1a7db | 197 | Bool_t |
198 | AliForwardQATask::Event(AliESDEvent& esd) | |
96624385 | 199 | { |
200 | // | |
201 | // Process each event | |
202 | // | |
203 | // Parameters: | |
204 | // option Not used | |
205 | // | |
241cca4d | 206 | DGUARD(fDebug,1,"Process the input event"); |
96624385 | 207 | |
460a5c02 | 208 | if (fFirstEvent) { |
209 | // If the first event flag wasn't cleared in the above call to | |
210 | // GetESDEvent, we should not do anything, since nothing has been | |
211 | // initialised yet, so we opt out here (with a warning) | |
212 | AliWarning("Nothing has been initialized yet, opt'ing out"); | |
c8b1a7db | 213 | return false; |
460a5c02 | 214 | } |
96624385 | 215 | |
96624385 | 216 | Bool_t lowFlux = kFALSE; |
217 | UInt_t triggers = 0; | |
218 | UShort_t ivz = 0; | |
5ca83fee | 219 | TVector3 ip; |
96624385 | 220 | Double_t cent = -1; |
221 | UShort_t nClusters = 0; | |
c8b1a7db | 222 | UInt_t found = fEventInspector.Process(&esd, triggers, lowFlux, |
5ca83fee | 223 | ivz, ip, cent, nClusters); |
96624385 | 224 | |
241cca4d | 225 | Bool_t ok = true; |
226 | if (found & AliFMDEventInspector::kNoEvent) ok = false; | |
227 | if (found & AliFMDEventInspector::kNoTriggers) ok = false; | |
228 | if (found & AliFMDEventInspector::kNoSPD) ok = false; | |
229 | if (found & AliFMDEventInspector::kNoFMD) ok = false; | |
230 | if (found & AliFMDEventInspector::kNoVertex) ok = false; | |
231 | if (triggers & AliAODForwardMult::kPileUp) ok = false; | |
81775aba | 232 | if (triggers & AliAODForwardMult::kA) ok = false; |
233 | if (triggers & AliAODForwardMult::kC) ok = false; | |
234 | if (triggers & AliAODForwardMult::kE) ok = false; | |
235 | if (!(triggers & AliAODForwardMult::kOffline)) ok = false; | |
241cca4d | 236 | if (found & AliFMDEventInspector::kBadVertex) ok = false; |
237 | if (!ok) { | |
238 | DMSG(fDebug,2,"Event failed selection: %s", | |
239 | AliFMDEventInspector::CodeString(found)); | |
c8b1a7db | 240 | return false; |
241cca4d | 241 | } |
5ca83fee | 242 | DMSG(fDebug,2,"Event triggers: %s", |
243 | AliAODForwardMult::GetTriggerString(triggers)); | |
96624385 | 244 | |
245 | // We we do not want to use low flux specific code, we disable it here. | |
246 | if (!fEnableLowFlux) lowFlux = false; | |
247 | ||
248 | // Get FMD data | |
c8b1a7db | 249 | AliESDFMD* esdFMD = esd.GetFMDData(); |
96624385 | 250 | |
251 | // Run the energy loss fitter | |
252 | if (!fEnergyFitter.Accumulate(*esdFMD, cent, | |
253 | triggers & AliAODForwardMult::kEmpty)) { | |
254 | AliWarning("Energy fitter failed"); | |
c8b1a7db | 255 | return false; |
96624385 | 256 | } |
4077f3e8 | 257 | |
96624385 | 258 | // // Apply the sharing filter (or hit merging or clustering if you like) |
5ca83fee | 259 | if (!fSharingFilter.Filter(*esdFMD, lowFlux, fESDFMD, ip.Z())) { |
96624385 | 260 | AliWarning("Sharing filter failed!"); |
c8b1a7db | 261 | return false; |
96624385 | 262 | } |
4077f3e8 | 263 | |
96624385 | 264 | // Calculate the inclusive charged particle density |
57522224 | 265 | if (!fDensityCalculator.Calculate(fESDFMD, fHistos, lowFlux, cent, ip)) { |
96624385 | 266 | // if (!fDensityCalculator.Calculate(*esdFMD, fHistos, ivz, lowFlux)) { |
267 | AliWarning("Density calculator failed!"); | |
c8b1a7db | 268 | return false; |
96624385 | 269 | } |
4077f3e8 | 270 | |
c8b1a7db | 271 | return true; |
96624385 | 272 | } |
273 | ||
274 | //____________________________________________________________________ | |
c8b1a7db | 275 | Bool_t |
276 | AliForwardQATask::Finalize() | |
96624385 | 277 | { |
278 | // | |
279 | // End of job | |
280 | // | |
281 | // Parameters: | |
282 | // option Not used | |
283 | // | |
9b2f2e39 | 284 | if (fDebug) AliInfo("In Forwards terminate"); |
e2213ed5 | 285 | TStopwatch swt; |
286 | swt.Start(); | |
96624385 | 287 | |
96624385 | 288 | // Get our histograms from the container |
c8b1a7db | 289 | TH1I* hEventsTr = 0; |
290 | TH1I* hEventsTrVtx = 0; | |
5ca83fee | 291 | TH1I* hEventsAcc = 0; |
96624385 | 292 | TH1I* hTriggers = 0; |
c8b1a7db | 293 | if (!fEventInspector.FetchHistograms(fList, |
5ca83fee | 294 | hEventsTr, |
295 | hEventsTrVtx, | |
296 | hEventsAcc, | |
297 | hTriggers)) { | |
96624385 | 298 | AliError(Form("Didn't get histograms from event selector " |
5ca83fee | 299 | "(hEventsTr=%p,hEventsTrVtx=%p,hEventsAcc=%p)", |
300 | hEventsTr, hEventsTrVtx,hEventsAcc)); | |
c8b1a7db | 301 | return false; |
96624385 | 302 | } |
303 | ||
e2213ed5 | 304 | TStopwatch swf; |
305 | swf.Start(); | |
c8b1a7db | 306 | fEnergyFitter.Fit(fResults); |
e2213ed5 | 307 | swf.Stop(); |
308 | AliInfoF("Fitting took %d real-time seconds, and %f CPU seconds", | |
309 | Int_t(swf.RealTime()), swf.CpuTime()); | |
96624385 | 310 | |
c8b1a7db | 311 | fSharingFilter.Terminate(fList,fResults,Int_t(hEventsTr->Integral())); |
312 | fDensityCalculator.Terminate(fList,fResults,Int_t(hEventsTrVtx->Integral())); | |
96624385 | 313 | |
9b2f2e39 | 314 | if (fDebug) AliInfoF("Posting post processing results to %s", |
c8b1a7db | 315 | fResults->GetName()); |
e2213ed5 | 316 | swt.Stop(); |
c8b1a7db | 317 | AliInfoF("Finalize took %d real-time seconds, and %f CPU seconds", |
e2213ed5 | 318 | Int_t(swt.RealTime()), swt.CpuTime()); |
319 | ||
c8b1a7db | 320 | return true; |
96624385 | 321 | } |
322 | ||
323 | //____________________________________________________________________ | |
324 | void | |
325 | AliForwardQATask::Print(Option_t* option) const | |
326 | { | |
327 | // | |
328 | // Print information | |
329 | // | |
330 | // Parameters: | |
331 | // option Not used | |
332 | // | |
c8b1a7db | 333 | AliBaseESDTask::Print(option); |
96624385 | 334 | gROOT->IncreaseDirLevel(); |
96624385 | 335 | GetEnergyFitter() .Print(option); |
336 | GetSharingFilter() .Print(option); | |
57522224 | 337 | GetDensityCalculator().Print(option); |
96624385 | 338 | gROOT->DecreaseDirLevel(); |
339 | } | |
340 | ||
341 | // | |
342 | // EOF | |
343 | // |