CMS 3D CMS Logo

FWME0DigiProxyBuilder.cc
Go to the documentation of this file.
1 //#include "TEveStraightLineSet.h"
2 #include "TEveBoxSet.h"
3 #include "TEveCompound.h"
4 #include "TEveGeoNode.h"
5 
10 
14 
16 public:
18  ~FWME0DigiProxyBuilder() override {}
19 
21 
24 
25 private:
26  void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
27 };
28 
29 void FWME0DigiProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) {
30  const ME0DigiPreRecoCollection* digis = nullptr;
31 
32  iItem->get(digis);
33 
34  if (!digis) {
35  fwLog(fwlog::kWarning) << "Failed to get ME0Digis" << std::endl;
36  return;
37  }
38  const FWGeometry* geom = iItem->getGeom();
39 
40  for (ME0DigiPreRecoCollection::DigiRangeIterator dri = digis->begin(), driEnd = digis->end(); dri != driEnd; ++dri) {
41  unsigned int rawid = (*dri).first.rawId();
42  const ME0DigiPreRecoCollection::Range& range = (*dri).second;
43 
44  if (!geom->contains(rawid)) {
45  fwLog(fwlog::kWarning) << "Failed to get geometry of ME0 roll with detid: " << rawid << std::endl;
46 
47  TEveCompound* compound = createCompound();
48  setupAddElement(compound, product);
49 
50  continue;
51  }
52 
53  for (ME0DigiPreRecoCollection::const_iterator dit = range.first; dit != range.second; ++dit) {
54  TEveBoxSet* stripDigiSet = new TEveBoxSet;
55  setupAddElement(stripDigiSet, product);
56 
57  float localPoint[3] = {(*dit).x(), (*dit).y(), 0.0};
58  float globalPoint[3];
59 
60  geom->localToGlobal(rawid, localPoint, globalPoint);
61 
62  stripDigiSet->AddBox(globalPoint[0], globalPoint[1], globalPoint[2], (*dit).ex(), (*dit).ey(), 0.1);
63  }
64  }
65 }
66 
69  "ME0Digi",
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:57
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void get(const T *&oData) const
Definition: FWEventItem.h:78
const FWME0DigiProxyBuilder & operator=(const FWME0DigiProxyBuilder &)=delete
static const int kAll3DBits
Definition: FWViewType.h:58
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
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator