Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-05 22:48:11

0001 // -*- C++ -*-
0002 //
0003 // Package:     ParticleFlow
0004 // Class  :     FWCandidate3DProxyBuilder
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:  Colin Bernet
0010 //         Created:  Fri May 28 15:58:19 CEST 2010
0011 // Edited:           sharris, Wed 9 Feb 2011, 17:34
0012 //
0013 
0014 // System include files
0015 #include "TEveTrack.h"
0016 #include "TEveTrackPropagator.h"
0017 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h"
0018 
0019 // User include files
0020 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
0021 #include "Fireworks/Core/interface/FWEvePtr.h"
0022 #include "Fireworks/Core/interface/FWEventItem.h"
0023 #include "Fireworks/ParticleFlow/interface/setTrackTypePF.h"
0024 
0025 //-----------------------------------------------------------------------------
0026 // FWPFCandidate3DProxyBuilder
0027 //-----------------------------------------------------------------------------
0028 
0029 class FWPFCandidate3DProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::PFCandidate> {
0030 public:
0031   // ---------------- Constructor(s)/Destructor ----------------------
0032   FWPFCandidate3DProxyBuilder() {}
0033   ~FWPFCandidate3DProxyBuilder() override;
0034 
0035   REGISTER_PROXYBUILDER_METHODS();
0036 
0037   FWPFCandidate3DProxyBuilder(const FWPFCandidate3DProxyBuilder&) = delete;                   // Stop default
0038   const FWPFCandidate3DProxyBuilder& operator=(const FWPFCandidate3DProxyBuilder&) = delete;  // Stop default
0039 
0040 private:
0041   // --------------------- Member Functions --------------------------
0042   using FWSimpleProxyBuilderTemplate<reco::PFCandidate>::build;
0043   void build(const reco::PFCandidate& iData,
0044              unsigned int iIndex,
0045              TEveElement& oItemHolder,
0046              const FWViewContext*) override;
0047 };
0048 //=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_
0049 
0050 //______________________________________________________________________________
0051 FWPFCandidate3DProxyBuilder::~FWPFCandidate3DProxyBuilder() {}
0052 
0053 //______________________________________________________________________________
0054 void FWPFCandidate3DProxyBuilder::build(const reco::PFCandidate& iData,
0055                                         unsigned int iIndex,
0056                                         TEveElement& oItemHolder,
0057                                         const FWViewContext*) {
0058   TEveRecTrack t;
0059   t.fBeta = 1.;
0060   t.fP = TEveVector(iData.px(), iData.py(), iData.pz());
0061   t.fV = TEveVector(iData.vertex().x(), iData.vertex().y(), iData.vertex().z());
0062   t.fSign = iData.charge();
0063   TEveTrack* trk = new TEveTrack(&t, context().getTrackPropagator());
0064 
0065   trk->MakeTrack();
0066 
0067   fireworks::setTrackTypePF(iData, trk);
0068   setupAddElement(trk, &oItemHolder);
0069 }
0070 
0071 //______________________________________________________________________________
0072 REGISTER_FWPROXYBUILDER(FWPFCandidate3DProxyBuilder,
0073                         reco::PFCandidate,
0074                         "PF Candidates",
0075                         FWViewType::kAll3DBits | FWViewType::kAllRPZBits);