CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/Fireworks/ParticleFlow/plugins/FWPFPatJet3DProxyBuilder.cc

Go to the documentation of this file.
00001 #include "FWPFPatJet3DProxyBuilder.h"
00002 
00003 //______________________________________________________________________________
00004 template<class T> FWPFPatJet3DProxyBuilder<T>::FWPFPatJet3DProxyBuilder(){}
00005 template<class T> FWPFPatJet3DProxyBuilder<T>::~FWPFPatJet3DProxyBuilder(){}
00006  
00007 //______________________________________________________________________________
00008 template<class T> void
00009 FWPFPatJet3DProxyBuilder<T>::build(const T& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*)
00010 {
00011    std::vector<reco::PFCandidatePtr> consts = iData.getPFConstituents();
00012 
00013    typedef std::vector<reco::PFCandidatePtr>::const_iterator IC;
00014 
00015    for( IC ic = consts.begin();   // If consts has no constituents then the loop simply won't execute
00016         ic != consts.end(); ic++ )   // and so no segmentation fault should occur
00017    {
00018       const reco::PFCandidatePtr pfCandPtr = *ic;
00019 
00020       TEveRecTrack t;
00021       t.fBeta = 1;
00022       t.fP = TEveVector( pfCandPtr->px(), pfCandPtr->py(), pfCandPtr->pz() );
00023       t.fV = TEveVector( pfCandPtr->vertex().x(), pfCandPtr->vertex().y(), pfCandPtr->vertex().z() );
00024       t.fSign = pfCandPtr->charge();
00025       TEveTrack* trk = new TEveTrack(&t, FWProxyBuilderBase::context().getTrackPropagator());
00026       trk->MakeTrack();
00027       trk->SetLineWidth(3);
00028 
00029       fireworks::setTrackTypePF( *pfCandPtr, trk );
00030 
00031       FWProxyBuilderBase::setupAddElement( trk, &oItemHolder );
00032    }
00033 
00034 }
00035 
00036 /* Classes have been created because 'concrete' types (i.e. reco::PFJet and not T) are required to register
00037 a proxy builder. Each class must first register it's methods so that REGISTER_FWPROXYBUILDER macro knows
00038 about them */
00039 //_____________________________PF_______________________________________________
00040 class FWPFJet3DProxyBuilder : public FWPFPatJet3DProxyBuilder<reco::PFJet> {
00041 public:
00042    FWPFJet3DProxyBuilder(){}
00043    virtual ~FWPFJet3DProxyBuilder(){}
00044 
00045    REGISTER_PROXYBUILDER_METHODS();
00046 };
00047 
00048 //_____________________________PAT______________________________________________
00049 class FWPatJet3DProxyBuilder : public FWPFPatJet3DProxyBuilder<pat::Jet> {
00050 public:
00051    FWPatJet3DProxyBuilder(){}
00052    virtual ~FWPatJet3DProxyBuilder(){}
00053 
00054    REGISTER_PROXYBUILDER_METHODS();   // Register methods ready for macro
00055 };
00056 
00057 //______________________________________________________________________________
00058 template class FWPFPatJet3DProxyBuilder<reco::PFJet>;
00059 template class FWPFPatJet3DProxyBuilder<pat::Jet>;
00060 
00061 //______________________________________________________________________________
00062 REGISTER_FWPROXYBUILDER(FWPFJet3DProxyBuilder, reco::PFJet, "PF Jet", FWViewType::kAll3DBits | FWViewType::kAllRPZBits );
00063 REGISTER_FWPROXYBUILDER(FWPatJet3DProxyBuilder, pat::Jet, "PF PatJet", FWViewType::kAll3DBits | FWViewType::kAllRPZBits );