Skip to content

Commit

Permalink
Protect against MC events without weight
Browse files Browse the repository at this point in the history
  • Loading branch information
Sébastien Brochet committed May 18, 2016
1 parent f686c45 commit f37f6a9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/EventProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ void EventProducer::beginRun(const edm::Run& iRun, const edm::EventSetup& eventS
std::cout << "Number of scales variation weights: " << m_scale_variations_matching.size() << std::endl;
#endif

if (!m_scale_variations_matching.empty() && m_scale_variations_matching.size() != 6) {
std::cout << "\033[0;31m" << "Warning: invalid number of scale variation (6 was expected, only " << m_scale_variations_matching.size() << " found)." << "\033[0m" << std::endl;
}

break;
}

Expand Down Expand Up @@ -298,6 +302,16 @@ void EventProducer::produce(edm::Event& event_, const edm::EventSetup& eventSetu
ht += std::sqrt(lhe_particles[iparticle][0]*lhe_particles[iparticle][0] + lhe_particles[iparticle][1]*lhe_particles[iparticle][1]);
}

// Handle PDF & scale weights

// No weight on some events...
if (lhe_info->weights().empty()) {
std::cout << "Warning: no weight for this event." << std::endl;
// Set scale weights to 1. PDF weights are already set to 1 by default
scale_weights.resize(6, 1);
goto end;
}

if (isLO && !scalup_decision_taken) {
scalup_decision_taken = true;

Expand Down

0 comments on commit f37f6a9

Please sign in to comment.