CMS 3D CMS Logo

FWElectronProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Electrons
4 // Class : FWElectronProxyBuilder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Dec 2 14:17:03 EST 2008
11 //
12 #include "TEveCompound.h"
13 #include "TEveTrack.h"
14 #include "TEveScalableStraightLineSet.h"
15 
19 
23 
26 
28 
30 //
31 // 3D and RPZ proxy builder with shared track list
32 //
34 
35 class FWElectronProxyBuilder : public FWSimpleProxyBuilderTemplate<reco::GsfElectron> {
36 public:
38  ~FWElectronProxyBuilder() override;
39 
41  bool haveSingleProduct() const override { return false; }
43  void cleanLocal() override;
45  void buildViewType(const reco::GsfElectron& iData,
46  unsigned int iIndex,
47  TEveElement& oItemHolder,
49  const FWViewContext*) override;
50 
52  void setItem(const FWEventItem* iItem) override;
53 
55 
56 private:
57  FWElectronProxyBuilder(const FWElectronProxyBuilder&) = delete; // stop default
58  const FWElectronProxyBuilder& operator=(const FWElectronProxyBuilder&) = delete; // stop default
59 
60  TEveElementList* requestCommon();
61 
62  TEveElementList* m_common;
63 };
64 
66  m_common = new TEveElementList("common electron scene");
67  m_common->IncDenyDestroy();
68 }
69 
71 
74 
75  if (iItem) {
76  iItem->getConfig()->assertParam("LineWidth", long(1), long(1), long(4));
77  }
78 }
79 
81  if (m_common->HasChildren() == false) {
82  int width = item()->getConfig()->value<long>("LineWidth");
83  for (int i = 0; i < static_cast<int>(item()->size()); ++i) {
85 
86  TEveTrack* track(nullptr);
87  if (electron.gsfTrack().isAvailable())
89  else
90  track = fireworks::prepareCandidate(electron, context().getTrackPropagator());
91  track->MakeTrack();
92  track->SetLineWidth(width);
94  m_common->AddElement(track);
95  }
96  }
97  return m_common;
98 }
99 
100 void FWElectronProxyBuilder::cleanLocal() { m_common->DestroyElements(); }
101 
103  unsigned int iIndex,
104  TEveElement& oItemHolder,
106  const FWViewContext*) {
107  TEveElementList* tracks = requestCommon();
108  TEveElement::List_i trkIt = tracks->BeginChildren();
109  std::advance(trkIt, iIndex);
110  setupAddElement(*trkIt, &oItemHolder);
111 
113  fireworks::makeRhoPhiSuperCluster(this, electron.superCluster(), electron.phi(), oItemHolder);
114  else if (type == FWViewType::kRhoZ)
115  fireworks::makeRhoZSuperCluster(this, electron.superCluster(), electron.phi(), oItemHolder);
116 }
117 
120  "Electrons",
122 
124 //
125 // GLIMPSE specific proxy builder
126 //
128 
130 public:
134 
136 
137 private:
138  FWElectronGlimpseProxyBuilder(const FWElectronGlimpseProxyBuilder&) = delete; // stop default
139 
140  const FWElectronGlimpseProxyBuilder& operator=(const FWElectronGlimpseProxyBuilder&) = delete; // stop default
141 
142  void build(const reco::GsfElectron& iData,
143  unsigned int iIndex,
144  TEveElement& oItemHolder,
145  const FWViewContext*) override;
146 };
147 
149  unsigned int iIndex,
150  TEveElement& oItemHolder,
151  const FWViewContext*) {
152  TEveScalableStraightLineSet* marker = new TEveScalableStraightLineSet("", "");
153  marker->SetLineWidth(2);
154  fireworks::addStraightLineSegment(marker, &iData, 1.0);
155  setupAddElement(marker, &oItemHolder);
156  //add to scaler at end so that it can scale the line after all ends have been added
157  // FIXME: It's not a part of a standard FWSimpleProxyBuilderTemplate: the scaler is not set!
158  // assert(scaler());
159  // scaler()->addElement(marker);
160 }
FWElectronProxyBuilder::haveSingleProduct
bool haveSingleProduct() const override
Definition: FWElectronProxyBuilder.cc:41
FWElectronGlimpseProxyBuilder::~FWElectronGlimpseProxyBuilder
~FWElectronGlimpseProxyBuilder() override
Definition: FWElectronProxyBuilder.cc:132
ApeEstimator_cff.width
width
Definition: ApeEstimator_cff.py:24
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
mps_fire.i
i
Definition: mps_fire.py:355
FWSimpleProxyBuilderTemplate.h
fireworks::addStraightLineSegment
void addStraightLineSegment(TEveStraightLineSet *marker, reco::Candidate const *cand, double scale_factor=2)
Definition: CandidateUtils.cc:19
FWViewType::EType
EType
Definition: FWViewType.h:31
FWEventItem::getConfig
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:150
FWProxyBuilderBase::setupElement
void setupElement(TEveElement *el, bool color=true) const
Definition: FWProxyBuilderBase.cc:358
FWElectronProxyBuilder::requestCommon
TEveElementList * requestCommon()
Definition: FWElectronProxyBuilder.cc:80
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
FWViewType::kRhoZ
Definition: FWViewType.h:33
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:28
FWSimpleProxyBuilderTemplate< reco::GsfElectron >::modelData
const reco::GsfElectron & modelData(int index)
Definition: FWSimpleProxyBuilderTemplate.h:43
FWElectronProxyBuilder::FWElectronProxyBuilder
FWElectronProxyBuilder()
Definition: FWElectronProxyBuilder.cc:65
TrackUtils.h
FWElectronGlimpseProxyBuilder
Definition: FWElectronProxyBuilder.cc:129
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
FWViewType::kGlimpseBit
Definition: FWViewType.h:58
FWViewType.h
reco::GsfElectron
Definition: GsfElectron.h:35
GsfElectron.h
FWProxyBuilderConfiguration::assertParam
FWGenericParameter< T > * assertParam(const std::string &name, T def)
Definition: FWProxyBuilderConfiguration.cc:83
FWElectronGlimpseProxyBuilder::FWElectronGlimpseProxyBuilder
FWElectronGlimpseProxyBuilder()
Definition: FWElectronProxyBuilder.cc:131
fireworks::makeRhoZSuperCluster
bool makeRhoZSuperCluster(FWProxyBuilderBase *, const reco::SuperClusterRef &iCluster, float iPhi, TEveElement &oItemHolder)
Definition: makeSuperCluster.cc:68
FWElectronProxyBuilder::~FWElectronProxyBuilder
~FWElectronProxyBuilder() override
Definition: FWElectronProxyBuilder.cc:70
fireworks::prepareTrack
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:62
FWProxyBuilderConfiguration.h
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
GsfTrack.h
FWElectronProxyBuilder::operator=
const FWElectronProxyBuilder & operator=(const FWElectronProxyBuilder &)=delete
HPSPFTauProducerPuppi_cfi.electron
electron
Definition: HPSPFTauProducerPuppi_cfi.py:13
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
fireworks::makeRhoPhiSuperCluster
bool makeRhoPhiSuperCluster(FWProxyBuilderBase *, const reco::SuperClusterRef &iCluster, float iPhi, TEveElement &oItemHolder)
Definition: makeSuperCluster.cc:28
FWElectronProxyBuilder
Definition: FWElectronProxyBuilder.cc:35
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
makeSuperCluster.h
FWProxyBuilderBase::cleanLocal
virtual void cleanLocal()
Definition: FWProxyBuilderBase.cc:324
FWElectronGlimpseProxyBuilder::operator=
const FWElectronGlimpseProxyBuilder & operator=(const FWElectronGlimpseProxyBuilder &)=delete
CandidateUtils.h
FWEventItem
Definition: FWEventItem.h:56
type
type
Definition: HCALResponse.h:21
FWProxyBuilderConfiguration::value
T value(const std::string &name)
Definition: FWProxyBuilderConfiguration.cc:123
fireworks::prepareCandidate
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
Definition: CandidateUtils.cc:9
fireworks::Context::getTrackPropagator
TEveTrackPropagator * getTrackPropagator() const
Definition: Context.h:62
FWElectronProxyBuilder::setItem
void setItem(const FWEventItem *iItem) override
Definition: FWElectronProxyBuilder.cc:72
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition: FWProxyBuilderBase.cc:412
FWProxyBuilderBase::haveSingleProduct
virtual bool haveSingleProduct() const
Definition: FWProxyBuilderBase.h:88
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
FWElectronProxyBuilder::buildViewType
void buildViewType(const reco::GsfElectron &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
Definition: FWElectronProxyBuilder.cc:102
FWViewType::kRhoPhiPF
Definition: FWViewType.h:42
FWProxyBuilderBase::setItem
virtual void setItem(const FWEventItem *iItem)
Definition: FWProxyBuilderBase.cc:83
FWElectronProxyBuilder::m_common
TEveElementList * m_common
Definition: FWElectronProxyBuilder.cc:62
FWViewType::kRhoPhi
Definition: FWViewType.h:32
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
FWElectronProxyBuilder::cleanLocal
void cleanLocal() override
Definition: FWElectronProxyBuilder.cc:100