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 &)
virtual void localModelChanges (const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
const FWVertexProxyBuilderoperator= (const FWVertexProxyBuilder &)

Detailed Description

Definition at line 39 of file FWVertexProxyBuilder.cc.


Constructor & Destructor Documentation

FWVertexProxyBuilder::FWVertexProxyBuilder ( ) [inline]

Definition at line 42 of file FWVertexProxyBuilder.cc.

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

Definition at line 43 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 73 of file FWVertexProxyBuilder.cc.

References reco::TrackBase::charge(), FWProxyBuilderBase::context(), alignCSCRings::e, reco::Vertex::error(), FWEventItem::getConfig(), i, FWProxyBuilderBase::item(), j, m, siStripFEDMonitor_P5_cff::Min, reco::Vertex::p4(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), TEveEllipsoid::RefEMtx(), TEveEllipsoid::RefExtent3D(), TEveEllipsoid::RefPos(), TEveEllipsoid::SetScale(), FWProxyBuilderBase::setupAddElement(), mathSSE::sqrt(), lumiQTWidget::t, reco::Vertex::tracks_begin(), reco::Vertex::tracks_end(), reco::Vertex::trackWeight(), v, FWProxyBuilderConfiguration::value(), reco::TrackBase::vx(), reco::TrackBase::vy(), reco::TrackBase::vz(), w(), reco::Vertex::x(), reco::Vertex::y(), and reco::Vertex::z().

{
   const reco::Vertex & v = iData;
  
   // marker
   TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
   TEvePointSet* pointSet = new TEvePointSet();
   pointSet->SetNextPoint( v.x(), v.y(), v.z() );  
   setupAddElement(pointSet, &oItemHolder);
  

   // ellipse
   if ( item()->getConfig()->value<bool>("Draw Ellipse"))
   {
    
      TEveEllipsoid* eveEllipsoid = new TEveEllipsoid("Ellipsoid", Form("Ellipsoid %d", iIndex)); 

      eveEllipsoid->RefPos().Set(v.x(),v.y(),v.z());

      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);
            eveEllipsoid->RefEMtx()(i+1, j+1) =  e(i,j);
         }

      // external scaling
      double ellipseScale = 1.;
      if ( item()->getConfig()->value<long>("Scale Ellipse"))
         ellipseScale = item()->getConfig()->value<long>("Scale Ellipse");
     
      eveEllipsoid->SetScale(ellipseScale);

      // cache 3D extend used in eval bbox and render 3D
      TMatrixDEigen eig(m);
      TVectorD vv ( eig.GetEigenValuesRe());
      eveEllipsoid->RefExtent3D().Set(sqrt(vv(0))*ellipseScale,sqrt(vv(1))*ellipseScale,sqrt(vv(2))*ellipseScale); 

      eveEllipsoid->SetLineWidth(2);
      setupAddElement(eveEllipsoid, &oItemHolder);
      eveEllipsoid->SetMainTransparency(TMath::Min(100, 80 + item()->defaultDisplayProperties().transparency() / 5)); 
      
      
      
      Color_t color = item()->getConfig()->value<long>("Ellipse Color Index");
     // eveEllipsoid->SetFillColor(item()->defaultDisplayProperties().color());
     // eveEllipsoid->SetLineColor(item()->defaultDisplayProperties().color());    
      eveEllipsoid->SetMainColor(color + context().colorManager()->offsetOfLimitedColors());
   }

   // tracks
   if ( item()->getConfig()->value<bool>("Draw Tracks")) 
   {    
      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(); 
         setupAddElement(trk, &oItemHolder);
      }
   }
   if ( item()->getConfig()->value<bool>("Draw Pseudo Track"))
   {
      TEveRecTrack t;
      t.fBeta = 1.;
      t.fV = TEveVector(v.x(),v.y(),v.z());
      t.fP = TEveVector(-v.p4().px(), -v.p4().py(), -v.p4().pz());
      t.fSign = 1;
      TEveTrack* trk = new TEveTrack(&t, context().getTrackPropagator());
      trk->SetLineStyle(7);
      trk->MakeTrack();
      setupAddElement(trk, &oItemHolder);
      
   }
}
void FWVertexProxyBuilder::localModelChanges ( const FWModelId iId,
TEveElement *  iCompound,
FWViewType::EType  viewType,
const FWViewContext vc 
) [private, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 162 of file FWVertexProxyBuilder.cc.

References FWProxyBuilderBase::context(), FWProxyBuilderBase::increaseComponentTransparency(), FWModelId::index(), and FWProxyBuilderBase::item().

{
   increaseComponentTransparency(iId.index(), iCompound, "Ellipsoid", 80);
   TEveElement* el = iCompound->FindChild("Ellipsoid");
   if (el)
      el->SetMainColor(item()->getConfig()->value<long>("Ellipse Color Index") + context().colorManager()->offsetOfLimitedColors());
}
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 45 of file FWVertexProxyBuilder.cc.

References FWProxyBuilderConfiguration::assertParam(), FWProxyBuilderBase::context(), FWEventItem::getConfig(), and prof2calltree::l.

   {
      FWProxyBuilderBase::setItem(iItem);
      if (iItem)
      {
         iItem->getConfig()->assertParam("Draw Tracks", false);
         iItem->getConfig()->assertParam("Draw Pseudo Track", false);
         iItem->getConfig()->assertParam("Draw Ellipse", false);
         iItem->getConfig()->assertParam("Scale Ellipse",2l, 1l, 10l);
         iItem->getConfig()->assertParam("Ellipse Color Index",  6l, 0l, (long)context().colorManager()->numberOfLimitedColors());
      }
   }