CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 public:
25 
27 
30 
31 private:
33  void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
34 };
35 
37  TEveElementList* product,
38  const FWViewContext*) {
39  const Phase2TrackerCluster1DCollectionNew* pixels = nullptr;
40 
41  iItem->get(pixels);
42 
43  if (!pixels) {
44  fwLog(fwlog::kWarning) << "failed get SiPixelDigis" << std::endl;
45  return;
46  }
47 
48  for (Phase2TrackerCluster1DCollectionNew::const_iterator set = pixels->begin(), setEnd = pixels->end(); set != setEnd;
49  ++set) {
50  unsigned int id = set->detId();
51 
52  const FWGeometry* geom = iItem->getGeom();
53  const float* pars = geom->getParameters(id);
54  const float* shape = geom->getShapePars(id);
55 
57 
58  for (edmNew::DetSet<Phase2TrackerCluster1D>::const_iterator itc = clusters.begin(), edc = clusters.end();
59  itc != edc;
60  ++itc) {
61  TEveElement* itemHolder = createCompound();
62  product->AddElement(itemHolder);
63 
64  TEvePointSet* pointSet = new TEvePointSet;
65 
66  if (!geom->contains(id)) {
67  fwLog(fwlog::kWarning) << "failed get geometry of Phase2TrackerCluster1D with detid: " << id << std::endl;
68  continue;
69  }
70 
71  float localPoint[3] = {fireworks::phase2PixelLocalX((*itc).center(), pars, shape),
72  fireworks::phase2PixelLocalY((*itc).column(), pars, shape),
73  0.0};
74 
75  float globalPoint[3];
76  geom->localToGlobal(id, localPoint, globalPoint);
77 
78  pointSet->SetNextPoint(globalPoint[0], globalPoint[1], globalPoint[2]);
79 
80  setupAddElement(pointSet, itemHolder);
81  }
82  }
83 }
84 
87  "Phase2TrackerCluster1D",
#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:67
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:472
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void get(const T *&oData) const
Definition: FWEventItem.h:78
float phase2PixelLocalY(const double mpy, const float *, const float *)
Definition: TrackUtils.cc:255
data_type const * const_iterator
Definition: DetSetNew.h:31
const FWPhase2TrackerCluster1DProxyBuilder & operator=(const FWPhase2TrackerCluster1DProxyBuilder &)=delete
static const int kAll3DBits
Definition: FWViewType.h:68
const float * getShapePars(unsigned int id) const
Definition: FWGeometry.cc:483
float phase2PixelLocalX(const double mpx, const float *, const float *)
Definition: TrackUtils.cc:249
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:494
bool contains(unsigned int id) const
Definition: FWGeometry.h:139
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
#define fwLog(_level_)
Definition: fwLog.h:45
iterator end()
Definition: DetSetNew.h:56
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
const_iterator begin(bool update=false) const
iterator begin()
Definition: DetSetNew.h:54