CMS 3D CMS Logo

FWTrajectorySeedProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: TrajectorySeeds
4 // Class : FWTrajectorySeedProxyBuilder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Tue Nov 25 14:42:13 EST 2008
11 //
12 
13 // system include files
14 #include "TEveStraightLineSet.h"
15 #include "TEvePointSet.h"
16 #include "TEveLine.h"
17 
18 // user include files
26 
30 
32 public:
35 
37 
38 private:
39  FWTrajectorySeedProxyBuilder(const FWTrajectorySeedProxyBuilder&) = delete; // stop default
40 
41  const FWTrajectorySeedProxyBuilder& operator=(const FWTrajectorySeedProxyBuilder&) = delete; // stop default
42 
44  void build(const TrajectorySeed& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*) override;
45 };
46 
48 
50 
52  unsigned int iIndex,
53  TEveElement& itemHolder,
54  const FWViewContext*) {
55  // LocalPoint pnt = iData.startingState().parameters().position();
56  // std::cout << pnt << std::endl;
57  // std::cout << dynamic_cast<const SiPixelRecHit *>(&(*iData.recHits().first)) << std::endl;
58  // TEveVector startPos(pnt.x(), pnt.y(), pnt.z());
59 
60  TEvePointSet* pointSet = new TEvePointSet;
61  TEveLine* line = new TEveLine;
62  TEveStraightLineSet* lineSet = new TEveStraightLineSet;
63 
64  for (auto const& hit : iData.recHits()) {
65  unsigned int id = hit.geographicalId();
66  const FWGeometry* geom = item()->getGeom();
67  const float* pars = geom->getParameters(id);
68  const SiPixelRecHit* rh = dynamic_cast<const SiPixelRecHit*>(&hit);
69  // std::cout << id << "id "<< std::endl;
70  if (rh) {
71  const SiPixelCluster* itc = rh->cluster().get();
72  if (!geom->contains(id)) {
73  fwLog(fwlog::kWarning) << "failed get geometry of SiPixelCluster with detid: " << id << std::endl;
74  continue;
75  }
76 
77  float localPoint[3] = {
78  fireworks::pixelLocalX((*itc).minPixelRow(), pars), fireworks::pixelLocalY((*itc).minPixelCol(), pars), 0.0};
79 
80  float globalPoint[3];
81  geom->localToGlobal(id, localPoint, globalPoint);
82 
83  pointSet->SetNextPoint(globalPoint[0], globalPoint[1], globalPoint[2]);
84  line->SetNextPoint(globalPoint[0], globalPoint[1], globalPoint[2]);
85 
86  }
87 
88  else {
90 
91  if (cluster) {
92  short firststrip = cluster->firstStrip();
93  float localTop[3] = {0.0, 0.0, 0.0};
94  float localBottom[3] = {0.0, 0.0, 0.0};
95 
96  fireworks::localSiStrip(firststrip, localTop, localBottom, pars, id);
97 
98  float globalTop[3];
99  float globalBottom[3];
100  geom->localToGlobal(id, localTop, globalTop, localBottom, globalBottom);
101 
102  lineSet->AddLine(globalTop[0], globalTop[1], globalTop[2], globalBottom[0], globalBottom[1], globalBottom[2]);
103  }
104  }
105  }
106 
107  setupAddElement(pointSet, &itemHolder);
108  setupAddElement(line, &itemHolder);
109  setupAddElement(lineSet, &itemHolder);
110 }
111 
112 //
113 // static member functions
114 //
117  "TrajectorySeeds",
estimate_field.h
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
FWGeometry
Definition: FWGeometry.h:27
FWSimpleProxyBuilderTemplate.h
fireworks::pixelLocalX
float pixelLocalX(const double mpx, const float *)
Definition: TrackUtils.cc:159
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
SiPixelCluster.h
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:28
edm::Ref::get
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:232
SiPixelCluster
Pixel cluster – collection of neighboring pixels above threshold.
Definition: SiPixelCluster.h:28
SiPixelRecHit::cluster
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
TrackUtils.h
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
SiStripCluster::firstStrip
uint16_t firstStrip() const
Definition: SiStripCluster.h:46
FWTrajectorySeedProxyBuilder::~FWTrajectorySeedProxyBuilder
~FWTrajectorySeedProxyBuilder() override
Definition: FWTrajectorySeedProxyBuilder.cc:49
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
fireworks::pixelLocalY
float pixelLocalY(const double mpy, const float *)
Definition: TrackUtils.cc:209
SiPixelRecHit.h
TrajectorySeed.h
FWGeometry.h
FWTrajectorySeedProxyBuilder::operator=
const FWTrajectorySeedProxyBuilder & operator=(const FWTrajectorySeedProxyBuilder &)=delete
fireworks::extractClusterFromTrackingRecHit
const SiStripCluster * extractClusterFromTrackingRecHit(const TrackingRecHit *rh)
Definition: TrackUtils.cc:318
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
fwlog::kWarning
Definition: fwLog.h:35
fwLog.h
TrajectorySeed::recHits
RecHitRange recHits() const
Definition: TrajectorySeed.h:52
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
FWMagField.h
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
FWTrajectorySeedProxyBuilder
Definition: FWTrajectorySeedProxyBuilder.cc:31
TrajectorySeed
Definition: TrajectorySeed.h:18
fireworks::localSiStrip
void localSiStrip(short strip, float *localTop, float *localBottom, const float *pars, unsigned int id)
Definition: TrackUtils.cc:263
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
mps_splice.line
line
Definition: mps_splice.py:76
SiStripCluster
Definition: SiStripCluster.h:8
hit
Definition: SiStripHitEffFromCalibTree.cc:88
FWTrajectorySeedProxyBuilder::FWTrajectorySeedProxyBuilder
FWTrajectorySeedProxyBuilder()
Definition: FWTrajectorySeedProxyBuilder.cc:47