CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Fireworks/Calo/plugins/FWCastorRecHitProxyBuilder.cc

Go to the documentation of this file.
00001 /*
00002  *  FWCastorRecHitProxyBuilder.cc
00003  *  cmsShow
00004  *
00005  *  Created by Ianna Osborne on 7/8/10.
00006  *
00007  */
00008 
00009 #include "Fireworks/Core/interface/FWDigitSetProxyBuilder.h"
00010 #include "Fireworks/Core/interface/FWEventItem.h"
00011 #include "Fireworks/Core/interface/FWGeometry.h"
00012 #include "Fireworks/Core/interface/BuilderUtils.h"
00013 #include "DataFormats/HcalRecHit/interface/CastorRecHit.h"
00014 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00015 
00016 class FWCastorRecHitProxyBuilder : public FWDigitSetProxyBuilder
00017 {
00018 public:
00019    FWCastorRecHitProxyBuilder( void ) {}  
00020    virtual ~FWCastorRecHitProxyBuilder( void ) {}
00021 
00022    REGISTER_PROXYBUILDER_METHODS();
00023 
00024 private:
00025    FWCastorRecHitProxyBuilder( const FWCastorRecHitProxyBuilder& );
00026    const FWCastorRecHitProxyBuilder& operator=( const FWCastorRecHitProxyBuilder& );
00027 
00028    virtual void build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* );      
00029 };
00030 
00031 void FWCastorRecHitProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*)
00032 {
00033    const CastorRecHitCollection* collection = 0;
00034    iItem->get( collection );
00035    if (! collection)
00036       return;
00037 
00038 
00039    TEveBoxSet* boxSet = addBoxSetToProduct(product);
00040    int index = 0;
00041    for (std::vector<CastorRecHit>::const_iterator it = collection->begin() ; it != collection->end(); ++it)
00042    {  
00043       const float* corners = item()->getGeom()->getCorners((*it).detid());
00044       if (corners == 0) 
00045          continue;
00046 
00047       std::vector<float> scaledCorners(24);
00048       fireworks::energyTower3DCorners(corners, (*it).energy() * 10, scaledCorners);
00049 
00050       addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index++).displayProperties());
00051    }
00052 }
00053 
00054 REGISTER_FWPROXYBUILDER( FWCastorRecHitProxyBuilder, CastorRecHitCollection, "Castor RecHit", FWViewType::kISpyBit );