Go to the documentation of this file.00001
00002
00003
00004
00005 #include "TEveGeoNode.h"
00006 #include "TEveStraightLineSet.h"
00007
00008 #include "Fireworks/Core/interface/fwLog.h"
00009 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
00010 #include "Fireworks/Core/interface/FWEventItem.h"
00011 #include "Fireworks/Core/interface/FWGeometry.h"
00012 #include "Fireworks/Tracks/interface/TrackUtils.h"
00013
00014 #include "DataFormats/SiStripCluster/interface/SiStripCluster.h"
00015
00016 class FWSiStripClusterProxyBuilder : public FWSimpleProxyBuilderTemplate<SiStripCluster>
00017 {
00018 public:
00019 FWSiStripClusterProxyBuilder( void ) {}
00020 virtual ~FWSiStripClusterProxyBuilder( void ) {}
00021
00022 REGISTER_PROXYBUILDER_METHODS();
00023
00024 protected:
00025 virtual void build( const SiStripCluster& iData, unsigned int iIndex,
00026 TEveElement& oItemHolder, const FWViewContext* );
00027 virtual void localModelChanges( const FWModelId& iId, TEveElement* iCompound,
00028 FWViewType::EType viewType, const FWViewContext* vc );
00029
00030 private:
00031 FWSiStripClusterProxyBuilder( const FWSiStripClusterProxyBuilder& );
00032 const FWSiStripClusterProxyBuilder& operator=( const FWSiStripClusterProxyBuilder& );
00033 };
00034
00035 void
00036 FWSiStripClusterProxyBuilder::build( const SiStripCluster& iData,
00037 unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* )
00038 {
00039 unsigned int rawid = iData.geographicalId();
00040 const FWGeometry *geom = item()->getGeom();
00041
00042 TEveGeoShape* shape = geom->getEveShape( rawid );
00043
00044 if( shape )
00045 {
00046 shape->SetElementName( "Det" );
00047 setupAddElement( shape, &oItemHolder );
00048 }
00049 else
00050 {
00051 fwLog( fwlog::kWarning )
00052 << "failed to get shape of SiStripCluster with detid: "
00053 << rawid << std::endl;
00054 }
00055 increaseComponentTransparency( iIndex, &oItemHolder, "Det", 60 );
00056
00057 TEveStraightLineSet *lineSet = new TEveStraightLineSet( "strip" );
00058 setupAddElement( lineSet, &oItemHolder );
00059
00060 if( ! geom->contains( rawid ))
00061 {
00062 fwLog( fwlog::kError )
00063 << "failed to geometry of SiStripCluster with detid: "
00064 << rawid << std::endl;
00065
00066 return;
00067 }
00068
00069 float localTop[3] = { 0.0, 0.0, 0.0 };
00070 float localBottom[3] = { 0.0, 0.0, 0.0 };
00071
00072 fireworks::localSiStrip( iData.firstStrip(), localTop, localBottom, geom->getParameters( rawid ), rawid );
00073
00074 float globalTop[3];
00075 float globalBottom[3];
00076 geom->localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
00077
00078 lineSet->AddLine( globalTop[0], globalTop[1], globalTop[2],
00079 globalBottom[0], globalBottom[1], globalBottom[2] );
00080 }
00081
00082 void
00083 FWSiStripClusterProxyBuilder::localModelChanges( const FWModelId& iId, TEveElement* iCompound,
00084 FWViewType::EType viewType, const FWViewContext* vc )
00085 {
00086 increaseComponentTransparency( iId.index(), iCompound, "Det", 60 );
00087 }
00088
00089
00090 REGISTER_FWPROXYBUILDER( FWSiStripClusterProxyBuilder, SiStripCluster, "SiStripCluster", FWViewType::kAll3DBits | FWViewType::kAllRPZBits );