CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
32  virtual void build(const reco::GsfElectron& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override;
33 };
34 
35 void FWElectronLegoProxyBuilder::build(const reco::GsfElectron& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*)
36 {
37  TEveStraightLineSet *marker = new TEveStraightLineSet("marker");
38  setupAddElement(marker, &oItemHolder);
39 
40  TEveTrack* track(0);
41 
42  if( iData.gsfTrack().isAvailable() )
44  else
45  track = fireworks::prepareCandidate(iData, context().getTrackPropagator());
46 
47  track->MakeTrack();
48  const double delta = 0.1;
49  marker->AddLine(track->GetEndMomentum().Eta()-delta, track->GetEndMomentum().Phi()-delta, 0.1,
50  track->GetEndMomentum().Eta()+delta, track->GetEndMomentum().Phi()+delta, 0.1);
51  marker->AddLine(track->GetEndMomentum().Eta()-delta, track->GetEndMomentum().Phi()+delta, 0.1,
52  track->GetEndMomentum().Eta()+delta, track->GetEndMomentum().Phi()-delta, 0.1);
53  marker->AddLine(track->GetEndMomentum().Eta(), track->GetEndMomentum().Phi()-delta, 0.1,
54  track->GetEndMomentum().Eta(), track->GetEndMomentum().Phi()+delta, 0.1);
55  marker->AddLine(track->GetEndMomentum().Eta()-delta, track->GetEndMomentum().Phi(), 0.1,
56  track->GetEndMomentum().Eta()+delta, track->GetEndMomentum().Phi(), 0.1);
57 }
58 
dbl * delta
Definition: mlp_gen.cc:36
const fireworks::Context & context() const
#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
bool isAvailable() const
Definition: Ref.h:276
TEveTrackPropagator * getTrackPropagator() const
Definition: Context.h:73
const FWElectronLegoProxyBuilder & operator=(const FWElectronLegoProxyBuilder &)
static const int kAllLegoBits
Definition: FWViewType.h:60
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
virtual GsfTrackRef gsfTrack() const
reference to a GsfTrack
Definition: GsfElectron.h:169