CMS 3D CMS Logo

FWCandidateHGCalLegoProxyBuilder.cc
Go to the documentation of this file.
1 #ifndef _FWCANDIDATEHGCALLEGOPROXYBUILDER_H_
2 #define _FWCANDIDATEHGCALLEGOPROXYBUILDER_H_
3 
4 // -*- C++ -*-
5 //
6 // Package: Candidates
7 // Class : FWCandidateHGCalLegoProxyBuilder
8 //
9 //
10 
11 // User include files
16 
18 
19 #include <cmath>
20 
21 //-----------------------------------------------------------------------------
22 // FWCandidateHGCalLegoProxyBuilder
23 //-----------------------------------------------------------------------------
24 class FWCandidateHGCalLegoProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::HGCalMultiCluster> {
25 public:
26  // ---------------- Constructor(s)/Destructor ----------------------
29 
30  // --------------------- Member Functions --------------------------
31  bool havePerViewProduct(FWViewType::EType) const override { return true; }
32  void scaleProduct(TEveElementList *, FWViewType::EType, const FWViewContext *) override;
33  void localModelChanges(const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *) override;
34 
36 
37 private:
38  // ----------------------- Data Members ----------------------------
41 
42  // --------------------- Member Functions --------------------------
44  void build(const reco::HGCalMultiCluster &, unsigned int, TEveElement &, const FWViewContext *) override;
45 };
46 #endif
47 //=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_
48 
49 //______________________________________________________________________________
52  const FWViewContext *vc) {
53  for (TEveElement::List_i i = parent->BeginChildren(); i != parent->EndChildren(); ++i) {
54  if ((*i)->HasChildren()) {
55  TEveElement *el = (*i)->FirstChild(); // There is only one child
56  FWLegoCandidate *candidate = dynamic_cast<FWLegoCandidate *>(el);
57  candidate->updateScale(vc, context());
58  }
59  }
60 }
61 
62 //______________________________________________________________________________
64  TEveElement *parent,
66  const FWViewContext *vc) {
67  // Line set marker is nto the same color as line, have to fix it here
68  if ((parent)->HasChildren()) {
69  TEveElement *el = (parent)->FirstChild(); // There is only one child
70  FWLegoCandidate *candidate = dynamic_cast<FWLegoCandidate *>(el);
71  candidate->SetMarkerColor(item()->modelInfo(iId.index()).displayProperties().color());
72  candidate->ElementChanged();
73  }
74 }
75 
76 //______________________________________________________________________________
78  unsigned int iIndex,
79  TEveElement &oItemHolder,
80  const FWViewContext *vc) {
81  const auto &clusters = iData.clusters();
82 
83  for (const auto &c : clusters) {
84  auto pt = c->energy() / std::cosh(c->eta());
85  FWLegoCandidate *candidate = new FWLegoCandidate(vc, context(), c->energy(), pt, pt, c->eta(), c->phi());
86 
87  candidate->SetMarkerColor(item()->defaultDisplayProperties().color());
88  context().voteMaxEtAndEnergy(pt, c->energy());
89  setupAddElement(candidate, &oItemHolder);
90  }
91 }
92 
93 //______________________________________________________________________________
96  "HGCal Multiclusters Lego",
reco::HGCalMultiCluster::clusters
const edm::PtrVector< reco::BasicCluster > & clusters() const
Definition: HGCalMultiCluster.h:23
mps_fire.i
i
Definition: mps_fire.py:428
FWViewType::kLegoBit
Definition: FWViewType.h:55
FWSimpleProxyBuilderTemplate.h
FWViewType::EType
EType
Definition: FWViewType.h:31
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
FWModelId
Definition: FWModelId.h:28
HGCalMultiCluster.h
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:28
FWLegoCandidate
Definition: FWLegoCandidate.h:28
fireworks::Context::voteMaxEtAndEnergy
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:162
FWCandidateHGCalLegoProxyBuilder::operator=
const FWCandidateHGCalLegoProxyBuilder & operator=(const FWCandidateHGCalLegoProxyBuilder &)=delete
FWModelId::index
int index() const
Definition: FWModelId.h:41
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
FWCandidateHGCalLegoProxyBuilder::localModelChanges
void localModelChanges(const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *) override
Definition: FWCandidateHGCalLegoProxyBuilder.cc:63
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
FWCandidateHGCalLegoProxyBuilder
Definition: FWCandidateHGCalLegoProxyBuilder.cc:24
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
FWViewType::kLegoHF
Definition: FWViewType.h:37
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
reco::HGCalMultiCluster
Definition: HGCalMultiCluster.h:12
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
FWCandidateHGCalLegoProxyBuilder::~FWCandidateHGCalLegoProxyBuilder
~FWCandidateHGCalLegoProxyBuilder() override
Definition: FWCandidateHGCalLegoProxyBuilder.cc:28
FWCandidateHGCalLegoProxyBuilder::FWCandidateHGCalLegoProxyBuilder
FWCandidateHGCalLegoProxyBuilder()
Definition: FWCandidateHGCalLegoProxyBuilder.cc:27
FWLegoCandidate.h
FWLegoCandidate::updateScale
void updateScale(const FWViewContext *vc, const fireworks::Context &)
Definition: FWLegoCandidate.cc:41
FWCandidateHGCalLegoProxyBuilder::havePerViewProduct
bool havePerViewProduct(FWViewType::EType) const override
Definition: FWCandidateHGCalLegoProxyBuilder.cc:31
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition: FWProxyBuilderBase.cc:412
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
FWCandidateHGCalLegoProxyBuilder::scaleProduct
void scaleProduct(TEveElementList *, FWViewType::EType, const FWViewContext *) override
Definition: FWCandidateHGCalLegoProxyBuilder.cc:50
class-composition.parent
parent
Definition: class-composition.py:88
Context.h