CMS 3D CMS Logo

Public Member Functions | Private Member Functions

FWTrackingParticleProxyBuilder Class Reference

Inheritance diagram for FWTrackingParticleProxyBuilder:
FWSimpleProxyBuilderTemplate< TrackingParticle > FWSimpleProxyBuilder FWProxyBuilderBase

List of all members.

Public Member Functions

 FWTrackingParticleProxyBuilder (void)
 REGISTER_PROXYBUILDER_METHODS ()
virtual ~FWTrackingParticleProxyBuilder (void)

Private Member Functions

void build (const TrackingParticle &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *)
 FWTrackingParticleProxyBuilder (const FWTrackingParticleProxyBuilder &)
const
FWTrackingParticleProxyBuilder
operator= (const FWTrackingParticleProxyBuilder &)

Detailed Description

Definition at line 17 of file FWTrackingParticleProxyBuilder.cc.


Constructor & Destructor Documentation

FWTrackingParticleProxyBuilder::FWTrackingParticleProxyBuilder ( void  ) [inline]

Definition at line 20 of file FWTrackingParticleProxyBuilder.cc.

{} 
virtual FWTrackingParticleProxyBuilder::~FWTrackingParticleProxyBuilder ( void  ) [inline, virtual]

Definition at line 21 of file FWTrackingParticleProxyBuilder.cc.

{}
FWTrackingParticleProxyBuilder::FWTrackingParticleProxyBuilder ( const FWTrackingParticleProxyBuilder ) [private]

Member Function Documentation

void FWTrackingParticleProxyBuilder::build ( const TrackingParticle iData,
unsigned int  iIndex,
TEveElement &  oItemHolder,
const FWViewContext  
) [private, virtual]

iIndex is the index where iData is found in the container from which it came iItemHolder is the object to which you add your own objects which inherit from TEveElement

Reimplemented from FWSimpleProxyBuilderTemplate< TrackingParticle >.

Definition at line 35 of file FWTrackingParticleProxyBuilder.cc.

References ParticleBase::charge(), FWProxyBuilderBase::context(), PSimHit::detUnitId(), end, relativeConstraints::geom, FWEventItem::getGeom(), FWProxyBuilderBase::item(), PSimHit::localPosition(), FWGeometry::localToGlobal(), PSimHit::momentumAtEntry(), ParticleBase::px(), ParticleBase::py(), ParticleBase::pz(), FWProxyBuilderBase::setupAddElement(), matplotRender::t, ExpressReco_HICollisions_FallBack::track, PSimHit::trackId(), TrackingParticle::trackPSimHit(), ParticleBase::vx(), ParticleBase::vy(), ParticleBase::vz(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

{
   TEveRecTrack t;
   t.fBeta = 1.0;
   t.fP = TEveVector( iData.px(), iData.py(), iData.pz() );
   t.fV = TEveVector( iData.vx(), iData.vy(), iData.vz() );
   t.fSign = iData.charge();
  
   TEveTrack* track = new TEveTrack(&t, context().getTrackPropagator());
   if( t.fSign == 0 )
      track->SetLineStyle( 7 );
   
   TEvePointSet* pointSet = new TEvePointSet;
   setupAddElement( pointSet, track );
   const FWGeometry *geom = item()->getGeom();
   const std::vector<PSimHit>& hits = iData.trackPSimHit();

   float local[3];
   float localDir[3];
   float global[3] = { 0.0, 0.0, 0.0 };
   float globalDir[3] = { 0.0, 0.0, 0.0 };
   std::vector<PSimHit>::const_iterator it = hits.begin();
   std::vector<PSimHit>::const_iterator end = hits.end();
   if( it != end )
   {
      unsigned int trackid = hits.begin()->trackId();

      for( ; it != end; ++it )
      {
         const PSimHit& phit = (*it);
         if( phit.trackId() != trackid )
         {
            trackid = phit.trackId();
            track->AddPathMark( TEvePathMark( TEvePathMark::kDecay, TEveVector( global[0], global[1], global[2] ),
                                              TEveVector( globalDir[0], globalDir[1], globalDir[2] )));
         }
         local[0] = phit.localPosition().x();
         local[1] = phit.localPosition().y();
         local[2] = phit.localPosition().z();
         localDir[0] = phit.momentumAtEntry().x();
         localDir[1] = phit.momentumAtEntry().y();
         localDir[2] = phit.momentumAtEntry().z();
         geom->localToGlobal( phit.detUnitId(), local, global );
         geom->localToGlobal( phit.detUnitId(), localDir, globalDir );
         pointSet->SetNextPoint( global[0], global[1], global[2] );
         track->AddPathMark( TEvePathMark( TEvePathMark::kReference/*kDaughter*/, TEveVector( global[0], global[1], global[2] ),
                                           TEveVector( globalDir[0], globalDir[1], globalDir[2] )));
      }
      if( hits.size() > 1 )
         track->AddPathMark( TEvePathMark( TEvePathMark::kDecay, TEveVector( global[0], global[1], global[2] ),
                                           TEveVector( globalDir[0], globalDir[1], globalDir[2] )));
   }
   
   track->MakeTrack();
   setupAddElement( track, &oItemHolder );
}
const FWTrackingParticleProxyBuilder& FWTrackingParticleProxyBuilder::operator= ( const FWTrackingParticleProxyBuilder ) [private]
FWTrackingParticleProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )