Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-03 04:10:04

0001 // -*- C++ -*-
0002 //
0003 // Package:     Tracks
0004 // Class  :     FWPhase2TrackerCluster1DDetProxyBuilder
0005 //
0006 //
0007 
0008 #include "TEveGeoNode.h"
0009 #include "TEveGeoShape.h"
0010 #include "Fireworks/Core/interface/FWProxyBuilderBase.h"
0011 #include "Fireworks/Core/interface/FWEventItem.h"
0012 #include "Fireworks/Core/interface/FWGeometry.h"
0013 
0014 #include "DataFormats/Phase2TrackerCluster/interface/Phase2TrackerCluster1D.h"
0015 #include "DataFormats/DetId/interface/DetId.h"
0016 
0017 class FWPhase2TrackerCluster1DDetProxyBuilder : public FWProxyBuilderBase {
0018 public:
0019   FWPhase2TrackerCluster1DDetProxyBuilder() {}
0020   ~FWPhase2TrackerCluster1DDetProxyBuilder() override {}
0021 
0022   REGISTER_PROXYBUILDER_METHODS();
0023 
0024 private:
0025   using FWProxyBuilderBase::build;
0026   void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
0027 
0028 public:
0029   FWPhase2TrackerCluster1DDetProxyBuilder(const FWPhase2TrackerCluster1DDetProxyBuilder&) = delete;
0030   const FWPhase2TrackerCluster1DDetProxyBuilder& operator=(const FWPhase2TrackerCluster1DDetProxyBuilder&) = delete;
0031 };
0032 
0033 void FWPhase2TrackerCluster1DDetProxyBuilder::build(const FWEventItem* iItem,
0034                                                     TEveElementList* product,
0035                                                     const FWViewContext*) {
0036   const Phase2TrackerCluster1DCollectionNew* pixels = nullptr;
0037 
0038   iItem->get(pixels);
0039 
0040   if (!pixels)
0041     return;
0042 
0043   const FWGeometry* geom = iItem->getGeom();
0044 
0045   for (Phase2TrackerCluster1DCollectionNew::const_iterator set = pixels->begin(), setEnd = pixels->end(); set != setEnd;
0046        ++set) {
0047     unsigned int id = set->detId();
0048     DetId detid(id);
0049 
0050     if (geom->contains(detid)) {
0051       const edmNew::DetSet<Phase2TrackerCluster1D>& clusters = *set;
0052 
0053       for (edmNew::DetSet<Phase2TrackerCluster1D>::const_iterator itc = clusters.begin(), edc = clusters.end();
0054            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(FWPhase2TrackerCluster1DDetProxyBuilder,
0068                         Phase2TrackerCluster1DCollectionNew,
0069                         "Phase2TrackerCluster1DDets",
0070                         FWViewType::kAll3DBits | FWViewType::kAllRPZBits);