CMS 3D CMS Logo

FWTrackProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Tracks
4 // Class : FWTrackProxyBuilder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Nov 25 14:42:13 EST 2008
11 //
12 
13 // system include files
14 #include "TEveTrack.h"
15 
16 // user include files
23 
25 
27 public:
29  ~FWTrackProxyBuilder() override;
30 
32 
33  void setItem(const FWEventItem* iItem) override;
34 
35  FWTrackProxyBuilder(const FWTrackProxyBuilder&) = delete; // stop default
36 
37  const FWTrackProxyBuilder& operator=(const FWTrackProxyBuilder&) = delete; // stop default
38 
39 private:
41  void build(const reco::Track& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override;
42 };
43 
45 
47 
50 
51  if (iItem) {
52  iItem->getConfig()->assertParam("LineWidth", long(1), long(1), long(4));
53  }
54 }
55 
57  unsigned int iIndex,
58  TEveElement& oItemHolder,
59  const FWViewContext*) {
60  if (context().getField()->getSource() == FWMagField::kNone) {
61  if (fabs(iData.eta()) < 2.0 && iData.pt() > 0.5 && iData.pt() < 30) {
62  double estimate = fw::estimate_field(iData, true);
63  if (estimate >= 0)
64  context().getField()->guessField(estimate);
65  }
66  }
67 
68  TEveTrackPropagator* propagator =
70 
71  TEveTrack* trk = fireworks::prepareTrack(iData, propagator);
72  trk->MakeTrack();
73 
74  // Line width can be cached as a member. Set in virtual builder::itemChanged()
75  int width = item()->getConfig()->value<long>("LineWidth");
76  trk->SetLineWidth(width);
77 
78  setupAddElement(trk, &oItemHolder);
79 }
80 
81 //
82 // static member functions
83 //
#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
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
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
static const int kAll3DBits
Definition: FWViewType.h:68
const fireworks::Context & context() const
double estimate_field(const reco::Track &track, bool highQuality=false)
double pt() const
track transverse momentum
Definition: TrackBase.h:637
const FWTrackProxyBuilder & operator=(const FWTrackProxyBuilder &)=delete
virtual void setItem(const FWEventItem *iItem)
TEveTrackPropagator * getTrackerTrackPropagator() const
Definition: Context.h:63
bool isAvailable() const
Definition: Ref.h:541
constexpr unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
FWGenericParameter< T > * assertParam(const std::string &name, T def)
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:652
void guessField(float estimate) const
Definition: FWMagField.cc:129
void setItem(const FWEventItem *iItem) override
const FWEventItem * item() const
FWMagField * getField() const
Definition: Context.h:66
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:139