CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10/src/Fireworks/Calo/plugins/FWPRCaloTowerProxyBuilder.cc

Go to the documentation of this file.
00001 #include "Fireworks/Core/interface/FWDigitSetProxyBuilder.h"
00002 #include "Fireworks/Core/interface/FWEventItem.h"
00003 #include "Fireworks/Core/interface/FWGeometry.h"
00004 #include "Fireworks/Core/interface/BuilderUtils.h"
00005 #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h"
00006 
00007 class FWPRCaloTowerProxyBuilder : public FWDigitSetProxyBuilder
00008 {
00009 public:
00010    FWPRCaloTowerProxyBuilder( void ) {}  
00011    virtual ~FWPRCaloTowerProxyBuilder( void ) {}
00012 
00013    REGISTER_PROXYBUILDER_METHODS();
00014 
00015 private:
00016    FWPRCaloTowerProxyBuilder( const FWPRCaloTowerProxyBuilder& );                       // stop default
00017    const FWPRCaloTowerProxyBuilder& operator=( const FWPRCaloTowerProxyBuilder& );      // stop default
00018 
00019    virtual void build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* );      
00020 };
00021 
00022 
00023 void FWPRCaloTowerProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*)
00024 {
00025    const CaloTowerCollection* collection = 0;
00026    iItem->get( collection );
00027    if (! collection)
00028       return;
00029 
00030 
00031    TEveBoxSet* boxSet = addBoxSetToProduct(product);
00032    int index = 0;
00033    for (std::vector<CaloTower>::const_iterator it = collection->begin() ; it != collection->end(); ++it)
00034    {  
00035       const float* corners = item()->getGeom()->getCorners((*it).id().rawId());
00036       if (corners == 0) 
00037          continue;
00038 
00039       std::vector<float> scaledCorners(24);
00040       fireworks::energyTower3DCorners(corners, (*it).et(), scaledCorners);
00041 
00042      addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index++).displayProperties());
00043 
00044    }
00045 } 
00046 
00047 REGISTER_FWPROXYBUILDER( FWPRCaloTowerProxyBuilder, CaloTowerCollection, "CaloTower", FWViewType::kISpyBit );