CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWPhotonProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Photons
4 // Class : FWPhotonProxyBuilder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Wed Nov 26 14:52:01 EST 2008
11 //
12 
13 #include "TEveBoxSet.h"
14 
20 
22 
24 
26 {
27 public:
29 
30  virtual ~FWPhotonProxyBuilder( void ) {}
31 
32  virtual bool haveSingleProduct( void ) const override { return false; }
33 
35 
36 private:
39 
41  virtual void buildViewType( const reco::Photon& photon, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type , const FWViewContext*) override;
42 };
43 
44 void
45 FWPhotonProxyBuilder::buildViewType( const reco::Photon& photon, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type , const FWViewContext*)
46 {
47  const FWGeometry *geom = item()->getGeom();
48 
49  if( type == FWViewType::kRhoPhi || type == FWViewType::kRhoPhiPF )
50  {
52  photon.superCluster(),
53  photon.phi(),
54  oItemHolder );
55  }
56 
57  else if( type == FWViewType::kRhoZ )
59  photon.superCluster(),
60  photon.phi(),
61  oItemHolder );
62 
63  else if( type == FWViewType::kISpy )
64  {
65  std::vector<std::pair<DetId, float> > detIds = photon.superCluster()->hitsAndFractions();
66 
67  TEveBoxSet* boxset = new TEveBoxSet();
68  boxset->Reset(TEveBoxSet::kBT_FreeBox, true, 64);
69  boxset->UseSingleColor();
70  boxset->SetPickable(1);
71 
72  for( std::vector<std::pair<DetId, float> >::iterator id = detIds.begin(), ide = detIds.end();
73  id != ide; ++id )
74  {
75  const float* corners = geom->getCorners( id->first.rawId() );
76 
77  if( corners == 0 )
78  {
80  << "No corners available for supercluster constituent" << std::endl;
81  continue;
82  }
83  boxset->AddBox( &corners[0]);
84  }
85 
86  boxset->RefitPlex();
87  setupAddElement(boxset, &oItemHolder);
88  }
89 }
90 
type
Definition: HCALResponse.h:21
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:58
reco::SuperClusterRef superCluster() const
Ref to SuperCluster.
virtual float phi() const
momentum azimuthal angle
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:59
virtual void buildViewType(const reco::Photon &photon, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
bool makeRhoZSuperCluster(FWProxyBuilderBase *, const reco::SuperClusterRef &iCluster, float iPhi, TEveElement &oItemHolder)
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:280
#define fwLog(_level_)
Definition: fwLog.h:50
bool makeRhoPhiSuperCluster(FWProxyBuilderBase *, const reco::SuperClusterRef &iCluster, float iPhi, TEveElement &oItemHolder)
virtual ~FWPhotonProxyBuilder(void)
virtual bool haveSingleProduct(void) const override
const FWPhotonProxyBuilder & operator=(const FWPhotonProxyBuilder &)
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681