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;
33 
34 public:
37 };
38 
39 void FWSiStripDigiProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) {
40  const edm::DetSetVector<SiStripDigi>* digis = nullptr;
41 
42  iItem->get(digis);
43 
44  if (!digis) {
45  return;
46  }
47  const FWGeometry* geom = iItem->getGeom();
48 
49  for (edm::DetSetVector<SiStripDigi>::const_iterator it = digis->begin(), end = digis->end(); it != end; ++it) {
50  edm::DetSet<SiStripDigi> ds = *it;
51  const uint32_t& id = ds.id;
52 
53  const float* pars = geom->getParameters(id);
54 
55  for (edm::DetSet<SiStripDigi>::const_iterator idigi = ds.data.begin(), idigiEnd = ds.data.end(); idigi != idigiEnd;
56  ++idigi) {
57  TEveStraightLineSet* lineSet = new TEveStraightLineSet;
58  setupAddElement(lineSet, product);
59 
60  if (!geom->contains(id)) {
61  fwLog(fwlog::kWarning) << "failed get geometry and topology of SiStripDigi with detid: " << id << std::endl;
62  continue;
63  }
64  float localTop[3] = {0.0, 0.0, 0.0};
65  float localBottom[3] = {0.0, 0.0, 0.0};
66 
67  fireworks::localSiStrip((*idigi).strip(), localTop, localBottom, pars, id);
68 
69  float globalTop[3];
70  float globalBottom[3];
71  geom->localToGlobal(id, localTop, globalTop, localBottom, globalBottom);
72 
73  lineSet->AddLine(globalTop[0], globalTop[1], globalTop[2], globalBottom[0], globalBottom[1], globalBottom[2]);
74  } // end of iteration over digis
75  } // end of iteration over the DetSetVector
76 }
77 
80  "SiStripDigi",
const FWSiStripDigiProxyBuilder & operator=(const FWSiStripDigiProxyBuilder &)=delete
#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
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
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:316
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
#define fwLog(_level_)
Definition: fwLog.h:45
collection_type data
Definition: DetSet.h:80
det_id_type id
Definition: DetSet.h:79
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:305
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102