Skip to content

Commit

Permalink
Fixing weights in ZDefinitionWorkspace
Browse files Browse the repository at this point in the history
Also fixing the names of variables; the names in the strings should be
the name given in the constructor, not the name of the variable holding
the object.
  • Loading branch information
Alexander Gude committed May 6, 2014
1 parent b7d53ef commit 2b5ab89
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions ZFinder/Event/src/ZDefinitionWorkspace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ namespace zf {
degenerate_->defineType("Degenerate Denominator", 1);
degenerate_->defineType("Degenerate Denominator and numerator", 2);

// Add the weight variable
weight_ = new RooRealVar("weight", "Event weight", 0, 100);

// Argsets
argset_ = new RooArgSet(*z_mass_, *phistar_, *z_pt_, *z_eta_, *z_y_);
argset_->add(*e0_pt_);
Expand All @@ -82,9 +85,9 @@ namespace zf {
argset_->add(*data_type_);
argset_->add(*numerator_);
argset_->add(*degenerate_);
argset_->add(*weight_);

// Dataset
weight_ = new RooRealVar("weight", "Event weight", 0, 100);
roodataset_ = new RooDataSet(
"roo_dataset",
"All events selected by the ZDefinition",
Expand Down Expand Up @@ -117,24 +120,24 @@ namespace zf {

// MC or Reco
if (zf_event.is_real_data) {
argset_->setCatLabel("data_type_", "Data");
argset_->setCatLabel("data_type", "Data");
} else if (USE_TRUTH_) {
argset_->setCatLabel("data_type_", "Truth MC");
argset_->setCatLabel("data_type", "Truth MC");
} else {
argset_->setCatLabel("data_type_", "Reco MC");
argset_->setCatLabel("data_type", "Reco MC");
}

// Check if we have a degenerate tag
// Check denominator level first
if (penult_cutlevel.t0p1_pass && penult_cutlevel.t1p0_pass) {
// Then check numerator level
if (last_cutlevel.t0p1_pass && last_cutlevel.t1p0_pass) {
argset_->setCatLabel("degenerate_", "Degenerate Denominator and numerator");
argset_->setCatLabel("degenerate", "Degenerate Denominator and numerator");
} else {
argset_->setCatLabel("degenerate_", "Degenerate Denominator");
argset_->setCatLabel("degenerate", "Degenerate Denominator");
}
} else {
argset_->setCatLabel("degenerate_", "False");
argset_->setCatLabel("degenerate", "False");
}

// Now we set the tag If it is degenerate in the numerator, we pick
Expand Down Expand Up @@ -163,9 +166,9 @@ namespace zf {
// Check if our event is in the numerator of the efficiency, or just
// the denominator
if (!last_cutlevel.pass && penult_cutlevel.pass) {
argset_->setCatLabel("numerator_", "False");
argset_->setCatLabel("numerator", "False");
} else {
argset_->setCatLabel("numerator_", "True");
argset_->setCatLabel("numerator", "True");
}

// Assign the correct electrons
Expand Down Expand Up @@ -204,18 +207,18 @@ namespace zf {
}

// Assign the variables
argset_->setRealValue("z_mass_", z_data->m);
argset_->setRealValue("z_eta_", z_data->eta);
argset_->setRealValue("z_y_", z_data->y);
argset_->setRealValue("z_pt_", z_data->pt);
argset_->setRealValue("phistar_", z_data->phistar);
argset_->setRealValue("e0_pt_", e_tag->pt);
argset_->setRealValue("e0_eta_", e_tag->eta);
argset_->setCatIndex("e0_charge_", e_tag->charge);
argset_->setRealValue("e1_pt_", e_probe->pt);
argset_->setRealValue("e1_eta_", e_probe->eta);
argset_->setCatIndex("e1_charge_", e_probe->charge);
argset_->setRealValue("n_vert_", verts);
argset_->setRealValue("z_mass", z_data->m);
argset_->setRealValue("z_eta", z_data->eta);
argset_->setRealValue("z_y", z_data->y);
argset_->setRealValue("z_pt", z_data->pt);
argset_->setRealValue("phistar", z_data->phistar);
argset_->setRealValue("e0_pt", e_tag->pt);
argset_->setRealValue("e0_eta", e_tag->eta);
argset_->setCatIndex("e0_charge", e_tag->charge);
argset_->setRealValue("e1_pt", e_probe->pt);
argset_->setRealValue("e1_eta", e_probe->eta);
argset_->setCatIndex("e1_charge", e_probe->charge);
argset_->setRealValue("n_vert", verts);

// We set the weight to be equal to the weight of the last cut level.
double weight = 1.;
Expand Down

0 comments on commit 2b5ab89

Please sign in to comment.