10 #include <TParticle.h>
11 #include <TDatabasePDG.h>
15 TDatabasePDG *
pdg =
new TDatabasePDG;
18 TTree*
tree = (TTree*)tfile->Get(
"T");
20 vector<float> *m_pt = 0;
24 TParticle *m_part[2] = {0};
27 tree->SetBranchAddress(
"evt", &m_evt);
28 tree->SetBranchAddress(
"b", &m_b);
29 tree->SetBranchAddress(
"part0", &m_part[0]);
30 tree->SetBranchAddress(
"part1", &m_part[1]);
32 TFile *savefile =
new TFile(
"hijbkg_results.root",
"RECREATE");
35 TH1F *h_pt =
new TH1F(
"h_pt",
"Pt Distribution", 200, 0, 2.0 );
36 TH1F *h_eta =
new TH1F(
"h_eta",
"Eta Distribution", 200, -6, 6 );
37 TH1F *h_rap =
new TH1F(
"h_rap",
"Rapidity Distribution", 200, -4, 4 );
38 TH1F *h_phi =
new TH1F(
"h_phi",
"Phi Distribution", 100, -M_PI, M_PI );
39 TH1F *h_dphi =
new TH1F(
"h_dphi",
"dPhi Distribution", 100, -M_PI, M_PI );
40 TH1F *h_mass =
new TH1F(
"h_mass",
"Inv Mass", 200, 0., 6.);
41 h_pt->SetLineColor(4);
42 h_eta->SetLineColor(4);
43 h_phi->SetLineColor(4);
44 h_mass->SetLineColor(4);
47 TH1F *he_pt =
new TH1F(
"he_pt",
"Pt, assuming e+/e-", 200, 0, 2.0 );
48 TH1F *he_eta =
new TH1F(
"he_eta",
"Eta, assuming e+/e- ", 200, -6, 6 );
49 TH1F *he_rap =
new TH1F(
"he_rap",
"Rapidity, assuming e+/e-", 200, -4, 4 );
50 TH1F *he_phi =
new TH1F(
"he_phi",
"Phi, assuming e+/e- ", 100, -M_PI, M_PI );
51 TH1F *he_dphi =
new TH1F(
"he_dphi",
"dPhi, assuming e+/e- ", 100, -M_PI, M_PI );
52 TH1F *he_mass =
new TH1F(
"he_mass",
"Mass, assuming e+/e-", 200, 0., 6.);
55 TH1F *hej_pt =
new TH1F(
"hej_pt",
"Pt, J/Psi mass cut", 200, 0, 2.0 );
56 TH1F *hej_eta =
new TH1F(
"hej_eta",
"Eta, J/Psi mass cut ", 200, -6, 6 );
57 TH1F *hej_rap =
new TH1F(
"hej_rap",
"Rapidity, J/Psi mass cut", 200, -4, 4 );
58 TH1F *hej_dphi =
new TH1F(
"hej_dphi",
"dPhi, J/Psi mass cut", 100, -M_PI, M_PI );
59 hej_pt->SetLineColor(2);
60 hej_eta->SetLineColor(2);
61 hej_rap->SetLineColor(2);
62 hej_dphi->SetLineColor(2);
63 hej_pt->SetXTitle(
"#p_T (GeV/c)");
65 TLorentzVector part_v4[2];
66 TLorentzVector sum_v4;
68 TLorentzVector epart_v4[2];
69 TLorentzVector esum_v4;
72 Int_t nEntries = tree->GetEntries();
73 for (
int iEntry = 0; iEntry < nEntries; iEntry++)
75 tree->GetEntry(iEntry);
78 if ( iEntry%10000 == 0 ) cout << iEntry <<
"\t" << m_evt << endl;
83 for (
int ipart=0; ipart<2; ipart++)
85 charge[ipart] = m_part[ipart]->GetPDG()->Charge();
87 if ( fabs( m_part[ipart]->
GetPDG()->PdgCode() ) == 11 )
89 cout << m_part[ipart]->GetPDG()->PdgCode() <<
"\t" << charge[ipart] << endl;
92 double px = m_part[ipart]->Px();
93 double py = m_part[ipart]->Py();
94 double pz = m_part[ipart]->Pz();
96 part_v4[ipart].SetPxPyPzE( px, py, pz, m_part[ipart]->Energy() );
99 const double m_e = 0.511e-3;
100 double e_energy = sqrt( px*px + py*py + pz*pz + m_e*m_e );
101 epart_v4[ipart].SetPxPyPzE( px, py, pz, e_energy );
105 if ( fabs(part_v4[ipart].
Eta()) > 1.1 )
107 cout <<
"ERROR " << iEntry << m_part[ipart]->GetPdgCode() << endl;
112 if ( charge[0]*charge[1] > 0 )
117 sum_v4 = part_v4[0] + part_v4[1];
118 esum_v4 = epart_v4[0] + epart_v4[1];
121 h_pt->Fill( sum_v4.Pt() );
122 h_eta->Fill( sum_v4.Eta() );
123 h_phi->Fill( sum_v4.Phi() );
124 h_mass->Fill( sum_v4.M() );
125 h_rap->Fill( sum_v4.Rapidity() );
126 h_dphi->Fill( part_v4[0].
DeltaPhi( part_v4[1] ) );
129 he_pt->Fill( esum_v4.Pt() );
130 he_eta->Fill( esum_v4.Eta() );
131 he_phi->Fill( esum_v4.Phi() );
132 he_mass->Fill( esum_v4.M() );
133 he_rap->Fill( esum_v4.Rapidity() );
134 he_dphi->Fill( epart_v4[0].
DeltaPhi( epart_v4[1] ) );
137 if ( fabs( esum_v4.M() - 3.1 ) < 0.3 )
139 hej_pt->Fill( esum_v4.Pt() );
140 hej_eta->Fill( esum_v4.Eta() );
141 hej_rap->Fill( esum_v4.Rapidity() );
142 hej_dphi->Fill( epart_v4[0].
DeltaPhi( epart_v4[1] ) );
147 TCanvas *
ac =
new TCanvas(
"ac",
"pt",550,425);
148 h_pt->SetMinimum(0.5);
151 hej_pt->Draw(
"same");
153 ac->SaveAs(
"h_pt.png");
155 TCanvas *dc =
new TCanvas(
"dc",
"eta",550,425);
156 h_eta->SetMinimum(0.5);
158 he_eta->Draw(
"same");
159 hej_eta->Draw(
"same");
160 dc->SaveAs(
"h_eta.png");
162 TCanvas *
fc =
new TCanvas(
"fc",
"rapidity",550,425);
163 h_rap->SetMinimum(0.5);
165 he_rap->Draw(
"same");
166 hej_rap->Draw(
"same");
167 dc->SaveAs(
"h_eta.png");
169 TCanvas *bc =
new TCanvas(
"bc",
"phi",550,425);
170 h_phi->SetMinimum(0.5);
172 he_phi->Draw(
"same");
173 bc->SaveAs(
"h_phi.png");
175 TCanvas *gc =
new TCanvas(
"gc",
"dphi",550,425);
176 h_dphi->SetMinimum(0.5);
178 he_dphi->Draw(
"same");
179 hej_dphi->Draw(
"same");
180 dc->SaveAs(
"h_eta.png");
182 TCanvas *ec =
new TCanvas(
"ec",
"mass",550,425);
183 h_mass->SetMinimum(0.5);
185 he_mass->Draw(
"same");
187 ec->SaveAs(
"h_mass.png");