]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG2/FORWARD/analysis2/AliAODForwardMult.cxx
Added MC master task
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliAODForwardMult.cxx
CommitLineData
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>
22
23ClassImp(AliAODForwardMult)
24#if 0
25; // For Emacs
26#endif
27
28//____________________________________________________________________
29const Float_t AliAODForwardMult::fgkInvalidIpZ = 1e6;
30
31//____________________________________________________________________
32AliAODForwardMult::AliAODForwardMult()
f49fc45d 33 : fIsMC(false),
34 fHist(),
7e4038b5 35 fTriggers(0),
36 fIpZ(fgkInvalidIpZ)
f49fc45d 37{
38 //
39 // Constructor
40 //
41}
7e4038b5 42
43//____________________________________________________________________
f49fc45d 44AliAODForwardMult::AliAODForwardMult(Bool_t isMC)
45 : fIsMC(isMC),
46 fHist("forwardMult", "d^{2}N_{ch}/d#etad#varphi in the forward regions",
7e4038b5 47 200, -4, 6, 20, 0, 2*TMath::Pi()),
48 fTriggers(0),
49 fIpZ(fgkInvalidIpZ)
50{
f49fc45d 51 //
52 // Constructor
53 //
54 // Parameters:
55 // isMC If set to true this is for MC data (effects branch name)
56 //
7e4038b5 57 fHist.SetXTitle("#eta");
58 fHist.SetYTitle("#varphi [radians]");
59 fHist.SetZTitle("#frac{d^{2}N_{ch}}{d#etad#varphi}");
f49fc45d 60 fHist.SetDirectory(0);
7e4038b5 61 fHist.Sumw2();
62}
63
64//____________________________________________________________________
65void
66AliAODForwardMult::Init(const TAxis& etaAxis)
67{
f49fc45d 68 // Initialize the histogram with an eta axis
69 //
70 // Parameters:
71 // etaAxis Eta axis to use
72 //
7e4038b5 73 fHist.SetBins(etaAxis.GetNbins(), etaAxis.GetXmin(), etaAxis.GetXmax(),
74 20, 0, 2*TMath::Pi());
75}
76
77//____________________________________________________________________
78void
79AliAODForwardMult::Clear(Option_t* option)
80{
f49fc45d 81 // Clear (or reset) internal values
82 //
83 // Parameters:
84 // option Passed to TH1::Reset
85 //
7e4038b5 86 fHist.Reset(option);
87 fTriggers = 0;
88 fIpZ = fgkInvalidIpZ;
89}
90//____________________________________________________________________
91Bool_t
92AliAODForwardMult::HasIpZ() const
93{
f49fc45d 94 // Check if we have valid z coordinate of the interaction point
95 //
96 // Return:
97 // true if the z coordinate of the interaction point is valid
98 //
7e4038b5 99 return TMath::Abs(fIpZ - fgkInvalidIpZ) > 1;
100}
101
102//____________________________________________________________________
103void
104AliAODForwardMult::Browse(TBrowser* b)
105{
f49fc45d 106 // Browse this object
107 //
108 // Parameters:
109 // b Browser to use
7e4038b5 110 static TObjString ipz;
111 static TObjString trg;
112 ipz = Form("ip_z=%fcm", fIpZ);
113 trg = GetTriggerString(fTriggers);
114 b->Add(&fHist);
115 b->Add(&ipz);
116 b->Add(&trg);
117}
118
119//____________________________________________________________________
120const Char_t*
121AliAODForwardMult::GetTriggerString(UInt_t mask)
122{
f49fc45d 123 // Get a string that describes the triggers
124 //
125 // Parameters:
126 // mask Bit pattern of triggers
127 // Return:
128 // Character string representation of mask
7e4038b5 129 static TString trg;
130 trg = "";
131 if ((mask & kInel) != 0x0) trg.Append("INEL ");
132 if ((mask & kInelGt0) != 0x0) trg.Append("INEL>0 ");
133 if ((mask & kNSD) != 0x0) trg.Append("NSD ");
134 if ((mask & kA) != 0x0) trg.Append("A ");
135 if ((mask & kB) != 0x0) trg.Append("B ");
136 if ((mask & kC) != 0x0) trg.Append("C ");
137 if ((mask & kE) != 0x0) trg.Append("E ");
138 return trg.Data();
139}
140
141//____________________________________________________________________
142void
143AliAODForwardMult::Print(Option_t* option) const
144{
f49fc45d 145 // Print this object
146 //
147 // Parameters:
148 // option Passed to TH1::Print
7e4038b5 149 fHist.Print(option);
150 std::cout << "Ipz: " << fIpZ << "cm " << (HasIpZ() ? "" : "in")
151 << "valid\n"
152 << "Triggers: " << GetTriggerString(fTriggers) << std::endl;
153}
154
155//____________________________________________________________________
156//
157// EOF
158//