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 //
11 
12 #include "TEvePointSet.h"
13 
19 
21 
23 {
24 public:
26  virtual ~FWSiPixelClusterProxyBuilder( void ) {}
27 
29 
30 private:
31  // Disable default copy constructor
33  // Disable default assignment operator
35 
36  virtual void build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* ) override;
37 };
38 
39 void
40 FWSiPixelClusterProxyBuilder::build( const FWEventItem* iItem, TEveElementList* product , const FWViewContext* )
41 {
42  const SiPixelClusterCollectionNew* pixels = 0;
43 
44  iItem->get( pixels );
45 
46  if( ! pixels )
47  {
48  fwLog( fwlog::kWarning ) << "failed get SiPixelDigis" << std::endl;
49  return;
50  }
51 
52  for( SiPixelClusterCollectionNew::const_iterator set = pixels->begin(), setEnd = pixels->end();
53  set != setEnd; ++set )
54  {
55  unsigned int id = set->detId();
56 
57  const FWGeometry *geom = iItem->getGeom();
58  const float* pars = geom->getParameters( id );
59 
60  const edmNew::DetSet<SiPixelCluster> & clusters = *set;
61 
62  for( edmNew::DetSet<SiPixelCluster>::const_iterator itc = clusters.begin(), edc = clusters.end();
63  itc != edc; ++itc )
64  {
65  TEvePointSet* pointSet = new TEvePointSet;
66  setupAddElement( pointSet, product );
67 
68  if( ! geom->contains( id ))
69  {
71  << "failed get geometry of SiPixelCluster with detid: "
72  << id << std::endl;
73  continue;
74  }
75 
76  float localPoint[3] =
77  {
78  fireworks::pixelLocalX(( *itc ).minPixelRow(), ( int )pars[0] ),
79  fireworks::pixelLocalY(( *itc ).minPixelCol(), ( int )pars[1] ),
80  0.0
81  };
82 
83  float globalPoint[3];
84  geom->localToGlobal( id, localPoint, globalPoint );
85 
86  pointSet->SetNextPoint( globalPoint[0], globalPoint[1], globalPoint[2] );
87  }
88  }
89 }
90 
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
#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:197
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:84
data_type const * const_iterator
Definition: DetSetNew.h:30
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:325
bool contains(unsigned int id) const
Definition: FWGeometry.h:98
#define fwLog(_level_)
Definition: fwLog.h:50
const_iterator end(bool update=true) const
iterator end()
Definition: DetSetNew.h:70
const FWSiPixelClusterProxyBuilder & operator=(const FWSiPixelClusterProxyBuilder &)
const_iterator begin(bool update=true) const
float pixelLocalX(const double mpx, const int m_nrows)
Definition: TrackUtils.cc:164
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681
iterator begin()
Definition: DetSetNew.h:67