CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules 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 class FWCandidateProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Candidate> {
26 public:
29 
30  void setItem(const FWEventItem* iItem) override {
32  if (iItem) {
33  iItem->getConfig()->assertParam("Draw backward extrapolation", false);
34  }
35  }
36 
38 
39  FWCandidateProxyBuilder(const FWCandidateProxyBuilder&) = delete; // stop default
40  const FWCandidateProxyBuilder& operator=(const FWCandidateProxyBuilder&) = delete; // stop default
41 
42 private:
44  void build(const reco::Candidate& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override;
45 };
46 
48  unsigned int iIndex,
49  TEveElement& oItemHolder,
50  const FWViewContext*) {
51  TEveTrack* trk = fireworks::prepareCandidate(iData, context().getTrackPropagator());
52 
53  trk->MakeTrack();
54  setupAddElement(trk, &oItemHolder);
55 
56  if (item()->getConfig()->value<bool>("Draw backward extrapolation")) {
57  TEveRecTrack t;
58  t.fBeta = 1.;
59  t.fV = TEveVector(iData.vx(), iData.vy(), iData.vz());
60  t.fP = TEveVector(-iData.p4().px(), -iData.p4().py(), -iData.p4().pz());
61  t.fSign = iData.charge();
62  TEveTrack* trk2 = new TEveTrack(&t, context().getTrackPropagator());
63  trk2->SetLineStyle(7);
64  trk2->MakeTrack();
65  setupAddElement(trk2, &oItemHolder);
66  }
67 }
68 
69 //
70 // static member functions
71 //
74  "Candidates",
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:67
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
virtual double vx() const =0
x coordinate of vertex position
const FWCandidateProxyBuilder & operator=(const FWCandidateProxyBuilder &)=delete
static const int kAll3DBits
Definition: FWViewType.h:68
virtual double vy() const =0
y coordinate of vertex position
const fireworks::Context & context() const
virtual void setItem(const FWEventItem *iItem)
virtual int charge() const =0
electric charge
FWGenericParameter< T > * assertParam(const std::string &name, T def)
virtual double vz() const =0
z coordinate of vertex position
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
void setItem(const FWEventItem *iItem) override
const FWEventItem * item() const
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector