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 private:
36  FWTrackProxyBuilder(const FWTrackProxyBuilder&) = delete; // stop default
37 
38  const FWTrackProxyBuilder& operator=(const FWTrackProxyBuilder&) = delete; // stop default
39 
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 //
const fireworks::Context & context() const
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
static const int kAllRPZBits
Definition: FWViewType.h:67
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:139
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:62
TEveTrackPropagator * getTrackerTrackPropagator() const
Definition: Context.h:63
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
TEveTrackPropagator * getTrackPropagator() const
Definition: Context.h:62
bool isAvailable() const
Definition: Ref.h:537
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:68
double estimate_field(const reco::Track &track, bool highQuality=false)
const FWTrackProxyBuilder & operator=(const FWTrackProxyBuilder &)=delete
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:617
FWMagField * getField() const
Definition: Context.h:66
void guessField(float estimate) const
Definition: FWMagField.cc:129
virtual void setItem(const FWEventItem *iItem)
double pt() const
track transverse momentum
Definition: TrackBase.h:602
constexpr unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
FWGenericParameter< T > * assertParam(const std::string &name, T def)
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
void setItem(const FWEventItem *iItem) override