CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWCaloClusterProxyBuilder.cc
Go to the documentation of this file.
1 #include "TEveBoxSet.h"
7 
8 class FWCaloClusterProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::CaloCluster>
9 {
10 public:
12  virtual ~FWCaloClusterProxyBuilder( void ) {}
13 
15 
16 private:
17  FWCaloClusterProxyBuilder( const FWCaloClusterProxyBuilder& ); // stop default
18  const FWCaloClusterProxyBuilder& operator=( const FWCaloClusterProxyBuilder& ); // stop default
19 
20  void build( const reco::CaloCluster& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* );
21 };
22 
23 void
24 FWCaloClusterProxyBuilder::build( const reco::CaloCluster& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* )
25 {
26  std::vector<std::pair<DetId, float> > clusterDetIds = iData.hitsAndFractions();
27 
28  TEveBoxSet* boxset = new TEveBoxSet();
29  boxset->Reset(TEveBoxSet::kBT_FreeBox, true, 64);
30  boxset->UseSingleColor();
31  boxset->SetPickable(1);
32 
33  for( std::vector<std::pair<DetId, float> >::iterator it = clusterDetIds.begin(), itEnd = clusterDetIds.end();
34  it != itEnd; ++it )
35  {
36  const float* corners = item()->getGeom()->getCorners( (*it).first );
37  if( corners == 0 ) {
38  continue;
39  }
40  std::vector<float> pnts(24);
41  fireworks::energyTower3DCorners(corners, (*it).second, pnts);
42  boxset->AddBox( &pnts[0]);
43  }
44 
45  boxset->RefitPlex();
46  setupAddElement(boxset, &oItemHolder);
47 }
48 
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
Definition: CaloCluster.h:189
const FWEventItem * item() const
const FWCaloClusterProxyBuilder & operator=(const FWCaloClusterProxyBuilder &)
void energyTower3DCorners(const float *corners, float scale, std::vector< float > &, bool reflect=false)
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:277
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681