CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

FWTrackProxyBuilderFF Class Reference

Inheritance diagram for FWTrackProxyBuilderFF:
FWProxyBuilderBase

List of all members.

Public Member Functions

 FWTrackProxyBuilderFF ()
 REGISTER_PROXYBUILDER_METHODS ()
virtual void setItem (const FWEventItem *iItem)
virtual bool visibilityModelChanges (const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
virtual ~FWTrackProxyBuilderFF ()

Private Member Functions

void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
void buildTrack (TrajTrackAssociationCollection::const_iterator it, TEveCompound *comp)
 FWTrackProxyBuilderFF (const FWTrackProxyBuilderFF &)
const FWTrackProxyBuilderFFoperator= (const FWTrackProxyBuilderFF &)

Private Attributes

TEveTrackPropagator * m_trackerPropagator
const
TrajTrackAssociationCollection
m_trajToTrackMap

Detailed Description

Definition at line 35 of file FWTrackProxyBuilderFF.cc.


Constructor & Destructor Documentation

FWTrackProxyBuilderFF::FWTrackProxyBuilderFF ( )

Definition at line 58 of file FWTrackProxyBuilderFF.cc.

References m_trackerPropagator.

                                            : 
m_trackerPropagator(0),
m_trajToTrackMap(0)
{
   m_trackerPropagator = new TEveTrackPropagator();
   m_trackerPropagator->SetStepper( TEveTrackPropagator::kRungeKutta );
   m_trackerPropagator->SetDelta(0.01);
   m_trackerPropagator->SetMaxOrbs(0.7);
   m_trackerPropagator->IncDenyDestroy();
}
FWTrackProxyBuilderFF::~FWTrackProxyBuilderFF ( ) [virtual]

Definition at line 69 of file FWTrackProxyBuilderFF.cc.

References m_trackerPropagator.

{
   m_trackerPropagator->DecDenyDestroy();
}
FWTrackProxyBuilderFF::FWTrackProxyBuilderFF ( const FWTrackProxyBuilderFF ) [private]

Member Function Documentation

void FWTrackProxyBuilderFF::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext vc 
) [private, virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 85 of file FWTrackProxyBuilderFF.cc.

References edm::AssociationMap< Tag >::begin(), buildTrack(), AlCaHLTBitMon_QueryRunRegistry::comp, gather_cfg::cout, FWProxyBuilderBase::createCompound(), edm::AssociationMap< Tag >::end(), exception, FWEventItem::get(), FWEventItem::getConfig(), FWEventItem::getEvent(), FWProxyBuilderBase::item(), m_trackerPropagator, m_trajToTrackMap, FWProxyBuilderBase::setupAddElement(), GlobalPosition_Frontier_DevDB_cff::tag, testEve_cfg::tracks, FWProxyBuilderConfiguration::value(), and cms::Exception::what().

{    
   const reco::TrackCollection * tracks = 0;
   iItem->get( tracks );
   if( tracks == 0 ) return;
   
   try {
      const edm::EventBase* event = item()->getEvent();
      edm::InputTag tag(item()->moduleLabel(), item()->productInstanceLabel(), item()->processName());
      edm::Handle<TrajTrackAssociationCollection> trajTrackAssociationHandle;
      event->getByLabel(tag, trajTrackAssociationHandle);
      m_trajToTrackMap = &*trajTrackAssociationHandle;
   }
   catch (cms::Exception &exception)
   {
      m_trajToTrackMap =0;
      std::cout << exception.what() << std::endl;
      return;
   }
   
 
   bool rnrPathMarks = item()->getConfig()->value<bool>("Rnr TrajectoryMeasurement");
   if (m_trackerPropagator->GetRnrReferences() != rnrPathMarks ) m_trackerPropagator->SetRnrReferences(rnrPathMarks);

   unsigned track_index = 0;
   for(TrajTrackAssociationCollection::const_iterator it = m_trajToTrackMap->begin(); it!=m_trajToTrackMap->end(); ++it, ++track_index) 
   {
      TEveCompound* comp = createCompound();
      setupAddElement( comp, product );
      
      if (item()->modelInfo(track_index).displayProperties().isVisible())
         buildTrack(it, comp);
   }
   
  gEve->GetBrowser()->MapWindow();
}
void FWTrackProxyBuilderFF::buildTrack ( TrajTrackAssociationCollection::const_iterator  it,
TEveCompound *  comp 
) [private]

Definition at line 122 of file FWTrackProxyBuilderFF.cc.

References alongMomentum, reco::TrackBase::charge(), Trajectory::direction(), TrajectoryStateOnSurface::globalMomentum(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), m_trackerPropagator, Trajectory::measurements(), reco::TrackBase::px(), reco::TrackBase::py(), reco::TrackBase::pz(), FWProxyBuilderBase::setupAddElement(), lumiQTWidget::t, reco::TrackBase::vx(), reco::TrackBase::vy(), reco::TrackBase::vz(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by build(), and visibilityModelChanges().

{
   const reco::Track track = *it->val;
   const Trajectory  traj  = *it->key;
   
   TEveRecTrack ts;
   ts.fBeta = 1.;
   ts.fSign = track.charge();
   ts.fP.Set(track.px(), track.py(), track.pz());
   ts.fV.Set(track.vx(), track.vy(), track.vz());
   TEveTrack* eveTrack = new TEveTrack( &ts, m_trackerPropagator);
   
   // path-marks from a trajectory
   std::vector<TrajectoryMeasurement> measurements = traj.measurements();
   std::vector<TrajectoryMeasurement>::iterator measurements_it = measurements.begin();
   std::vector<TrajectoryMeasurement>::reverse_iterator measurements_rit = measurements.rbegin();
   for (size_t t=0; t != measurements.size(); ++t, ++measurements_it, ++measurements_rit)
   {
      TrajectoryStateOnSurface trajState = (traj.direction() == alongMomentum) ? measurements_it->updatedState() : measurements_rit->updatedState() ;

      if( !trajState.isValid() ) continue;

      eveTrack->AddPathMark( TEvePathMark( TEvePathMark::kReference,
                                           TEveVector(trajState.globalPosition().x(),trajState.globalPosition().y(), trajState.globalPosition().z()),
                                           TEveVector(trajState.globalMomentum().x(),trajState.globalMomentum().y(), trajState.globalMomentum().z())));
   }

   eveTrack->MakeTrack();         
   setupAddElement(eveTrack, comp);      
}
const FWTrackProxyBuilderFF& FWTrackProxyBuilderFF::operator= ( const FWTrackProxyBuilderFF ) [private]
FWTrackProxyBuilderFF::REGISTER_PROXYBUILDER_METHODS ( )
void FWTrackProxyBuilderFF::setItem ( const FWEventItem iItem) [virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 74 of file FWTrackProxyBuilderFF.cc.

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

{
   FWProxyBuilderBase::setItem(iItem);
   if (iItem)
   {
      m_trackerPropagator->SetMagFieldObj(context().getField(), false);
      iItem->getConfig()->assertParam("Rnr TrajectoryMeasurement", false);
   }
}
bool FWTrackProxyBuilderFF::visibilityModelChanges ( const FWModelId iId,
TEveElement *  iCompound,
FWViewType::EType  viewType,
const FWViewContext vc 
) [virtual]

Reimplemented from FWProxyBuilderBase.

Definition at line 153 of file FWTrackProxyBuilderFF.cc.

References edm::AssociationMap< Tag >::begin(), buildTrack(), FWEventItem::ModelInfo::displayProperties(), FWModelId::index(), info, FWDisplayProperties::isVisible(), FWModelId::item(), m_trajToTrackMap, and FWEventItem::modelInfo().

{
   const FWEventItem::ModelInfo& info = iId.item()->modelInfo(iId.index());
   bool returnValue = false;
   if (info.displayProperties().isVisible() && iCompound->NumChildren()==0 && m_trajToTrackMap)
   {
      TrajTrackAssociationCollection::const_iterator it = m_trajToTrackMap->begin();
      std::advance(it, iId.index());
      buildTrack(it, (TEveCompound*)iCompound);
      returnValue=true;
   }
   return returnValue;
}

Member Data Documentation

TEveTrackPropagator* FWTrackProxyBuilderFF::m_trackerPropagator [private]

Definition at line 55 of file FWTrackProxyBuilderFF.cc.

Referenced by build(), and visibilityModelChanges().