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 "TEveStraightLineSet.h"
10 #include "TEveCompound.h"
11 #include "TEveBox.h"
17 
19 
21 public:
24 
26 
29 
30 private:
31  void localModelChanges(const FWModelId& iId,
32  TEveElement* parent,
33  FWViewType::EType viewType,
34  const FWViewContext* vc) override;
35 
37  void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
38 };
39 
41  TEveElementList* product,
42  const FWViewContext*) {
43  const Phase2TrackerCluster1DCollectionNew* pixels = nullptr;
44 
45  iItem->get(pixels);
46 
47  if (!pixels) {
48  fwLog(fwlog::kWarning) << "failed get SiPixelDigis" << std::endl;
49  return;
50  }
51 
52  for (Phase2TrackerCluster1DCollectionNew::const_iterator set = pixels->begin(), setEnd = pixels->end(); set != setEnd;
53  ++set) {
54  unsigned int id = set->detId();
55 
56  const FWGeometry* geom = iItem->getGeom();
57  const float* pars = geom->getParameters(id);
58  const float* shape = geom->getShapePars(id);
59 
61 
63  itc != edc;
64  ++itc) {
65  TEveElement* itemHolder = createCompound();
66  product->AddElement(itemHolder);
67 
68  if (!geom->contains(id)) {
69  fwLog(fwlog::kWarning) << "failed get geometry of Phase2TrackerCluster1D with detid: " << id << std::endl;
70  continue;
71  }
72 
73  float halfLength = shape[2];
74  float pitchSecond = pars[1];
75 
76  // line
77  //
78  TEveStraightLineSet* lineSet = new TEveStraightLineSet;
79  float localPointBeg[3] = {fireworks::phase2PixelLocalX((*itc).center(), pars, shape),
80  float((*itc).column()) * pitchSecond - halfLength,
81  0.0};
82  float localPointEnd[3] = {fireworks::phase2PixelLocalX((*itc).center(), pars, shape),
83  float((*itc).column() + 1.0) * pitchSecond - halfLength,
84  0.0};
85 
86  float globalPointBeg[3];
87  float globalPointEnd[3];
88  geom->localToGlobal(id, localPointBeg, globalPointBeg);
89  geom->localToGlobal(id, localPointEnd, globalPointEnd);
90 
91  lineSet->AddLine(globalPointBeg, globalPointEnd);
92  lineSet->AddMarker(0, 0.5f);
93 
95  lineSet->SetMarkerColor(dp.color());
96 
97  setupAddElement(lineSet, itemHolder);
98  }
99  }
100 }
101 
103  TEveElement* parent,
104  FWViewType::EType viewType,
105  const FWViewContext* vc) {
106  if (TEveStraightLineSet* ls = dynamic_cast<TEveStraightLineSet*>(*parent->BeginChildren())) {
107  Color_t c = FWProxyBuilderBase::item()->modelInfo(iId.index()).displayProperties().color();
108  for (TEveProjectable::ProjList_i j = ls->BeginProjecteds(); j != ls->EndProjecteds(); ++j) {
109  if (TEveStraightLineSet* pls = dynamic_cast<TEveStraightLineSet*>(*j)) {
110  pls->SetMarkerColor(c);
111  pls->ElementChanged();
112  }
113  }
114 
115  ls->SetMarkerColor(c);
116  ls->ElementChanged();
117  }
118 }
119 
122  "Phase2TrackerCluster1D",
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:67
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void get(const T *&oData) const
Definition: FWEventItem.h:78
int index() const
Definition: FWModelId.h:41
data_type const * const_iterator
Definition: DetSetNew.h:31
const FWPhase2TrackerCluster1DProxyBuilder & operator=(const FWPhase2TrackerCluster1DProxyBuilder &)=delete
static const int kAll3DBits
Definition: FWViewType.h:68
const_iterator end(bool update=false) const
float phase2PixelLocalX(const double mpx, const float *, const float *)
Definition: TrackUtils.cc:249
const FWDisplayProperties & defaultDisplayProperties() const
Definition: FWEventItem.cc:403
double f[11][100]
void localModelChanges(const FWModelId &iId, TEveElement *parent, FWViewType::EType viewType, const FWViewContext *vc) override
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
def ls(path, rec=False)
Definition: eostools.py:349
const_iterator begin(bool update=false) const
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
#define fwLog(_level_)
Definition: fwLog.h:45
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
const FWEventItem * item() const