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 
22 private:
23  void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
26 };
27 
28 void FWME0DigiProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) {
29  const ME0DigiPreRecoCollection* digis = nullptr;
30 
31  iItem->get(digis);
32 
33  if (!digis) {
34  fwLog(fwlog::kWarning) << "Failed to get ME0Digis" << std::endl;
35  return;
36  }
37  const FWGeometry* geom = iItem->getGeom();
38 
39  for (ME0DigiPreRecoCollection::DigiRangeIterator dri = digis->begin(), driEnd = digis->end(); dri != driEnd; ++dri) {
40  unsigned int rawid = (*dri).first.rawId();
41  const ME0DigiPreRecoCollection::Range& range = (*dri).second;
42 
43  if (!geom->contains(rawid)) {
44  fwLog(fwlog::kWarning) << "Failed to get geometry of ME0 roll with detid: " << rawid << std::endl;
45 
46  TEveCompound* compound = createCompound();
47  setupAddElement(compound, product);
48 
49  continue;
50  }
51 
52  for (ME0DigiPreRecoCollection::const_iterator dit = range.first; dit != range.second; ++dit) {
53  TEveBoxSet* stripDigiSet = new TEveBoxSet;
54  setupAddElement(stripDigiSet, product);
55 
56  float localPoint[3] = {(*dit).x(), (*dit).y(), 0.0};
57  float globalPoint[3];
58 
59  geom->localToGlobal(rawid, localPoint, globalPoint);
60 
61  stripDigiSet->AddBox(globalPoint[0], globalPoint[1], globalPoint[2], (*dit).ex(), (*dit).ey(), 0.1);
62  }
63  }
64 }
65 
68  "ME0Digi",
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
ME0DigiPreRecoCollection
FWGeometry
Definition: FWGeometry.h:27
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
FWEventItem::get
void get(const T *&oData) const
Definition: FWEventItem.h:78
FWProxyBuilderBase.h
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:28
FWProxyBuilderBase::createCompound
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
Definition: FWProxyBuilderBase.cc:374
MuonDigiCollection::const_iterator
std::vector< DigiType >::const_iterator const_iterator
Definition: MuonDigiCollection.h:94
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
FWME0DigiProxyBuilder
Definition: FWME0DigiProxyBuilder.cc:15
FWME0DigiProxyBuilder::~FWME0DigiProxyBuilder
~FWME0DigiProxyBuilder() override
Definition: FWME0DigiProxyBuilder.cc:18
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
FWGeometry.h
FWME0DigiProxyBuilder::operator=
const FWME0DigiProxyBuilder & operator=(const FWME0DigiProxyBuilder &)=delete
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
fwlog::kWarning
Definition: fwLog.h:35
fwLog.h
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
ME0Geometry.h
FWME0DigiProxyBuilder::FWME0DigiProxyBuilder
FWME0DigiProxyBuilder()
Definition: FWME0DigiProxyBuilder.cc:17
FWEventItem
Definition: FWEventItem.h:56
ME0DigiPreRecoCollection.h
FWProxyBuilderBase
Definition: FWProxyBuilderBase.h:46
ME0EtaPartition.h
MuonDigiCollection::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
DigiContainerIterator
Definition: MuonDigiCollection.h:30