CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWSiPixelDigiProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Tracks
4 // Class : FWSiPixelDigiProxyBuilder
5 //
6 //
7 // Original Author:
8 // Created: Thu Dec 6 18:01:21 PST 2007
9 //
10 
11 #include "TEveCompound.h"
12 #include "TEvePointSet.h"
13 
19 
22 
24 {
25 public:
27  virtual ~FWSiPixelDigiProxyBuilder( void ) {}
28 
30 
31 private:
32  // Disable default copy constructor
34  // Disable default assignment operator
36 
38  virtual void build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* ) override;
39 };
40 
41 void FWSiPixelDigiProxyBuilder::build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* )
42 {
43  const edm::DetSetVector<PixelDigi>* digis = 0;
44  iItem->get( digis );
45 
46  if( ! digis )
47  {
48  return;
49  }
50  const FWGeometry *geom = iItem->getGeom();
51 
52  for( edm::DetSetVector<PixelDigi>::const_iterator it = digis->begin(), end = digis->end();
53  it != end; ++it )
54  {
55  edm::DetSet<PixelDigi> ds = *it;
56  unsigned int id = ds.id;
57 
58  const float* pars = geom->getParameters( id );
59 
60  for( edm::DetSet<PixelDigi>::const_iterator idigi = ds.data.begin(), idigiEnd = ds.data.end();
61  idigi != idigiEnd; ++idigi )
62  {
63  TEvePointSet* pointSet = new TEvePointSet;
64  pointSet->SetMarkerSize( 2 );
65  pointSet->SetMarkerStyle( 2 );
66  setupAddElement( pointSet, product );
67 
68  if( ! geom->contains( id ))
69  {
71  << "failed get geometry of SiPixelDigi with detid: "
72  << id << std::endl;
73  }
74  else
75  {
76  float localPoint[3] = {
77  fireworks::pixelLocalX(( *idigi ).row(), pars[0] ),
78  fireworks::pixelLocalY(( *idigi ).column(), pars[1] ),
79  0.0 };
80 
81  float globalPoint[3];
82  geom->localToGlobal( id, localPoint, globalPoint );
83 
84  pointSet->SetNextPoint( globalPoint[0], globalPoint[1], globalPoint[2] );
85  }
86  } // end of iteration over digis in range
87  } // end of iteration over the DetSetVector
88 }
89 
90 
#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
void get(const T *&oData) const
Definition: FWEventItem.h:84
static const int kAll3DBits
Definition: FWViewType.h:59
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
#define end
Definition: vmac.h:37
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:365
#define fwLog(_level_)
Definition: fwLog.h:50
collection_type data
Definition: DetSet.h:78
det_id_type id
Definition: DetSet.h:77
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:350
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:108
float pixelLocalX(const double mpx, const int m_nrows)
Definition: TrackUtils.cc:170
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:695
const FWSiPixelDigiProxyBuilder & operator=(const FWSiPixelDigiProxyBuilder &)