CMS 3D CMS Logo

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 private:
40  FWCandidateProxyBuilder(const FWCandidateProxyBuilder&) = delete; // stop default
41  const FWCandidateProxyBuilder& operator=(const FWCandidateProxyBuilder&) = delete; // stop default
42 
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",
FWSimpleProxyBuilderTemplate.h
FWEventItem::getConfig
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
FWCandidateProxyBuilder::operator=
const FWCandidateProxyBuilder & operator=(const FWCandidateProxyBuilder &)=delete
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:28
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
reco::Candidate::vx
virtual double vx() const =0
x coordinate of vertex position
reco::Candidate::vy
virtual double vy() const =0
y coordinate of vertex position
reco::Candidate::charge
virtual int charge() const =0
electric charge
FWCandidateProxyBuilder
Definition: FWCandidateProxyBuilder.cc:25
OrderedSet.t
t
Definition: OrderedSet.py:90
FWProxyBuilderConfiguration::assertParam
FWGenericParameter< T > * assertParam(const std::string &name, T def)
Definition: FWProxyBuilderConfiguration.cc:83
FWCandidateProxyBuilder::FWCandidateProxyBuilder
FWCandidateProxyBuilder()
Definition: FWCandidateProxyBuilder.cc:27
FWProxyBuilderConfiguration.h
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
reco::Candidate
Definition: Candidate.h:27
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
CandidateUtils.h
FWEventItem
Definition: FWEventItem.h:56
fireworks::prepareCandidate
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
Definition: CandidateUtils.cc:9
reco::Candidate::vz
virtual double vz() const =0
z coordinate of vertex position
reco::Candidate::p4
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition: FWProxyBuilderBase.cc:412
FWCandidateProxyBuilder::~FWCandidateProxyBuilder
~FWCandidateProxyBuilder() override
Definition: FWCandidateProxyBuilder.cc:28
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
Candidate.h
FWProxyBuilderBase::setItem
virtual void setItem(const FWEventItem *iItem)
Definition: FWProxyBuilderBase.cc:83
Context.h
FWCandidateProxyBuilder::setItem
void setItem(const FWEventItem *iItem) override
Definition: FWCandidateProxyBuilder.cc:30