CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/Fireworks/Calo/plugins/FWEcalRecHitProxyBuilder.cc

Go to the documentation of this file.
00001 /*
00002  *  FWEcalRecHitProxyBuilder.cc
00003  *  FWorks
00004  *
00005  *  Created by Ianna Osborne on 5/28/10.
00006  *
00007  */
00008 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
00009 #include "Fireworks/Calo/plugins/FWCaloRecHitDigitSetProxyBuilder.h"
00010 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
00011 
00012 class FWEcalRecHitProxyBuilder : public FWCaloRecHitDigitSetProxyBuilder
00013 {
00014 public:
00015    FWEcalRecHitProxyBuilder() {}
00016    virtual ~FWEcalRecHitProxyBuilder() {}
00017  
00018    virtual void viewContextBoxScale( const float* corners, float scale, bool plotEt, std::vector<float>& scaledCorners, const CaloRecHit*);
00019         
00020    REGISTER_PROXYBUILDER_METHODS();
00021         
00022 private:
00023    FWEcalRecHitProxyBuilder( const FWEcalRecHitProxyBuilder& );
00024    const FWEcalRecHitProxyBuilder& operator=( const FWEcalRecHitProxyBuilder& );
00025 };
00026 
00027 
00028 void FWEcalRecHitProxyBuilder::viewContextBoxScale( const float* corners, float scale, bool plotEt, std::vector<float>& scaledCorners, const CaloRecHit* hit)
00029 { 
00030    invertBox((EcalSubdetector( hit->detid().subdetId() ) == EcalPreshower) && (corners[2] < 0));
00031    FWCaloRecHitDigitSetProxyBuilder::viewContextBoxScale(corners, scale, plotEt, scaledCorners, hit );
00032 }
00033 
00034 
00035 REGISTER_FWPROXYBUILDER( FWEcalRecHitProxyBuilder, EcalRecHitCollection, "Ecal RecHit", FWViewType::kISpyBit );
00036 
00037 // AMT: Scale box round cener. Prviousy used fireworks::energyTower3DCorners().
00038 // Why differnt scale factor in  EcalPreShower ???
00039 
00040 
00041 /*
00042 void FWEcalRecHitProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext* vc)
00043 {
00044    m_plotEt = vc->getEnergyScale()->getPlotEt();
00045 
00046    const EcalRecHitCollection* collection = 0;
00047    iItem->get( collection );
00048    if (! collection)
00049       return;
00050 
00051    TEveBoxSet* boxSet = addBoxSetToProduct(product);
00052    std::vector<float> scaledCorners(24);
00053    int index = 0;
00054    for (std::vector<EcalRecHit>::const_iterator it = collection->begin() ; it != collection->end(); ++it)
00055    {
00056       const float* corners = item()->getGeom()->getCorners((*it).detid());
00057       if (corners == 0) 
00058          continue;
00059 
00060       Float_t scale = 10.0;
00061       bool reflect = false;
00062       if (EcalSubdetector( (*it).detid().subdetId() ) == EcalPreshower)
00063       {
00064          scale = 1000.0;        // FIXME: The scale should be taken form somewhere else
00065          reflect = corners[2] < 0;
00066       }
00067 
00068       if (m_plotEt)
00069          fireworks::energyTower3DCorners(corners, (*it).energy() * scale,  scaledCorners, reflect);
00070       else
00071          fireworks::energyTower3DCorners(corners, (*it).energy() * scale,  scaledCorners, reflect);
00072 
00073       addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index++).displayProperties());
00074    }
00075 }
00076 */