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 // $Id: FWSiPixelDigiProxyBuilder.cc,v 1.17 2010/09/07 15:46:48 yana Exp $
10 //
11 
12 #include "TEveCompound.h"
13 #include "TEvePointSet.h"
14 
20 
23 
25 {
26 public:
28  virtual ~FWSiPixelDigiProxyBuilder( void ) {}
29 
31 
32 private:
33  // Disable default copy constructor
35  // Disable default assignment operator
37 
38  virtual void build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* );
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_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:59
float pixelLocalY(const double mpy, const int m_ncols)
Definition: TrackUtils.cc:198
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:293
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void get(const T *&oData) const
Definition: FWEventItem.h:85
void localToGlobal(unsigned int id, const float *local, float *global) const
Definition: FWGeometry.cc:325
static const int kAll3DBits
Definition: FWViewType.h:60
bool contains(unsigned int id) const
Definition: FWGeometry.h:98
#define end
Definition: vmac.h:38
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:356
#define fwLog(_level_)
Definition: fwLog.h:51
collection_type data
Definition: DetSet.h:79
det_id_type id
Definition: DetSet.h:78
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:341
collection_type::const_iterator const_iterator
Definition: DetSet.h:34
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:106
float pixelLocalX(const double mpx, const int m_nrows)
Definition: TrackUtils.cc:165
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:682
const FWSiPixelDigiProxyBuilder & operator=(const FWSiPixelDigiProxyBuilder &)