Validation/MtdValidation/plugins/Primary4DVertexHarvester.cc
// auxiliary method to compute efficiency from the ratio of two 1D MonitorElement
auxiliary method to compute efficiency from the ratio of two 1D MonitorElement
auxiliary method to compute efficiency from the ratio of two 1D MonitorElement
void Primary4DVertexHarvester::computeEfficiency1D(MonitorElement* num, MonitorElement* den, MonitorElement* result) {
  for (int ibin = 1; ibin <= den->getNbinsX(); ibin++) {
    double eff = num->getBinContent(ibin) / den->getBinContent(ibin);
    double bin_err = sqrt((num->getBinContent(ibin) * (den->getBinContent(ibin) - num->getBinContent(ibin))) /
                          pow(den->getBinContent(ibin), 3));
    if (den->getBinContent(ibin) == 0) {
      eff = 0;
      bin_err = 0;
    }
    result->setBinContent(ibin, eff);
    result->setBinError(ibin, bin_err);
  }
}
void Primary4DVertexHarvester :: computeEfficiency1D ( MonitorElement * num , MonitorElement * den , MonitorElement * result ) { for ( int ibin = 1 ; ibin <= den -> getNbinsX ( ) ; ibin ++ ) { double eff = num -> getBinContent ( ibin ) / den -> getBinContent ( ibin ) ; double bin_err = sqrt ( ( num -> getBinContent ( ibin ) * ( den -> getBinContent ( ibin ) - num -> getBinContent ( ibin ) ) ) / pow ( den -> getBinContent ( ibin ) , 3 ) ) ; if ( den -> getBinContent ( ibin ) == 0 ) { eff = 0 ; bin_err = 0 ; } result -> setBinContent ( ibin , eff ) ; result -> setBinError ( ibin , bin_err ) ; } }
auxiliary method to compute efficiency from the ratio of two 1D MonitorElement
auxiliary method to compute efficiency from the ratio of two 1D MonitorElement