CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWHORecHitProxyBuilder.cc
Go to the documentation of this file.
7 #include "TEveCompound.h"
8 
10 {
11 public:
13  : m_maxEnergy( 1.0 )
14  {}
15 
16  virtual ~FWHORecHitProxyBuilder( void )
17  {}
18 
20 
21 private:
22  virtual void build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* );
23 
24  Float_t m_maxEnergy;
25 
28 };
29 
30 void
31 FWHORecHitProxyBuilder::build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* )
32 {
33  const HORecHitCollection* collection = 0;
34  iItem->get( collection );
35 
36  if( 0 == collection )
37  {
38  return;
39  }
40  std::vector<HORecHit>::const_iterator it = collection->begin();
41  std::vector<HORecHit>::const_iterator itEnd = collection->end();
42  for( ; it != itEnd; ++it )
43  {
44  if(( *it ).energy() > m_maxEnergy)
45  m_maxEnergy = ( *it ).energy();
46  }
47 
48  TEveBoxSet* boxSet = addBoxSetToProduct(product);
49  int index = 0;
50  for (std::vector<HORecHit>::const_iterator it = collection->begin() ; it != collection->end(); ++it)
51  {
52  const float* corners = item()->getGeom()->getCorners((*it).detid());
53  std::vector<float> scaledCorners(24);
54  if (corners)
55  fireworks::energyScaledBox3DCorners(corners, (*it).energy() / m_maxEnergy, scaledCorners, true);
56 
57  addBox(boxSet, &scaledCorners[0], iItem->modelInfo(index++).displayProperties());
58  }
59 }
60 
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:67
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
void get(const T *&oData) const
Definition: FWEventItem.h:84
const FWEventItem * item() const
const FWHORecHitProxyBuilder & operator=(const FWHORecHitProxyBuilder &)
const_iterator end() const
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:278
void energyScaledBox3DCorners(const float *corners, float scale, std::vector< float > &, bool invert=false)
TEveBoxSet * addBoxSetToProduct(TEveElementList *product)
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:536
void addBox(TEveBoxSet *set, const float *pnts, const FWDisplayProperties &dp)
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:688
const_iterator begin() const