CMS 3D CMS Logo

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  ~FWPhotonProxyBuilder( void ) override {}
31 
32  bool haveSingleProduct( void ) const override { return false; }
33 
35 
36 private:
37  FWPhotonProxyBuilder( const FWPhotonProxyBuilder& ) = delete;
38  const FWPhotonProxyBuilder& operator=( const FWPhotonProxyBuilder& ) = delete;
39 
41  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(true);
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 == nullptr )
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
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
bool haveSingleProduct(void) const override
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:59
void buildViewType(const reco::Photon &photon, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
~FWPhotonProxyBuilder(void) override
const FWPhotonProxyBuilder & operator=(const FWPhotonProxyBuilder &)=delete
bool makeRhoZSuperCluster(FWProxyBuilderBase *, const reco::SuperClusterRef &iCluster, float iPhi, TEveElement &oItemHolder)
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:430
#define fwLog(_level_)
Definition: fwLog.h:50
bool makeRhoPhiSuperCluster(FWProxyBuilderBase *, const reco::SuperClusterRef &iCluster, float iPhi, TEveElement &oItemHolder)
double phi() const final
momentum azimuthal angle
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683