1 #include "DrawResBase.h"
4 * @defgroup pwg2_forward_analysis_scripts PWG2 Forward analysis - scripts
6 * @ingroup pwg2_forward_analysis
9 * Example macro to loop over the event-by-event 2D histogram of
11 * \frac{d^{2}N_{ch}}{d\eta\,d\phi}
15 * The class needs the files <<i>base</i>><tt>_hists.root</tt>
16 * containing the histograms generated by AliForwardMultiplicity and
17 * the file <<i>base</i>><tt>_aods.root</tt> containing the tree
18 * with AliAODEvent objects where AliAODForwardMult objects have been
19 * added to in the branch <tt>Forward</tt>
21 * @ingroup pwg2_forward_analysis_scripts
23 class DrawRes2D : public DrawResBase
29 * @param special If true, add to the list of 'specials'
35 //__________________________________________________________________
36 virtual void Clear(Option_t* option)
38 DrawResBase::Clear(option);
39 if (fTotal2D) delete fTotal2D;
42 //__________________________________________________________________
43 Bool_t IsInit() const { return fTotal2D; }
44 //__________________________________________________________________
46 * Utility function to set-up histograms based on the input
47 * @f$ dd^{2}N_{ch}/d\eta\,d\phi@f$ histogram. This member function
48 * is called on the first event so that we have the proper binning
50 * @param templ Input histogram
52 * @return true on succcess
54 Bool_t FirstEvent(const TH2D& templ)
56 if (!DrawResBase::FirstEvent(templ)) return kFALSE;
58 const TAxis* etaAxis = templ.GetXaxis();
59 const TAxis* phiAxis = templ.GetYaxis();
61 // Generate sum histograms.
62 // - fTotal2D will be the direct sum of the input histograms.
63 fTotal2D = new TH2D("d2ndetadphi", "1/N dN^{2}_{ch}/d#etad#phi",
70 fTotal2D->SetXTitle("#eta");
71 fTotal2D->SetYTitle("#varphi [radians]");
72 fTotal2D->SetZTitle(fTotal2D->GetTitle());
74 fTotal2D->SetStats(0);
75 fTotal2D->SetDirectory(0);
81 //__________________________________________________________________
86 * @return true on success, false otherwise
88 void AddContrib(const TH2D& hist, Int_t)
92 //__________________________________________________________________
97 * @return true on success, false otherwise
101 // Do not sum underflow bins!
102 TH1D* proj = fTotal2D->ProjectionX("dndeta_proj", 1, -1, "e");
103 TH1D* norm = fTotal2D->ProjectionX("norm", 0, 1, "");
104 proj->SetTitle("1/N dN_{ch}/d#eta");
106 proj->Scale(1., "width");
112 * @param b Browser to use
114 void Browse(TBrowser* b)
116 if (fTotal2D) b->Add(fTotal2D);
117 DrawResBase::Browse(b);
120 * Create a new object of this class, and add it to the list of
121 * specials, and create a browse and browse to this object
123 * @return Newly created object
125 static DrawResBase* Create()
127 DrawRes2D* dr = new DrawRes2D;
128 gROOT->GetListOfSpecials()->Add(dr);
129 TBrowser* b = new TBrowser("b");
130 b->BrowseObject(gROOT->GetListOfSpecials());
134 TH2D* fTotal2D; // Direct sum of input histograms
136 ClassDef(DrawRes2D,0)