CMS 3D CMS Logo

/data/git/CMSSW_5_3_11_patch5/src/Fireworks/Calo/plugins/FWZDCRecHitProxyBuilder.cc

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