CMS 3D CMS Logo

Public Member Functions | Private Member Functions

FWVertexProxyBuilder Class Reference

Inheritance diagram for FWVertexProxyBuilder:
FWSimpleProxyBuilderTemplate< reco::Vertex > FWSimpleProxyBuilder FWProxyBuilderBase

List of all members.

Public Member Functions

 FWVertexProxyBuilder ()
 REGISTER_PROXYBUILDER_METHODS ()
virtual void setItem (const FWEventItem *iItem)
virtual ~FWVertexProxyBuilder ()

Private Member Functions

virtual void build (const reco::Vertex &iData, unsigned int iIndex, TEveElement &oItemHolder, const FWViewContext *)
 FWVertexProxyBuilder (const FWVertexProxyBuilder &)
const FWVertexProxyBuilderoperator= (const FWVertexProxyBuilder &)

Detailed Description

Definition at line 34 of file FWVertexProxyBuilder.cc.


Constructor & Destructor Documentation

FWVertexProxyBuilder::FWVertexProxyBuilder ( ) [inline]

Definition at line 37 of file FWVertexProxyBuilder.cc.

{}
virtual FWVertexProxyBuilder::~FWVertexProxyBuilder ( ) [inline, virtual]

Definition at line 38 of file FWVertexProxyBuilder.cc.

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

Member Function Documentation

void FWVertexProxyBuilder::build ( const reco::Vertex 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< reco::Vertex >.

Definition at line 59 of file FWVertexProxyBuilder.cc.

References reco::TrackBase::charge(), FWProxyBuilderBase::context(), reco::Vertex::error(), i, FWProxyBuilderBase::item(), j, m, reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), mathSSE::sqrt(), matplotRender::t, reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), reco::Vertex::trackWeight(), v, reco::TrackBase::vx(), reco::TrackBase::vy(), reco::TrackBase::vz(), reco::Vertex::x(), reco::Vertex::y(), and reco::Vertex::z().

{
   const reco::Vertex & v = iData;

   TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
   TEvePointSet* pointSet = new TEvePointSet();
   pointSet->SetMainColor(item()->defaultDisplayProperties().color());
   pointSet->SetNextPoint( v.x(), v.y(), v.z() );
   oItemHolder.AddElement( pointSet );

   if ( item()->getConfig()->value<bool>("Draw Tracks")) 
   {
      // do we need this stuff?
      TGeoSphere * sphere = new TGeoSphere(0, 0.002); //would that leak?
      TEveGeoShape * shape = new TEveGeoShape();
      sphere->SetBoxDimensions(2.5,2.5,2.5);
      shape->SetShape(sphere);
      shape->SetMainColor(item()->defaultDisplayProperties().color());
      shape->SetMainTransparency(10);

      TEveTrans & t =   shape->RefMainTrans();
      reco::Vertex::Error e= v.error();
      TMatrixDSym m(3);
      for(int i=0;i<3;i++)
         for(int j=0;j<3;j++)
         {
            m(i,j) = e(i,j);
         }
      TMatrixDEigen eig(m);
      TDecompSVD svd(m);
      TMatrixD mm = svd.GetU();
      //   TMatrixD mm =  eig.GetEigenVectors().Print();
      for(int i=0;i<3;i++)
         for(int j=0;j<3;j++)
         {
            t(i+1,j+1) = mm(i,j);
         }

      TVectorD vv ( eig.GetEigenValuesRe())   ;
      t.Scale(sqrt(vv(0))*1000.,sqrt(vv(1))*1000.,sqrt(vv(2))*1000.);
      t.SetPos(v.x(),v.y(),v.z());
      oItemHolder.AddElement(shape);
      for(reco::Vertex::trackRef_iterator it = v.tracks_begin() ;
          it != v.tracks_end()  ; ++it)
      {
         float w = v.trackWeight(*it);
         if (w < 0.5) continue;

         const reco::Track & track = *it->get();
         TEveRecTrack t;
         t.fBeta = 1.;
         t.fV = TEveVector(track.vx(), track.vy(), track.vz());
         t.fP = TEveVector(track.px(), track.py(), track.pz());
         t.fSign = track.charge();
         TEveTrack* trk = new TEveTrack(&t, context().getTrackPropagator());
         trk->SetMainColor(item()->defaultDisplayProperties().color());
         trk->MakeTrack();
         oItemHolder.AddElement( trk );
      }
   }
}
const FWVertexProxyBuilder& FWVertexProxyBuilder::operator= ( const FWVertexProxyBuilder ) [private]
FWVertexProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )
virtual void FWVertexProxyBuilder::setItem ( const FWEventItem iItem) [inline, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 40 of file FWVertexProxyBuilder.cc.

References FWProxyBuilderConfiguration::assertParam(), and FWEventItem::getConfig().

   {
      FWProxyBuilderBase::setItem(iItem);
      iItem->getConfig()->assertParam("Draw Tracks", false);
   }