5 void PhaseSpacePlots() {
7 string fileName1 =
"rootFiles/B0JpsiKpi.root";
8 string fileName2 =
"rootFiles/B0KpiJpsi.root";
10 string decay1 =
"B^{0} #rightarrow J/#psi K #pi";
11 string decay2 =
"B^{0} #rightarrow K #pi J/#psi";
13 string xLabel =
"m^{2}(K#pi)";
14 string yLabel =
"m^{2}(J/#psi #pi)";
21 latex.SetTextSize(0.05);
24 gROOT->SetStyle(
"Plain");
25 gStyle->SetOptStat(0);
26 TCanvas* theCanvas =
new TCanvas(
"theCanvas",
"", 1500, 600);
27 theCanvas->UseCurrentStyle();
29 theCanvas->Divide(2,1);
32 TH2D* plot1 = getDalitzPlot(fileName1, xInt1, yInt1, xLabel, yLabel);
34 latex.DrawLatex(0.3, 0.95, decay1.c_str());
37 TH2D* plot2 = getDalitzPlot(fileName2, xInt2, yInt2, xLabel, yLabel);
39 latex.DrawLatex(0.3, 0.95, decay2.c_str());
41 theCanvas->Print(
"PhaseSpacePlots.png");
45 TH2D* getDalitzPlot(
string fileName,
int xInt = 1,
int yInt = 2,
46 string xLabel =
"m^{2}_{23}",
47 string yLabel =
"m^{2}_{13}") {
49 TFile* theFile =
new TFile(fileName.c_str(),
"read");
50 if (!theFile) {
return 0;}
52 TTree* theTree =
dynamic_cast<TTree*
>(theFile->Get(
"dalitzTree"));
53 if (!theTree) {
return 0;}
55 double m12Sq(0.0), m23Sq(0.0), m13Sq(0.0);
56 theTree->SetBranchAddress(
"invMass12Sq", &m12Sq);
57 theTree->SetBranchAddress(
"invMass23Sq", &m23Sq);
58 theTree->SetBranchAddress(
"invMass13Sq", &m13Sq);
61 theTree->SetBranchStatus(
"invMass12", 0);
62 theTree->SetBranchStatus(
"invMass23", 0);
63 theTree->SetBranchStatus(
"invMass13", 0);
65 double m12SqMin = theTree->GetMinimum(
"invMass12Sq");
66 double m12SqMax = theTree->GetMaximum(
"invMass12Sq");
68 double m23SqMin = theTree->GetMinimum(
"invMass23Sq");
69 double m23SqMax = theTree->GetMaximum(
"invMass23Sq");
71 double m13SqMin = theTree->GetMinimum(
"invMass13Sq");
72 double m13SqMax = theTree->GetMaximum(
"invMass13Sq");
75 double xMin(m23SqMin), xMax(m23SqMax);
76 double yMin(m13SqMin), yMax(m13SqMax);
79 xMin = m13SqMin; xMax = m13SqMax;
80 }
else if (xInt == 3) {
81 xMin = m12SqMin; xMax = m12SqMax;
85 yMin = m23SqMin; yMax = m23SqMax;
86 }
else if (yInt == 3) {
87 yMin = m12SqMin; yMax = m12SqMin;
91 xMin = roundMin(xMin);
92 xMax = roundMax(xMax);
93 yMin = roundMin(yMin);
94 yMax = roundMax(yMax);
96 TH2D* DPHist =
new TH2D(
"DPHist",
"", 100, xMin, xMax, 100, yMin, yMax);
97 DPHist->SetDirectory(0);
99 DPHist->SetXTitle(xLabel.c_str());
100 DPHist->SetYTitle(yLabel.c_str());
102 int N = theTree->GetEntries();
105 for (i = 0; i < N; i++) {
107 theTree->GetEntry(i);
109 if (i%100000 == 0) {cout<<
"i = "<<N-i<<endl;}
116 }
else if (xInt == 3) {
122 }
else if (yInt == 3) {
126 DPHist->Fill(xVal, yVal);
134 double roundMin(
double x) {
136 double value = floor(x)*0.98;
141 double roundMax(
double x) {
143 double value = ceil(x)*1.02;