Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:11:53

0001 // -*- C++ -*-
0002 //
0003 // Package:     Tracks
0004 // Class  :     FWSiPixelClusterDetProxyBuilder
0005 //
0006 //
0007 // Original Author:
0008 //         Created:  Thu Dec  6 18:01:21 PST 2007
0009 //
0010 
0011 #include "TEveGeoNode.h"
0012 #include "TEveGeoShape.h"
0013 #include "Fireworks/Core/interface/FWProxyBuilderBase.h"
0014 #include "Fireworks/Core/interface/FWEventItem.h"
0015 #include "Fireworks/Core/interface/FWGeometry.h"
0016 
0017 #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h"
0018 #include "DataFormats/DetId/interface/DetId.h"
0019 
0020 class FWSiPixelClusterDetProxyBuilder : public FWProxyBuilderBase {
0021 public:
0022   FWSiPixelClusterDetProxyBuilder() {}
0023   ~FWSiPixelClusterDetProxyBuilder() override {}
0024 
0025   REGISTER_PROXYBUILDER_METHODS();
0026 
0027 private:
0028   using FWProxyBuilderBase::build;
0029   void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
0030 
0031 public:
0032   FWSiPixelClusterDetProxyBuilder(const FWSiPixelClusterDetProxyBuilder&) = delete;
0033   const FWSiPixelClusterDetProxyBuilder& operator=(const FWSiPixelClusterDetProxyBuilder&) = delete;
0034 };
0035 
0036 void FWSiPixelClusterDetProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) {
0037   const SiPixelClusterCollectionNew* pixels = nullptr;
0038 
0039   iItem->get(pixels);
0040 
0041   if (!pixels)
0042     return;
0043 
0044   const FWGeometry* geom = iItem->getGeom();
0045 
0046   for (SiPixelClusterCollectionNew::const_iterator set = pixels->begin(), setEnd = pixels->end(); set != setEnd;
0047        ++set) {
0048     unsigned int id = set->detId();
0049     DetId detid(id);
0050 
0051     if (geom->contains(detid)) {
0052       const edmNew::DetSet<SiPixelCluster>& clusters = *set;
0053 
0054       for (edmNew::DetSet<SiPixelCluster>::const_iterator itc = clusters.begin(), edc = clusters.end(); itc != edc;
0055            ++itc) {
0056         TEveGeoShape* shape = geom->getEveShape(detid);
0057 
0058         if (shape) {
0059           shape->SetMainTransparency(50);
0060           setupAddElement(shape, product);
0061         }
0062       }
0063     }
0064   }
0065 }
0066 
0067 REGISTER_FWPROXYBUILDER(FWSiPixelClusterDetProxyBuilder,
0068                         SiPixelClusterCollectionNew,
0069                         "SiPixelClusterDets",
0070                         FWViewType::kAll3DBits | FWViewType::kAllRPZBits);