]>
Commit | Line | Data |
---|---|---|
f49fc45d | 1 | // |
2 | // Class that contains the forward multiplicity data per event | |
3 | // | |
4 | // This class contains a histogram of | |
5 | // @f[ | |
6 | // \frac{d^2N_{ch}}{d\eta d\phi}\quad, | |
7 | // @f] | |
8 | // as well as a trigger mask for each analysed event. | |
9 | // | |
10 | // The eta acceptance of the event is stored in the underflow bins of | |
11 | // the histogram. So to build the final histogram, one needs to | |
12 | // correct for this acceptance (properly weighted by the events), and | |
13 | // the vertex efficiency. This simply boils down to defining a 2D | |
14 | // histogram and summing the event histograms in that histogram. One | |
15 | // should of course also do proper book-keeping of the accepted event. | |
16 | // | |
7e4038b5 | 17 | #include "AliAODForwardMult.h" |
18 | #include <TBrowser.h> | |
19 | #include <iostream> | |
20 | #include <TMath.h> | |
21 | #include <TObjString.h> | |
9453b19e | 22 | #include <TObjArray.h> |
23 | #include "AliLog.h" | |
7e4038b5 | 24 | ClassImp(AliAODForwardMult) |
ffca499d | 25 | #ifdef DOXY_INPUT |
7e4038b5 | 26 | ; // For Emacs |
27 | #endif | |
28 | ||
29 | //____________________________________________________________________ | |
30 | const Float_t AliAODForwardMult::fgkInvalidIpZ = 1e6; | |
31 | ||
32 | //____________________________________________________________________ | |
33 | AliAODForwardMult::AliAODForwardMult() | |
f49fc45d | 34 | : fIsMC(false), |
35 | fHist(), | |
7e4038b5 | 36 | fTriggers(0), |
e58000b7 | 37 | fIpZ(fgkInvalidIpZ), |
5bb5d1f6 | 38 | fCentrality(-1), |
39 | fNClusters(0) | |
f49fc45d | 40 | { |
41 | // | |
42 | // Constructor | |
43 | // | |
44 | } | |
7e4038b5 | 45 | |
46 | //____________________________________________________________________ | |
f49fc45d | 47 | AliAODForwardMult::AliAODForwardMult(Bool_t isMC) |
48 | : fIsMC(isMC), | |
49 | fHist("forwardMult", "d^{2}N_{ch}/d#etad#varphi in the forward regions", | |
7e4038b5 | 50 | 200, -4, 6, 20, 0, 2*TMath::Pi()), |
51 | fTriggers(0), | |
e58000b7 | 52 | fIpZ(fgkInvalidIpZ), |
5bb5d1f6 | 53 | fCentrality(-1), |
54 | fNClusters(0) | |
7e4038b5 | 55 | { |
f49fc45d | 56 | // |
57 | // Constructor | |
58 | // | |
59 | // Parameters: | |
60 | // isMC If set to true this is for MC data (effects branch name) | |
61 | // | |
7e4038b5 | 62 | fHist.SetXTitle("#eta"); |
63 | fHist.SetYTitle("#varphi [radians]"); | |
64 | fHist.SetZTitle("#frac{d^{2}N_{ch}}{d#etad#varphi}"); | |
f49fc45d | 65 | fHist.SetDirectory(0); |
7e4038b5 | 66 | fHist.Sumw2(); |
67 | } | |
68 | ||
69 | //____________________________________________________________________ | |
70 | void | |
71 | AliAODForwardMult::Init(const TAxis& etaAxis) | |
72 | { | |
f49fc45d | 73 | // Initialize the histogram with an eta axis |
74 | // | |
75 | // Parameters: | |
76 | // etaAxis Eta axis to use | |
77 | // | |
7e4038b5 | 78 | fHist.SetBins(etaAxis.GetNbins(), etaAxis.GetXmin(), etaAxis.GetXmax(), |
79 | 20, 0, 2*TMath::Pi()); | |
80 | } | |
81 | ||
82 | //____________________________________________________________________ | |
83 | void | |
84 | AliAODForwardMult::Clear(Option_t* option) | |
85 | { | |
f49fc45d | 86 | // Clear (or reset) internal values |
87 | // | |
88 | // Parameters: | |
89 | // option Passed to TH1::Reset | |
90 | // | |
7e4038b5 | 91 | fHist.Reset(option); |
5bb5d1f6 | 92 | fTriggers = 0; |
93 | fIpZ = fgkInvalidIpZ; | |
94 | fNClusters = 0; | |
7e4038b5 | 95 | } |
b2e7f2d6 | 96 | //____________________________________________________________________ |
97 | void | |
98 | AliAODForwardMult::SetSNN(UShort_t snn) | |
99 | { | |
100 | // set the center of mass energy per nucleon pair (GeV). | |
101 | // This is stored in bin (0,0) of the histogram | |
102 | // | |
103 | // Parameters: | |
104 | // sNN Center of mass energy per nuclean | |
105 | fHist.SetBinContent(0,0,snn); | |
106 | } | |
107 | //____________________________________________________________________ | |
108 | void | |
109 | AliAODForwardMult::SetSystem(UShort_t sys) | |
110 | { | |
111 | // set the center of mass energy per nucleon pair (GeV). | |
112 | // This is stored in bin (N+1,0) of the histogram | |
113 | // | |
114 | // Parameters: | |
115 | // sys Collision system number | |
116 | fHist.SetBinContent(fHist.GetNbinsX()+1,0,sys); | |
117 | } | |
118 | ||
7e4038b5 | 119 | //____________________________________________________________________ |
120 | Bool_t | |
121 | AliAODForwardMult::HasIpZ() const | |
122 | { | |
f49fc45d | 123 | // Check if we have valid z coordinate of the interaction point |
124 | // | |
125 | // Return: | |
126 | // true if the z coordinate of the interaction point is valid | |
127 | // | |
7e4038b5 | 128 | return TMath::Abs(fIpZ - fgkInvalidIpZ) > 1; |
129 | } | |
130 | ||
b2e7f2d6 | 131 | //____________________________________________________________________ |
132 | UShort_t | |
133 | AliAODForwardMult::GetSNN() const | |
134 | { | |
135 | // set the center of mass energy per nucleon pair (GeV). | |
136 | // This is stored in bin (0,0) of the histogram | |
137 | // | |
138 | // Parameters: | |
139 | // sNN Center of mass energy per nuclean | |
8e2bb72a | 140 | return UShort_t(fHist.GetBinContent(0,0)); |
b2e7f2d6 | 141 | } |
142 | ||
143 | //____________________________________________________________________ | |
144 | UShort_t | |
145 | AliAODForwardMult::GetSystem() const | |
146 | { | |
147 | // set the center of mass energy per nucleon pair (GeV). | |
148 | // This is stored in bin (N+1,0) of the histogram | |
149 | // | |
150 | // Parameters: | |
151 | // sNN Center of mass energy per nuclean | |
8e2bb72a | 152 | return UShort_t(fHist.GetBinContent(fHist.GetNbinsX()+1,0)); |
b2e7f2d6 | 153 | } |
154 | ||
7e4038b5 | 155 | //____________________________________________________________________ |
156 | void | |
157 | AliAODForwardMult::Browse(TBrowser* b) | |
158 | { | |
f49fc45d | 159 | // Browse this object |
160 | // | |
161 | // Parameters: | |
162 | // b Browser to use | |
7e4038b5 | 163 | static TObjString ipz; |
164 | static TObjString trg; | |
e58000b7 | 165 | static TObjString cnt; |
5bb5d1f6 | 166 | static TObjString ncl; |
7e4038b5 | 167 | ipz = Form("ip_z=%fcm", fIpZ); |
168 | trg = GetTriggerString(fTriggers); | |
e58000b7 | 169 | cnt = Form("%+6.1f%%", fCentrality); |
5bb5d1f6 | 170 | ncl = Form("%d clusters", fNClusters); |
7e4038b5 | 171 | b->Add(&fHist); |
172 | b->Add(&ipz); | |
173 | b->Add(&trg); | |
e58000b7 | 174 | b->Add(&cnt); |
5bb5d1f6 | 175 | b->Add(&ncl); |
7e4038b5 | 176 | } |
177 | ||
321cf27d | 178 | namespace { |
179 | void AppendAnd(TString& trg, const TString& what) | |
180 | { | |
181 | if (!trg.IsNull()) trg.Append(" & "); | |
182 | trg.Append(what); | |
183 | } | |
184 | } | |
7e4038b5 | 185 | //____________________________________________________________________ |
186 | const Char_t* | |
187 | AliAODForwardMult::GetTriggerString(UInt_t mask) | |
188 | { | |
f49fc45d | 189 | // Get a string that describes the triggers |
190 | // | |
191 | // Parameters: | |
192 | // mask Bit pattern of triggers | |
193 | // Return: | |
194 | // Character string representation of mask | |
7e4038b5 | 195 | static TString trg; |
196 | trg = ""; | |
321cf27d | 197 | if ((mask & kInel) != 0x0) AppendAnd(trg, "INEL"); |
198 | if ((mask & kInelGt0) != 0x0) AppendAnd(trg, "INEL>0"); | |
199 | if ((mask & kNSD) != 0x0) AppendAnd(trg, "NSD"); | |
200 | if ((mask & kV0AND) != 0x0) AppendAnd(trg, "V0AND"); | |
201 | if ((mask & kA) != 0x0) AppendAnd(trg, "A"); | |
202 | if ((mask & kB) != 0x0) AppendAnd(trg, "B"); | |
203 | if ((mask & kC) != 0x0) AppendAnd(trg, "C"); | |
204 | if ((mask & kE) != 0x0) AppendAnd(trg, "E"); | |
205 | if ((mask & kMCNSD) != 0x0) AppendAnd(trg, "MCNSD"); | |
206 | if ((mask & kNClusterGt0) != 0x0) AppendAnd(trg, "NCluster>0"); | |
8449e3e0 | 207 | if ((mask & kSatellite) != 0x0) AppendAnd(trg, "Satellite"); |
7e4038b5 | 208 | return trg.Data(); |
209 | } | |
210 | ||
e938e22b | 211 | //____________________________________________________________________ |
212 | TH1I* | |
321cf27d | 213 | AliAODForwardMult::MakeTriggerHistogram(const char* name, Int_t mask) |
e938e22b | 214 | { |
ffca499d | 215 | // |
216 | // Make a histogram to record triggers in. | |
217 | // | |
218 | // The bins defined by the trigger enumeration in this class. One | |
219 | // can use this enumeration to retrieve the number of triggers for | |
220 | // each class. | |
221 | // | |
222 | // Parameters: | |
223 | // name Name of the histogram | |
224 | // | |
225 | // Return: | |
226 | // Newly allocated histogram | |
227 | // | |
321cf27d | 228 | TString sel(""); |
229 | TString andSel(""); | |
230 | if (mask > 0) { | |
231 | sel = GetTriggerString(mask); | |
232 | andSel = GetTriggerString(mask & ~kB); | |
233 | andSel.Prepend(" & "); | |
234 | } | |
e938e22b | 235 | TH1I* ret = new TH1I(name, "Triggers", kAccepted+1, -.5, kAccepted+.5); |
236 | ret->SetYTitle("Events"); | |
237 | ret->SetFillColor(kRed+1); | |
238 | ret->SetFillStyle(3001); | |
239 | ret->GetXaxis()->SetBinLabel(kBinAll, "All events"); | |
cd548b09 | 240 | ret->GetXaxis()->SetBinLabel(kBinB, Form("B (Coll.)%s", |
241 | andSel.Data())); | |
321cf27d | 242 | ret->GetXaxis()->SetBinLabel(kBinA, Form("A%s", andSel.Data())); |
243 | ret->GetXaxis()->SetBinLabel(kBinC, Form("C%s", andSel.Data())); | |
244 | ret->GetXaxis()->SetBinLabel(kBinE, Form("E%s", andSel.Data())); | |
cd548b09 | 245 | ret->GetXaxis()->SetBinLabel(kBinInel, "Coll. & INEL"); |
246 | ret->GetXaxis()->SetBinLabel(kBinInelGt0, "Coll. & INEL>0"); | |
247 | ret->GetXaxis()->SetBinLabel(kBinNSD, "Coll. & NSD"); | |
248 | ret->GetXaxis()->SetBinLabel(kBinV0AND, "Coll. & V0AND"); | |
e938e22b | 249 | ret->GetXaxis()->SetBinLabel(kBinMCNSD, "NSD (MC truth)"); |
8449e3e0 | 250 | ret->GetXaxis()->SetBinLabel(kBinSatellite, "Satellite"); |
e938e22b | 251 | ret->GetXaxis()->SetBinLabel(kBinPileUp, "w/Pileup"); |
0be6c8cd | 252 | ret->GetXaxis()->SetBinLabel(kBinOffline, "w/Offline"); |
5bb5d1f6 | 253 | ret->GetXaxis()->SetBinLabel(kBinNClusterGt0, "w/N_{cluster}>1"); |
e938e22b | 254 | ret->GetXaxis()->SetBinLabel(kWithVertex, "w/Vertex"); |
321cf27d | 255 | ret->GetXaxis()->SetBinLabel(kWithTrigger, Form("w/Selected trigger (%s)", |
256 | sel.Data())); | |
e938e22b | 257 | ret->GetXaxis()->SetBinLabel(kAccepted, "Accepted by cut"); |
258 | ret->GetXaxis()->SetNdivisions(kAccepted, false); | |
259 | ret->SetStats(0); | |
260 | ||
261 | return ret; | |
262 | } | |
bfab35d9 | 263 | |
264 | //____________________________________________________________________ | |
265 | TH1I* | |
266 | AliAODForwardMult::MakeStatusHistogram(const char* name) | |
267 | { | |
268 | // | |
269 | // Make a histogram to record status in. | |
270 | // | |
271 | // The bins defined by the status enumeration in this class. | |
272 | // | |
273 | // Parameters: | |
274 | // name Name of the histogram | |
275 | // | |
276 | // Return: | |
277 | // Newly allocated histogram | |
278 | // | |
279 | TH1I* ret = new TH1I(name, "Event selection status", | |
280 | kWrongVertex+1, -.5, kWrongVertex+.5); | |
281 | ret->SetYTitle("Events"); | |
282 | ret->SetFillColor(kBlue+1); | |
283 | ret->SetFillStyle(3001); | |
284 | ret->GetXaxis()->SetBinLabel(kGoodEvent+1, "Good"); | |
285 | ret->GetXaxis()->SetBinLabel(kWrongCentrality+1, "Out-of-range centrality"); | |
286 | ret->GetXaxis()->SetBinLabel(kWrongTrigger+1, "Wrong trigger"); | |
287 | ret->GetXaxis()->SetBinLabel(kIsPileup+1, "Pile-up"); | |
288 | ret->GetXaxis()->SetBinLabel(kNoVertex+1, "No IP_{z}"); | |
289 | ret->GetXaxis()->SetBinLabel(kWrongVertex+1, "Out-or-range IP_{z}"); | |
290 | ret->GetXaxis()->SetNdivisions(kWrongVertex, false); | |
291 | ret->SetStats(0); | |
292 | return ret; | |
293 | } | |
294 | ||
9453b19e | 295 | //____________________________________________________________________ |
296 | UInt_t | |
297 | AliAODForwardMult::MakeTriggerMask(const char* what) | |
298 | { | |
299 | UShort_t trgMask = 0; | |
300 | TString trgs(what); | |
301 | trgs.ToUpper(); | |
321cf27d | 302 | TObjArray* parts = trgs.Tokenize("&"); |
9453b19e | 303 | TObjString* trg; |
321cf27d | 304 | TIter next(parts); |
9453b19e | 305 | while ((trg = static_cast<TObjString*>(next()))) { |
306 | TString s(trg->GetString()); | |
321cf27d | 307 | s.Strip(TString::kBoth, ' '); |
308 | s.ToUpper(); | |
9453b19e | 309 | if (s.IsNull()) continue; |
bfab35d9 | 310 | if (s.CompareTo("INEL") == 0) trgMask |= kInel; |
311 | else if (s.CompareTo("INEL>0") == 0) trgMask |= kInelGt0; | |
312 | else if (s.CompareTo("INELGT0") == 0) trgMask |= kInelGt0; | |
313 | else if (s.CompareTo("NSD") == 0) trgMask |= kNSD; | |
314 | else if (s.CompareTo("V0AND") == 0) trgMask |= kV0AND; | |
315 | else if (s.CompareTo("MCNSD") == 0) trgMask |= kMCNSD; | |
316 | else if (s.CompareTo("B") == 0) trgMask |= kB; | |
317 | else if (s.CompareTo("A") == 0) trgMask |= kA; | |
318 | else if (s.CompareTo("C") == 0) trgMask |= kC; | |
319 | else if (s.CompareTo("SAT") == 0) trgMask |= kSatellite; | |
320 | else if (s.CompareTo("E") == 0) trgMask |= kE; | |
321 | else if (s.CompareTo("NCLUSTER>0") == 0) trgMask |= kNClusterGt0; | |
9453b19e | 322 | else |
323 | AliWarningGeneral("MakeTriggerMask", | |
324 | Form("Unknown trigger %s", s.Data())); | |
325 | } | |
09d5920f | 326 | delete parts; |
9453b19e | 327 | return trgMask; |
328 | } | |
e938e22b | 329 | |
330 | //____________________________________________________________________ | |
331 | Bool_t | |
332 | AliAODForwardMult::CheckEvent(Int_t triggerMask, | |
333 | Double_t vzMin, Double_t vzMax, | |
334 | UShort_t cMin, UShort_t cMax, | |
bfab35d9 | 335 | TH1* hist, TH1* status) const |
e938e22b | 336 | { |
ffca499d | 337 | // |
338 | // Check if event meets the passses requirements. | |
339 | // | |
340 | // It returns true if @e all of the following is true | |
341 | // | |
342 | // - The trigger is within the bit mask passed. | |
343 | // - The vertex is within the specified limits. | |
344 | // - The centrality is within the specified limits, or if lower | |
345 | // limit is equal to or larger than the upper limit. | |
346 | // | |
347 | // If a histogram is passed in the last parameter, then that | |
348 | // histogram is filled with the trigger bits. | |
349 | // | |
350 | // Parameters: | |
351 | // triggerMask Trigger mask | |
352 | // vzMin Minimum @f$ v_z@f$ (in centimeters) | |
353 | // vzMax Maximum @f$ v_z@f$ (in centimeters) | |
354 | // cMin Minimum centrality (in percent) | |
355 | // cMax Maximum centrality (in percent) | |
356 | // hist Histogram to fill | |
357 | // | |
358 | // Return: | |
359 | // @c true if the event meets the requirements | |
360 | // | |
bfab35d9 | 361 | if (cMin < cMax && (cMin > fCentrality || cMax <= fCentrality)) { |
362 | if (status) status->Fill(kWrongCentrality); | |
363 | return false; | |
364 | } | |
e938e22b | 365 | |
366 | if (hist) { | |
321cf27d | 367 | Int_t tmp = triggerMask & ~kB; |
e938e22b | 368 | hist->AddBinContent(kBinAll); |
321cf27d | 369 | if (IsTriggerBits(kB|tmp)) hist->AddBinContent(kBinB); |
370 | if (IsTriggerBits(kA|tmp)) hist->AddBinContent(kBinA); | |
371 | if (IsTriggerBits(kC|tmp)) hist->AddBinContent(kBinC); | |
372 | if (IsTriggerBits(kE|tmp)) hist->AddBinContent(kBinE); | |
0be6c8cd | 373 | if (IsTriggerBits(kB|kInel)) hist->AddBinContent(kBinInel); |
374 | if (IsTriggerBits(kB|kInelGt0)) hist->AddBinContent(kBinInelGt0); | |
375 | if (IsTriggerBits(kB|kNSD)) hist->AddBinContent(kBinNSD); | |
e6463868 | 376 | if (IsTriggerBits(kB|kV0AND)) hist->AddBinContent(kBinV0AND); |
0be6c8cd | 377 | if (IsTriggerBits(kPileUp)) hist->AddBinContent(kBinPileUp); |
378 | if (IsTriggerBits(kMCNSD)) hist->AddBinContent(kBinMCNSD); | |
379 | if (IsTriggerBits(kOffline)) hist->AddBinContent(kBinOffline); | |
5bb5d1f6 | 380 | if (IsTriggerBits(kNClusterGt0)) hist->AddBinContent(kBinNClusterGt0); |
8449e3e0 | 381 | if (IsTriggerBits(kSatellite)) hist->AddBinContent(kBinSatellite); |
321cf27d | 382 | if (IsTriggerBits(triggerMask) && !IsTriggerBits(kB|tmp)) |
383 | Warning("CheckEvent", "event: 0x%x, mask: 0x%x, tmp: 0x%x, tmp|b: 0x%x", | |
384 | fTriggers, triggerMask, tmp, tmp|kB); | |
e938e22b | 385 | } |
386 | // Check if we have an event of interest. | |
f7cfc454 | 387 | Int_t mask = triggerMask; //|kB |
bfab35d9 | 388 | if (!IsTriggerBits(mask)) { |
389 | if (status) status->Fill(kWrongTrigger); | |
390 | return false; | |
391 | } | |
e938e22b | 392 | |
393 | // Check for pileup | |
bfab35d9 | 394 | if (IsTriggerBits(kPileUp)) { |
395 | if (status) status->Fill(kIsPileup); | |
396 | return false; | |
397 | } | |
e938e22b | 398 | if (hist) hist->AddBinContent(kWithTrigger); |
399 | ||
400 | // Check that we have a valid vertex | |
bfab35d9 | 401 | if (vzMin < vzMax && !HasIpZ()) { |
402 | if (status) status->Fill(kNoVertex); | |
403 | return false; | |
404 | } | |
e938e22b | 405 | if (hist) hist->AddBinContent(kWithVertex); |
406 | ||
407 | // Check that vertex is within cuts | |
bfab35d9 | 408 | if (vzMin < vzMax && !InRange(vzMin, vzMax)) { |
409 | if (status) status->Fill(kWrongVertex); | |
410 | return false; | |
411 | } | |
e938e22b | 412 | if (hist) hist->AddBinContent(kAccepted); |
413 | ||
bfab35d9 | 414 | if (status) status->Fill(kGoodEvent); |
e938e22b | 415 | return true; |
416 | } | |
417 | ||
7e4038b5 | 418 | //____________________________________________________________________ |
419 | void | |
420 | AliAODForwardMult::Print(Option_t* option) const | |
421 | { | |
f49fc45d | 422 | // Print this object |
423 | // | |
424 | // Parameters: | |
425 | // option Passed to TH1::Print | |
7e4038b5 | 426 | fHist.Print(option); |
8e2bb72a | 427 | UShort_t sys = GetSystem(); |
428 | TString str = "unknown"; | |
429 | switch (sys) { | |
430 | case 1: str = "pp"; break; | |
431 | case 2: str = "PbPb"; break; | |
321cf27d | 432 | case 3: str = "pPb" ; break; |
8e2bb72a | 433 | } |
e58000b7 | 434 | std::cout << "Ipz: " << fIpZ << "cm " << (HasIpZ() ? "" : "in") |
7e4038b5 | 435 | << "valid\n" |
321cf27d | 436 | << "Triggers: " << GetTriggerString(fTriggers) << "\n" |
e58000b7 | 437 | << "sNN: " << GetSNN() << "GeV\n" |
321cf27d | 438 | << "System: " << str << "\n" |
e58000b7 | 439 | << "Centrality: " << fCentrality << "%" |
8e2bb72a | 440 | << std::endl; |
7e4038b5 | 441 | } |
442 | ||
443 | //____________________________________________________________________ | |
444 | // | |
445 | // EOF | |
446 | // |