]>
Commit | Line | Data |
---|---|---|
7984e5f7 | 1 | // |
2 | // This class inspects the event | |
3 | // | |
4 | // Input: | |
5 | // - AliESDFMD object possibly corrected for sharing | |
6 | // | |
7 | // Output: | |
8 | // - A histogram of v_z of events with triggers. | |
9 | // - A histogram of v_z of events with vertex and triggers | |
10 | // - A histogram of trigger counters | |
11 | // | |
12 | // Note, that these are added to the master output list | |
13 | // | |
14 | // Corrections used: | |
15 | // - None | |
16 | // | |
8565b10b | 17 | #include "AliFMDEventInspector.h" |
18 | #include "AliLog.h" | |
19 | #include "AliESDEvent.h" | |
20 | #include "AliMultiplicity.h" | |
21 | #include "AliAnalysisManager.h" | |
11d40ecb | 22 | #include "AliMCEventHandler.h" |
8565b10b | 23 | #include "AliInputEventHandler.h" |
24 | #include "AliTriggerAnalysis.h" | |
25 | #include "AliPhysicsSelection.h" | |
e85a76b7 | 26 | #include "AliOADBPhysicsSelection.h" |
8565b10b | 27 | #include "AliAODForwardMult.h" |
0bd4b00f | 28 | #include "AliForwardUtil.h" |
5e4d905e | 29 | #include "AliCentrality.h" |
8565b10b | 30 | #include <TH1.h> |
31 | #include <TList.h> | |
32 | #include <TDirectory.h> | |
0bd4b00f | 33 | #include <TROOT.h> |
e6463868 | 34 | #include <TParameter.h> |
0bd4b00f | 35 | #include <iostream> |
36 | #include <iomanip> | |
65abd48b | 37 | #include "AliMCEvent.h" |
38 | #include "AliHeader.h" | |
39 | #include "AliGenEventHeader.h" | |
40 | #include "AliCollisionGeometry.h" | |
e1f47419 | 41 | |
8565b10b | 42 | //==================================================================== |
43 | AliFMDEventInspector::AliFMDEventInspector() | |
44 | : TNamed(), | |
45 | fHEventsTr(0), | |
46 | fHEventsTrVtx(0), | |
5bb5d1f6 | 47 | fHEventsAccepted(0), |
96110c91 | 48 | fHEventsAcceptedXY(0), |
8565b10b | 49 | fHTriggers(0), |
0bd4b00f | 50 | fHType(0), |
fe52e455 | 51 | fHWords(0), |
5e4d905e | 52 | fHCent(0), |
e308a636 | 53 | fHCentVsQual(0), |
8565b10b | 54 | fLowFluxCut(1000), |
9d05ffeb | 55 | fMaxVzErr(0.2), |
8565b10b | 56 | fList(0), |
0bd4b00f | 57 | fEnergy(0), |
58 | fField(999), | |
59 | fCollisionSystem(kUnknown), | |
e308a636 | 60 | fDebug(0), |
5bb5d1f6 | 61 | fCentAxis(0), |
e83d0620 | 62 | fVtxAxis(10,-10,10), |
31554871 | 63 | fUseFirstPhysicsVertex(true), |
e6463868 | 64 | fUseV0AND(false), |
65 | fMinPileupContrib(3), | |
65abd48b | 66 | fMinPileupDistance(0.8), |
67 | fUseDisplacedVertices(false), | |
68 | fDisplacedVertex() | |
8565b10b | 69 | { |
7984e5f7 | 70 | // |
71 | // Constructor | |
72 | // | |
6ab100ec | 73 | DGUARD(fDebug,0,"Default CTOR of AliFMDEventInspector"); |
8565b10b | 74 | } |
75 | ||
76 | //____________________________________________________________________ | |
77 | AliFMDEventInspector::AliFMDEventInspector(const char* name) | |
78 | : TNamed("fmdEventInspector", name), | |
79 | fHEventsTr(0), | |
80 | fHEventsTrVtx(0), | |
5bb5d1f6 | 81 | fHEventsAccepted(0), |
96110c91 | 82 | fHEventsAcceptedXY(0), |
8565b10b | 83 | fHTriggers(0), |
0bd4b00f | 84 | fHType(0), |
fe52e455 | 85 | fHWords(0), |
5e4d905e | 86 | fHCent(0), |
e308a636 | 87 | fHCentVsQual(0), |
8565b10b | 88 | fLowFluxCut(1000), |
9d05ffeb | 89 | fMaxVzErr(0.2), |
8565b10b | 90 | fList(0), |
0bd4b00f | 91 | fEnergy(0), |
92 | fField(999), | |
93 | fCollisionSystem(kUnknown), | |
e308a636 | 94 | fDebug(0), |
5bb5d1f6 | 95 | fCentAxis(0), |
e83d0620 | 96 | fVtxAxis(10,-10,10), |
31554871 | 97 | fUseFirstPhysicsVertex(true), |
e6463868 | 98 | fUseV0AND(false), |
99 | fMinPileupContrib(3), | |
65abd48b | 100 | fMinPileupDistance(0.8), |
101 | fUseDisplacedVertices(false), | |
102 | fDisplacedVertex() | |
8565b10b | 103 | { |
7984e5f7 | 104 | // |
105 | // Constructor | |
106 | // | |
107 | // Parameters: | |
108 | // name Name of object | |
109 | // | |
6ab100ec | 110 | DGUARD(fDebug,0,"Named CTOR of AliFMDEventInspector: %s", name); |
8565b10b | 111 | } |
112 | ||
113 | //____________________________________________________________________ | |
114 | AliFMDEventInspector::AliFMDEventInspector(const AliFMDEventInspector& o) | |
115 | : TNamed(o), | |
116 | fHEventsTr(o.fHEventsTr), | |
117 | fHEventsTrVtx(o.fHEventsTrVtx), | |
5bb5d1f6 | 118 | fHEventsAccepted(o.fHEventsAccepted), |
96110c91 | 119 | fHEventsAcceptedXY(o.fHEventsAcceptedXY), |
8565b10b | 120 | fHTriggers(o.fHTriggers), |
0bd4b00f | 121 | fHType(o.fHType), |
fe52e455 | 122 | fHWords(o.fHWords), |
5e4d905e | 123 | fHCent(o.fHCent), |
e308a636 | 124 | fHCentVsQual(o.fHCentVsQual), |
6feacd76 | 125 | fLowFluxCut(o.fLowFluxCut), |
8565b10b | 126 | fMaxVzErr(o.fMaxVzErr), |
127 | fList(o.fList), | |
0bd4b00f | 128 | fEnergy(o.fEnergy), |
129 | fField(o.fField), | |
130 | fCollisionSystem(o.fCollisionSystem), | |
e308a636 | 131 | fDebug(0), |
5bb5d1f6 | 132 | fCentAxis(0), |
e83d0620 | 133 | fVtxAxis(o.fVtxAxis), |
31554871 | 134 | fUseFirstPhysicsVertex(o.fUseFirstPhysicsVertex), |
e6463868 | 135 | fUseV0AND(o.fUseV0AND), |
136 | fMinPileupContrib(o.fMinPileupContrib), | |
65abd48b | 137 | fMinPileupDistance(o.fMinPileupDistance), |
138 | fUseDisplacedVertices(o.fUseDisplacedVertices), | |
139 | fDisplacedVertex(o.fDisplacedVertex) | |
8565b10b | 140 | { |
7984e5f7 | 141 | // |
142 | // Copy constructor | |
143 | // | |
144 | // Parameters: | |
145 | // o Object to copy from | |
146 | // | |
6ab100ec | 147 | DGUARD(fDebug,0,"Copy CTOR of AliFMDEventInspector"); |
8565b10b | 148 | } |
149 | ||
150 | //____________________________________________________________________ | |
151 | AliFMDEventInspector::~AliFMDEventInspector() | |
152 | { | |
7984e5f7 | 153 | // |
154 | // Destructor | |
155 | // | |
8565b10b | 156 | if (fList) delete fList; |
157 | } | |
158 | //____________________________________________________________________ | |
159 | AliFMDEventInspector& | |
160 | AliFMDEventInspector::operator=(const AliFMDEventInspector& o) | |
161 | { | |
7984e5f7 | 162 | // |
163 | // Assignement operator | |
164 | // | |
165 | // Parameters: | |
166 | // o Object to assign from | |
167 | // | |
168 | // Return: | |
169 | // Reference to this object | |
170 | // | |
6ab100ec | 171 | DGUARD(fDebug,3,"Assignment of AliFMDEventInspector"); |
d015ecfe | 172 | if (&o == this) return *this; |
8565b10b | 173 | TNamed::operator=(o); |
174 | fHEventsTr = o.fHEventsTr; | |
175 | fHEventsTrVtx = o.fHEventsTrVtx; | |
5bb5d1f6 | 176 | fHEventsAccepted = o.fHEventsAccepted; |
96110c91 | 177 | fHEventsAcceptedXY = o.fHEventsAcceptedXY; |
8565b10b | 178 | fHTriggers = o.fHTriggers; |
0bd4b00f | 179 | fHType = o.fHType; |
fe52e455 | 180 | fHWords = o.fHWords; |
5e4d905e | 181 | fHCent = o.fHCent; |
e308a636 | 182 | fHCentVsQual = o.fHCentVsQual; |
8565b10b | 183 | fLowFluxCut = o.fLowFluxCut; |
184 | fMaxVzErr = o.fMaxVzErr; | |
185 | fDebug = o.fDebug; | |
186 | fList = (o.fList ? new TList : 0); | |
0bd4b00f | 187 | fEnergy = o.fEnergy; |
188 | fField = o.fField; | |
189 | fCollisionSystem = o.fCollisionSystem; | |
5bb5d1f6 | 190 | fVtxAxis.Set(o.fVtxAxis.GetNbins(), o.fVtxAxis.GetXmin(), |
191 | o.fVtxAxis.GetXmax()); | |
e83d0620 | 192 | |
193 | fUseFirstPhysicsVertex = o.fUseFirstPhysicsVertex; | |
31554871 | 194 | fUseV0AND = o.fUseV0AND; |
e6463868 | 195 | fMinPileupContrib = o.fMinPileupContrib; |
196 | fMinPileupDistance = o.fMinPileupDistance; | |
65abd48b | 197 | fUseDisplacedVertices = o.fUseDisplacedVertices; |
198 | fDisplacedVertex = o.fDisplacedVertex; | |
8565b10b | 199 | if (fList) { |
200 | fList->SetName(GetName()); | |
201 | if (fHEventsTr) fList->Add(fHEventsTr); | |
202 | if (fHEventsTrVtx) fList->Add(fHEventsTrVtx); | |
203 | if (fHTriggers) fList->Add(fHTriggers); | |
0bd4b00f | 204 | if (fHType) fList->Add(fHType); |
fe52e455 | 205 | if (fHWords) fList->Add(fHWords); |
5e4d905e | 206 | if (fHCent) fList->Add(fHCent); |
e308a636 | 207 | if (fHCentVsQual) fList->Add(fHCentVsQual); |
8565b10b | 208 | } |
209 | return *this; | |
210 | } | |
211 | ||
212 | //____________________________________________________________________ | |
213 | Bool_t | |
fb3430ac | 214 | AliFMDEventInspector::FetchHistograms(const TList* d, |
8565b10b | 215 | TH1I*& hEventsTr, |
216 | TH1I*& hEventsTrVtx, | |
217 | TH1I*& hTriggers) const | |
218 | { | |
7984e5f7 | 219 | // |
220 | // Fetch our histograms from the passed list | |
221 | // | |
222 | // Parameters: | |
223 | // d Input | |
224 | // hEventsTr On return, pointer to histogram, or null | |
225 | // hEventsTrVtx On return, pointer to histogram, or null | |
226 | // hTriggers On return, pointer to histogram, or null | |
227 | // | |
228 | // Return: | |
229 | // true on success, false otherwise | |
230 | // | |
6ab100ec | 231 | DGUARD(fDebug,3,"Fetch histograms in AliFMDEventInspector"); |
8565b10b | 232 | hEventsTr = 0; |
233 | hEventsTrVtx = 0; | |
234 | hTriggers = 0; | |
235 | TList* dd = dynamic_cast<TList*>(d->FindObject(GetName())); | |
236 | if (!dd) return kFALSE; | |
237 | ||
238 | hEventsTr = dynamic_cast<TH1I*>(dd->FindObject("nEventsTr")); | |
239 | hEventsTrVtx = dynamic_cast<TH1I*>(dd->FindObject("nEventsTrVtx")); | |
240 | hTriggers = dynamic_cast<TH1I*>(dd->FindObject("triggers")); | |
241 | ||
242 | if (!hEventsTr || !hEventsTrVtx || !hTriggers) return kFALSE; | |
243 | return kTRUE; | |
244 | } | |
245 | //____________________________________________________________________ | |
246 | void | |
247 | AliFMDEventInspector::Init(const TAxis& vtxAxis) | |
248 | { | |
7984e5f7 | 249 | // |
250 | // Initialize the object | |
251 | // | |
252 | // Parameters: | |
253 | // vtxAxis Vertex axis in use | |
254 | // | |
6ab100ec | 255 | DGUARD(fDebug,1,"Initialize in AliFMDEventInspector"); |
e308a636 | 256 | |
257 | // -1.5 -0.5 0.5 1.5 ... 89.5 ... 100.5 | |
258 | // ----- 92 number --------- ---- 1 --- | |
259 | TArrayD limits(93); | |
260 | for (Int_t i = 0; i < 92; i++) limits[i] = -1.5 + i; | |
d8244e9e | 261 | limits[92] = 100.5; |
5bb5d1f6 | 262 | |
263 | fVtxAxis.Set(vtxAxis.GetNbins(), vtxAxis.GetXmin(), vtxAxis.GetXmax()); | |
e308a636 | 264 | |
265 | fCentAxis = new TAxis(limits.GetSize()-1, limits.GetArray()); | |
8565b10b | 266 | fHEventsTr = new TH1I("nEventsTr", "Number of events w/trigger", |
5bb5d1f6 | 267 | 4*vtxAxis.GetNbins(), |
268 | 2*vtxAxis.GetXmin(), | |
269 | 2*vtxAxis.GetXmax()); | |
8565b10b | 270 | fHEventsTr->SetXTitle("v_{z} [cm]"); |
271 | fHEventsTr->SetYTitle("# of events"); | |
272 | fHEventsTr->SetFillColor(kRed+1); | |
273 | fHEventsTr->SetFillStyle(3001); | |
274 | fHEventsTr->SetDirectory(0); | |
275 | // fHEventsTr->Sumw2(); | |
276 | fList->Add(fHEventsTr); | |
277 | ||
5bb5d1f6 | 278 | fHEventsTrVtx = static_cast<TH1I*>(fHEventsTr->Clone("nEventsTrVtx")); |
279 | fHEventsTrVtx->SetTitle("Number of events w/trigger and vertex"); | |
8565b10b | 280 | fHEventsTrVtx->SetFillColor(kBlue+1); |
8565b10b | 281 | fHEventsTrVtx->SetDirectory(0); |
282 | // fHEventsTrVtx->Sumw2(); | |
283 | fList->Add(fHEventsTrVtx); | |
284 | ||
5bb5d1f6 | 285 | fHEventsAccepted = new TH1I("nEventsAccepted", |
286 | "Number of events w/trigger and vertex in range", | |
287 | 2*vtxAxis.GetNbins(), | |
288 | 2*vtxAxis.GetXmin(), | |
289 | 2*vtxAxis.GetXmax()); | |
290 | fHEventsAccepted->SetXTitle("v_{z} [cm]"); | |
291 | fHEventsAccepted->SetYTitle("# of events"); | |
292 | fHEventsAccepted->SetFillColor(kGreen+1); | |
293 | fHEventsAccepted->SetFillStyle(3001); | |
294 | fHEventsAccepted->SetDirectory(0); | |
295 | // fHEventsAccepted->Sumw2(); | |
296 | fList->Add(fHEventsAccepted); | |
297 | ||
96110c91 | 298 | fHEventsAcceptedXY = new TH2D("nEventsAcceptedXY", |
299 | "XY vertex w/trigger and Z vertex in range", | |
300 | 1000,-1,1,1000,-1,1); | |
301 | ||
302 | fHEventsAcceptedXY->SetXTitle("v_{x} [cm]"); | |
303 | fHEventsAcceptedXY->SetYTitle("v_{y} [cm]"); | |
304 | fHEventsAcceptedXY->SetDirectory(0); | |
305 | // fHEventsAccepted->Sumw2(); | |
306 | fList->Add(fHEventsAcceptedXY); | |
307 | ||
308 | ||
0be6c8cd | 309 | fHTriggers = new TH1I("triggers", "Triggers", kOffline+1, 0, kOffline+1); |
8565b10b | 310 | fHTriggers->SetFillColor(kRed+1); |
311 | fHTriggers->SetFillStyle(3001); | |
312 | fHTriggers->SetStats(0); | |
313 | fHTriggers->SetDirectory(0); | |
314 | fHTriggers->GetXaxis()->SetBinLabel(kInel +1,"INEL"); | |
315 | fHTriggers->GetXaxis()->SetBinLabel(kInelGt0+1,"INEL>0"); | |
316 | fHTriggers->GetXaxis()->SetBinLabel(kNSD +1,"NSD"); | |
e6463868 | 317 | fHTriggers->GetXaxis()->SetBinLabel(kV0AND +1,"VOAND"); |
8565b10b | 318 | fHTriggers->GetXaxis()->SetBinLabel(kEmpty +1,"Empty"); |
319 | fHTriggers->GetXaxis()->SetBinLabel(kA +1,"A"); | |
320 | fHTriggers->GetXaxis()->SetBinLabel(kB +1,"B"); | |
321 | fHTriggers->GetXaxis()->SetBinLabel(kC +1,"C"); | |
322 | fHTriggers->GetXaxis()->SetBinLabel(kE +1,"E"); | |
e58000b7 | 323 | fHTriggers->GetXaxis()->SetBinLabel(kPileUp +1,"Pileup"); |
0be6c8cd | 324 | fHTriggers->GetXaxis()->SetBinLabel(kMCNSD +1,"NSD_{MC}"); |
325 | fHTriggers->GetXaxis()->SetBinLabel(kOffline+1,"Offline"); | |
8565b10b | 326 | fList->Add(fHTriggers); |
0bd4b00f | 327 | |
328 | fHType = new TH1I("type", Form("Event type (cut: SPD mult>%d)", | |
329 | fLowFluxCut), 2, -.5, 1.5); | |
330 | fHType->SetFillColor(kRed+1); | |
331 | fHType->SetFillStyle(3001); | |
332 | fHType->SetStats(0); | |
333 | fHType->SetDirectory(0); | |
334 | fHType->GetXaxis()->SetBinLabel(1,"Low-flux"); | |
335 | fHType->GetXaxis()->SetBinLabel(2,"High-flux"); | |
336 | fList->Add(fHType); | |
fe52e455 | 337 | |
c56f8519 | 338 | #if 0 |
339 | // This histogram disabled as it causes problems in the merge | |
fe52e455 | 340 | fHWords = new TH1I("words", "Trigger words seen", 1, 0, 0); |
341 | fHWords->SetFillColor(kBlue+1); | |
342 | fHWords->SetFillStyle(3001); | |
343 | fHWords->SetStats(0); | |
344 | fHWords->SetDirectory(0); | |
345 | fHWords->SetBit(TH1::kCanRebin); | |
346 | fList->Add(fHWords); | |
c56f8519 | 347 | #endif |
5e4d905e | 348 | |
e308a636 | 349 | fHCent = new TH1F("cent", "Centrality", limits.GetSize()-1,limits.GetArray()); |
5e4d905e | 350 | fHCent->SetFillColor(kBlue+1); |
351 | fHCent->SetFillStyle(3001); | |
352 | fHCent->SetStats(0); | |
353 | fHCent->SetDirectory(0); | |
354 | fHCent->SetXTitle("Centrality [%]"); | |
355 | fHCent->SetYTitle("Events"); | |
356 | fList->Add(fHCent); | |
e308a636 | 357 | |
358 | fHCentVsQual = new TH2F("centVsQuality", "Quality vs Centrality", | |
359 | 5, 0, 5, limits.GetSize()-1, limits.GetArray()); | |
360 | fHCentVsQual->SetXTitle("Quality"); | |
361 | fHCentVsQual->SetYTitle("Centrality [%]"); | |
362 | fHCentVsQual->SetZTitle("Events"); | |
363 | fHCentVsQual->GetXaxis()->SetBinLabel(1, "OK"); | |
364 | fHCentVsQual->GetXaxis()->SetBinLabel(2, "Outside v_{z} cut"); | |
365 | fHCentVsQual->GetXaxis()->SetBinLabel(3, "V0 vs SPD outlier"); | |
366 | fHCentVsQual->GetXaxis()->SetBinLabel(4, "V0 vs TPC outlier"); | |
367 | fHCentVsQual->GetXaxis()->SetBinLabel(5, "V0 vs ZDC outlier"); | |
368 | fList->Add(fHCentVsQual); | |
8565b10b | 369 | } |
370 | ||
f7cfc454 | 371 | //____________________________________________________________________ |
372 | void | |
9b2f2e39 | 373 | AliFMDEventInspector::StoreInformation(Int_t runNo) |
f7cfc454 | 374 | { |
375 | // Write TNamed objects to output list containing information about | |
376 | // the running conditions | |
6ab100ec | 377 | DGUARD(fDebug,2,"Store information from AliFMDEventInspector"); |
f7cfc454 | 378 | if (!fList) return; |
379 | ||
e2ebf8c4 | 380 | #if 0 |
f7cfc454 | 381 | TNamed* sys = new TNamed("sys", ""); |
382 | TNamed* sNN = new TNamed("sNN", ""); | |
383 | TNamed* fld = new TNamed("field", ""); | |
9b2f2e39 | 384 | TNamed* run = new TNamed("runNo", Form("%d", runNo)); |
e6463868 | 385 | TNamed* low = new TNamed("lowFlux", Form("%d", fLowFluxCut)); |
a76fb27d | 386 | TNamed* fpv = new TNamed("fpVtx", Form("%s", fUseFirstPhysicsVertex ? |
387 | "true" : "false")); | |
e6463868 | 388 | TNamed* v0a = new TNamed("v0and", Form("%s", fUseV0AND ? "true" : "false")); |
389 | TNamed* nCp = new TNamed("nPileup", Form("%d", fMinPileupContrib)); | |
f7cfc454 | 390 | sys->SetTitle(AliForwardUtil::CollisionSystemString(fCollisionSystem)); |
391 | sNN->SetTitle(AliForwardUtil::CenterOfMassEnergyString(fEnergy)); | |
392 | fld->SetTitle(AliForwardUtil::MagneticFieldString(fField)); | |
e2ebf8c4 | 393 | #else |
394 | TParameter<int>* sys = new TParameter<int>("sys", fCollisionSystem); | |
395 | TParameter<int>* sNN = new TParameter<int>("sNN", fEnergy); | |
396 | TParameter<int>* fld = new TParameter<int>("field", fField); | |
397 | TParameter<int>* run = new TParameter<int>("runNo", runNo); | |
398 | TParameter<int>* low = new TParameter<int>("lowFlux", fLowFluxCut); | |
399 | TParameter<bool>* fpv = new TParameter<bool>("fpVtx",fUseFirstPhysicsVertex); | |
400 | TParameter<bool>* v0a = new TParameter<bool>("v0and",fUseV0AND); | |
a76fb27d | 401 | TParameter<int>* nCp = new TParameter<int>("nPileUp", fMinPileupContrib); |
402 | TParameter<Double_t>* dP = new TParameter<Double_t>("dPileup", | |
403 | fMinPileupDistance); | |
e2ebf8c4 | 404 | #endif |
f7cfc454 | 405 | sys->SetUniqueID(fCollisionSystem); |
406 | sNN->SetUniqueID(fEnergy); | |
407 | fld->SetUniqueID(fField); | |
9b2f2e39 | 408 | run->SetUniqueID(runNo); |
e6463868 | 409 | low->SetUniqueID(fLowFluxCut); |
410 | fpv->SetUniqueID(fUseFirstPhysicsVertex ? 1 : 0); | |
411 | v0a->SetUniqueID(fUseV0AND ? 1 : 0); | |
412 | nCp->SetUniqueID(fMinPileupContrib); | |
f7cfc454 | 413 | |
414 | fList->Add(sys); | |
415 | fList->Add(sNN); | |
416 | fList->Add(fld); | |
e6463868 | 417 | fList->Add(run); |
418 | fList->Add(low); | |
419 | fList->Add(fpv); | |
420 | fList->Add(v0a); | |
421 | fList->Add(nCp); | |
422 | fList->Add(dP); | |
f7cfc454 | 423 | } |
424 | ||
8565b10b | 425 | //____________________________________________________________________ |
426 | void | |
427 | AliFMDEventInspector::DefineOutput(TList* dir) | |
428 | { | |
7984e5f7 | 429 | // |
430 | // Define the output histograms. These are put in a sub list of the | |
431 | // passed list. The histograms are merged before the parent task calls | |
432 | // AliAnalysisTaskSE::Terminate | |
433 | // | |
434 | // dir Directory to add to | |
435 | // | |
6ab100ec | 436 | DGUARD(fDebug,1,"Define output from AliFMDEventInspector"); |
8565b10b | 437 | fList = new TList; |
438 | fList->SetName(GetName()); | |
439 | dir->Add(fList); | |
440 | } | |
441 | ||
442 | //____________________________________________________________________ | |
443 | UInt_t | |
444 | AliFMDEventInspector::Process(const AliESDEvent* event, | |
445 | UInt_t& triggers, | |
446 | Bool_t& lowFlux, | |
0bd4b00f | 447 | UShort_t& ivz, |
5e4d905e | 448 | Double_t& vz, |
5bb5d1f6 | 449 | Double_t& cent, |
450 | UShort_t& nClusters) | |
8565b10b | 451 | { |
7984e5f7 | 452 | // |
453 | // Process the event | |
454 | // | |
455 | // Parameters: | |
456 | // event Input event | |
457 | // triggers On return, the triggers fired | |
458 | // lowFlux On return, true if the event is considered a low-flux | |
459 | // event (according to the setting of fLowFluxCut) | |
460 | // ivz On return, the found vertex bin (1-based). A zero | |
461 | // means outside of the defined vertex range | |
462 | // vz On return, the z position of the interaction | |
5e4d905e | 463 | // cent On return, the centrality - if not available < 0 |
7984e5f7 | 464 | // |
465 | // Return: | |
466 | // 0 (or kOk) on success, otherwise a bit mask of error codes | |
467 | // | |
6ab100ec | 468 | DGUARD(fDebug,1,"Process event in AliFMDEventInspector"); |
7984e5f7 | 469 | |
e1f47419 | 470 | // --- Check that we have an event --------------------------------- |
8565b10b | 471 | if (!event) { |
472 | AliWarning("No ESD event found for input event"); | |
473 | return kNoEvent; | |
474 | } | |
475 | ||
e1f47419 | 476 | // --- Read trigger information from the ESD and store in AOD object |
5bb5d1f6 | 477 | if (!ReadTriggers(event, triggers, nClusters)) { |
0bd4b00f | 478 | if (fDebug > 2) { |
479 | AliWarning("Failed to read triggers from ESD"); } | |
8565b10b | 480 | return kNoTriggers; |
481 | } | |
482 | ||
e1f47419 | 483 | // --- Check if this is a high-flux event -------------------------- |
8565b10b | 484 | const AliMultiplicity* testmult = event->GetMultiplicity(); |
485 | if (!testmult) { | |
0bd4b00f | 486 | if (fDebug > 3) { |
487 | AliWarning("No central multiplicity object found"); } | |
8565b10b | 488 | } |
e1f47419 | 489 | else |
490 | lowFlux = testmult->GetNumberOfTracklets() < fLowFluxCut; | |
5e4d905e | 491 | |
0bd4b00f | 492 | fHType->Fill(lowFlux ? 0 : 1); |
5e4d905e | 493 | |
e1f47419 | 494 | // --- Read centrality information |
e308a636 | 495 | cent = -10; |
496 | UShort_t qual = 0; | |
497 | if (!ReadCentrality(event, cent, qual)) { | |
e1f47419 | 498 | if (fDebug > 3) |
499 | AliWarning("Failed to get centrality"); | |
8565b10b | 500 | } |
e308a636 | 501 | fHCent->Fill(cent); |
502 | if (qual == 0) fHCentVsQual->Fill(0., cent); | |
503 | else { | |
504 | for (UShort_t i = 0; i < 4; i++) | |
505 | if (qual & (1 << i)) fHCentVsQual->Fill(Double_t(i+1), cent); | |
506 | } | |
8565b10b | 507 | |
e1f47419 | 508 | // --- Get the vertex information ---------------------------------- |
96110c91 | 509 | |
510 | Double_t vx = 0; | |
511 | Double_t vy = 0; | |
8565b10b | 512 | vz = 0; |
96110c91 | 513 | |
514 | Bool_t vzOk = ReadVertex(event, vz,vx,vy); | |
8565b10b | 515 | |
516 | fHEventsTr->Fill(vz); | |
517 | if (!vzOk) { | |
0bd4b00f | 518 | if (fDebug > 3) { |
519 | AliWarning("Failed to read vertex from ESD"); } | |
8565b10b | 520 | return kNoVertex; |
521 | } | |
522 | fHEventsTrVtx->Fill(vz); | |
96110c91 | 523 | |
e1f47419 | 524 | // --- Get the vertex bin ------------------------------------------ |
5bb5d1f6 | 525 | ivz = fVtxAxis.FindBin(vz); |
526 | if (ivz <= 0 || ivz > fVtxAxis.GetNbins()) { | |
0bd4b00f | 527 | if (fDebug > 3) { |
8565b10b | 528 | AliWarning(Form("Vertex @ %f outside of range [%f,%f]", |
5bb5d1f6 | 529 | vz, fVtxAxis.GetXmin(), fVtxAxis.GetXmax())); |
530 | } | |
0bd4b00f | 531 | ivz = 0; |
8565b10b | 532 | return kBadVertex; |
533 | } | |
5bb5d1f6 | 534 | fHEventsAccepted->Fill(vz); |
96110c91 | 535 | fHEventsAcceptedXY->Fill(vx,vy); |
e58000b7 | 536 | |
e1f47419 | 537 | // --- Check the FMD ESD data -------------------------------------- |
538 | if (!event->GetFMDData()) { | |
539 | if (fDebug > 3) { | |
540 | AliWarning("No FMD data found in ESD"); } | |
541 | return kNoFMD; | |
542 | } | |
543 | ||
e58000b7 | 544 | |
8565b10b | 545 | return kOk; |
546 | } | |
547 | ||
e1f47419 | 548 | //____________________________________________________________________ |
549 | Bool_t | |
e308a636 | 550 | AliFMDEventInspector::ReadCentrality(const AliESDEvent* esd, |
551 | Double_t& cent, | |
552 | UShort_t& qual) const | |
e1f47419 | 553 | { |
554 | // | |
555 | // Read centrality from event | |
556 | // | |
557 | // Parameters: | |
558 | // esd Event | |
559 | // cent On return, the centrality or negative if not found | |
560 | // | |
561 | // Return: | |
562 | // False on error, true otherwise | |
563 | // | |
6ab100ec | 564 | DGUARD(fDebug,2,"Read the centrality in AliFMDEventInspector"); |
565 | ||
e308a636 | 566 | cent = -1; |
567 | qual = 0; | |
e1f47419 | 568 | AliCentrality* centObj = const_cast<AliESDEvent*>(esd)->GetCentrality(); |
e308a636 | 569 | if (!centObj) return true; |
65abd48b | 570 | AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager(); |
571 | Bool_t isMC = am->GetMCtruthEventHandler() != 0; | |
572 | ||
573 | //std::cout<<fUseDisplacedVertices<<" "<<isMC<<std::endl; | |
574 | if(fUseDisplacedVertices && !isMC) { | |
575 | Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd); | |
576 | qual = 1; | |
577 | if(TMath::Abs(zvtx) < 999) { | |
578 | cent = fDisplacedVertex.CalculateDisplacedVertexCent(esd); //centObj->GetCentralityPercentileUnchecked("ZEMvsZDC"); | |
579 | qual = 0; | |
580 | } | |
581 | } | |
582 | else if(fUseDisplacedVertices && isMC) { | |
583 | ||
584 | ||
585 | AliMCEventHandler* mchandler = static_cast<AliMCEventHandler*>(am->GetMCtruthEventHandler()); | |
586 | AliMCEvent* mcevent = mchandler->MCEvent(); | |
587 | ||
588 | AliHeader* header = mcevent->Header(); | |
589 | AliGenEventHeader* genHeader = header->GenEventHeader(); | |
590 | AliCollisionGeometry* colGeometry = | |
591 | dynamic_cast<AliCollisionGeometry*>(genHeader); | |
592 | Double_t b = -1; | |
593 | if (colGeometry) | |
594 | b = colGeometry->ImpactParameter(); | |
595 | std::cout<<"Hallo!! "<<b<<std::endl; | |
596 | cent = -1; | |
597 | if(b<3.5 && b >0) cent = 2.5; //0-5% | |
598 | if(b>3.5 && b<4.95) cent = 7.5; //5-10% | |
599 | if(b>4.95 && b<6.98) cent = 15; //10-20% | |
600 | if(b>6.98 && b<8.55) cent = 25; //20-30% | |
601 | if(b>8.55 && b<9.88) cent = 35; //30-40% | |
602 | if(b>9.88 && b<11.04) cent = 45; //40-50% | |
603 | if(b>11.04) cent = 55; //50-60% | |
604 | //cent = 10; | |
605 | qual = 0; | |
606 | } | |
607 | else { | |
608 | cent = centObj->GetCentralityPercentile("V0M"); | |
609 | qual = centObj->GetQuality(); | |
610 | } | |
611 | ||
e308a636 | 612 | // AliInfo(Form("Got centrality object %p with quality %d", |
613 | // centObj, centObj->GetQuality())); | |
614 | // centObj->Print(); | |
65abd48b | 615 | //cent = centObj->GetCentralityPercentile("V0M"); |
fd36b8a6 | 616 | //cent = centObj->GetCentralityPercentile("ZEMvsZDC"); |
65abd48b | 617 | //qual = centObj->GetQuality(); |
e1f47419 | 618 | |
619 | return true; | |
620 | } | |
621 | ||
8565b10b | 622 | //____________________________________________________________________ |
623 | Bool_t | |
5bb5d1f6 | 624 | AliFMDEventInspector::ReadTriggers(const AliESDEvent* esd, UInt_t& triggers, |
625 | UShort_t& nClusters) | |
8565b10b | 626 | { |
7984e5f7 | 627 | // |
628 | // Read the trigger information from the ESD event | |
629 | // | |
630 | // Parameters: | |
631 | // esd ESD event | |
632 | // triggers On return, contains the trigger bits | |
633 | // | |
634 | // Return: | |
635 | // @c true on success, @c false otherwise | |
636 | // | |
6ab100ec | 637 | DGUARD(fDebug,2,"Read the triggers in AliFMDEventInspector"); |
8565b10b | 638 | triggers = 0; |
639 | ||
640 | // Get the analysis manager - should always be there | |
641 | AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager(); | |
642 | if (!am) { | |
643 | AliWarning("No analysis manager defined!"); | |
644 | return kFALSE; | |
645 | } | |
646 | ||
647 | // Get the input handler - should always be there | |
648 | AliInputEventHandler* ih = | |
649 | static_cast<AliInputEventHandler*>(am->GetInputEventHandler()); | |
650 | if (!ih) { | |
651 | AliWarning("No input handler"); | |
652 | return kFALSE; | |
653 | } | |
e85a76b7 | 654 | AliPhysicsSelection* ps = |
655 | static_cast<AliPhysicsSelection*>(ih->GetEventSelection()); | |
656 | if (!ps) { | |
657 | AliWarning("No physics selection"); | |
658 | return kFALSE; | |
659 | } | |
660 | AliOADBPhysicsSelection* oadb = | |
661 | const_cast<AliOADBPhysicsSelection*>(ps->GetOADBPhysicsSelection()); | |
662 | if (!oadb) { | |
663 | AliWarning("No OADB physics selection object"); | |
664 | return kFALSE; | |
665 | } | |
666 | ||
e1f47419 | 667 | // Check if this is a collision candidate (MB) |
e333578d | 668 | // Note, that we should use the value cached in the input |
669 | // handler rather than calling IsCollisionCandiate directly | |
670 | // on the AliPhysicsSelection obejct. If we called the latter | |
671 | // then the AliPhysicsSelection object would overcount by a | |
672 | // factor of 2! :-( | |
11d40ecb | 673 | Bool_t offline = ih->IsEventSelected() ; |
674 | Bool_t fastonly = (ih->IsEventSelected() & AliVEvent::kFastOnly); | |
59acef00 | 675 | TString trigStr = esd->GetFiredTriggerClasses(); |
11d40ecb | 676 | |
460a5c02 | 677 | //If we have the MC input handler, this must be MC |
678 | Bool_t isMC = am->GetMCtruthEventHandler() != 0; | |
65abd48b | 679 | |
680 | if(fUseDisplacedVertices && isMC) { | |
681 | AliMCEventHandler* mchandler = static_cast<AliMCEventHandler*>(am->GetMCtruthEventHandler()); | |
682 | AliMCEvent* mcevent = mchandler->MCEvent(); | |
683 | AliHeader* header = mcevent->Header(); | |
684 | AliGenEventHeader* genHeader = header->GenEventHeader(); | |
685 | TArrayF vertex; | |
686 | genHeader->PrimaryVertex(vertex); | |
687 | ||
688 | Double_t zvtx = vertex.At(2); | |
689 | if(TMath::Abs(zvtx) > 35) | |
690 | offline = true; | |
691 | else offline = false; | |
692 | } | |
693 | ||
694 | if(fUseDisplacedVertices && !isMC) { | |
695 | Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd); | |
696 | if(TMath::Abs(zvtx) < 999) offline = true; | |
697 | else offline = false; | |
698 | ||
699 | } | |
11d40ecb | 700 | // For the 2.76 TeV p+p run, the FMD ran in the slow partition |
701 | // so it received no triggers from the fast partition. Therefore | |
702 | // the fast triggers are removed here but not for MC where all | |
703 | // triggers are fast. | |
11d40ecb | 704 | if(TMath::Abs(fEnergy - 2750.) < 20 && |
705 | fCollisionSystem == AliForwardUtil::kPP && | |
706 | !isMC) | |
707 | if (fastonly) offline = false; | |
5bb5d1f6 | 708 | nClusters = 0; |
59acef00 | 709 | |
710 | // MUON triggers are not strictly minimum bias (MB) so they are removed (HHD) | |
711 | ||
712 | if(offline && trigStr.Contains("CMUS1")) offline = false; | |
713 | ||
e6463868 | 714 | if (offline) { |
0be6c8cd | 715 | triggers |= AliAODForwardMult::kOffline; |
8565b10b | 716 | triggers |= AliAODForwardMult::kInel; |
f53fb4f6 | 717 | if (!fHTriggers) { |
718 | AliWarning("Histogram of triggers not defined - has init been called"); | |
719 | return false; | |
720 | } | |
0be6c8cd | 721 | fHTriggers->Fill(kOffline+0.5); |
8565b10b | 722 | |
0be6c8cd | 723 | // If this is inel, see if we have a tracklet |
8565b10b | 724 | const AliMultiplicity* spdmult = esd->GetMultiplicity(); |
725 | if (!spdmult) { | |
726 | AliWarning("No SPD multiplicity"); | |
727 | } | |
728 | else { | |
e333578d | 729 | // Check if we have one or more tracklets |
730 | // in the range -1 < eta < 1 to set the INEL>0 | |
731 | // trigger flag. | |
5bb5d1f6 | 732 | // |
733 | // Also count tracklets as a single cluster | |
8565b10b | 734 | Int_t n = spdmult->GetNumberOfTracklets(); |
735 | for (Int_t j = 0; j < n; j++) { | |
736 | if(TMath::Abs(spdmult->GetEta(j)) < 1) { | |
737 | triggers |= AliAODForwardMult::kInelGt0; | |
5bb5d1f6 | 738 | nClusters++; |
8565b10b | 739 | } |
740 | } | |
5bb5d1f6 | 741 | n = spdmult->GetNumberOfSingleClusters(); |
742 | for (Int_t j = 0; j < n; j++) { | |
743 | Double_t eta = -TMath::Log(TMath::Tan(spdmult->GetThetaSingle(j)/2.)); | |
744 | if (TMath::Abs(eta) < 1) nClusters++; | |
745 | } | |
8565b10b | 746 | } |
5bb5d1f6 | 747 | if (nClusters > 0) triggers |= AliAODForwardMult::kNClusterGt0; |
8565b10b | 748 | } |
11d40ecb | 749 | |
8565b10b | 750 | // Analyse some trigger stuff |
751 | AliTriggerAnalysis ta; | |
e6463868 | 752 | if (ta.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kV0AND)) { |
753 | triggers |= AliAODForwardMult::kV0AND; | |
754 | if (fUseV0AND) | |
31554871 | 755 | triggers |= AliAODForwardMult::kNSD; |
756 | } | |
e6463868 | 757 | if (ta.IsOfflineTriggerFired(esd, AliTriggerAnalysis::kNSD1)) |
758 | triggers |= AliAODForwardMult::kNSD; | |
31554871 | 759 | |
5bb5d1f6 | 760 | // Check for multiple vertices (pile-up) with at least 3 |
761 | // contributors and at least 0.8cm from the primary vertex | |
10f6a070 | 762 | Bool_t pileup = kFALSE; |
763 | if(fCollisionSystem == AliForwardUtil::kPP) | |
e6463868 | 764 | pileup = esd->IsPileupFromSPD(fMinPileupContrib,fMinPileupDistance); |
e58000b7 | 765 | if (pileup) { |
766 | triggers |= AliAODForwardMult::kPileUp; | |
767 | fHTriggers->Fill(kPileUp+.5); | |
768 | } | |
59acef00 | 769 | |
8565b10b | 770 | // Get trigger stuff |
59acef00 | 771 | |
772 | //TString trigStr = esd->GetFiredTriggerClasses(); | |
fe52e455 | 773 | // AliWarning(Form("Fired trigger classes: %s", trigStr.Data())); |
c56f8519 | 774 | if (fHWords) fHWords->Fill(trigStr.Data(), 1); |
fe52e455 | 775 | #if 0 |
776 | if (trigStr.Contains("MB1") || trigStr.Contains("MBBG3")) | |
0be6c8cd | 777 | triggers |= AliAOODForwardMult::kB; |
fe52e455 | 778 | if (trigStr.Contains("COTA")) |
779 | triggers |= AliAODForwardMult::kA; | |
780 | if (trigStr.Contains("COTC")) | |
781 | triggers |= AliAODForwardMult::kC; | |
782 | #endif | |
8565b10b | 783 | if (trigStr.Contains("CBEAMB-ABCE-NOPF-ALL")) { |
784 | triggers |= AliAODForwardMult::kEmpty; | |
785 | fHTriggers->Fill(kEmpty+.5); | |
786 | } | |
e85a76b7 | 787 | #if 0 |
d969d4af | 788 | // Check for B triggers |
789 | if (trigStr.Contains("CINT1B-ABCE-NOPF-ALL") || // Early pp | |
790 | trigStr.Contains("CINT1-B-NOPF-ALLNOTRD") || // Late pp | |
59acef00 | 791 | trigStr.Contains("CINT1-B-NOPF-FASTNOTRD") || // Late pp |
792 | //trigStr.Contains("CMUS1-B-NOPF-MUON") || // Late pp -- HHD 160811 | |
d969d4af | 793 | trigStr.Contains("CSMBB-ABCE-NOPF-ALL") || // pp |
794 | trigStr.Contains("CMBACS2-B-NOPF-ALL") || // PbPb | |
795 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
796 | trigStr.Contains("CMBS2A-B-NOPF-ALL") || // PbPb | |
797 | trigStr.Contains("CMBS2C-B-NOPF-ALL") || // PbPb | |
798 | trigStr.Contains("CMBAC-B-NOPF-ALL") || // PbPb | |
799 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
800 | trigStr.Contains("CMBACS2-B-NOPF-ALLNOTRD") // PbPb | |
801 | // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult | |
802 | ) { | |
59acef00 | 803 | Bool_t bTrigger = kTRUE; |
804 | if ( trigStr.Contains("CINT1-B-NOPF-FASTNOTRD") && | |
805 | !trigStr.Contains("CINT1-B-NOPF-ALLNOTRD") && | |
806 | TMath::Abs(fEnergy - 2750.) < 20 && | |
807 | fCollisionSystem == AliForwardUtil::kPP) | |
808 | bTrigger = kFALSE; | |
809 | if(bTrigger) { | |
810 | triggers |= AliAODForwardMult::kB; | |
811 | fHTriggers->Fill(kB+.5); | |
812 | } | |
8565b10b | 813 | } |
d969d4af | 814 | |
815 | // Check for A triggers | |
8d847dd3 | 816 | if (trigStr.Contains("CINT1A-ABCE-NOPF-ALL") || // Early pp |
817 | trigStr.Contains("CINT1-AC-NOPF-ALLNOTRD") || // Late pp | |
818 | trigStr.Contains("CINT1-AC-NOPF-FASTNOTRD") || // Late pp | |
d969d4af | 819 | (trigStr.Contains("CSMBA-ABCE-NOPF-ALL") && |
8d847dd3 | 820 | !(triggers & AliAODForwardMult::kB)) || // pp |
821 | trigStr.Contains("CMBACS2-A-NOPF-ALL") || // PbPb | |
822 | // trigStr.Contains("C0SMH-A-NOPF-ALL") || // PbPb - high mult | |
823 | trigStr.Contains("CMBS2A-A-NOPF-ALL") || // PbPb | |
824 | trigStr.Contains("CMBS2C-A-NOPF-ALL") || // PbPb | |
825 | trigStr.Contains("CMBAC-A-NOPF-ALL") || // PbPb | |
826 | // trigStr.Contains("C0SMH-A-NOPF-ALL") || // PbPb - high mult | |
d969d4af | 827 | trigStr.Contains("CMBACS2-A-NOPF-ALLNOTRD") // PbPb |
828 | // trigStr.Contains("C0SMH-A-NOPF-ALLNOTRD") // PbPb - high mult | |
829 | ) { | |
830 | triggers |= AliAODForwardMult::kA; | |
831 | fHTriggers->Fill(kA+.5); | |
832 | } | |
8565b10b | 833 | |
d969d4af | 834 | // Check for C triggers |
835 | if (trigStr.Contains("CINT1C-ABCE-NOPF-ALL") || // Early pp | |
836 | (trigStr.Contains("CSMBC-ABCE-NOPF-ALL") && | |
837 | !(triggers & AliAODForwardMult::kB)) || // pp | |
838 | trigStr.Contains("CMBACS2-C-NOPF-ALL") || // PbPb | |
839 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
840 | trigStr.Contains("CMBS2A-C-NOPF-ALL") || // PbPb | |
841 | trigStr.Contains("CMBS2C-C-NOPF-ALL") || // PbPb | |
842 | trigStr.Contains("CMBAC-C-NOPF-ALL") || // PbPb | |
843 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
844 | trigStr.Contains("CMBACS2-C-NOPF-ALLNOTRD") // PbPb | |
845 | // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult | |
846 | ) { | |
8565b10b | 847 | triggers |= AliAODForwardMult::kC; |
848 | fHTriggers->Fill(kC+.5); | |
849 | } | |
850 | ||
d969d4af | 851 | // Check for E triggers |
852 | if (trigStr.Contains("CINT1-E-NOPF-ALL") || // Early pp | |
853 | trigStr.Contains("CINT1-E-NOPF-ALLNOTRD") || // Late pp | |
308e9175 | 854 | trigStr.Contains("CINT1-E-NOPF-FASTNOTRD") || // Late pp |
d969d4af | 855 | trigStr.Contains("CMBACS2-E-NOPF-ALL") || // PbPb |
856 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
857 | trigStr.Contains("CMBS2A-E-NOPF-ALL") || // PbPb | |
858 | trigStr.Contains("CMBS2C-E-NOPF-ALL") || // PbPb | |
859 | trigStr.Contains("CMBAC-E-NOPF-ALL") || // PbPb | |
860 | // trigStr.Contains("C0SMH-B-NOPF-ALL") || // PbPb - high mult | |
861 | trigStr.Contains("CMBACS2-E-NOPF-ALLNOTRD") // PbPb | |
862 | // trigStr.Contains("C0SMH-B-NOPF-ALLNOTRD") // PbPb - high mult | |
863 | ) { | |
8565b10b | 864 | triggers |= AliAODForwardMult::kE; |
865 | fHTriggers->Fill(kE+.5); | |
866 | } | |
e85a76b7 | 867 | #endif |
868 | ||
869 | const TList* collTriggClasses = ps->GetCollisionTriggerClasses(); | |
870 | const TList* bgTriggClasses = ps->GetBGTriggerClasses(); | |
871 | ||
872 | TIter nextColl(collTriggClasses); | |
873 | TObjString* oadbString = 0; | |
874 | TObjArray* tokens = 0; | |
875 | while ((oadbString = static_cast<TObjString*>(nextColl()))) { | |
876 | tokens = oadbString->String().Tokenize(" "); | |
877 | for (Int_t i = 0; i < tokens->GetEntries(); i++) { | |
878 | TString string = (((TObjString*)tokens->At(i))->String()); | |
879 | if (string[0] != '+') continue; | |
880 | string.Remove(0,1); | |
881 | if (trigStr.Contains(string.Data())) { | |
882 | TString beamSide = oadb->GetBeamSide(oadbString->String().Data()); | |
883 | if (beamSide.EqualTo("B")) { | |
884 | triggers |= AliAODForwardMult::kB; | |
885 | fHTriggers->Fill(kB+.5); | |
886 | } | |
887 | } | |
888 | } | |
889 | } | |
890 | TIter nextBG(bgTriggClasses); | |
891 | while ((oadbString = static_cast<TObjString*>(nextBG()))) { | |
892 | tokens = oadbString->String().Tokenize(" "); | |
893 | for (Int_t i = 0; i < tokens->GetEntries(); i++) { | |
894 | TString string = (((TObjString*)tokens->At(i))->String()); | |
895 | if (string[0] != '+') continue; | |
896 | string.Remove(0,1); | |
897 | if (trigStr.Contains(string.Data())) { | |
898 | TString beamSide = oadb->GetBeamSide(oadbString->String().Data()); | |
899 | if (beamSide.Contains("A")) { | |
900 | triggers |= AliAODForwardMult::kA; | |
901 | fHTriggers->Fill(kA+.5); | |
902 | } | |
903 | if (beamSide.Contains("C")) { | |
904 | triggers |= AliAODForwardMult::kC; | |
905 | fHTriggers->Fill(kC+.5); | |
906 | } | |
907 | if (beamSide.Contains("E")) { | |
908 | triggers |= AliAODForwardMult::kE; | |
909 | fHTriggers->Fill(kE+.5); | |
910 | } | |
911 | } | |
912 | } | |
913 | } | |
8565b10b | 914 | |
d969d4af | 915 | // Now check - if we have a collision - for offline triggers and |
916 | // fill histogram. | |
0be6c8cd | 917 | if (triggers & AliAODForwardMult::kB) { |
918 | if (triggers & AliAODForwardMult::kInel) | |
919 | fHTriggers->Fill(kInel); | |
920 | ||
921 | if (triggers & AliAODForwardMult::kInelGt0) | |
922 | fHTriggers->Fill(kInelGt0+.5); | |
923 | ||
924 | if (triggers & AliAODForwardMult::kNSD) | |
925 | fHTriggers->Fill(kNSD+.5); | |
e6463868 | 926 | |
927 | if (triggers & AliAODForwardMult::kV0AND) | |
928 | fHTriggers->Fill(kV0AND+.5); | |
0be6c8cd | 929 | } |
930 | ||
8565b10b | 931 | return kTRUE; |
932 | } | |
933 | //____________________________________________________________________ | |
934 | Bool_t | |
96110c91 | 935 | AliFMDEventInspector::ReadVertex(const AliESDEvent* esd, |
936 | Double_t& vz, | |
937 | Double_t& vx, | |
938 | Double_t& vy) | |
8565b10b | 939 | { |
7984e5f7 | 940 | // |
941 | // Read the vertex information from the ESD event | |
942 | // | |
943 | // Parameters: | |
944 | // esd ESD event | |
945 | // vz On return, the vertex Z position | |
946 | // | |
947 | // Return: | |
948 | // @c true on success, @c false otherwise | |
949 | // | |
6ab100ec | 950 | DGUARD(fDebug,2,"Read the vertex in AliFMDEventInspector"); |
8565b10b | 951 | vz = 0; |
96110c91 | 952 | vx = 1024; |
953 | vy = 1024; | |
65abd48b | 954 | |
955 | AliAnalysisManager* am = AliAnalysisManager::GetAnalysisManager(); | |
956 | Bool_t isMC = am->GetMCtruthEventHandler() != 0; | |
957 | if(fUseDisplacedVertices && isMC) { | |
958 | ||
959 | AliMCEventHandler* mchandler = static_cast<AliMCEventHandler*>(am->GetMCtruthEventHandler()); | |
960 | AliMCEvent* mcevent = mchandler->MCEvent(); | |
961 | AliHeader* header = mcevent->Header(); | |
962 | AliGenEventHeader* genHeader = header->GenEventHeader(); | |
963 | TArrayF vertex; | |
964 | genHeader->PrimaryVertex(vertex); | |
965 | ||
966 | Double_t zvtx = vertex.At(2); | |
967 | Double_t ratio = zvtx/37.5; | |
968 | if(ratio > 0) ratio = ratio + 0.5; | |
969 | if(ratio < 0) ratio = ratio - 0.5; | |
970 | Int_t ratioInt = (Int_t)ratio; | |
971 | zvtx = 37.5*((Double_t)ratioInt); | |
972 | if(TMath::Abs(zvtx) < 999) { | |
973 | vz = zvtx; | |
974 | return true; | |
975 | } | |
976 | else return false; | |
977 | ||
978 | } | |
979 | if(fUseDisplacedVertices && !isMC) { | |
980 | Double_t zvtx = fDisplacedVertex.CheckDisplacedVertex(esd); | |
981 | ||
982 | if(TMath::Abs(zvtx) < 999) { | |
983 | vz = zvtx; | |
984 | return true; | |
985 | } | |
986 | else return false; | |
987 | } | |
988 | ||
e83d0620 | 989 | if(fUseFirstPhysicsVertex) { |
990 | // This is the code used by the 1st physics people | |
991 | const AliESDVertex* vertex = esd->GetPrimaryVertex(); | |
992 | if (!vertex || !vertex->GetStatus()) { | |
993 | if (fDebug > 2) { | |
994 | AliWarning(Form("No primary vertex (%p) or bad status %d", | |
995 | vertex, (vertex ? vertex->GetStatus() : -1))); | |
996 | } | |
997 | return false; | |
5bb5d1f6 | 998 | } |
e83d0620 | 999 | const AliESDVertex* vertexSPD = esd->GetPrimaryVertexSPD(); |
1000 | if (!vertexSPD || !vertexSPD->GetStatus()) { | |
5bb5d1f6 | 1001 | if (fDebug > 2) { |
e83d0620 | 1002 | AliWarning(Form("No primary SPD vertex (%p) or bad status %d", |
1003 | vertexSPD, (vertexSPD ? vertexSPD->GetStatus() : -1))); | |
5bb5d1f6 | 1004 | } |
1005 | return false; | |
1006 | } | |
e83d0620 | 1007 | |
1008 | // if vertex is from SPD vertexZ, require more stringent cuts | |
1009 | if (vertex->IsFromVertexerZ()) { | |
1010 | if (vertex->GetDispersion() > fMaxVzErr || | |
1011 | vertex->GetZRes() > 1.25 * fMaxVzErr) { | |
1012 | if (fDebug > 2) { | |
1013 | AliWarning(Form("Dispersion %f > %f or resolution %f > %f", | |
1014 | vertex->GetDispersion(), fMaxVzErr, | |
1015 | vertex->GetZRes(), 1.25 * fMaxVzErr)); | |
1016 | } | |
1017 | return false; | |
1018 | } | |
1019 | } | |
1020 | vz = vertex->GetZ(); | |
96110c91 | 1021 | |
1022 | if(!vertex->IsFromVertexerZ()) { | |
1023 | vx = vertex->GetX(); | |
1024 | vy = vertex->GetY(); | |
1025 | } | |
e83d0620 | 1026 | return true; |
96110c91 | 1027 | } |
e83d0620 | 1028 | else { //Use standard SPD vertex (perhaps preferable for Pb+Pb) |
1029 | ||
1030 | // Get the vertex | |
1031 | const AliESDVertex* vertex = esd->GetPrimaryVertexSPD(); | |
1032 | if (!vertex) { | |
1033 | if (fDebug > 2) { | |
1034 | AliWarning("No SPD vertex found in ESD"); } | |
1035 | return kFALSE; | |
1036 | } | |
1037 | ||
1038 | // Check that enough tracklets contributed | |
1039 | if(vertex->GetNContributors() <= 0) { | |
1040 | if (fDebug > 2) { | |
1041 | AliWarning(Form("Number of contributors to vertex is %d<=0", | |
1042 | vertex->GetNContributors())); } | |
1043 | vz = 0; | |
1044 | return kFALSE; | |
1045 | } | |
1046 | // Check that the uncertainty isn't too large | |
1047 | if (vertex->GetZRes() > fMaxVzErr) { | |
1048 | if (fDebug > 2) { | |
1049 | AliWarning(Form("Uncertaintity in Z of vertex is too large %f > %f", | |
0bd4b00f | 1050 | vertex->GetZRes(), fMaxVzErr)); } |
e83d0620 | 1051 | return kFALSE; |
1052 | } | |
1053 | ||
1054 | // Get the z coordiante | |
1055 | vz = vertex->GetZ(); | |
96110c91 | 1056 | const AliESDVertex* vertexXY = esd->GetPrimaryVertex(); |
1057 | ||
1058 | if(!vertexXY->IsFromVertexerZ()) { | |
1059 | vx = vertexXY->GetX(); | |
1060 | vy = vertexXY->GetY(); | |
1061 | } | |
e83d0620 | 1062 | return kTRUE; |
1063 | } | |
8565b10b | 1064 | } |
0be6c8cd | 1065 | |
0bd4b00f | 1066 | //____________________________________________________________________ |
1067 | Bool_t | |
1068 | AliFMDEventInspector::ReadRunDetails(const AliESDEvent* esd) | |
1069 | { | |
7984e5f7 | 1070 | // |
1071 | // Read the collision system, collision energy, and L3 field setting | |
1072 | // from the ESD | |
1073 | // | |
1074 | // Parameters: | |
1075 | // esd ESD to get information from | |
1076 | // | |
1077 | // Return: | |
1078 | // true on success, false | |
1079 | // | |
cc83fca2 | 1080 | // AliInfo(Form("Parameters from 1st ESD event: cms=%s, sNN=%f, field=%f", |
1081 | // esd->GetBeamType(), 2*esd->GetBeamEnergy(), | |
1082 | // esd->GetMagneticField())); | |
6ab100ec | 1083 | DGUARD(fDebug,2,"Read the run details in AliFMDEventInspector"); |
0bd4b00f | 1084 | fCollisionSystem = |
1085 | AliForwardUtil::ParseCollisionSystem(esd->GetBeamType()); | |
1086 | fEnergy = | |
1087 | AliForwardUtil::ParseCenterOfMassEnergy(fCollisionSystem, | |
0be6c8cd | 1088 | 2 * esd->GetBeamEnergy()); |
0bd4b00f | 1089 | fField = |
1090 | AliForwardUtil::ParseMagneticField(esd->GetMagneticField()); | |
f7cfc454 | 1091 | |
9b2f2e39 | 1092 | StoreInformation(esd->GetRunNumber()); |
0bd4b00f | 1093 | if (fCollisionSystem == AliForwardUtil::kUnknown || |
1094 | fEnergy <= 0 || | |
1095 | TMath::Abs(fField) > 10) | |
1096 | return kFALSE; | |
1097 | ||
1098 | return kTRUE; | |
1099 | } | |
1100 | ||
1101 | //____________________________________________________________________ | |
1102 | void | |
1103 | AliFMDEventInspector::Print(Option_t*) const | |
1104 | { | |
7984e5f7 | 1105 | // |
1106 | // Print information | |
1107 | // | |
1108 | // option Not used | |
1109 | // | |
0bd4b00f | 1110 | char ind[gROOT->GetDirLevel()+1]; |
1111 | for (Int_t i = 0; i < gROOT->GetDirLevel(); i++) ind[i] = ' '; | |
1112 | ind[gROOT->GetDirLevel()] = '\0'; | |
1113 | TString sNN(AliForwardUtil::CenterOfMassEnergyString(fEnergy)); | |
1114 | sNN.Strip(TString::kBoth, '0'); | |
1115 | sNN.ReplaceAll("GeV", " GeV"); | |
1116 | TString field(AliForwardUtil::MagneticFieldString(fField)); | |
1117 | field.ReplaceAll("p", "+"); | |
1118 | field.ReplaceAll("m", "-"); | |
1119 | field.ReplaceAll("kG", " kG"); | |
1120 | ||
e1f47419 | 1121 | std::cout << ind << ClassName() << ": " << GetName() << '\n' |
2a9e4c0b | 1122 | << ind << " Vertex bins: " << fVtxAxis.GetNbins() << '\n' |
1123 | << ind << " Vertex range: [" << fVtxAxis.GetXmin() | |
1124 | << "," << fVtxAxis.GetXmax() << "]\n" | |
0bd4b00f | 1125 | << ind << " Low flux cut: " << fLowFluxCut << '\n' |
1126 | << ind << " Max(delta v_z): " << fMaxVzErr << " cm\n" | |
e6463868 | 1127 | << ind << " Min(nContrib_pileup): " << fMinPileupContrib << '\n' |
1128 | << ind << " Min(v-pileup): " << fMinPileupDistance << '\n' | |
0bd4b00f | 1129 | << ind << " System: " |
1130 | << AliForwardUtil::CollisionSystemString(fCollisionSystem) << '\n' | |
1131 | << ind << " CMS energy per nucleon: " << sNN << '\n' | |
d8244e9e | 1132 | << ind << " Field: " << field << '\n'; |
1133 | if (!fCentAxis) { std::cout << std::flush; return; } | |
1134 | Int_t nBin = fCentAxis->GetNbins(); | |
1135 | std::cout << ind << " Centrality axis: " << nBin << " bins" | |
1136 | << std::flush; | |
1137 | for (Int_t i = 0; i < nBin; i++) { | |
1138 | if ((i % 10) == 0) std::cout << '\n' << ind << " "; | |
1139 | std::cout << std::setw(5) << fCentAxis->GetBinLowEdge(i+1) << '-'; | |
1140 | } | |
1141 | std::cout << std::setw(5) << fCentAxis->GetBinUpEdge(nBin) << std::endl; | |
0bd4b00f | 1142 | } |
1143 | ||
1144 | ||
8565b10b | 1145 | // |
1146 | // EOF | |
1147 | // | |
1148 |