CMS 3D CMS Logo

FWPCaloHitProxyBuilder.cc
Go to the documentation of this file.
1 /*
2  * FWPCaloHitProxyBuilder.cc
3  * FWorks
4  *
5  * Created by Ianna Osborne on 9/9/10.
6  *
7  */
8 
16 
18 public:
20  ~FWPCaloHitProxyBuilder(void) override {}
21 
23 
24 private:
27 
29  void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
30 };
31 
32 void FWPCaloHitProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) {
33  const edm::PCaloHitContainer* collection = nullptr;
34  iItem->get(collection);
35  if (!collection)
36  return;
37 
38  TEveBoxSet* boxSet = addBoxSetToProduct(product);
39  int index = 0;
40  for (std::vector<PCaloHit>::const_iterator it = collection->begin(); it != collection->end(); ++it) {
41  const float* corners = item()->getGeom()->getCorners((*it).id());
42 
43  std::vector<float> scaledCorners(24);
44  if (corners)
45  fireworks::energyTower3DCorners(corners, (*it).energy() * 10, scaledCorners);
46 
47  addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index++).displayProperties());
48  }
49 }
50 
51 // !AMT TEveBoxSet is not projectable. Can't be added to RPZ views empty.
54  "PCaloHits",
std::vector< PCaloHit > PCaloHitContainer
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:64
static const int kAllRPZBits
Definition: FWViewType.h:67
void get(const T *&oData) const
Definition: FWEventItem.h:78
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:68
~FWPCaloHitProxyBuilder(void) override
void energyTower3DCorners(const float *corners, float scale, std::vector< float > &, bool reflect=false)
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:463
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
const FWPCaloHitProxyBuilder & operator=(const FWPCaloHitProxyBuilder &)=delete
TEveBoxSet * addBoxSetToProduct(TEveElementList *product)
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
void addBox(TEveBoxSet *set, const float *pnts, const FWDisplayProperties &dp)
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548