test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWCandidateProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Candidates
4 // Class : FWCandidateProxyBuilder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Fri Dec 5 09:56:09 EST 2008
11 //
12 
13 #include "TEveTrack.h"
14 
15 // user include files
18 
20 
24 
25 
26 class FWCandidateProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Candidate> {
27 
28 public:
31 
32  virtual void setItem(const FWEventItem* iItem) override
33  {
35  if (iItem)
36  {
37  iItem->getConfig()->assertParam("Draw backward extrapolation", false);
38  }
39  }
40 
42 
43 private:
44  FWCandidateProxyBuilder(const FWCandidateProxyBuilder&); // stop default
45  const FWCandidateProxyBuilder& operator=(const FWCandidateProxyBuilder&); // stop default
46 
48  void build(const reco::Candidate& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override;
49 };
50 
51 
52 void
53 FWCandidateProxyBuilder::build(const reco::Candidate& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*)
54 {
55  TEveTrack* trk = fireworks::prepareCandidate( iData, context().getTrackPropagator() );
56 
57  trk->MakeTrack();
58  setupAddElement(trk, &oItemHolder);
59 
60  if ( item()->getConfig()->value<bool>("Draw backward extrapolation"))
61  {
62  TEveRecTrack t;
63  t.fBeta = 1.;
64  t.fV = TEveVector(iData.vx(),iData.vy(),iData.vz());
65  t.fP = TEveVector(-iData.p4().px(), -iData.p4().py(), -iData.p4().pz());
66  t.fSign = iData.charge();
67  TEveTrack* trk2= new TEveTrack(&t, context().getTrackPropagator());
68  trk2->SetLineStyle(7);
69  trk2->MakeTrack();
70  setupAddElement(trk2, &oItemHolder);
71 
72  }
73 
74 }
75 
76 //
77 // static member functions
78 //
const FWCandidateProxyBuilder & operator=(const FWCandidateProxyBuilder &)
const fireworks::Context & context() const
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:168
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:58
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
virtual double vx() const =0
x coordinate of vertex position
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:59
virtual double vy() const =0
y coordinate of vertex position
virtual void setItem(const FWEventItem *iItem)
virtual int charge() const =0
electric charge
FWGenericParameter< T > * assertParam(const std::string &name, T def)
virtual void setItem(const FWEventItem *iItem) override
virtual double vz() const =0
z coordinate of vertex position
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector