CMS 3D CMS Logo

FWTrackTrackingRecHitProxyBuilder.cc
Go to the documentation of this file.
1 #include "TEvePointSet.h"
2 
7 
12 
14 public:
17 
19 
20 private:
22  void build(const reco::Track& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override;
23 
26 };
27 
29  unsigned int iIndex,
30  TEveElement& oItemHolder,
31  const FWViewContext*) {
32  const FWGeometry* geom = item()->getGeom();
33 
34  for (trackingRecHit_iterator it = iData.recHitsBegin(), itEnd = iData.recHitsEnd(); it != itEnd; ++it) {
35  TEvePointSet* pointSet = new TEvePointSet;
36  setupAddElement(pointSet, &oItemHolder);
37 
38  auto rechitRef = *it;
39  const TrackingRecHit* rechit = &(*rechitRef);
40 
41  if (rechit->isValid()) {
42  unsigned int rawid = rechit->geographicalId().rawId();
43 
44  if (!geom->contains(rawid)) {
45  fwLog(fwlog::kError) << "failed get geometry for detid: " << rawid << std::endl;
46  }
47 
48  LocalPoint pos(0.0, 0.0, 0.0);
49  if (const SiStripRecHit2D* hit = dynamic_cast<const SiStripRecHit2D*>(rechit)) {
50  if (hit->hasPositionAndError()) {
51  pos = rechit->localPosition();
52  }
53  } else if (const SiStripRecHit1D* hit = dynamic_cast<const SiStripRecHit1D*>(rechit)) {
54  if (hit->hasPositionAndError()) {
55  pos = rechit->localPosition();
56  }
57  }
58 
59  float localPos[3] = {pos.x(), pos.y(), pos.z()};
60  float globalPos[3];
61  geom->localToGlobal(rawid, localPos, globalPos);
62  pointSet->SetNextPoint(globalPos[0], globalPos[1], globalPos[2]);
63  }
64  }
65 }
66 
69  "Track Tracking RecHits",
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
FWGeometry
Definition: FWGeometry.h:27
FWSimpleProxyBuilderTemplate.h
reco::Track::recHitsBegin
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:88
FWTrackTrackingRecHitProxyBuilder::operator=
const FWTrackTrackingRecHitProxyBuilder & operator=(const FWTrackTrackingRecHitProxyBuilder &)=delete
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
pos
Definition: PixelAliasList.h:18
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:27
SiStripRecHit2D
Definition: SiStripRecHit2D.h:7
TrackingRecHit::localPosition
virtual LocalPoint localPosition() const =0
TrackingRecHit::geographicalId
DetId geographicalId() const
Definition: TrackingRecHit.h:120
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
TrackingRecHit.h
Track.h
FWTrackTrackingRecHitProxyBuilder::FWTrackTrackingRecHitProxyBuilder
FWTrackTrackingRecHitProxyBuilder(void)
Definition: FWTrackTrackingRecHitProxyBuilder.cc:15
reco::Track::recHitsEnd
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:91
reco::Track
Definition: Track.h:27
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
Point3DBase< float, LocalTag >
FWTrackTrackingRecHitProxyBuilder::~FWTrackTrackingRecHitProxyBuilder
~FWTrackTrackingRecHitProxyBuilder(void) override
Definition: FWTrackTrackingRecHitProxyBuilder.cc:16
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
FWGeometry.h
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
fwLog.h
SiStripRecHit1D
Definition: SiStripRecHit1D.h:8
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
TrackingRecHit
Definition: TrackingRecHit.h:21
SiStripRecHit1D.h
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
FWTrackTrackingRecHitProxyBuilder
Definition: FWTrackTrackingRecHitProxyBuilder.cc:13
fwlog::kError
Definition: fwLog.h:35
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
TrackingRecHit::isValid
bool isValid() const
Definition: TrackingRecHit.h:141
SiStripRecHit2D.h
hit
Definition: SiStripHitEffFromCalibTree.cc:88