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>
23 ClassImp(AliAODForwardMult)
28 //____________________________________________________________________
29 const Float_t AliAODForwardMult::fgkInvalidIpZ = 1e6;
31 //____________________________________________________________________
32 AliAODForwardMult::AliAODForwardMult()
44 //____________________________________________________________________
45 AliAODForwardMult::AliAODForwardMult(Bool_t isMC)
47 fHist("forwardMult", "d^{2}N_{ch}/d#etad#varphi in the forward regions",
48 200, -4, 6, 20, 0, 2*TMath::Pi()),
57 // isMC If set to true this is for MC data (effects branch name)
59 fHist.SetXTitle("#eta");
60 fHist.SetYTitle("#varphi [radians]");
61 fHist.SetZTitle("#frac{d^{2}N_{ch}}{d#etad#varphi}");
62 fHist.SetDirectory(0);
66 //____________________________________________________________________
68 AliAODForwardMult::Init(const TAxis& etaAxis)
70 // Initialize the histogram with an eta axis
73 // etaAxis Eta axis to use
75 fHist.SetBins(etaAxis.GetNbins(), etaAxis.GetXmin(), etaAxis.GetXmax(),
76 20, 0, 2*TMath::Pi());
79 //____________________________________________________________________
81 AliAODForwardMult::Clear(Option_t* option)
83 // Clear (or reset) internal values
86 // option Passed to TH1::Reset
92 //____________________________________________________________________
94 AliAODForwardMult::SetSNN(UShort_t snn)
96 // set the center of mass energy per nucleon pair (GeV).
97 // This is stored in bin (0,0) of the histogram
100 // sNN Center of mass energy per nuclean
101 fHist.SetBinContent(0,0,snn);
103 //____________________________________________________________________
105 AliAODForwardMult::SetSystem(UShort_t sys)
107 // set the center of mass energy per nucleon pair (GeV).
108 // This is stored in bin (N+1,0) of the histogram
111 // sys Collision system number
112 fHist.SetBinContent(fHist.GetNbinsX()+1,0,sys);
115 //____________________________________________________________________
117 AliAODForwardMult::HasIpZ() const
119 // Check if we have valid z coordinate of the interaction point
122 // true if the z coordinate of the interaction point is valid
124 return TMath::Abs(fIpZ - fgkInvalidIpZ) > 1;
127 //____________________________________________________________________
129 AliAODForwardMult::GetSNN() const
131 // set the center of mass energy per nucleon pair (GeV).
132 // This is stored in bin (0,0) of the histogram
135 // sNN Center of mass energy per nuclean
136 return UShort_t(fHist.GetBinContent(0,0));
139 //____________________________________________________________________
141 AliAODForwardMult::GetSystem() const
143 // set the center of mass energy per nucleon pair (GeV).
144 // This is stored in bin (N+1,0) of the histogram
147 // sNN Center of mass energy per nuclean
148 return UShort_t(fHist.GetBinContent(fHist.GetNbinsX()+1,0));
151 //____________________________________________________________________
153 AliAODForwardMult::Browse(TBrowser* b)
155 // Browse this object
159 static TObjString ipz;
160 static TObjString trg;
161 static TObjString cnt;
162 ipz = Form("ip_z=%fcm", fIpZ);
163 trg = GetTriggerString(fTriggers);
164 cnt = Form("%+6.1f%%", fCentrality);
171 //____________________________________________________________________
173 AliAODForwardMult::GetTriggerString(UInt_t mask)
175 // Get a string that describes the triggers
178 // mask Bit pattern of triggers
180 // Character string representation of mask
183 if ((mask & kInel) != 0x0) trg.Append("INEL ");
184 if ((mask & kInelGt0) != 0x0) trg.Append("INEL>0 ");
185 if ((mask & kNSD) != 0x0) trg.Append("NSD ");
186 if ((mask & kA) != 0x0) trg.Append("A ");
187 if ((mask & kB) != 0x0) trg.Append("B ");
188 if ((mask & kC) != 0x0) trg.Append("C ");
189 if ((mask & kE) != 0x0) trg.Append("E ");
190 if ((mask & kMCNSD) != 0x0) trg.Append("MCNSD ");
194 //____________________________________________________________________
196 AliAODForwardMult::MakeTriggerHistogram(const char* name)
199 // Make a histogram to record triggers in.
201 // The bins defined by the trigger enumeration in this class. One
202 // can use this enumeration to retrieve the number of triggers for
206 // name Name of the histogram
209 // Newly allocated histogram
211 TH1I* ret = new TH1I(name, "Triggers", kAccepted+1, -.5, kAccepted+.5);
212 ret->SetYTitle("Events");
213 ret->SetFillColor(kRed+1);
214 ret->SetFillStyle(3001);
215 ret->GetXaxis()->SetBinLabel(kBinAll, "All events");
216 ret->GetXaxis()->SetBinLabel(kBinB, "w/B trigger");
217 ret->GetXaxis()->SetBinLabel(kBinA, "w/A trigger");
218 ret->GetXaxis()->SetBinLabel(kBinC, "w/C trigger");
219 ret->GetXaxis()->SetBinLabel(kBinE, "w/E trigger");
220 ret->GetXaxis()->SetBinLabel(kBinInel, "Minimum Bias");
221 ret->GetXaxis()->SetBinLabel(kBinInelGt0, "INEL>0");
222 ret->GetXaxis()->SetBinLabel(kBinNSD, "NSD");
223 ret->GetXaxis()->SetBinLabel(kBinMCNSD, "NSD (MC truth)");
224 ret->GetXaxis()->SetBinLabel(kBinPileUp, "w/Pileup");
225 ret->GetXaxis()->SetBinLabel(kWithVertex, "w/Vertex");
226 ret->GetXaxis()->SetBinLabel(kWithTrigger, "w/Selected trigger");
227 ret->GetXaxis()->SetBinLabel(kAccepted, "Accepted by cut");
228 ret->GetXaxis()->SetNdivisions(kAccepted, false);
234 //____________________________________________________________________
236 AliAODForwardMult::CheckEvent(Int_t triggerMask,
237 Double_t vzMin, Double_t vzMax,
238 UShort_t cMin, UShort_t cMax,
242 // Check if event meets the passses requirements.
244 // It returns true if @e all of the following is true
246 // - The trigger is within the bit mask passed.
247 // - The vertex is within the specified limits.
248 // - The centrality is within the specified limits, or if lower
249 // limit is equal to or larger than the upper limit.
251 // If a histogram is passed in the last parameter, then that
252 // histogram is filled with the trigger bits.
255 // triggerMask Trigger mask
256 // vzMin Minimum @f$ v_z@f$ (in centimeters)
257 // vzMax Maximum @f$ v_z@f$ (in centimeters)
258 // cMin Minimum centrality (in percent)
259 // cMax Maximum centrality (in percent)
260 // hist Histogram to fill
263 // @c true if the event meets the requirements
265 if (cMin < cMax && (cMin > fCentrality || cMax <= fCentrality)) return false;
268 hist->AddBinContent(kBinAll);
269 if (IsTriggerBits(kB)) hist->AddBinContent(kBinB);
270 if (IsTriggerBits(kA)) hist->AddBinContent(kBinA);
271 if (IsTriggerBits(kC)) hist->AddBinContent(kBinC);
272 if (IsTriggerBits(kE)) hist->AddBinContent(kBinE);
273 if (IsTriggerBits(kInel)) hist->AddBinContent(kBinInel);
274 if (IsTriggerBits(kInelGt0)) hist->AddBinContent(kBinInelGt0);
275 if (IsTriggerBits(kNSD)) hist->AddBinContent(kBinNSD);
276 if (IsTriggerBits(kPileUp)) hist->AddBinContent(kBinPileUp);
277 if (IsTriggerBits(kMCNSD)) hist->AddBinContent(kBinMCNSD);
279 // Check if we have an event of interest.
280 if (!IsTriggerBits(triggerMask)) return false;
283 if (IsTriggerBits(kPileUp)) return false;
284 if (hist) hist->AddBinContent(kWithTrigger);
286 // Check that we have a valid vertex
287 if (!HasIpZ()) return false;
288 if (hist) hist->AddBinContent(kWithVertex);
290 // Check that vertex is within cuts
291 if (!InRange(vzMin, vzMax)) return false;
292 if (hist) hist->AddBinContent(kAccepted);
297 //____________________________________________________________________
299 AliAODForwardMult::Print(Option_t* option) const
304 // option Passed to TH1::Print
306 UShort_t sys = GetSystem();
307 TString str = "unknown";
309 case 1: str = "pp"; break;
310 case 2: str = "PbPb"; break;
312 std::cout << "Ipz: " << fIpZ << "cm " << (HasIpZ() ? "" : "in")
314 << "Triggers: " << GetTriggerString(fTriggers)
315 << "sNN: " << GetSNN() << "GeV\n"
317 << "Centrality: " << fCentrality << "%"
321 //____________________________________________________________________