CMS 3D CMS Logo

FWPhase2TrackerCluster1DProxyBuilder.cc
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 //
4 // Package: Tracks
5 // Class : FWPhase2TrackerCluster1DProxyBuilder
6 //
7 //
8 
9 #include "TEvePointSet.h"
10 #include "TEveStraightLineSet.h"
11 #include "TEveCompound.h"
12 #include "TEveBox.h"
18 
20 
22 {
23 public:
26 
28 
31 
32 private:
34  void build( const FWEventItem* iItem, TEveElementList* product, const FWViewContext* ) override;
35 };
36 
37 void
38 FWPhase2TrackerCluster1DProxyBuilder::build( const FWEventItem* iItem, TEveElementList* product , const FWViewContext* )
39 {
40  const Phase2TrackerCluster1DCollectionNew* pixels = nullptr;
41 
42  iItem->get( pixels );
43 
44  if( ! pixels ) {
45  fwLog( fwlog::kWarning ) << "failed get SiPixelDigis" << std::endl;
46  return;
47  }
48 
49  for( Phase2TrackerCluster1DCollectionNew::const_iterator set = pixels->begin(), setEnd = pixels->end();
50  set != setEnd; ++set ) {
51  unsigned int id = set->detId();
52 
53  const FWGeometry *geom = iItem->getGeom();
54  const float* pars = geom->getParameters( id );
55  const float* shape = geom->getShapePars( id );
56 
58 
59  for( edmNew::DetSet<Phase2TrackerCluster1D>::const_iterator itc = clusters.begin(), edc = clusters.end();
60  itc != edc; ++itc ) {
61  TEveElement* itemHolder = createCompound();
62  product->AddElement(itemHolder);
63 
64  TEvePointSet* pointSet = new TEvePointSet;
65 
66  if( ! geom->contains( id )) {
68  << "failed get geometry of Phase2TrackerCluster1D with detid: "
69  << id << std::endl;
70  continue;
71  }
72 
73  float localPoint[3] = {
74  fireworks::phase2PixelLocalX(( *itc ).center(), pars, shape ),
75  fireworks::phase2PixelLocalY(( *itc ).column(), pars, shape ),
76  0.0
77  };
78 
79  float globalPoint[3];
80  geom->localToGlobal( id, localPoint, globalPoint );
81 
82  pointSet->SetNextPoint( globalPoint[0], globalPoint[1], globalPoint[2] );
83 
84  setupAddElement( pointSet, itemHolder );
85  }
86  }
87 }
88 
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
#define REGISTER_PROXYBUILDER_METHODS()
const_iterator end(bool update=false) const
#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
float phase2PixelLocalY(const double mpy, const float *, const float *)
Definition: TrackUtils.cc:269
data_type const * const_iterator
Definition: DetSetNew.h:30
const FWPhase2TrackerCluster1DProxyBuilder & operator=(const FWPhase2TrackerCluster1DProxyBuilder &)=delete
static const int kAll3DBits
Definition: FWViewType.h:59
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:462
float phase2PixelLocalX(const double mpx, const float *, const float *)
Definition: TrackUtils.cc:261
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 fwLog(_level_)
Definition: fwLog.h:50
iterator end()
Definition: DetSetNew.h:70
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:686
const_iterator begin(bool update=false) const
iterator begin()
Definition: DetSetNew.h:67