CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWSiPixelClusterProxyBuilder.cc
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 //
4 // Package: Tracks
5 // Class : FWSiPixelClusterProxyBuilder
6 //
7 //
8 // Original Author:
9 // Created: Thu Dec 6 18:01:21 PST 2007
10 // $Id: FWSiPixelClusterProxyBuilder.cc,v 1.17 2010/09/07 15:46:48 yana Exp $
11 //
12 
13 #include "TEvePointSet.h"
14 
20 
22 
24 {
25 public:
27  virtual ~FWSiPixelClusterProxyBuilder( void ) {}
28 
30 
31 private:
32  // Disable default copy constructor
34  // Disable default assignment operator
36 
37  virtual void build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* );
38 };
39 
40 void
41 FWSiPixelClusterProxyBuilder::build( const FWEventItem* iItem, TEveElementList* product , const FWViewContext* )
42 {
43  const SiPixelClusterCollectionNew* pixels = 0;
44 
45  iItem->get( pixels );
46 
47  if( ! pixels )
48  {
49  fwLog( fwlog::kWarning ) << "failed get SiPixelDigis" << std::endl;
50  return;
51  }
52 
53  for( SiPixelClusterCollectionNew::const_iterator set = pixels->begin(), setEnd = pixels->end();
54  set != setEnd; ++set )
55  {
56  unsigned int id = set->detId();
57 
58  const FWGeometry *geom = iItem->getGeom();
59  const float* pars = geom->getParameters( id );
60 
61  const edmNew::DetSet<SiPixelCluster> & clusters = *set;
62 
63  for( edmNew::DetSet<SiPixelCluster>::const_iterator itc = clusters.begin(), edc = clusters.end();
64  itc != edc; ++itc )
65  {
66  TEvePointSet* pointSet = new TEvePointSet;
67  setupAddElement( pointSet, product );
68 
69  if( ! geom->contains( id ))
70  {
72  << "failed get geometry of SiPixelCluster with detid: "
73  << id << std::endl;
74  continue;
75  }
76 
77  float localPoint[3] =
78  {
79  fireworks::pixelLocalX(( *itc ).minPixelRow(), ( int )pars[0] ),
80  fireworks::pixelLocalY(( *itc ).minPixelCol(), ( int )pars[1] ),
81  0.0
82  };
83 
84  float globalPoint[3];
85  geom->localToGlobal( id, localPoint, globalPoint );
86 
87  pointSet->SetNextPoint( globalPoint[0], globalPoint[1], globalPoint[2] );
88  }
89  }
90 }
91 
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator begin() const
#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
data_type const * const_iterator
Definition: DetSetNew.h:25
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
const_iterator end() const
#define fwLog(_level_)
Definition: fwLog.h:51
iterator end()
Definition: DetSetNew.h:59
const FWSiPixelClusterProxyBuilder & operator=(const FWSiPixelClusterProxyBuilder &)
float pixelLocalX(const double mpx, const int m_nrows)
Definition: TrackUtils.cc:165
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681
void set(const std::string &name, int value)
set the flag, with a run-time name
iterator begin()
Definition: DetSetNew.h:56