CMS 3D CMS Logo

FWElectronLegoProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Muons
4 // Class : FWElectronLegoProxyBuilder
5 //
6 //
7 
8 #include "TEveStraightLineSet.h"
9 #include "TEveTrack.h"
10 
13 
16 
19 
20 class FWElectronLegoProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::GsfElectron>
21 {
22 public:
25 
27 
28 private:
31 
33  void build(const reco::GsfElectron& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override;
34 };
35 
36 void FWElectronLegoProxyBuilder::build(const reco::GsfElectron& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*)
37 {
38  TEveStraightLineSet *marker = new TEveStraightLineSet("marker");
39  setupAddElement(marker, &oItemHolder);
40 
41  TEveTrack* track(nullptr);
42 
43  if( iData.gsfTrack().isAvailable() )
45  else
46  track = fireworks::prepareCandidate(iData, context().getTrackPropagator());
47 
48  track->MakeTrack();
49  const double delta = 0.1;
50  marker->AddLine(track->GetEndMomentum().Eta()-delta, track->GetEndMomentum().Phi()-delta, 0.1,
51  track->GetEndMomentum().Eta()+delta, track->GetEndMomentum().Phi()+delta, 0.1);
52  marker->AddLine(track->GetEndMomentum().Eta()-delta, track->GetEndMomentum().Phi()+delta, 0.1,
53  track->GetEndMomentum().Eta()+delta, track->GetEndMomentum().Phi()-delta, 0.1);
54  marker->AddLine(track->GetEndMomentum().Eta(), track->GetEndMomentum().Phi()-delta, 0.1,
55  track->GetEndMomentum().Eta(), track->GetEndMomentum().Phi()+delta, 0.1);
56  marker->AddLine(track->GetEndMomentum().Eta()-delta, track->GetEndMomentum().Phi(), 0.1,
57  track->GetEndMomentum().Eta()+delta, track->GetEndMomentum().Phi(), 0.1);
58 }
59 
dbl * delta
Definition: mlp_gen.cc:36
bool isAvailable() const
Definition: Ref.h:577
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:185
const fireworks::Context & context() const
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:69
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
TEveTrackPropagator * getTrackPropagator() const
Definition: Context.h:73
static const int kAllLegoBits
Definition: FWViewType.h:60
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
const FWElectronLegoProxyBuilder & operator=(const FWElectronLegoProxyBuilder &)=delete