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 
28 public:
30  virtual ~FWTrackProxyBuilder();
31 
33 
34  virtual void setItem(const FWEventItem* iItem) override;
35 private:
36  FWTrackProxyBuilder(const FWTrackProxyBuilder&); // stop default
37 
38  const FWTrackProxyBuilder& operator=(const FWTrackProxyBuilder&); // stop default
39 
41  void build(const reco::Track& iData, unsigned int iIndex,TEveElement& oItemHolder, const FWViewContext*) override;
42 };
43 
45 {
46 }
47 
49 {
50 }
51 
52 void
54 {
56 
57  if (iItem) {
58  iItem->getConfig()->assertParam("LineWidth", long(1), long(1), long(4));
59  }
60 }
61 
62 void
63 FWTrackProxyBuilder::build( const reco::Track& iData, unsigned int iIndex,TEveElement& oItemHolder , const FWViewContext*)
64 {
65  if( context().getField()->getSource() == FWMagField::kNone ) {
66  if( fabs( iData.eta() ) < 2.0 && iData.pt() > 0.5 && iData.pt() < 30 ) {
67  double estimate = fw::estimate_field( iData, true );
68  if( estimate >= 0 ) context().getField()->guessField( estimate );
69  }
70  }
71 
72  TEveTrackPropagator* propagator = ( !iData.extra().isAvailable() ) ? context().getTrackerTrackPropagator() : context().getTrackPropagator();
73 
74  TEveTrack* trk = fireworks::prepareTrack( iData, propagator );
75  trk->MakeTrack();
76 
77  // Line width can be cached as a member. Set in virtual builder::itemChanged()
78  int width = item()->getConfig()->value<long>("LineWidth");
79  trk->SetLineWidth(width);
80 
81  setupAddElement(trk, &oItemHolder);
82 }
83 
84 //
85 // static member functions
86 //
bool isAvailable() const
Definition: Ref.h:576
const fireworks::Context & context() const
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:170
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:58
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:189
unsigned getField(const uint32_t u, const unsigned mask, const unsigned offset)
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:69
TEveTrackPropagator * getTrackerTrackPropagator() const
Definition: Context.h:74
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
TEveTrackPropagator * getTrackPropagator() const
Definition: Context.h:73
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:59
double estimate_field(const reco::Track &track, bool highQuality=false)
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:646
FWMagField * getField() const
Definition: Context.h:77
void guessField(float estimate) const
Definition: FWMagField.cc:155
virtual void setItem(const FWEventItem *iItem)
double pt() const
track transverse momentum
Definition: TrackBase.h:616
FWGenericParameter< T > * assertParam(const std::string &name, T def)
const FWTrackProxyBuilder & operator=(const FWTrackProxyBuilder &)
virtual void setItem(const FWEventItem *iItem) override