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 
21  void build( const reco::CaloCluster& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* );
22 };
23 
24 void
25 FWCaloClusterProxyBuilder::build( const reco::CaloCluster& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* )
26 {
27  std::vector<std::pair<DetId, float> > clusterDetIds = iData.hitsAndFractions();
28 
29  TEveBoxSet* boxset = new TEveBoxSet();
30  boxset->Reset(TEveBoxSet::kBT_FreeBox, true, 64);
31  boxset->UseSingleColor();
32  boxset->SetPickable(1);
33 
34  for( std::vector<std::pair<DetId, float> >::iterator it = clusterDetIds.begin(), itEnd = clusterDetIds.end();
35  it != itEnd; ++it )
36  {
37  const float* corners = item()->getGeom()->getCorners( (*it).first );
38  if( corners == 0 ) {
39  continue;
40  }
41  std::vector<float> pnts(24);
42  fireworks::energyTower3DCorners(corners, (*it).second, pnts);
43  boxset->AddBox( &pnts[0]);
44  }
45 
46  boxset->RefitPlex();
47  setupAddElement(boxset, &oItemHolder);
48 }
49 
#define REGISTER_PROXYBUILDER_METHODS()
#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:192
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:280
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681