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;
64 
65  for (; hit != iData.recHits().second; hit++) {
66  unsigned int id = hit->geographicalId();
67  const FWGeometry* geom = item()->getGeom();
68  const float* pars = geom->getParameters(id);
69  const SiPixelRecHit* rh = dynamic_cast<const SiPixelRecHit*>(&*hit);
70  // std::cout << id << "id "<< std::endl;
71  if (rh) {
72  const SiPixelCluster* itc = rh->cluster().get();
73  if (!geom->contains(id)) {
74  fwLog(fwlog::kWarning) << "failed get geometry of SiPixelCluster with detid: " << id << std::endl;
75  continue;
76  }
77 
78  float localPoint[3] = {
79  fireworks::pixelLocalX((*itc).minPixelRow(), pars), fireworks::pixelLocalY((*itc).minPixelCol(), pars), 0.0};
80 
81  float globalPoint[3];
82  geom->localToGlobal(id, localPoint, globalPoint);
83 
84  pointSet->SetNextPoint(globalPoint[0], globalPoint[1], globalPoint[2]);
85  line->SetNextPoint(globalPoint[0], globalPoint[1], globalPoint[2]);
86 
87  }
88 
89  else {
91 
92  if (cluster) {
93  short firststrip = cluster->firstStrip();
94  float localTop[3] = {0.0, 0.0, 0.0};
95  float localBottom[3] = {0.0, 0.0, 0.0};
96 
97  fireworks::localSiStrip(firststrip, localTop, localBottom, pars, id);
98 
99  float globalTop[3];
100  float globalBottom[3];
101  geom->localToGlobal(id, localTop, globalTop, localBottom, globalBottom);
102 
103  lineSet->AddLine(globalTop[0], globalTop[1], globalTop[2], globalBottom[0], globalBottom[1], globalBottom[2]);
104  }
105  }
106  }
107 
108  setupAddElement(pointSet, &itemHolder);
109  setupAddElement(line, &itemHolder);
110  setupAddElement(lineSet, &itemHolder);
111 }
112 
113 //
114 // static member functions
115 //
118  "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
TrajectorySeed::const_iterator
recHitContainer::const_iterator const_iterator
Definition: TrajectorySeed.h:20
SiPixelCluster
Pixel cluster – collection of neighboring pixels above threshold.
Definition: SiPixelCluster.h:27
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:38
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
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::recHits
range recHits() const
Definition: TrajectorySeed.h:52
TrajectorySeed
Definition: TrajectorySeed.h:17
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:9
hit
Definition: SiStripHitEffFromCalibTree.cc:88
FWTrajectorySeedProxyBuilder::FWTrajectorySeedProxyBuilder
FWTrajectorySeedProxyBuilder()
Definition: FWTrajectorySeedProxyBuilder.cc:47