]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FORWARD/analysis2/AliAODForwardMult.cxx
Renamed
[u/mrichter/AliRoot.git] / PWG2 / FORWARD / analysis2 / AliAODForwardMult.cxx
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 //
17 #include "AliAODForwardMult.h"
18 #include <TBrowser.h>
19 #include <iostream>
20 #include <TMath.h>
21 #include <TObjString.h>
22
23 ClassImp(AliAODForwardMult)
24 #if 0 
25 ; // For Emacs 
26 #endif
27
28 //____________________________________________________________________
29 const Float_t AliAODForwardMult::fgkInvalidIpZ = 1e6;
30
31 //____________________________________________________________________
32 AliAODForwardMult::AliAODForwardMult()
33   : fIsMC(false),
34     fHist(),
35     fTriggers(0),
36     fIpZ(fgkInvalidIpZ)
37 {
38   // 
39   // Constructor 
40   // 
41 }
42
43 //____________________________________________________________________
44 AliAODForwardMult::AliAODForwardMult(Bool_t isMC) 
45   : fIsMC(isMC),
46     fHist("forwardMult", "d^{2}N_{ch}/d#etad#varphi in the forward regions", 
47           200, -4, 6, 20, 0, 2*TMath::Pi()),
48     fTriggers(0),
49     fIpZ(fgkInvalidIpZ)
50 {
51   // 
52   // Constructor 
53   // 
54   // Parameters: 
55   //  isMC   If set to true this is for MC data (effects branch name)
56   // 
57   fHist.SetXTitle("#eta");
58   fHist.SetYTitle("#varphi [radians]");
59   fHist.SetZTitle("#frac{d^{2}N_{ch}}{d#etad#varphi}");
60   fHist.SetDirectory(0);
61   fHist.Sumw2();
62 }
63
64 //____________________________________________________________________
65 void
66 AliAODForwardMult::Init(const TAxis& etaAxis)
67 {
68   // Initialize the histogram with an eta axis 
69   // 
70   // Parameters: 
71   //   etaAxis       Eta axis to use 
72   // 
73   fHist.SetBins(etaAxis.GetNbins(), etaAxis.GetXmin(), etaAxis.GetXmax(), 
74                 20, 0, 2*TMath::Pi());
75 }
76
77 //____________________________________________________________________
78 void
79 AliAODForwardMult::Clear(Option_t* option)
80 {
81   // Clear (or reset) internal values 
82   // 
83   // Parameters: 
84   //  option   Passed to TH1::Reset 
85   // 
86   fHist.Reset(option);
87   fTriggers = 0;
88   fIpZ      = fgkInvalidIpZ;
89 }
90 //____________________________________________________________________
91 Bool_t
92 AliAODForwardMult::HasIpZ() const
93 {
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   // 
99   return TMath::Abs(fIpZ - fgkInvalidIpZ) > 1;
100 }
101
102 //____________________________________________________________________
103 void
104 AliAODForwardMult::Browse(TBrowser* b)
105 {
106   // Browse this object 
107   // 
108   // Parameters: 
109   //   b   Browser to use 
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 //____________________________________________________________________
120 const Char_t*
121 AliAODForwardMult::GetTriggerString(UInt_t mask)
122 {
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 
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 //____________________________________________________________________
142 void
143 AliAODForwardMult::Print(Option_t* option) const
144 {
145   // Print this object 
146   // 
147   // Parameters: 
148   //  option   Passed to TH1::Print 
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 //