CMS 3D CMS Logo

FWSiStripDigiProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Tracks
4 // Class : FWSiStripDigiProxyBuilder
5 //
6 //
7 // Original Author:
8 // Created: Thu Dec 6 18:01:21 PST 2007
9 //
10 
11 #include "TEveStraightLineSet.h"
12 
18 
22 
24 public:
26  ~FWSiStripDigiProxyBuilder(void) override {}
27 
29 
30 private:
32  void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
35 };
36 
37 void FWSiStripDigiProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) {
38  const edm::DetSetVector<SiStripDigi>* digis = nullptr;
39 
40  iItem->get(digis);
41 
42  if (!digis) {
43  return;
44  }
45  const FWGeometry* geom = iItem->getGeom();
46 
47  for (edm::DetSetVector<SiStripDigi>::const_iterator it = digis->begin(), end = digis->end(); it != end; ++it) {
48  edm::DetSet<SiStripDigi> ds = *it;
49  const uint32_t& id = ds.id;
50 
51  const float* pars = geom->getParameters(id);
52 
53  for (edm::DetSet<SiStripDigi>::const_iterator idigi = ds.data.begin(), idigiEnd = ds.data.end(); idigi != idigiEnd;
54  ++idigi) {
55  TEveStraightLineSet* lineSet = new TEveStraightLineSet;
56  setupAddElement(lineSet, product);
57 
58  if (!geom->contains(id)) {
59  fwLog(fwlog::kWarning) << "failed get geometry and topology of SiStripDigi with detid: " << id << std::endl;
60  continue;
61  }
62  float localTop[3] = {0.0, 0.0, 0.0};
63  float localBottom[3] = {0.0, 0.0, 0.0};
64 
65  fireworks::localSiStrip((*idigi).strip(), localTop, localBottom, pars, id);
66 
67  float globalTop[3];
68  float globalBottom[3];
69  geom->localToGlobal(id, localTop, globalTop, localBottom, globalBottom);
70 
71  lineSet->AddLine(globalTop[0], globalTop[1], globalTop[2], globalBottom[0], globalBottom[1], globalBottom[2]);
72  } // end of iteration over digis
73  } // end of iteration over the DetSetVector
74 }
75 
78  "SiStripDigi",
const FWSiStripDigiProxyBuilder & operator=(const FWSiStripDigiProxyBuilder &)=delete
static const int kAllRPZBits
Definition: FWViewType.h:67
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:474
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void get(const T *&oData) const
Definition: FWEventItem.h:78
static const int kAll3DBits
Definition: FWViewType.h:68
void localSiStrip(short strip, float *localTop, float *localBottom, const float *pars, unsigned int id)
Definition: TrackUtils.cc:263
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:496
bool contains(unsigned int id) const
Definition: FWGeometry.h:139
#define end
Definition: vmac.h:39
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
#define fwLog(_level_)
Definition: fwLog.h:45
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
collection_type data
Definition: DetSet.h:81
det_id_type id
Definition: DetSet.h:80
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
collection_type::const_iterator const_iterator
Definition: DetSet.h:32
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548