Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-03 04:10:04

0001 /*
0002  *  FWPCaloHitProxyBuilder.cc
0003  *  FWorks
0004  *
0005  *  Created by Ianna Osborne on 9/9/10.
0006  *
0007  */
0008 
0009 #include "Fireworks/Core/interface/FWDigitSetProxyBuilder.h"
0010 #include "Fireworks/Core/interface/FWGeometry.h"
0011 #include "Fireworks/Core/interface/FWEventItem.h"
0012 #include "Fireworks/Core/interface/BuilderUtils.h"
0013 #include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
0014 #include "SimDataFormats/CaloHit/interface/PCaloHit.h"
0015 #include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h"
0016 
0017 class FWPCaloHitProxyBuilder : public FWDigitSetProxyBuilder {
0018 public:
0019   FWPCaloHitProxyBuilder(void) {}
0020   ~FWPCaloHitProxyBuilder(void) override {}
0021 
0022   REGISTER_PROXYBUILDER_METHODS();
0023 
0024   FWPCaloHitProxyBuilder(const FWPCaloHitProxyBuilder&) = delete;
0025   const FWPCaloHitProxyBuilder& operator=(const FWPCaloHitProxyBuilder&) = delete;
0026 
0027 private:
0028   using FWDigitSetProxyBuilder::build;
0029   void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
0030 };
0031 
0032 void FWPCaloHitProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) {
0033   const edm::PCaloHitContainer* collection = nullptr;
0034   iItem->get(collection);
0035   if (!collection)
0036     return;
0037 
0038   TEveBoxSet* boxSet = addBoxSetToProduct(product);
0039   int index = 0;
0040   for (std::vector<PCaloHit>::const_iterator it = collection->begin(); it != collection->end(); ++it) {
0041     const float* corners = item()->getGeom()->getCorners((*it).id());
0042 
0043     std::vector<float> scaledCorners(24);
0044     if (corners)
0045       fireworks::energyTower3DCorners(corners, (*it).energy() * 10, scaledCorners);
0046 
0047     addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index++).displayProperties());
0048   }
0049 }
0050 
0051 // !AMT TEveBoxSet is not projectable. Can't be added to RPZ views empty.
0052 REGISTER_FWPROXYBUILDER(FWPCaloHitProxyBuilder,
0053                         edm::PCaloHitContainer,
0054                         "PCaloHits",
0055                         FWViewType::kAll3DBits | FWViewType::kAllRPZBits);