Skip to content

Commit

Permalink
Add a Base Weight and a Full Weight histogram
Browse files Browse the repository at this point in the history
Base Weight is the ZFinderEvent.event_weight of the event, while the
Full Weight is the fully propagated weight including all the cuts up to
that point.
  • Loading branch information
Alexander Gude committed May 3, 2014
1 parent 7aa348d commit 5a8e253
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ZFinder/Event/interface/ZFinderPlotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ namespace zf {
TH1D* phistar_;
TH1D* pileup_;
TH1D* nelectrons_;
TH1D* baseweights_;
TH1D* fullweights_;

// Use the MC or reco data
const bool USE_MC_;
Expand Down
25 changes: 25 additions & 0 deletions ZFinder/Event/src/ZFinderPlotter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ namespace zf {
nelectrons_ = tdir.make<TH1D>(nelectrons_name.c_str(), nelectrons_name.c_str(), 10, 0., 10.);
nelectrons_->GetXaxis()->SetTitle("N_{e}");
nelectrons_->GetYaxis()->SetTitle("Events");

// baseweights
const std::string baseweights_name = "Base Weight";
baseweights_ = tdir.make<TH1D>(baseweights_name.c_str(), baseweights_name.c_str(), 500, 0., 5.);
baseweights_->GetXaxis()->SetTitle("Weight");
baseweights_->GetYaxis()->SetTitle("Events");

// baseweights
const std::string fullweights_name = "Full Weight";
fullweights_ = tdir.make<TH1D>(fullweights_name.c_str(), fullweights_name.c_str(), 500, 0., 5.);
fullweights_->GetXaxis()->SetTitle("Weight");
fullweights_->GetYaxis()->SetTitle("Events");
}

void ZFinderPlotter::Fill(
Expand Down Expand Up @@ -192,6 +204,9 @@ namespace zf {
pileup_->Fill(zf_event.truth_vert.num, EVENT_WEIGHT);
nelectrons_->Fill(2, EVENT_WEIGHT); // We only ever grab the two electrons from the Z
}
// Event weights, they are of course, unweighted
baseweights_->Fill(zf_event.event_weight);
fullweights_->Fill(EVENT_WEIGHT);
}

void ZFinderPlotter::Print(const std::string& basename) {
Expand Down Expand Up @@ -275,5 +290,15 @@ namespace zf {
TCanvas* nelectronsC = new TCanvas(nelectronsStr.c_str(), nelectronsStr.c_str(), X_SIZE, Y_SIZE);
nelectrons_->Draw();
nelectronsC->Print((nelectronsStr+".png").c_str());

std::string baseweightsStr = basename + "_baseweights";
TCanvas* baseweightsC = new TCanvas(baseweightsStr.c_str(), baseweightsStr.c_str(), X_SIZE, Y_SIZE);
baseweights_->Draw();
baseweightsC->Print((baseweightsStr+".png").c_str());

std::string fullweightsStr = basename + "_fullweights";
TCanvas* fullweightsC = new TCanvas(fullweightsStr.c_str(), fullweightsStr.c_str(), X_SIZE, Y_SIZE);
fullweights_->Draw();
fullweightsC->Print((fullweightsStr+".png").c_str());
}
} // namespace zf

0 comments on commit 5a8e253

Please sign in to comment.