CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 
25 class FWPhotonProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::Photon> {
26 public:
28 
29  ~FWPhotonProxyBuilder(void) override {}
30 
31  bool haveSingleProduct(void) const override { return false; }
32 
34 
36  const FWPhotonProxyBuilder& operator=(const FWPhotonProxyBuilder&) = delete;
37 
38 private:
40  void buildViewType(const reco::Photon& photon,
41  unsigned int iIndex,
42  TEveElement& oItemHolder,
44  const FWViewContext*) override;
45 };
46 
48  unsigned int iIndex,
49  TEveElement& oItemHolder,
51  const FWViewContext*) {
52  const FWGeometry* geom = item()->getGeom();
53 
54  if (type == FWViewType::kRhoPhi || type == FWViewType::kRhoPhiPF) {
55  fireworks::makeRhoPhiSuperCluster(this, photon.superCluster(), photon.phi(), oItemHolder);
56  }
57 
58  else if (type == FWViewType::kRhoZ)
59  fireworks::makeRhoZSuperCluster(this, photon.superCluster(), photon.phi(), oItemHolder);
60 
61  else if (type == FWViewType::kISpy) {
62  std::vector<std::pair<DetId, float> > detIds = photon.superCluster()->hitsAndFractions();
63 
64  TEveBoxSet* boxset = new TEveBoxSet();
65  boxset->Reset(TEveBoxSet::kBT_FreeBox, true, 64);
66  boxset->UseSingleColor();
67  boxset->SetPickable(true);
68 
69  for (std::vector<std::pair<DetId, float> >::iterator id = detIds.begin(), ide = detIds.end(); id != ide; ++id) {
70  const float* corners = geom->getCorners(id->first.rawId());
71 
72  if (corners == nullptr) {
73  fwLog(fwlog::kWarning) << "No corners available for supercluster constituent" << std::endl;
74  continue;
75  }
76  boxset->AddBox(&corners[0]);
77  }
78 
79  boxset->RefitPlex();
80  setupAddElement(boxset, &oItemHolder);
81  }
82 }
83 
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:67
uint16_t *__restrict__ id
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:68
reco::SuperClusterRef superCluster() const override
Ref to SuperCluster.
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)
bool haveSingleProduct(void) const override
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:461
#define fwLog(_level_)
Definition: fwLog.h:45
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:548