Skip to content

Commit

Permalink
Reinstating 1GeV bins in unfolding analyser (still excluded 1GeV 2D r…
Browse files Browse the repository at this point in the history
…esponse histograms though)
  • Loading branch information
jjacob committed Oct 30, 2013
1 parent 8611c0d commit b64e1eb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 36 deletions.
71 changes: 36 additions & 35 deletions plugins/UnfoldingAnalyser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ UnfoldingAnalyser::UnfoldingAnalyser(const edm::ParameterSet& iConfig) :
fake_(), //
contamination_in_gen_variable_(), //
contamination_in_reco_variable_(), //
response_(), //
response_without_fakes_(), //
// response_(), //
// response_without_fakes_(), //
//
truth_asym_bins_(), //
measured_asym_bins_(), //
Expand Down Expand Up @@ -97,24 +97,25 @@ void UnfoldingAnalyser::beginJob() {
throw edm::Exception(edm::errors::Configuration, "TFile Service is not registered in cfg file");
}
//cout << "This is not how you debug" << endl;
// truth_ =
// fs->make < TH1F
// > ("truth", TString("True distribution;GEN(" + variable_under_analysis_ + ");# Events"), variable_n_bins_, variable_min_, variable_max_);
// measured_ =
// fs->make < TH1F
// > ("measured", TString("Measured distribution;RECO(" + variable_under_analysis_ + ");# Events"), variable_n_bins_, variable_min_, variable_max_);
// fake_ =
// fs->make < TH1F
// > ("fake", TString("background distribution;RECO(" + variable_under_analysis_ + ");# Events"), variable_n_bins_, variable_min_, variable_max_);
// contamination_in_gen_variable_ =
// fs->make < TH1F
// > ("contamination_inGenMET", TString(
// "background distribution;GEN(" + variable_under_analysis_ + ");# Events"), variable_n_bins_, variable_min_, variable_max_);
// contamination_in_reco_variable_ =
// fs->make < TH1F
// > ("contamination_inRecoMET", TString(
// "background distribution;RECO(" + variable_under_analysis_ + ");# Events"), variable_n_bins_, variable_min_, variable_max_);
//
//histograms with 1 GeV binning
truth_ =
fs->make < TH1F
> ("truth", TString("True distribution;GEN(" + variable_under_analysis_ + ");# Events"), variable_n_bins_, variable_min_, variable_max_);
measured_ =
fs->make < TH1F
> ("measured", TString("Measured distribution;RECO(" + variable_under_analysis_ + ");# Events"), variable_n_bins_, variable_min_, variable_max_);
fake_ =
fs->make < TH1F
> ("fake", TString("background distribution;RECO(" + variable_under_analysis_ + ");# Events"), variable_n_bins_, variable_min_, variable_max_);
contamination_in_gen_variable_ =
fs->make < TH1F
> ("contamination_inGenMET", TString(
"background distribution;GEN(" + variable_under_analysis_ + ");# Events"), variable_n_bins_, variable_min_, variable_max_);
contamination_in_reco_variable_ =
fs->make < TH1F
> ("contamination_inRecoMET", TString(
"background distribution;RECO(" + variable_under_analysis_ + ");# Events"), variable_n_bins_, variable_min_, variable_max_);

// response_ =
// fs->make < TH2F
// > ("response", TString(
Expand Down Expand Up @@ -157,11 +158,11 @@ void UnfoldingAnalyser::beginJob() {
"response;RECO(" + variable_under_analysis_ + ");GEN(" + variable_under_analysis_ + ")"), n_asym_bins, METBinEdges, n_asym_bins, METBinEdges);

//cout << "Well, you could use 'scram b' as a compiler on your machine within an IDE" << endl;
// truth_->Sumw2();
// measured_->Sumw2();
// fake_->Sumw2();
// contamination_in_gen_variable_->Sumw2();
// contamination_in_reco_variable_->Sumw2();
truth_->Sumw2();
measured_->Sumw2();
fake_->Sumw2();
contamination_in_gen_variable_->Sumw2();
contamination_in_reco_variable_->Sumw2();
// response_->Sumw2();
// response_without_fakes_->Sumw2();

Expand Down Expand Up @@ -211,14 +212,14 @@ void UnfoldingAnalyser::analyze(const edm::Event& iEvent, const edm::EventSetup&
if (do_electron_channel_) {
if (is_semileptonic_electron) {
//PU weight only (no btag-weight) as no b-tagging is applied
//truth_->Fill(gen_variable, puWeight);
truth_->Fill(gen_variable, puWeight);
truth_asym_bins_->Fill(gen_variable, puWeight);
}

if (passes_selection) {
float reco_variable(get_reco_variable(iEvent));

//measured_->Fill(reco_variable, weight);
measured_->Fill(reco_variable, weight);
measured_asym_bins_->Fill(reco_variable, weight);
//response_->Fill(reco_variable, gen_variable, weight);
response_asym_bins_->Fill(reco_variable, gen_variable, weight);
Expand All @@ -227,13 +228,13 @@ void UnfoldingAnalyser::analyze(const edm::Event& iEvent, const edm::EventSetup&
//response_without_fakes_->Fill(reco_variable, gen_variable, weight);
response_without_fakes_asym_bins_->Fill(reco_variable, gen_variable, weight);
} else {
//fake_->Fill(reco_variable, weight);
fake_->Fill(reco_variable, weight);
fake_asym_bins_->Fill(reco_variable, weight);
//contamination from other ttbar processes
if (is_fully_hadronic || is_dileptonic || is_semileptonic_tau || is_semileptonic_muon) {
//contamination_in_reco_variable_->Fill(reco_variable, weight);
contamination_in_reco_variable_->Fill(reco_variable, weight);
contamination_asym_bins_in_reco_variable_->Fill(reco_variable, weight);
//contamination_in_gen_variable_->Fill(gen_variable, weight);
contamination_in_gen_variable_->Fill(gen_variable, weight);
contamination_asym_bins_in_gen_variable_->Fill(gen_variable, weight);
}
}
Expand All @@ -243,7 +244,7 @@ void UnfoldingAnalyser::analyze(const edm::Event& iEvent, const edm::EventSetup&
} else { //muon channel
if (is_semileptonic_muon) {
//PU weight only (no btag-weight) as no b-tagging is applied
//truth_->Fill(gen_variable, puWeight);
truth_->Fill(gen_variable, puWeight);
truth_asym_bins_->Fill(gen_variable, puWeight);
}

Expand All @@ -254,7 +255,7 @@ void UnfoldingAnalyser::analyze(const edm::Event& iEvent, const edm::EventSetup&

weight *= muonCorrection;

//measured_->Fill(reco_variable, weight);
measured_->Fill(reco_variable, weight);
measured_asym_bins_->Fill(reco_variable, weight);
//response_->Fill(reco_variable, gen_variable, weight);
response_asym_bins_->Fill(reco_variable, gen_variable, weight);
Expand All @@ -263,12 +264,12 @@ void UnfoldingAnalyser::analyze(const edm::Event& iEvent, const edm::EventSetup&
//response_without_fakes_->Fill(reco_variable, gen_variable, weight);
response_without_fakes_asym_bins_->Fill(reco_variable, gen_variable, weight);
} else {
//fake_->Fill(reco_variable, weight);
fake_->Fill(reco_variable, weight);
fake_asym_bins_->Fill(reco_variable, weight);
if (is_fully_hadronic || is_dileptonic || is_semileptonic_tau || is_semileptonic_electron) {
//contamination_in_reco_variable_->Fill(reco_variable, weight);
contamination_in_reco_variable_->Fill(reco_variable, weight);
contamination_asym_bins_in_reco_variable_->Fill(reco_variable, weight);
//contamination_in_gen_variable_->Fill(gen_variable, weight);
contamination_in_gen_variable_->Fill(gen_variable, weight);
contamination_asym_bins_in_gen_variable_->Fill(gen_variable, weight);
}
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/UnfoldingAnalyser.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class UnfoldingAnalyser: public edm::EDAnalyzer {
// - fill fake (1D)
//histograms with 1 GeV binning
TH1F* truth_, *measured_, *fake_, *contamination_in_gen_variable_, *contamination_in_reco_variable_;
TH2F* response_, *response_without_fakes_;
// TH2F* response_, *response_without_fakes_;
//histograms with analysis binning: [0,25,45,70,100, inf]
TH1F* truth_asym_bins_, *measured_asym_bins_, *fake_asym_bins_, *contamination_asym_bins_in_gen_variable_,
*contamination_asym_bins_in_reco_variable_;
Expand Down

3 comments on commit b64e1eb

@senkin
Copy link
Member

@senkin senkin commented on b64e1eb Feb 26, 2014

Choose a reason for hiding this comment

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

What was the point doing this to 1D, but not 2D response matrices?
Also, can anyone (Phil? @phy6phs ) point me to fine-binned matrices used for binning choice scatter plots in the AN? Are they up to date, i.e. is the unfolding selection correct for them?

@phy6phs
Copy link

Choose a reason for hiding this comment

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

The fine binned histos are filled in the BinningAnalyser: https://github.com/BristolTopGroup/AnalysisSoftware/blob/master/src/Analysers/BinningAnalyser.cpp
The selection is just after the final event selection. Was it meant to be the final events just in the semi-leptonic channel? Although i'm not sure how this would work as you need to know how many selected events are in each bin so that you have enough stats...

@senkin
Copy link
Member

@senkin senkin commented on b64e1eb Feb 27, 2014

Choose a reason for hiding this comment

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

Ok, thanks — I think it makes sense, the binning plots should be after the full event selection in both channels. I just reproduced the plots in matplotlib and made the pull request (BristolTopGroup/DailyPythonScripts#69). Should be compatible with both 7 and 8 TeV.

Please sign in to comment.