CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/Fireworks/Tracks/plugins/FWSiPixelClusterDetProxyBuilder.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     Tracks
00004 // Class  :     FWSiPixelClusterDetProxyBuilder
00005 //
00006 //
00007 // Original Author:
00008 //         Created:  Thu Dec  6 18:01:21 PST 2007
00009 // $Id: FWSiPixelClusterDetProxyBuilder.cc,v 1.5 2010/09/07 15:46:48 yana Exp $
00010 //
00011 
00012 #include "TEveGeoNode.h"
00013 
00014 #include "Fireworks/Core/interface/FWProxyBuilderBase.h"
00015 #include "Fireworks/Core/interface/FWEventItem.h"
00016 #include "Fireworks/Core/interface/FWGeometry.h"
00017 
00018 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
00019 #include "DataFormats/DetId/interface/DetId.h"
00020 
00021 class FWSiPixelClusterDetProxyBuilder : public FWProxyBuilderBase
00022 {
00023 public:
00024   FWSiPixelClusterDetProxyBuilder() {}
00025   virtual ~FWSiPixelClusterDetProxyBuilder() {}
00026   
00027   REGISTER_PROXYBUILDER_METHODS();
00028 
00029 private:
00030   virtual void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*);
00031   FWSiPixelClusterDetProxyBuilder(const FWSiPixelClusterDetProxyBuilder&);
00032   const FWSiPixelClusterDetProxyBuilder& operator=(const FWSiPixelClusterDetProxyBuilder&);
00033 };
00034 
00035 void FWSiPixelClusterDetProxyBuilder::build( const FWEventItem* iItem, TEveElementList* product , const FWViewContext*)
00036 {
00037   const SiPixelClusterCollectionNew* pixels = 0;
00038   
00039   iItem->get(pixels);
00040   
00041   if( ! pixels ) 
00042     return;
00043   
00044   const FWGeometry* geom = iItem->getGeom();
00045   
00046   for( SiPixelClusterCollectionNew::const_iterator set = pixels->begin(), setEnd = pixels->end();
00047        set != setEnd; ++set) 
00048   {
00049     unsigned int id = set->detId();
00050     DetId detid(id);
00051       
00052     if( geom->contains( detid )) 
00053     {
00054       const edmNew::DetSet<SiPixelCluster> & clusters = *set;
00055       
00056       for( edmNew::DetSet<SiPixelCluster>::const_iterator itc = clusters.begin(), edc = clusters.end(); 
00057            itc != edc; ++itc ) 
00058       {
00059         TEveGeoShape* shape = geom->getEveShape(detid);
00060        
00061         if ( shape )
00062         {
00063           shape->SetMainTransparency(50);
00064           setupAddElement(shape, product);
00065         }
00066       }
00067     }
00068   }
00069 }
00070 
00071 REGISTER_FWPROXYBUILDER( FWSiPixelClusterDetProxyBuilder, SiPixelClusterCollectionNew, "SiPixelClusterDets", FWViewType::kAll3DBits | FWViewType::kAllRPZBits );