StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
photosPlots.C
1 #include <string>
2 
3 void photosPlots(std::string fileName = "Upsilon4S_PHOTOS.root") {
4 
5  TFile* theFile = new TFile(fileName.c_str(), "read");
6  TTree* theTree = dynamic_cast<TTree*>(theFile->Get("Data"));
7  TTree* nDaugTree = dynamic_cast<TTree*>(theFile->Get("nDaugTree"));
8 
9  TH1F* eMtmHist = new TH1F("eMtmHist", "", 100, 0.0, 5.5);
10  eMtmHist->SetXTitle("Electron momentum (GeV/c)");
11  eMtmHist->SetYTitle("Frequency/55 (MeV/c)");
12  eMtmHist->SetTitleOffset(1.1, "Y");
13  TAxis* exAxis = eMtmHist->GetXaxis();
14  exAxis->SetLabelSize(0.045);
15  exAxis->SetTitleSize(0.045);
16  TAxis* eyAxis = eMtmHist->GetYaxis();
17  eyAxis->SetLabelSize(0.045);
18  eyAxis->SetTitleSize(0.045);
19 
20  TH1F* pMtmHist = new TH1F("pMtmHist", "", 100, 0.0, 5.5);
21  pMtmHist->SetXTitle("Positron momentum (GeV/c)");
22  pMtmHist->SetYTitle("Frequency/55 (MeV/c)");
23  pMtmHist->SetTitleOffset(1.1, "Y");
24  TAxis* pxAxis = pMtmHist->GetXaxis();
25  pxAxis->SetLabelSize(0.045);
26  pxAxis->SetTitleSize(0.045);
27  TAxis* pyAxis = pMtmHist->GetYaxis();
28  pyAxis->SetLabelSize(0.045);
29  pyAxis->SetTitleSize(0.045);
30 
31  TH1F* gMtmHist = new TH1F("gMtmHist", "", 100, 0.0, 5.5);
32  gMtmHist->SetXTitle("Photon momentum (GeV/c)");
33  gMtmHist->SetYTitle("Frequency/55 (MeV/c)");
34  gMtmHist->SetTitleOffset(1.1, "Y");
35  TAxis* gxAxis = gMtmHist->GetXaxis();
36  gxAxis->SetLabelSize(0.045);
37  gxAxis->SetTitleSize(0.045);
38  TAxis* gyAxis = gMtmHist->GetYaxis();
39  gyAxis->SetLabelSize(0.045);
40  gyAxis->SetTitleSize(0.045);
41 
42  TH1F* nDaugHist = new TH1F("nDaugHist", "", 10, 0, 10);
43  nDaugHist->SetXTitle("Number of daughters");
44  nDaugHist->SetYTitle("Frequency");
45  nDaugHist->SetTitleOffset(1.15, "Y");
46  TAxis* nxAxis = nDaugHist->GetXaxis();
47  nxAxis->SetLabelSize(0.045);
48  nxAxis->SetTitleSize(0.045);
49  TAxis* nyAxis = nDaugHist->GetYaxis();
50  nyAxis->SetLabelSize(0.045);
51  nyAxis->SetTitleSize(0.045);
52 
53  theTree->Draw("p>>eMtmHist", "id==11");
54  theTree->Draw("p>>pMtmHist", "id==-11");
55  theTree->Draw("p>>gMtmHist", "id==22");
56  nDaugTree->Draw("nDaug>>nDaugHist");
57 
58  gROOT->SetStyle("Plain");
59  gStyle->SetOptStat(0);
60  TCanvas* theCanvas = new TCanvas("theCanvas", "", 900, 700);
61  theCanvas->UseCurrentStyle();
62 
63  theCanvas->Divide(2,2);
64 
65  theCanvas->cd(1);
66  gPad->SetLogy();
67  double scale = 1.0/eMtmHist->Integral(); // same normalisation number for all plots
68 
69  eMtmHist->Scale(scale);
70  eMtmHist->SetMaximum(1.0);
71  eMtmHist->Draw();
72 
73  theCanvas->cd(2);
74  gPad->SetLogy();
75  pMtmHist->Scale(scale);
76  pMtmHist->SetMaximum(1.0);
77  pMtmHist->Draw();
78 
79  theCanvas->cd(3);
80  gPad->SetLogy();
81  gMtmHist->Scale(scale);
82  gMtmHist->SetMaximum(1.0);
83  gMtmHist->Draw();
84 
85  theCanvas->cd(4);
86  gPad->SetLogy(0);
87  nDaugHist->Scale(scale);
88  nDaugHist->SetMaximum(0.5);
89  nDaugHist->Draw();
90 
91  theCanvas->cd(1);
92  TLatex latex;
93  latex.SetNDC();
94  latex.SetTextSize(0.045);
95  latex.DrawLatex(0.1, 0.95, "#Upsilon(4S) #rightarrow e^{-} e^{+} decay with PHOTOS");
96 
97  theCanvas->Print("photosPlots.png");
98 
99 }