Skip to content

Commit

Permalink
Merge pull request #37185 from perrotta/fixGenWeightValidation
Browse files Browse the repository at this point in the history
Tighten check for the number of weights in GenWeightValidation
  • Loading branch information
cmsbuild authored Mar 10, 2022
2 parents c0513d4 + fffff2f commit 291fef2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Validation/EventGenerator/plugins/GenWeightValidation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,18 @@ void GenWeightValidation::dqmBeginRun(const edm::Run&, const edm::EventSetup&) {
void GenWeightValidation::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
weights_ = wmanager_.weightsCollection(iEvent);

if (weights_.at(idxGenEvtInfo_).empty())
return; // no weights in GenEventInfo
unsigned weightsSize = weights_.at(idxGenEvtInfo_).size();
if (weightsSize < 2)
return; // no baseline weight in GenEventInfo

weight_ = weights_.at(idxGenEvtInfo_)[0] / std::abs(weights_.at(idxGenEvtInfo_)[0]);
nEvt_->Fill(0.5, weight_);
nlogWgt_->Fill(std::log10(weights_.at(idxGenEvtInfo_).size()), weight_);
nlogWgt_->Fill(std::log10(weightsSize), weight_);

for (unsigned idx = 0; idx < weights_.at(idxGenEvtInfo_).size(); idx++)
for (unsigned idx = 0; idx < weightsSize; idx++)
wgtVal_->Fill(weights_.at(idxGenEvtInfo_)[idx] / weights_.at(idxGenEvtInfo_)[1], weight_);

if ((int)weights_.at(idxGenEvtInfo_).size() <= idxMax_)
if ((int)weightsSize <= idxMax_)
return; // no PS weights in GenEventInfo

edm::Handle<reco::GenParticleCollection> ptcls;
Expand Down

0 comments on commit 291fef2

Please sign in to comment.