CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/Fireworks/Tracks/plugins/FWTracksRecHitsProxyBuilder.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // $Id: FWTracksRecHitsProxyBuilder.cc,v 1.1 2009/01/16 10:37:00 Tom Danielson
00003 //
00004 
00005 // user include files
00006 #include "TEveGeoShape.h"
00007 #include "TEvePointSet.h"
00008 
00009 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
00010 #include "Fireworks/Core/interface/FWGeometry.h"
00011 #include "Fireworks/Core/interface/FWEventItem.h"
00012 #include "Fireworks/Tracks/interface/TrackUtils.h"
00013 
00014 #include "DataFormats/TrackReco/interface/Track.h"
00015 
00016 #include "Fireworks/Core/interface/fwLog.h"
00017 
00018 class FWTracksRecHitsProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Track>
00019 {
00020 public:
00021    FWTracksRecHitsProxyBuilder( void ) {}
00022    virtual ~FWTracksRecHitsProxyBuilder( void ) {}
00023   
00024    REGISTER_PROXYBUILDER_METHODS();
00025   
00026    static bool representsSubPart( void );
00027    
00028 private:
00029    void build( const reco::Track& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* );
00030 
00031    FWTracksRecHitsProxyBuilder( const FWTracksRecHitsProxyBuilder& );    // stop default
00032    const FWTracksRecHitsProxyBuilder& operator=( const FWTracksRecHitsProxyBuilder& );    // stop default
00033 };
00034 
00035 void
00036 FWTracksRecHitsProxyBuilder::build( const reco::Track& track, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* ) 
00037 {
00038    if( track.extra().isAvailable() )
00039    {
00040       std::vector<TVector3> points;
00041       const FWEventItem &iItem = *item();
00042       fireworks::pushPixelHits( points, iItem, track );
00043     
00044       TEvePointSet* pointSet = new TEvePointSet();
00045       for( std::vector<TVector3>::const_iterator it = points.begin(), itEnd = points.end(); it != itEnd; ++it )
00046       {
00047          pointSet->SetNextPoint( it->x(), it->y(), it->z());
00048       }
00049       setupAddElement(pointSet, &oItemHolder);
00050       
00051       fireworks::addSiStripClusters( item(), track, &oItemHolder, false, true );
00052    }
00053 }
00054 
00055 bool
00056 FWTracksRecHitsProxyBuilder::representsSubPart( void )
00057 {
00058    return true;
00059 }
00060 
00061 REGISTER_FWPROXYBUILDER( FWTracksRecHitsProxyBuilder, reco::Track, "TrackHits", FWViewType::kAll3DBits | FWViewType::kAllRPZBits );