2 // Class that contains the forward multiplicity data per event
4 // This class contains a histogram of
6 // \frac{d^2N_{ch}}{d\eta d\phi}\quad,
8 // as well as a trigger mask for each analysed event.
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.
17 #include "AliAODForwardMult.h"
21 #include <TObjString.h>
22 #include <TObjArray.h>
24 ClassImp(AliAODForwardMult)
29 //____________________________________________________________________
30 const Float_t AliAODForwardMult::fgkInvalidIpZ = 1e6;
32 //____________________________________________________________________
33 AliAODForwardMult::AliAODForwardMult()
46 //____________________________________________________________________
47 AliAODForwardMult::AliAODForwardMult(Bool_t isMC)
49 fHist("forwardMult", "d^{2}N_{ch}/d#etad#varphi in the forward regions",
50 200, -4, 6, 20, 0, 2*TMath::Pi()),
60 // isMC If set to true this is for MC data (effects branch name)
62 fHist.SetXTitle("#eta");
63 fHist.SetYTitle("#varphi [radians]");
64 fHist.SetZTitle("#frac{d^{2}N_{ch}}{d#etad#varphi}");
65 fHist.SetDirectory(0);
69 //____________________________________________________________________
71 AliAODForwardMult::Init(const TAxis& etaAxis)
73 // Initialize the histogram with an eta axis
76 // etaAxis Eta axis to use
78 fHist.SetBins(etaAxis.GetNbins(), etaAxis.GetXmin(), etaAxis.GetXmax(),
79 20, 0, 2*TMath::Pi());
82 //____________________________________________________________________
84 AliAODForwardMult::Clear(Option_t* option)
86 // Clear (or reset) internal values
89 // option Passed to TH1::Reset
96 //____________________________________________________________________
98 AliAODForwardMult::SetSNN(UShort_t snn)
100 // set the center of mass energy per nucleon pair (GeV).
101 // This is stored in bin (0,0) of the histogram
104 // sNN Center of mass energy per nuclean
105 fHist.SetBinContent(0,0,snn);
107 //____________________________________________________________________
109 AliAODForwardMult::SetSystem(UShort_t sys)
111 // set the center of mass energy per nucleon pair (GeV).
112 // This is stored in bin (N+1,0) of the histogram
115 // sys Collision system number
116 fHist.SetBinContent(fHist.GetNbinsX()+1,0,sys);
119 //____________________________________________________________________
121 AliAODForwardMult::HasIpZ() const
123 // Check if we have valid z coordinate of the interaction point
126 // true if the z coordinate of the interaction point is valid
128 return TMath::Abs(fIpZ - fgkInvalidIpZ) > 1;
131 //____________________________________________________________________
133 AliAODForwardMult::GetSNN() const
135 // set the center of mass energy per nucleon pair (GeV).
136 // This is stored in bin (0,0) of the histogram
139 // sNN Center of mass energy per nuclean
140 return UShort_t(fHist.GetBinContent(0,0));
143 //____________________________________________________________________
145 AliAODForwardMult::GetSystem() const
147 // set the center of mass energy per nucleon pair (GeV).
148 // This is stored in bin (N+1,0) of the histogram
151 // sNN Center of mass energy per nuclean
152 return UShort_t(fHist.GetBinContent(fHist.GetNbinsX()+1,0));
155 //____________________________________________________________________
157 AliAODForwardMult::Browse(TBrowser* b)
159 // Browse this object
163 static TObjString ipz;
164 static TObjString trg;
165 static TObjString cnt;
166 static TObjString ncl;
167 ipz = Form("ip_z=%fcm", fIpZ);
168 trg = GetTriggerString(fTriggers);
169 cnt = Form("%+6.1f%%", fCentrality);
170 ncl = Form("%d clusters", fNClusters);
178 //____________________________________________________________________
180 AliAODForwardMult::GetTriggerString(UInt_t mask)
182 // Get a string that describes the triggers
185 // mask Bit pattern of triggers
187 // Character string representation of mask
190 if ((mask & kInel) != 0x0) trg.Append("INEL ");
191 if ((mask & kInelGt0) != 0x0) trg.Append("INEL>0 ");
192 if ((mask & kNSD) != 0x0) trg.Append("NSD ");
193 if ((mask & kA) != 0x0) trg.Append("A ");
194 if ((mask & kB) != 0x0) trg.Append("B ");
195 if ((mask & kC) != 0x0) trg.Append("C ");
196 if ((mask & kE) != 0x0) trg.Append("E ");
197 if ((mask & kMCNSD) != 0x0) trg.Append("MCNSD ");
198 if ((mask & kNClusterGt0) != 0x0) trg.Append("NCluster>0 ");
202 //____________________________________________________________________
204 AliAODForwardMult::MakeTriggerHistogram(const char* name)
207 // Make a histogram to record triggers in.
209 // The bins defined by the trigger enumeration in this class. One
210 // can use this enumeration to retrieve the number of triggers for
214 // name Name of the histogram
217 // Newly allocated histogram
219 TH1I* ret = new TH1I(name, "Triggers", kAccepted+1, -.5, kAccepted+.5);
220 ret->SetYTitle("Events");
221 ret->SetFillColor(kRed+1);
222 ret->SetFillStyle(3001);
223 ret->GetXaxis()->SetBinLabel(kBinAll, "All events");
224 ret->GetXaxis()->SetBinLabel(kBinB, "w/B trigger");
225 ret->GetXaxis()->SetBinLabel(kBinA, "w/A trigger");
226 ret->GetXaxis()->SetBinLabel(kBinC, "w/C trigger");
227 ret->GetXaxis()->SetBinLabel(kBinE, "w/E trigger");
228 ret->GetXaxis()->SetBinLabel(kBinInel, "Minimum Bias");
229 ret->GetXaxis()->SetBinLabel(kBinInelGt0, "INEL>0");
230 ret->GetXaxis()->SetBinLabel(kBinNSD, "NSD");
231 ret->GetXaxis()->SetBinLabel(kBinMCNSD, "NSD (MC truth)");
232 ret->GetXaxis()->SetBinLabel(kBinPileUp, "w/Pileup");
233 ret->GetXaxis()->SetBinLabel(kBinOffline, "w/Offline");
234 ret->GetXaxis()->SetBinLabel(kBinNClusterGt0, "w/N_{cluster}>1");
235 ret->GetXaxis()->SetBinLabel(kWithVertex, "w/Vertex");
236 ret->GetXaxis()->SetBinLabel(kWithTrigger, "w/Selected trigger");
237 ret->GetXaxis()->SetBinLabel(kAccepted, "Accepted by cut");
238 ret->GetXaxis()->SetNdivisions(kAccepted, false);
243 //____________________________________________________________________
245 AliAODForwardMult::MakeTriggerMask(const char* what)
247 UShort_t trgMask = 0;
251 TIter next(trgs.Tokenize(" ,|"));
252 while ((trg = static_cast<TObjString*>(next()))) {
253 TString s(trg->GetString());
254 if (s.IsNull()) continue;
255 if (s.CompareTo("INEL") == 0) trgMask |= AliAODForwardMult::kInel;
256 else if (s.CompareTo("INEL>0")== 0) trgMask |= AliAODForwardMult::kInelGt0;
257 else if (s.CompareTo("NSD") == 0) trgMask |= AliAODForwardMult::kNSD;
258 else if (s.CompareTo("B") == 0) trgMask |= AliAODForwardMult::kB;
259 else if (s.CompareTo("A") == 0) trgMask |= AliAODForwardMult::kA;
260 else if (s.CompareTo("C") == 0) trgMask |= AliAODForwardMult::kC;
261 else if (s.CompareTo("E") == 0) trgMask |= AliAODForwardMult::kE;
262 else if (s.CompareTo("NCluster>0") == 0)
263 trgMask |= AliAODForwardMult::kNClusterGt0;
265 AliWarningGeneral("MakeTriggerMask",
266 Form("Unknown trigger %s", s.Data()));
271 //____________________________________________________________________
273 AliAODForwardMult::CheckEvent(Int_t triggerMask,
274 Double_t vzMin, Double_t vzMax,
275 UShort_t cMin, UShort_t cMax,
279 // Check if event meets the passses requirements.
281 // It returns true if @e all of the following is true
283 // - The trigger is within the bit mask passed.
284 // - The vertex is within the specified limits.
285 // - The centrality is within the specified limits, or if lower
286 // limit is equal to or larger than the upper limit.
288 // If a histogram is passed in the last parameter, then that
289 // histogram is filled with the trigger bits.
292 // triggerMask Trigger mask
293 // vzMin Minimum @f$ v_z@f$ (in centimeters)
294 // vzMax Maximum @f$ v_z@f$ (in centimeters)
295 // cMin Minimum centrality (in percent)
296 // cMax Maximum centrality (in percent)
297 // hist Histogram to fill
300 // @c true if the event meets the requirements
302 if (cMin < cMax && (cMin > fCentrality || cMax <= fCentrality)) return false;
305 hist->AddBinContent(kBinAll);
306 if (IsTriggerBits(kB|triggerMask)) hist->AddBinContent(kBinB);
307 if (IsTriggerBits(kA|triggerMask)) hist->AddBinContent(kBinA);
308 if (IsTriggerBits(kC|triggerMask)) hist->AddBinContent(kBinC);
309 if (IsTriggerBits(kE|triggerMask)) hist->AddBinContent(kBinE);
310 if (IsTriggerBits(kB|kInel)) hist->AddBinContent(kBinInel);
311 if (IsTriggerBits(kB|kInelGt0)) hist->AddBinContent(kBinInelGt0);
312 if (IsTriggerBits(kB|kNSD)) hist->AddBinContent(kBinNSD);
313 if (IsTriggerBits(kPileUp)) hist->AddBinContent(kBinPileUp);
314 if (IsTriggerBits(kMCNSD)) hist->AddBinContent(kBinMCNSD);
315 if (IsTriggerBits(kOffline)) hist->AddBinContent(kBinOffline);
316 if (IsTriggerBits(kNClusterGt0)) hist->AddBinContent(kBinNClusterGt0);
318 // Check if we have an event of interest.
319 if (!IsTriggerBits(triggerMask|kB)) return false;
322 if (IsTriggerBits(kPileUp)) return false;
323 if (hist) hist->AddBinContent(kWithTrigger);
325 // Check that we have a valid vertex
326 if (vzMin < vzMax && !HasIpZ()) return false;
327 if (hist) hist->AddBinContent(kWithVertex);
329 // Check that vertex is within cuts
330 if (vzMin < vzMax && !InRange(vzMin, vzMax)) return false;
331 if (hist) hist->AddBinContent(kAccepted);
336 //____________________________________________________________________
338 AliAODForwardMult::Print(Option_t* option) const
343 // option Passed to TH1::Print
345 UShort_t sys = GetSystem();
346 TString str = "unknown";
348 case 1: str = "pp"; break;
349 case 2: str = "PbPb"; break;
351 std::cout << "Ipz: " << fIpZ << "cm " << (HasIpZ() ? "" : "in")
353 << "Triggers: " << GetTriggerString(fTriggers)
354 << "sNN: " << GetSNN() << "GeV\n"
356 << "Centrality: " << fCentrality << "%"
360 //____________________________________________________________________