Skip to content
Open
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
76db2c5
Added the angular distributions for W1->cs and W2->ud
Jun 25, 2025
bbdae27
cos(phi) calculations with truth variables
Jun 30, 2025
7467d65
uncommented the recojets and added all variables to chi2
Jun 30, 2025
d7eb0d9
added plots using TCanvas
Jul 1, 2025
a6c016d
added the ee correlator calculations
Jul 3, 2025
7e7bc83
Plots from AnalysisWWCR
Jul 3, 2025
ce793e8
corrected to delta-phi
Jul 8, 2025
8d482b9
plots delta-phi, cos-phi, ee correlator, and ratios
Jul 8, 2025
1adc643
modified the function that selects hadronic decays using truth info
Jul 11, 2025
db6ea1a
started the process of adding in the jet constituents
Jul 11, 2025
259c7aa
Python version of Plots_AnalysisWWCR
Jul 14, 2025
53883a2
issue with jet-substructure for-loop (line 461)
Jul 14, 2025
da245b0
Fixed issue with branches and have started calculating the four-vector
Jul 15, 2025
7f89a2b
issue on lines 439-442
Jul 15, 2025
fce7047
includes print statements and minor fixes from previous version
Jul 16, 2025
9dceacb
load RVecDict and compute jet const. LV
Jul 16, 2025
dd0b1fb
commiting before merging branches
Jul 16, 2025
f593f8a
Merge branch 'WW_CR_fix' into WW_CR_kl
Jul 16, 2025
3878acb
modifications before merge
Jul 16, 2025
828f693
added calculation for EE correlations w/ jet substructure
Jul 17, 2025
3433144
started correcting ee calculation
Jul 20, 2025
ffeb43c
modified ee correlation calculation for jet constituents and jets
Jul 20, 2025
4f5c091
fixed issue phi measurements
Jul 24, 2025
2dca02c
add brances to output root file
Jul 24, 2025
ed7b4cc
add simple plotting script
Jul 24, 2025
66698b0
scripts/plotall.C
Jul 24, 2025
37f9dcb
hadronic decay cuts added
Jul 25, 2025
ac41828
added truth level cut
Jul 25, 2025
f0f8bd7
all hadronic decays selected on truth level
Jul 25, 2025
b93e1a8
truth level selection of WW->4q events
Jul 25, 2025
bf80ed4
added mostly complete plots for theta, phi, and chi. Issues with cosi…
Jul 28, 2025
c3e6b87
binning issue with cosine and eec calculations
Jul 28, 2025
fa05044
saving reco-jets to ROOT file
Jul 31, 2025
1ee5eeb
variable binning for momenta plots
Aug 1, 2025
0014b91
all kinematic plots saved to root
Aug 4, 2025
8211dde
loading in SKI_kl variation files
Aug 5, 2025
5f03cf6
SKI_100 variables setup with all plots
Aug 6, 2025
6974686
added SKI w/ kl = 100
Aug 6, 2025
006c49e
SKI w/ kl=100 added to plots
Aug 6, 2025
3c897b9
SKI w/ kl=100 added to all plots
Aug 6, 2025
b4dbf58
all histograms saved as branches
Aug 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
265 changes: 238 additions & 27 deletions PostCutCode/Root/AnalysisWWCR.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "TH1F.h"
#include "TCanvas.h"
#include "TLegend.h"
#include <set>


Expand Down Expand Up @@ -130,15 +131,12 @@ void AnalysisWWCR::run()
auto h_W1_e = m_histContainer->get1DHist("h_W1_e", 300, 0, 150);
auto h_W2_e = m_histContainer->get1DHist("h_W2_e", 300, 0, 150);

auto h_cos_phi_c_s = m_histContainer->get1DHist("h_cos_phi_c_s", 150, -1, 1);
auto h_cos_phi_c_l0 = m_histContainer->get1DHist("h_cos_phi_c_l0", 150, -1, 1);
auto h_cos_phi_l1_l2 = m_histContainer->get1DHist("h_cos_phi_l1_l2", 150, -1, 1);
// auto h_cos_phi_c_l1 = m_histContainer->get1DHist("h_cos_phi_c_l1", 300, -1, 1);
// auto h_cos_phi_c_l2 = m_histContainer->get1DHist("h_cos_phi_c_l2", 300, -1, 1);
// auto h_cos_phi_s_l1 = m_histContainer->get1DHist("h_cos_phi_s_l1", 300, -1, 1);
// auto h_cos_phi_s_l2 = m_histContainer->get1DHist("h_cos_phi_s_l2", 300, -1, 1);

// auto h_W1_cos_phi_l1_l2 = m_histContainer->get1DHist("h_W1_cos_phi_l1_l2", 150, -1, 1);
// auto h_W2_cos_phi_l1_l2 = m_histContainer->get1DHist("h_W2_cos_phi_l1_l2", 150, -1, 1);
auto h_cos_phi_c_l1 = m_histContainer->get1DHist("h_cos_phi_c_l1", 300, -1, 1);
auto h_cos_phi_c_l2 = m_histContainer->get1DHist("h_cos_phi_c_l2", 300, -1, 1);
auto h_cos_phi_s_l1 = m_histContainer->get1DHist("h_cos_phi_s_l1", 300, -1, 1);
auto h_cos_phi_s_l2 = m_histContainer->get1DHist("h_cos_phi_s_l2", 300, -1, 1);

// Get the trees
auto treeCont = std::make_shared<TreeContainer>();
Expand Down Expand Up @@ -489,7 +487,7 @@ void AnalysisWWCR::run()
std::cout << " " << std::endl;
}

// calculate the mass
// ************************** CALCULATIONS FOR MASS AND SUCH BEGIN HERE **************************
TLorentzVector cTag_Jet, lTag_Jet_0, lTag_Jet_1, lTag_Jet_2;

cTag_Jet.SetPxPyPzE(jet_px.at(cJet), jet_py.at(cJet), jet_pz.at(cJet), jet_e.at(cJet));
Expand All @@ -498,8 +496,6 @@ void AnalysisWWCR::run()
lTag_Jet_1.SetPxPyPzE(jet_px.at(lJets[1]), jet_py.at(lJets[1]), jet_pz.at(lJets[1]), jet_e.at(lJets[1]));
lTag_Jet_2.SetPxPyPzE(jet_px.at(lJets[2]), jet_py.at(lJets[2]), jet_pz.at(lJets[2]), jet_e.at(lJets[2]));


// ************************** CALCULATIONS FOR MASS AND SUCH BEGIN HERE **************************
const double m_W_true = 80.379;

TLorentzVector W1_option1 = cTag_Jet + lTag_Jet_0;
Expand All @@ -520,6 +516,9 @@ void AnalysisWWCR::run()
double chi2_option3 =
(pow(W1_option3.M() - m_W_true, 2) + pow(W2_option3.M() - m_W_true, 2)) / (m_W_true);

// for the cos(phi) angle
TLorentzVector W1_j1, W1_j2, W2_j1, W2_j2;

if (chi2_option1 <= chi2_option2 && chi2_option1 <= chi2_option3) {
h_W1_mass->Fill(W1_option1.M());
h_W2_mass->Fill(W2_option1.M());
Expand All @@ -541,8 +540,11 @@ void AnalysisWWCR::run()
h_lJet1_p->Fill(lTag_Jet_1.P());
h_lJet2_p->Fill(lTag_Jet_2.P());

CosPhi_Angle(cTag_Jet, lTag_Jet_0, h_cos_phi_c_s);
CosPhi_Angle(lTag_Jet_1, lTag_Jet_2, h_cos_phi_l1_l2);
W1_j1 = cTag_Jet;
W1_j2 = lTag_Jet_0;

W2_j1 = lTag_Jet_1;
W2_j2 = lTag_Jet_2;

} else if (chi2_option2 <= chi2_option1 && chi2_option2 <= chi2_option3) {
h_W1_mass->Fill(W1_option2.M());
Expand All @@ -565,8 +567,11 @@ void AnalysisWWCR::run()
h_lJet1_p->Fill(lTag_Jet_1.P());
h_lJet2_p->Fill(lTag_Jet_2.P());

CosPhi_Angle(cTag_Jet, lTag_Jet_0, h_cos_phi_c_s);
CosPhi_Angle(lTag_Jet_1, lTag_Jet_2, h_cos_phi_l1_l2);
W1_j1 = cTag_Jet;
W1_j2 = lTag_Jet_1;

W2_j1 = lTag_Jet_0;
W2_j2 = lTag_Jet_2;

} else {
h_W1_mass->Fill(W1_option3.M());
Expand All @@ -589,8 +594,11 @@ void AnalysisWWCR::run()
h_lJet1_p->Fill(lTag_Jet_1.P());
h_lJet2_p->Fill(lTag_Jet_2.P());

CosPhi_Angle(cTag_Jet, lTag_Jet_0, h_cos_phi_c_s);
CosPhi_Angle(lTag_Jet_1, lTag_Jet_2, h_cos_phi_l1_l2);
W1_j1 = cTag_Jet;
W1_j2 = lTag_Jet_2;

W2_j1 = lTag_Jet_1;
W2_j2 = lTag_Jet_0;
}

// Reco_wPair result = Chi2_wMass(cTag_Jet, lTag_Jet_0, lTag_Jet_1, lTag_Jet_2);
Expand All @@ -615,15 +623,12 @@ void AnalysisWWCR::run()
// h_lJet2_p->Fill(lTag_Jet_2.P());

// ************************* CHANGE // COMMENT OUT WHEN RUNNING WITH DIFFERENT WW DECAY OPTIONS *******************************
// CosPhi_Angle(cTag_Jet, lTag_Jet_0, h_cos_phi_c_s);
// CosPhi_Angle(lTag_Jet_1, lTag_Jet_2, h_cos_phi_l1_l2);
// CosPhi_Angle(cTag_Jet, lTag_Jet_1, h_cos_phi_c_l1);
// CosPhi_Angle(cTag_Jet, lTag_Jet_2, h_cos_phi_c_l2);
// CosPhi_Angle(lTag_Jet_0, lTag_Jet_1, h_cos_phi_s_l1);
// CosPhi_Angle(lTag_Jet_0, lTag_Jet_2, h_cos_phi_s_l2);

// CosPhi_Angle(lTag_Jet_1, lTag_Jet_2, h_W1_cos_phi_l1_l2);
// CosPhi_Angle(lTag_Jet_1, lTag_Jet_2, h_W2_cos_phi_l1_l2);
CosPhi_Angle(W1_j1, W1_j2, h_cos_phi_c_l0);
CosPhi_Angle(W2_j1, W2_j2, h_cos_phi_l1_l2);
CosPhi_Angle(W1_j1, W2_j1, h_cos_phi_c_l1);
CosPhi_Angle(W1_j1, W2_j2, h_cos_phi_c_l2);
CosPhi_Angle(W1_j2, W2_j1, h_cos_phi_s_l1);
CosPhi_Angle(W1_j2, W2_j2, h_cos_phi_s_l2);

// cutflow histograms
cutFlowHist->SetBinContent(1, NEvents);
Expand All @@ -634,9 +639,179 @@ void AnalysisWWCR::run()
cutFlowHist->SetBinContent(6, NdCutd123);
cutFlowHist->SetBinContent(7, NdCutd34);
cutFlowHist->SetBinContent(8, nFlavScore);

}

// *************************** COMPARATIVE MASS PLOTS ***************************
TCanvas* c_W1_W2_mass = new TCanvas("c_W1_W2_mass", "Truth Histograms", 1800, 900);
c_W1_W2_mass->Divide(2, 1);

c_W1_W2_mass->cd(1);
h_W1_truth_mass->Draw();
h_W1_truth_mass->SetLineColor(kBlue);
h_W1_truth_mass->GetXaxis()->SetTitle("GeV");

h_W1_mass->Draw("same");
h_W1_mass->SetLineColor(kRed);

TLegend *legend_w1_mass = new TLegend(0.6, 0.7, 0.8, 0.8);
legend_w1_mass->SetTextSize(0.04);
legend_w1_mass->SetBorderSize(0);
legend_w1_mass->SetFillStyle(0); // Transparent background

legend_w1_mass->AddEntry(h_W1_truth_mass, "w1_truth_mass", "l");
legend_w1_mass->AddEntry(h_W1_mass, "w1_mass", "l");
legend_w1_mass->Draw();

c_W1_W2_mass->cd(2);
h_W2_truth_mass->Draw();
h_W2_truth_mass->SetLineColor(kBlue);
h_W2_truth_mass->GetXaxis()->SetTitle("GeV");

h_W2_mass->Draw("same");
h_W2_mass->SetLineColor(kRed);

TLegend *legend_w2_mass = new TLegend(0.6, 0.7, 0.8, 0.8);
legend_w2_mass->SetTextSize(0.04);
legend_w2_mass->SetBorderSize(0);
legend_w2_mass->SetFillStyle(0); // Transparent background

legend_w2_mass->AddEntry(h_W2_truth_mass, "w2_truth_mass", "l");
legend_w2_mass->AddEntry(h_W2_mass, "w2_mass", "l");
legend_w2_mass->Draw();

c_W1_W2_mass->Update();
c_W1_W2_mass->SaveAs("/usatlas/u/kleibensperger/FCCeePostCutCode/run/w1_w2_masses.png");


// *************************** COMPARATIVE MOMENTA PLOTS ***************************
TCanvas* c_W1_W2_p = new TCanvas("c_W1_W2_p", "Truth Histograms", 1800, 900);
c_W1_W2_p->Divide(2, 1);

c_W1_W2_p->cd(1);
h_W1_truth_p->Draw();
h_W1_truth_p->SetLineColor(kBlue);
h_W1_truth_p->GetXaxis()->SetTitle("GeV");

h_W1_p->Draw("same");
h_W1_p->SetLineColor(kRed);

TLegend *legend_w1_p = new TLegend(0.6, 0.7, 0.8, 0.8);
legend_w1_p->SetTextSize(0.04);
legend_w1_p->SetBorderSize(0);
legend_w1_p->SetFillStyle(0); // Transparent background

legend_w1_p->AddEntry(h_W1_truth_p, "w1_truth_p", "l");
legend_w1_p->AddEntry(h_W1_p, "w1_p", "l");
legend_w1_p->Draw();

c_W1_W2_p->cd(2);
h_W2_truth_p->Draw();
h_W2_truth_p->SetLineColor(kBlue);
h_W2_truth_p->GetXaxis()->SetTitle("GeV");

h_W2_p->Draw("same");
h_W2_p->SetLineColor(kRed);

TLegend *legend_w2_p = new TLegend(0.6, 0.7, 0.8, 0.8);
legend_w2_p->SetTextSize(0.04);
legend_w2_p->SetBorderSize(0);
legend_w2_p->SetFillStyle(0); // Transparent background

legend_w2_p->AddEntry(h_W2_truth_p, "w2_truth_p", "l");
legend_w2_p->AddEntry(h_W2_p, "w2_p", "l");
legend_w2_p->Draw();

c_W1_W2_p->Update();
c_W1_W2_p->SaveAs("/usatlas/u/kleibensperger/FCCeePostCutCode/run/w1_w2_p.png");


// *************************** COMPARATIVE ENERGY PLOTS ***************************
TCanvas* c_W1_W2_e = new TCanvas("c_W1_W2_e", "Truth Histograms", 1800, 900);
c_W1_W2_e->Divide(2, 1);

c_W1_W2_e->cd(1);
h_W1_truth_e->Draw();
h_W1_truth_e->SetLineColor(kBlue);
h_W1_truth_e->GetXaxis()->SetTitle("GeV");

h_W1_e->Draw("same");
h_W1_e->SetLineColor(kRed);

TLegend *legend_w1_e = new TLegend(0.6, 0.7, 0.8, 0.8);
legend_w1_e->SetTextSize(0.04);
legend_w1_e->SetBorderSize(0);
legend_w1_e->SetFillStyle(0); // Transparent background

legend_w1_e->AddEntry(h_W1_truth_e, "w1_truth_e", "l");
legend_w1_e->AddEntry(h_W1_e, "w1_e", "l");
legend_w1_e->Draw();

c_W1_W2_e->cd(2);
h_W2_truth_e->Draw();
h_W2_truth_e->SetLineColor(kBlue);
h_W2_truth_e->GetXaxis()->SetTitle("GeV");

h_W2_e->Draw("same");
h_W2_e->SetLineColor(kRed);

TLegend *legend_w2_e = new TLegend(0.6, 0.7, 0.8, 0.8);
legend_w2_e->SetTextSize(0.04);
legend_w2_e->SetBorderSize(0);
legend_w2_e->SetFillStyle(0); // Transparent background

legend_w2_e->AddEntry(h_W2_truth_e, "w2_truth_e", "l");
legend_w2_e->AddEntry(h_W2_e, "w2_e", "l");
legend_w2_e->Draw();

c_W1_W2_e->Update();
c_W1_W2_e->SaveAs("/usatlas/u/kleibensperger/FCCeePostCutCode/run/w1_w2_e.png");


// *************************** COMPARATIVE ANGULAR DISTRIBUTIONS PLOTS ***************************

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be done during this stage. You just run the event loop here and can make TH1D histograms. The plotting should be done with a separate script

TCanvas* c_angular_dist = new TCanvas("c_angular_dist", "Truth Histograms", 1800, 900);
c_angular_dist->Divide(2, 1);

c_angular_dist->cd(1);
h_cos_phi_truth_cs->Draw();
h_cos_phi_truth_cs->SetLineColor(kBlue);
h_cos_phi_truth_cs->GetXaxis()->SetTitle("cos(#phi)");

h_cos_phi_c_l0->Draw("same");
h_cos_phi_c_l0->SetLineColor(kRed);

TLegend *legend_w1_cos_phi = new TLegend(0.6, 0.7, 0.8, 0.8);
legend_w1_cos_phi->SetTextSize(0.04);
legend_w1_cos_phi->SetBorderSize(0);
legend_w1_cos_phi->SetFillStyle(0); // Transparent background

legend_w1_cos_phi->AddEntry(h_cos_phi_truth_cs, "truth cos_phi_cs", "l");
legend_w1_cos_phi->AddEntry(h_cos_phi_c_l0, "truth cos_phi_c_l0", "l");
legend_w1_cos_phi->Draw();

c_angular_dist->cd(2);
h_cos_phi_truth_ud->Draw();
h_cos_phi_truth_ud->SetLineColor(kBlue);
h_cos_phi_truth_ud->GetXaxis()->SetTitle("cos(#phi)");

h_cos_phi_l1_l2->Draw("same");
h_cos_phi_l1_l2->SetLineColor(kRed);

TLegend *legend_w2_cos_phi = new TLegend(0.6, 0.7, 0.8, 0.8);
legend_w2_cos_phi->SetTextSize(0.04);
legend_w2_cos_phi->SetBorderSize(0);
legend_w2_cos_phi->SetFillStyle(0); // Transparent background

legend_w2_cos_phi->AddEntry(h_cos_phi_truth_ud, "truth cos_phi_ud", "l");
legend_w2_cos_phi->AddEntry(h_cos_phi_l1_l2, "truth cos_phi_l1_l2", "l");
legend_w2_cos_phi->Draw();

c_angular_dist->Update();
c_angular_dist->SaveAs("/usatlas/u/kleibensperger/FCCeePostCutCode/run/w1_w2_angular_dist.png");




std::cout << " " << std::endl;
std::cout << "-------------------- Outputs --------------------" << std::endl;
std::cout << "Number of events: " << NEvents << std::endl;
Expand All @@ -650,7 +825,43 @@ void AnalysisWWCR::run()
std::cout << "Let there be data ;)" << std::endl;




std::cout << " " << std::endl;
std::cout << "-------------------- Outputs --------------------" << std::endl;
std::cout << "Number of events: " << NEvents << std::endl;
std::cout << "Number of events passing W decay cuts: " << NdecayCuts << std::endl;
std::cout << "Number of events w/ 4 jets: " << NjetCut << std::endl;
std::cout << "Number of Leptons Cut: " << NleptonCut << std::endl;
std::cout << "Number of events with 1 c-tagged, 1 s-tagged, and 2 light-tagged jets: " << nFlavScore << std::endl;
std::cout << " " << std::endl;

std::cout << " " << std::endl;
std::cout << "Let there be data ;)" << std::endl;

// end of macro
}

// void finalize() {
// auto h_W1_truth_mass = HistContainer->get1DHist("h_W1_truth_mass");
// auto h_W2_truth_mass = HistContainer->get1DHist("h_W2_truth_mass");

// // Create canvas
// TCanvas* c_truth = new TCanvas("c_truth", "Truth Histograms", 1200, 800);
// c_truth->Divide(3, 2);

// c_truth->cd(1);
// h_W1_truth_mass->Draw();

// c_truth->cd(2);
// h_W2_truth_mass->Draw();

// // ... draw other histograms on c_truth ...

// // Save canvas into the output ROOT file
// c_truth->Write();

// // Similarly for other canvases
// }