CMS 3D CMS Logo

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  ~FWSiPixelDigiProxyBuilder( void ) override {}
28 
30 
31 private:
32  // Disable default copy constructor
34  // Disable default assignment operator
36 
38  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 = nullptr;
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 ),
78  fireworks::pixelLocalY(( *idigi ).column(), pars ),
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
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:446
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void get(const T *&oData) const
Definition: FWEventItem.h:85
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:478
bool contains(unsigned int id) const
Definition: FWGeometry.h:117
#define end
Definition: vmac.h:39
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
float pixelLocalX(const double mpx, const float *)
Definition: TrackUtils.cc:160
float pixelLocalY(const double mpy, const float *)
Definition: TrackUtils.cc:216
#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:346
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
const FWSiPixelDigiProxyBuilder & operator=(const FWSiPixelDigiProxyBuilder &)=delete
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683