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 public:
24 
26 
29 
30 private:
32  void build(const reco::GsfElectron& iData,
33  unsigned int iIndex,
34  TEveElement& oItemHolder,
35  const FWViewContext*) override;
36 };
37 
39  unsigned int iIndex,
40  TEveElement& oItemHolder,
41  const FWViewContext*) {
42  TEveStraightLineSet* marker = new TEveStraightLineSet("marker");
43  setupAddElement(marker, &oItemHolder);
44 
45  TEveTrack* track(nullptr);
46 
47  if (iData.gsfTrack().isAvailable())
49  else
50  track = fireworks::prepareCandidate(iData, context().getTrackPropagator());
51 
52  track->MakeTrack();
53  const double delta = 0.1;
54  marker->AddLine(track->GetEndMomentum().Eta() - delta,
55  track->GetEndMomentum().Phi() - delta,
56  0.1,
57  track->GetEndMomentum().Eta() + delta,
58  track->GetEndMomentum().Phi() + delta,
59  0.1);
60  marker->AddLine(track->GetEndMomentum().Eta() - delta,
61  track->GetEndMomentum().Phi() + delta,
62  0.1,
63  track->GetEndMomentum().Eta() + delta,
64  track->GetEndMomentum().Phi() - delta,
65  0.1);
66  marker->AddLine(track->GetEndMomentum().Eta(),
67  track->GetEndMomentum().Phi() - delta,
68  0.1,
69  track->GetEndMomentum().Eta(),
70  track->GetEndMomentum().Phi() + delta,
71  0.1);
72  marker->AddLine(track->GetEndMomentum().Eta() - delta,
73  track->GetEndMomentum().Phi(),
74  0.1,
75  track->GetEndMomentum().Eta() + delta,
76  track->GetEndMomentum().Phi(),
77  0.1);
78 }
79 
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
TEveTrackPropagator * getTrackPropagator() const
Definition: Context.h:62
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:62
const fireworks::Context & context() const
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
Definition: GsfElectron.h:156
bool isAvailable() const
Definition: Ref.h:537
static const int kAllLegoBits
Definition: FWViewType.h:69
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
const FWElectronLegoProxyBuilder & operator=(const FWElectronLegoProxyBuilder &)=delete