test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
31 
33 
34 public:
37 
39 
40 private:
42 
44 
46  void build(const TrajectorySeed& iData, unsigned int iIndex,TEveElement& oItemHolder, const FWViewContext*) override;
47 };
48 
50 {
51 }
52 
54 {
55 }
56 
57 void
58 FWTrajectorySeedProxyBuilder::build( const TrajectorySeed& iData, unsigned int iIndex,TEveElement& itemHolder , const FWViewContext*)
59 {
60  // LocalPoint pnt = iData.startingState().parameters().position();
61  // std::cout << pnt << std::endl;
62  // std::cout << dynamic_cast<const SiPixelRecHit *>(&(*iData.recHits().first)) << std::endl;
63  // TEveVector startPos(pnt.x(), pnt.y(), pnt.z());
64 
65  TEvePointSet* pointSet = new TEvePointSet;
66  TEveLine* line = new TEveLine;
67  TEveStraightLineSet* lineSet = new TEveStraightLineSet;
69 
70  for(; hit != iData.recHits().second; hit++) {
71 
72  unsigned int id = hit->geographicalId();
73  const FWGeometry *geom = item()->getGeom();
74  const float* pars = geom->getParameters( id );
75  const SiPixelRecHit * rh = dynamic_cast<const SiPixelRecHit *>(&*hit);
76  // std::cout << id << "id "<< std::endl;
77  if(rh){
78  const SiPixelCluster * itc = rh->cluster().get();
79  if( ! geom->contains( id ))
80  {
82  << "failed get geometry of SiPixelCluster with detid: "
83  << id << std::endl;
84  continue;
85  }
86 
87 
88  float localPoint[3] =
89  {
90  fireworks::pixelLocalX(( *itc ).minPixelRow(), ( int )pars[0] ),
91  fireworks::pixelLocalY(( *itc ).minPixelCol(), ( int )pars[1] ),
92  0.0
93  };
94 
95  float globalPoint[3];
96  geom->localToGlobal( id, localPoint, globalPoint );
97 
98  pointSet->SetNextPoint( globalPoint[0], globalPoint[1], globalPoint[2] );
99  line->SetNextPoint( globalPoint[0], globalPoint[1], globalPoint[2] );
100 
101  }
102 
103  else {
105 
106  if (cluster) {
107  short firststrip = cluster->firstStrip();
108  float localTop[3] = { 0.0, 0.0, 0.0 };
109  float localBottom[3] = { 0.0, 0.0, 0.0 };
110 
111  fireworks::localSiStrip( firststrip, localTop, localBottom, pars, id );
112 
113  float globalTop[3];
114  float globalBottom[3];
115  geom->localToGlobal( id, localTop, globalTop, localBottom, globalBottom );
116 
117  lineSet->AddLine( globalTop[0], globalTop[1], globalTop[2],
118  globalBottom[0], globalBottom[1], globalBottom[2] );
119  }
120  }
121  }
122 
123  setupAddElement( pointSet, &itemHolder );
124  setupAddElement( line, &itemHolder );
125  setupAddElement( lineSet, &itemHolder );
126 }
127 
128 //
129 // static member functions
130 //
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:58
float pixelLocalY(const double mpy, const int m_ncols)
Definition: TrackUtils.cc:203
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:296
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
uint16_t firstStrip() const
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:59
void localSiStrip(short strip, float *localTop, float *localBottom, const float *pars, unsigned int id)
Definition: TrackUtils.cc:297
recHitContainer::const_iterator const_iterator
const SiStripCluster * extractClusterFromTrackingRecHit(const TrackingRecHit *rh)
Definition: TrackUtils.cc:364
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:328
bool contains(unsigned int id) const
Definition: FWGeometry.h:109
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:244
#define fwLog(_level_)
Definition: fwLog.h:50
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
range recHits() const
const FWTrajectorySeedProxyBuilder & operator=(const FWTrajectorySeedProxyBuilder &)
Pixel cluster – collection of neighboring pixels above threshold.
float pixelLocalX(const double mpx, const int m_nrows)
Definition: TrackUtils.cc:170
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681
Our base class.
Definition: SiPixelRecHit.h:23