Skip to content

Commit

Permalink
Merge pull request #13152 from slava77/CMSSW_8_0_0_pre5/sign664/hiJet…
Browse files Browse the repository at this point in the history
…ProducerCrash
  • Loading branch information
cmsbuild committed Feb 2, 2016
2 parents 2c39840 + afbee9b commit df7c1a6
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions RecoJets/JetProducers/plugins/VirtualJetProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -618,16 +618,21 @@ void VirtualJetProducer::writeJets( edm::Event & iEvent, edm::EventSetup const&
fastjet::ClusterSequenceAreaBase const* clusterSequenceWithArea =
dynamic_cast<fastjet::ClusterSequenceAreaBase const *> ( &*fjClusterSeq_ );


for(int ie = 0; ie < nEta; ++ie){
double eta = puCenters_[ie];
double etamin=eta-puWidth_;
double etamax=eta+puWidth_;
fastjet::RangeDefinition range_rho(etamin,etamax);
fastjet::BackgroundEstimator bkgestim(*clusterSequenceWithArea,range_rho);
bkgestim.set_excluded_jets(fjexcluded_jets);
rhos->push_back(bkgestim.rho());
sigmas->push_back(bkgestim.sigma());
if (clusterSequenceWithArea ==nullptr ){
if (fjJets_.size() > 0) {
throw cms::Exception("LogicError")<<"fjClusterSeq is not initialized while inputs are present\n ";
}
} else {
for(int ie = 0; ie < nEta; ++ie){
double eta = puCenters_[ie];
double etamin=eta-puWidth_;
double etamax=eta+puWidth_;
fastjet::RangeDefinition range_rho(etamin,etamax);
fastjet::BackgroundEstimator bkgestim(*clusterSequenceWithArea,range_rho);
bkgestim.set_excluded_jets(fjexcluded_jets);
rhos->push_back(bkgestim.rho());
sigmas->push_back(bkgestim.sigma());
}
}
iEvent.put(rhos,"rhos");
iEvent.put(sigmas,"sigmas");
Expand All @@ -644,11 +649,17 @@ void VirtualJetProducer::writeJets( edm::Event & iEvent, edm::EventSetup const&
edm::LogWarning("StrangeNEmtpyJets") << "n_empty_jets is : " << clusterSequenceWithArea->n_empty_jets(*fjRangeDef_) << " with range " << fjRangeDef_->description() << ".";
}
*/
clusterSequenceWithArea->get_median_rho_and_sigma(*fjRangeDef_,false,*rho,*sigma,mean_area);
if((*rho < 0)|| (edm::isNotFinite(*rho))) {
edm::LogError("BadRho") << "rho value is " << *rho << " area:" << mean_area << " and n_empty_jets: " << clusterSequenceWithArea->n_empty_jets(*fjRangeDef_) << " with range " << fjRangeDef_->description()
<<". Setting rho to rezo.";
*rho = 0;
if (clusterSequenceWithArea ==nullptr ){
if (fjJets_.size() > 0) {
throw cms::Exception("LogicError")<<"fjClusterSeq is not initialized while inputs are present\n ";
}
} else {
clusterSequenceWithArea->get_median_rho_and_sigma(*fjRangeDef_,false,*rho,*sigma,mean_area);
if((*rho < 0)|| (edm::isNotFinite(*rho))) {
edm::LogError("BadRho") << "rho value is " << *rho << " area:" << mean_area << " and n_empty_jets: " << clusterSequenceWithArea->n_empty_jets(*fjRangeDef_) << " with range " << fjRangeDef_->description()
<<". Setting rho to rezo.";
*rho = 0;
}
}
iEvent.put(rho,"rho");
iEvent.put(sigma,"sigma");
Expand Down

0 comments on commit df7c1a6

Please sign in to comment.