Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /*
0002  *  FWEcalRecHitProxyBuilder.cc
0003  *  FWorks
0004  *
0005  *  Created by Ianna Osborne on 5/28/10.
0006  *
0007  */
0008 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0009 #include "Fireworks/Calo/plugins/FWCaloRecHitDigitSetProxyBuilder.h"
0010 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0011 
0012 class FWEcalRecHitProxyBuilder : public FWCaloRecHitDigitSetProxyBuilder {
0013 public:
0014   FWEcalRecHitProxyBuilder() {}
0015   ~FWEcalRecHitProxyBuilder() override {}
0016 
0017   void viewContextBoxScale(
0018       const float* corners, float scale, bool plotEt, std::vector<float>& scaledCorners, const CaloRecHit*) override;
0019 
0020   REGISTER_PROXYBUILDER_METHODS();
0021 
0022   FWEcalRecHitProxyBuilder(const FWEcalRecHitProxyBuilder&) = delete;
0023   const FWEcalRecHitProxyBuilder& operator=(const FWEcalRecHitProxyBuilder&) = delete;
0024 };
0025 
0026 void FWEcalRecHitProxyBuilder::viewContextBoxScale(
0027     const float* corners, float scale, bool plotEt, std::vector<float>& scaledCorners, const CaloRecHit* hit) {
0028   invertBox((EcalSubdetector(hit->detid().subdetId()) == EcalPreshower) && (corners[2] < 0));
0029   FWCaloRecHitDigitSetProxyBuilder::viewContextBoxScale(corners, scale, plotEt, scaledCorners, hit);
0030 }
0031 
0032 REGISTER_FWPROXYBUILDER(FWEcalRecHitProxyBuilder, EcalRecHitCollection, "Ecal RecHit", FWViewType::kISpyBit);
0033 
0034 // AMT: Scale box round cener. Prviousy used fireworks::energyTower3DCorners().
0035 // Why differnt scale factor in  EcalPreShower ???
0036 
0037 /*
0038 void FWEcalRecHitProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext* vc)
0039 {
0040    m_plotEt = vc->getEnergyScale()->getPlotEt();
0041 
0042    const EcalRecHitCollection* collection = 0;
0043    iItem->get( collection );
0044    if (! collection)
0045       return;
0046 
0047    TEveBoxSet* boxSet = addBoxSetToProduct(product);
0048    std::vector<float> scaledCorners(24);
0049    int index = 0;
0050    for (std::vector<EcalRecHit>::const_iterator it = collection->begin() ; it != collection->end(); ++it)
0051    {
0052       const float* corners = item()->getGeom()->getCorners((*it).detid());
0053       if (corners == 0) 
0054          continue;
0055 
0056       Float_t scale = 10.0;
0057       bool reflect = false;
0058       if (EcalSubdetector( (*it).detid().subdetId() ) == EcalPreshower)
0059       {
0060          scale = 1000.0;    // FIXME: The scale should be taken form somewhere else
0061          reflect = corners[2] < 0;
0062       }
0063 
0064       if (m_plotEt)
0065          fireworks::energyTower3DCorners(corners, (*it).energy() * scale,  scaledCorners, reflect);
0066       else
0067          fireworks::energyTower3DCorners(corners, (*it).energy() * scale,  scaledCorners, reflect);
0068 
0069       addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index++).displayProperties());
0070    }
0071 }
0072 */