CMS 3D CMS Logo

FWTracksModulesProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: FWTracksModulesProxyBuilder.cc,v 1.1 2009/01/16 10:37:00 Tom Danielson
3 //
4 
5 // user include files
6 #include "TEveGeoShape.h"
7 
12 
16 
18 
20 {
21 public:
23  ~FWTracksModulesProxyBuilder( void ) override {}
24 
26 
27  static bool representsSubPart( void );
28 private:
30  void build( const reco::Track& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* ) override;
31 
32  FWTracksModulesProxyBuilder( const FWTracksModulesProxyBuilder& ) = delete; // stop default
33  const FWTracksModulesProxyBuilder& operator=( const FWTracksModulesProxyBuilder& ) = delete; // stop default
34 };
35 
36 void
37 FWTracksModulesProxyBuilder::build( const reco::Track& track, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* )
38 {
39  if( track.extra().isAvailable() )
40  {
41  const FWGeometry *geom = item()->getGeom();
42 
43  for( trackingRecHit_iterator recIt = track.recHitsBegin(), recItEnd = track.recHitsEnd();
44  recIt != recItEnd; ++recIt )
45  {
46  DetId detid = ( *recIt )->geographicalId();
47  if(( *recIt )->isValid())
48  {
49  if( detid.det() == DetId::Muon )
50  {
51  if( detid.subdetId() == MuonSubdetId::DT )
52  detid = DetId( DTChamberId( detid )); // get rid of layer bits
53  }
54 
55  TEveGeoShape* shape = geom->getEveShape( detid );
56  if( shape )
57  {
58  setupAddElement( shape, &oItemHolder );
59  }
60  else
61  {
63  << "Failed to get shape extract for track-id " << iIndex << ", tracking rec hit: "
64  << "\n" << fireworks::info( detid ) << std::endl;
65  }
66  }
67  }
68  }
69 }
70 
71 bool
73 {
74  return true;
75 }
76 
bool isAvailable() const
Definition: Ref.h:577
#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
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:59
const FWTracksModulesProxyBuilder & operator=(const FWTracksModulesProxyBuilder &)=delete
TEveGeoShape * getEveShape(unsigned int id) const
Definition: FWGeometry.cc:259
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
#define fwLog(_level_)
Definition: fwLog.h:50
std::string info(const DetId &)
Definition: TrackUtils.cc:663
static const int DT
Definition: MuonSubdetId.h:12
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:109