Skip to content

Commit

Permalink
Catch missing constituent exception.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja committed Jul 22, 2015
1 parent 60b4997 commit 2e07504
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions Fireworks/ParticleFlow/plugins/FWPFPatJet3DProxyBuilder.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "FWPFPatJet3DProxyBuilder.h"
#include "Fireworks/Core/interface/fwLog.h"

//______________________________________________________________________________
template<class T> FWPFPatJet3DProxyBuilder<T>::FWPFPatJet3DProxyBuilder(){}
Expand All @@ -8,27 +9,31 @@ template<class T> FWPFPatJet3DProxyBuilder<T>::~FWPFPatJet3DProxyBuilder(){}
template<class T> void
FWPFPatJet3DProxyBuilder<T>::build(const T& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*)
{
std::vector<reco::PFCandidatePtr> consts = iData.getPFConstituents();
try {
std::vector<reco::PFCandidatePtr> consts = iData.getPFConstituents();
typedef std::vector<reco::PFCandidatePtr>::const_iterator IC;

typedef std::vector<reco::PFCandidatePtr>::const_iterator IC;
for( IC ic = consts.begin(); // If consts has no constituents then the loop simply won't execute
ic != consts.end(); ic++ ) // and so no segmentation fault should occur
{
const reco::PFCandidatePtr pfCandPtr = *ic;

for( IC ic = consts.begin(); // If consts has no constituents then the loop simply won't execute
ic != consts.end(); ic++ ) // and so no segmentation fault should occur
{
const reco::PFCandidatePtr pfCandPtr = *ic;
TEveRecTrack t;
t.fBeta = 1;
t.fP = TEveVector( pfCandPtr->px(), pfCandPtr->py(), pfCandPtr->pz() );
t.fV = TEveVector( pfCandPtr->vertex().x(), pfCandPtr->vertex().y(), pfCandPtr->vertex().z() );
t.fSign = pfCandPtr->charge();
TEveTrack* trk = new TEveTrack(&t, FWProxyBuilderBase::context().getTrackPropagator());
trk->MakeTrack();
trk->SetLineWidth(3);

TEveRecTrack t;
t.fBeta = 1;
t.fP = TEveVector( pfCandPtr->px(), pfCandPtr->py(), pfCandPtr->pz() );
t.fV = TEveVector( pfCandPtr->vertex().x(), pfCandPtr->vertex().y(), pfCandPtr->vertex().z() );
t.fSign = pfCandPtr->charge();
TEveTrack* trk = new TEveTrack(&t, FWProxyBuilderBase::context().getTrackPropagator());
trk->MakeTrack();
trk->SetLineWidth(3);
fireworks::setTrackTypePF( *pfCandPtr, trk );

fireworks::setTrackTypePF( *pfCandPtr, trk );

FWProxyBuilderBase::setupAddElement( trk, &oItemHolder );
FWProxyBuilderBase::setupAddElement( trk, &oItemHolder );
}
}
catch (cms::Exception& iException) {
fwLog(fwlog::kError) << "FWPFPatJet3DProxyBuilder::build() Caught exception " << iException.what() << std::endl;
}

}
Expand Down

0 comments on commit 2e07504

Please sign in to comment.