CMS 3D CMS Logo

FWHGCalMultiClusterProxyBuilder.cc
Go to the documentation of this file.
1 #include "TEveBoxSet.h"
7 
8 class FWHGCalMultiClusterProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::HGCalMultiCluster>
9 {
10 public:
13 
15 
16 private:
17  FWHGCalMultiClusterProxyBuilder( const FWHGCalMultiClusterProxyBuilder& ) = delete; // stop default
18  const FWHGCalMultiClusterProxyBuilder& operator=( const FWHGCalMultiClusterProxyBuilder& ) = delete; // stop default
19 
21  void build( const reco::HGCalMultiCluster& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* ) override;
22 };
23 
24 void
25 FWHGCalMultiClusterProxyBuilder::build( const reco::HGCalMultiCluster& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* )
26 {
27  const auto & clusters = iData.clusters();
28 
29  TEveBoxSet* boxset = new TEveBoxSet();
30  boxset->Reset(TEveBoxSet::kBT_FreeBox, true, 64);
31  boxset->UseSingleColor();
32  boxset->SetPickable(true);
33  for (const auto & c : clusters)
34  {
35  std::vector<std::pair<DetId, float> > clusterDetIds = c->hitsAndFractions();
36 
37 
38  for( std::vector<std::pair<DetId, float> >::iterator it = clusterDetIds.begin(), itEnd = clusterDetIds.end();
39  it != itEnd; ++it )
40  {
41  const float* corners = item()->getGeom()->getCorners( (*it).first );
42  if( corners == nullptr ) {
43  continue;
44  }
45  std::vector<float> pnts(24);
46  fireworks::energyTower3DCorners(corners, (*it).second, pnts);
47  boxset->AddBox( &pnts[0]);
48  }
49  }
50  boxset->RefitPlex();
51  setupAddElement(boxset, &oItemHolder);
52 }
53 
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const FWEventItem * item() const
const edm::PtrVector< reco::BasicCluster > & clusters() const
const FWHGCalMultiClusterProxyBuilder & operator=(const FWHGCalMultiClusterProxyBuilder &)=delete
void energyTower3DCorners(const float *corners, float scale, std::vector< float > &, bool reflect=false)
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:286
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683