Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-03 04:09:56

0001 #include "Fireworks/Core/interface/FWDigitSetProxyBuilder.h"
0002 #include "Fireworks/Core/interface/FWEventItem.h"
0003 #include "Fireworks/Core/interface/FWGeometry.h"
0004 #include "Fireworks/Core/interface/BuilderUtils.h"
0005 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
0006 
0007 class FWPRCaloTowerProxyBuilder : public FWDigitSetProxyBuilder {
0008 public:
0009   FWPRCaloTowerProxyBuilder(void) {}
0010   ~FWPRCaloTowerProxyBuilder(void) override {}
0011 
0012   REGISTER_PROXYBUILDER_METHODS();
0013 
0014   FWPRCaloTowerProxyBuilder(const FWPRCaloTowerProxyBuilder&) = delete;                   // stop default
0015   const FWPRCaloTowerProxyBuilder& operator=(const FWPRCaloTowerProxyBuilder&) = delete;  // stop default
0016 
0017 private:
0018   using FWDigitSetProxyBuilder::build;
0019   void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
0020 };
0021 
0022 void FWPRCaloTowerProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) {
0023   const CaloTowerCollection* collection = nullptr;
0024   iItem->get(collection);
0025   if (!collection)
0026     return;
0027 
0028   TEveBoxSet* boxSet = addBoxSetToProduct(product);
0029   int index = 0;
0030   for (std::vector<CaloTower>::const_iterator it = collection->begin(); it != collection->end(); ++it) {
0031     const float* corners = item()->getGeom()->getCorners((*it).id().rawId());
0032     if (corners == nullptr)
0033       continue;
0034 
0035     std::vector<float> scaledCorners(24);
0036     fireworks::energyTower3DCorners(corners, (*it).et(), scaledCorners);
0037 
0038     addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index++).displayProperties());
0039   }
0040 }
0041 
0042 REGISTER_FWPROXYBUILDER(FWPRCaloTowerProxyBuilder, CaloTowerCollection, "PRCaloTower", FWViewType::kISpyBit);