CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch2/src/Fireworks/Muons/plugins/FWMuonLegoProxyBuilder.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Muons
00004 // Class  :     FWMuonLegoProxyBuilder
00005 //
00006 // $Id: FWMuonLegoProxyBuilder.cc,v 1.2 2010/12/01 11:41:36 amraktad Exp $
00007 //
00008 
00009 #include "TEvePointSet.h"
00010 
00011 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
00012 #include "DataFormats/MuonReco/interface/Muon.h"
00013 #include "DataFormats/TrackReco/interface/Track.h"
00014 
00015 class FWMuonLegoProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Muon>
00016 {
00017 public:
00018    FWMuonLegoProxyBuilder( void ) {}
00019    virtual ~FWMuonLegoProxyBuilder( void ) {}
00020 
00021    REGISTER_PROXYBUILDER_METHODS();
00022 
00023 private:
00024    // Disable default copy constructor
00025    FWMuonLegoProxyBuilder( const FWMuonLegoProxyBuilder& );
00026    // Disable default assignment operator
00027    const FWMuonLegoProxyBuilder& operator=( const FWMuonLegoProxyBuilder& );
00028 
00029    virtual void build( const reco::Muon& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* );
00030 };
00031 
00032 void
00033 FWMuonLegoProxyBuilder::build( const reco::Muon& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* ) 
00034 {
00035    TEvePointSet* points = new TEvePointSet;
00036    setupAddElement( points, &oItemHolder );
00037  
00038    points->SetMarkerStyle( 2 );
00039    points->SetMarkerSize( 0.2 );
00040     
00041    // get ECAL position of the propagated trajectory if available
00042    if( iData.isEnergyValid() && iData.calEnergy().ecal_position.r() > 100 )
00043    {
00044       points->SetNextPoint( iData.calEnergy().ecal_position.eta(),
00045                             iData.calEnergy().ecal_position.phi(),
00046                             0.1 );
00047      return;
00048    }
00049     
00050    // get position of the muon at surface of the tracker
00051    if( iData.track().isAvailable() && iData.track()->extra().isAvailable())
00052    {
00053       points->SetNextPoint( iData.track()->outerPosition().eta(),
00054                             iData.track()->outerPosition().phi(),
00055                             0.1 );
00056       return;
00057    } 
00058 
00059    // get position of the inner state of the stand alone muon
00060    if( iData.standAloneMuon().isAvailable() && iData.standAloneMuon()->extra().isAvailable())
00061    {
00062       if( iData.standAloneMuon()->innerPosition().R() <  iData.standAloneMuon()->outerPosition().R())
00063          points->SetNextPoint( iData.standAloneMuon()->innerPosition().eta(),
00064                                iData.standAloneMuon()->innerPosition().phi(),
00065                                0.1 );
00066       else
00067          points->SetNextPoint( iData.standAloneMuon()->outerPosition().eta(),
00068                                iData.standAloneMuon()->outerPosition().phi(),
00069                                0.1 );
00070       return;
00071    } 
00072    
00073    // WARNING: use direction at POCA as the last option
00074    points->SetNextPoint( iData.eta(), iData.phi(), 0.1 );
00075 }
00076 
00077 REGISTER_FWPROXYBUILDER( FWMuonLegoProxyBuilder, reco::Muon, "Muons", FWViewType::kAllLegoBits );
00078