CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/Fireworks/ParticleFlow/plugins/FWPFCandidate3DProxyBuilder.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     ParticleFlow
00004 // Class  :     FWCandidate3DProxyBuilder
00005 // 
00006 // Implementation:
00007 //     <Notes on implementation>
00008 //
00009 // Original Author:  Colin Bernet
00010 //         Created:  Fri May 28 15:58:19 CEST 2010
00011 // Edited:           sharris, Wed 9 Feb 2011, 17:34
00012 //
00013 
00014 // System include files
00015 #include "TEveTrack.h"
00016 #include "TEveTrackPropagator.h"
00017 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
00018 
00019 // User include files
00020 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
00021 #include "Fireworks/Core/interface/FWEvePtr.h"
00022 #include "Fireworks/Core/src/CmsShowMain.h"
00023 #include "Fireworks/Core/interface/FWEventItem.h"
00024 #include "Fireworks/ParticleFlow/interface/setTrackTypePF.h"
00025 
00026 //-----------------------------------------------------------------------------
00027 // FWPFCandidate3DProxyBuilder
00028 //-----------------------------------------------------------------------------
00029 
00030 class FWPFCandidate3DProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::PFCandidate>
00031 {
00032       
00033    public:
00034    // ---------------- Constructor(s)/Destructor ----------------------
00035       FWPFCandidate3DProxyBuilder() {}
00036       virtual ~FWPFCandidate3DProxyBuilder();
00037    
00038       REGISTER_PROXYBUILDER_METHODS();
00039 
00040    private:
00041       FWPFCandidate3DProxyBuilder( const FWPFCandidate3DProxyBuilder& );                    // Stop default
00042       const FWPFCandidate3DProxyBuilder& operator=( const FWPFCandidate3DProxyBuilder& );   // Stop default
00043 
00044    // --------------------- Member Functions --------------------------
00045       void build( const reco::PFCandidate& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* );
00046 
00047 };
00048 //=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_
00049 
00050 
00051 
00052 //______________________________________________________________________________
00053 FWPFCandidate3DProxyBuilder::~FWPFCandidate3DProxyBuilder(){}
00054 
00055 //______________________________________________________________________________
00056 void 
00057 FWPFCandidate3DProxyBuilder::build( const reco::PFCandidate& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* ) 
00058 {
00059   TEveRecTrack t;
00060   t.fBeta = 1.;
00061   t.fP = TEveVector( iData.px(), iData.py(), iData.pz() );
00062   t.fV = TEveVector( iData.vertex().x(), iData.vertex().y(), iData.vertex().z() );
00063   t.fSign = iData.charge();
00064   TEveTrack* trk = new TEveTrack(&t, context().getTrackPropagator() );
00065 
00066   trk->MakeTrack();
00067 
00068   fireworks::setTrackTypePF( iData, trk );
00069   setupAddElement( trk, &oItemHolder );
00070 }
00071 
00072 //______________________________________________________________________________
00073 REGISTER_FWPROXYBUILDER(FWPFCandidate3DProxyBuilder, reco::PFCandidate,"PF Candidates", FWViewType::kAll3DBits | FWViewType::kAllRPZBits );