Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "TEveCompound.h"
00013 #include "TEvePointSet.h"
00014
00015 #include "Fireworks/Core/interface/FWProxyBuilderBase.h"
00016 #include "Fireworks/Core/interface/FWEventItem.h"
00017 #include "Fireworks/Core/interface/FWGeometry.h"
00018 #include "Fireworks/Core/interface/fwLog.h"
00019 #include "Fireworks/Tracks/interface/TrackUtils.h"
00020
00021 #include "DataFormats/SiPixelDigi/interface/PixelDigi.h"
00022 #include "DataFormats/Common/interface/DetSetVector.h"
00023
00024 class FWSiPixelDigiProxyBuilder : public FWProxyBuilderBase
00025 {
00026 public:
00027 FWSiPixelDigiProxyBuilder( void ) {}
00028 virtual ~FWSiPixelDigiProxyBuilder( void ) {}
00029
00030 REGISTER_PROXYBUILDER_METHODS();
00031
00032 private:
00033
00034 FWSiPixelDigiProxyBuilder( const FWSiPixelDigiProxyBuilder& );
00035
00036 const FWSiPixelDigiProxyBuilder& operator=( const FWSiPixelDigiProxyBuilder& );
00037
00038 virtual void build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* );
00039 };
00040
00041 void FWSiPixelDigiProxyBuilder::build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* )
00042 {
00043 const edm::DetSetVector<PixelDigi>* digis = 0;
00044 iItem->get( digis );
00045
00046 if( ! digis )
00047 {
00048 return;
00049 }
00050 const FWGeometry *geom = iItem->getGeom();
00051
00052 for( edm::DetSetVector<PixelDigi>::const_iterator it = digis->begin(), end = digis->end();
00053 it != end; ++it )
00054 {
00055 edm::DetSet<PixelDigi> ds = *it;
00056 unsigned int id = ds.id;
00057
00058 const float* pars = geom->getParameters( id );
00059
00060 for( edm::DetSet<PixelDigi>::const_iterator idigi = ds.data.begin(), idigiEnd = ds.data.end();
00061 idigi != idigiEnd; ++idigi )
00062 {
00063 TEvePointSet* pointSet = new TEvePointSet;
00064 pointSet->SetMarkerSize( 2 );
00065 pointSet->SetMarkerStyle( 2 );
00066 setupAddElement( pointSet, product );
00067
00068 if( ! geom->contains( id ))
00069 {
00070 fwLog( fwlog::kWarning )
00071 << "failed get geometry of SiPixelDigi with detid: "
00072 << id << std::endl;
00073 }
00074 else
00075 {
00076 float localPoint[3] = {
00077 fireworks::pixelLocalX(( *idigi ).row(), pars[0] ),
00078 fireworks::pixelLocalY(( *idigi ).column(), pars[1] ),
00079 0.0 };
00080
00081 float globalPoint[3];
00082 geom->localToGlobal( id, localPoint, globalPoint );
00083
00084 pointSet->SetNextPoint( globalPoint[0], globalPoint[1], globalPoint[2] );
00085 }
00086 }
00087 }
00088 }
00089
00090
00091 REGISTER_FWPROXYBUILDER( FWSiPixelDigiProxyBuilder, edm::DetSetVector<PixelDigi>, "SiPixelDigi", FWViewType::kAll3DBits | FWViewType::kAllRPZBits );