1 TCanvas* theCanvas =
new TCanvas(
"theCanvas",
"", 900, 500);
2 gROOT->SetStyle(
"Plain");
3 theCanvas->UseCurrentStyle();
9 TFile* theFile = TFile::Open(
"Kspimumu.root",
"read");
10 TTree* theTree =
dynamic_cast<TTree*
>(theFile->Get(
"Data"));
12 int eventId, PDGId, dVtx, daug;
13 double E, px, py, pz, EL, pxL, pyL, pzL;
14 theTree->SetBranchAddress(
"eventId", &eventId);
15 theTree->SetBranchAddress(
"PDGId", &PDGId);
16 theTree->SetBranchAddress(
"dVtx", &dVtx);
17 theTree->SetBranchAddress(
"daug", &daug);
22 theTree->SetBranchAddress(
"EL", &EL);
23 theTree->SetBranchAddress(
"pxL", &pxL);
24 theTree->SetBranchAddress(
"pyL", &pyL);
25 theTree->SetBranchAddress(
"pzL", &pzL);
27 int nEntries = theTree->GetEntries();
32 int maxEvent = theTree->GetMaximum(
"eventId");
35 TH1D* mHist =
new TH1D(
"mHist",
"", 40, 0.2, 0.4);
36 mHist->SetDirectory(0);
37 mHist->SetXTitle(
"M_mumu (GeV/c^{2})");
40 TH1D* cHist =
new TH1D(
"cHist",
"", 40, -1.0, 1.0);
41 cHist->SetDirectory(0);
42 cHist->SetXTitle(
"cosHel");
44 TLorentzVector mumP4, mupP4, twoMuP4, pi0P4;
45 int mumId(13), mupId(-13), pi0Id(111);
48 bool gotMum(
false), gotMup(
false), gotPi0(
false);
50 for (i = 0; i < nEntries; i++) {
54 if (i%100000 == 0) {cout<<
"Event = "<<nEntries-i<<endl;}
56 if (gotMum && gotMup && gotPi0) {
59 twoMuP4 = mumP4 + mupP4;
60 mHist->Fill(twoMuP4.M());
62 double cosHel = cosHelicity(mumP4, twoMuP4, pi0P4);
65 zeroVector(mumP4); gotMum =
false;
66 zeroVector(mupP4); gotMup =
false;
67 zeroVector(pi0P4); gotPi0 =
false;
72 TLorentzVector p4(pxL, pyL, pzL, EL);
75 mumP4.SetPx(pxL); mumP4.SetPy(pyL); mumP4.SetPz(pzL); mumP4.SetE(EL);
77 }
else if (PDGId == mupId) {
78 mupP4.SetPx(pxL); mupP4.SetPy(pyL); mupP4.SetPz(pzL); mupP4.SetE(EL);
80 }
else if (PDGId == pi0Id) {
81 pi0P4.SetPx(pxL); pi0P4.SetPy(pyL); pi0P4.SetPz(pzL); pi0P4.SetE(EL);
88 if (gotMum && gotMup && gotPi0) {
91 twoMuP4 = mumP4 + mupP4;
92 mHist->Fill(twoMuP4.M());
94 double cosHel = cosHelicity(mumP4, twoMuP4, pi0P4);
99 theCanvas->Divide(2,1);
103 cHist->SetMinimum(0.0);
105 theCanvas->Print(
"Plots_Kspimumu.png");
109 double cosHelicity(TLorentzVector particle, TLorentzVector parent,
110 TLorentzVector grandparent) {
112 TVector3 boosttoparent = -(parent.BoostVector());
114 particle.Boost(boosttoparent);
115 grandparent.Boost(boosttoparent);
117 TVector3 particle3 = particle.Vect();
118 TVector3 grandparent3 = grandparent.Vect();
119 double numerator = particle3.Dot(grandparent3);
120 double denominator = (particle3.Mag())*(grandparent3.Mag());
121 double temp = numerator/denominator;
127 void zeroVector(TLorentzVector vect) {