CMS 3D CMS Logo

FWRPCDigiProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Muon
4 // Class : FWRPCDigiProxyBuilder
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: mccauley
10 // Created: Sun Jan 6 23:57:00 EST 2008
11 //
12 
13 #include "TEveStraightLineSet.h"
14 #include "TEveCompound.h"
15 #include "TEveGeoNode.h"
16 
21 
23 
25 public:
27  ~FWRPCDigiProxyBuilder() override {}
28 
30 
31 private:
33  void build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) override;
36 };
37 
38 void FWRPCDigiProxyBuilder::build(const FWEventItem* iItem, TEveElementList* product, const FWViewContext*) {
39  const RPCDigiCollection* digis = nullptr;
40 
41  iItem->get(digis);
42 
43  if (!digis) {
44  fwLog(fwlog::kWarning) << "Failed to get RPCDigis" << std::endl;
45  return;
46  }
47  const FWGeometry* geom = iItem->getGeom();
48 
49  for (RPCDigiCollection::DigiRangeIterator dri = digis->begin(), driEnd = digis->end(); dri != driEnd; ++dri) {
50  unsigned int rawid = (*dri).first.rawId();
51  const RPCDigiCollection::Range& range = (*dri).second;
52 
53  if (!geom->contains(rawid)) {
54  fwLog(fwlog::kWarning) << "Failed to get geometry of RPC roll with detid: " << rawid << std::endl;
55 
56  TEveCompound* compound = createCompound();
57  setupAddElement(compound, product);
58 
59  continue;
60  }
61 
62  const float* parameters = geom->getParameters(rawid);
63  float nStrips = parameters[0];
64  float halfStripLength = parameters[1] * 0.5;
65  float pitch = parameters[2];
66  float offset = -0.5 * nStrips * pitch;
67 
68  for (RPCDigiCollection::const_iterator dit = range.first; dit != range.second; ++dit) {
69  TEveStraightLineSet* stripDigiSet = new TEveStraightLineSet;
70  stripDigiSet->SetLineWidth(3);
71  setupAddElement(stripDigiSet, product);
72 
73  int strip = (*dit).strip();
74  float centreOfStrip = (strip - 0.5) * pitch + offset;
75 
76  float localPointTop[3] = {centreOfStrip, halfStripLength, 0.0};
77 
78  float localPointBottom[3] = {centreOfStrip, -halfStripLength, 0.0};
79 
80  float globalPointTop[3];
81  float globalPointBottom[3];
82 
83  geom->localToGlobal(rawid, localPointTop, globalPointTop, localPointBottom, globalPointBottom);
84 
85  stripDigiSet->AddLine(globalPointTop[0],
86  globalPointTop[1],
87  globalPointTop[2],
88  globalPointBottom[0],
89  globalPointBottom[1],
90  globalPointBottom[2]);
91  }
92  }
93 }
94 
97  "RPCDigi",
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:30
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
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
FWRPCDigiProxyBuilder
Definition: FWRPCDigiProxyBuilder.cc:24
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
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:27
FWProxyBuilderBase::createCompound
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
Definition: FWProxyBuilderBase.cc:374
MuonDigiCollection< RPCDetId, RPCDigi >::const_iterator
std::vector< RPCDigi >::const_iterator const_iterator
Definition: MuonDigiCollection.h:94
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
RPCDigiCollection
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
FWRPCDigiProxyBuilder::FWRPCDigiProxyBuilder
FWRPCDigiProxyBuilder()
Definition: FWRPCDigiProxyBuilder.cc:26
FWRPCDigiProxyBuilder::~FWRPCDigiProxyBuilder
~FWRPCDigiProxyBuilder() override
Definition: FWRPCDigiProxyBuilder.cc:27
FWGeometry.h
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
FWRPCDigiProxyBuilder::operator=
const FWRPCDigiProxyBuilder & operator=(const FWRPCDigiProxyBuilder &)=delete
fwlog::kWarning
Definition: fwLog.h:35
fwLog.h
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
me0TriggerPseudoDigis_cff.nStrips
nStrips
1.2 is to make the matching window safely the two nearest strips 0.35 is the size of an ME0 chamber i...
Definition: me0TriggerPseudoDigis_cff.py:26
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
FWEventItem
Definition: FWEventItem.h:56
FWProxyBuilderBase
Definition: FWProxyBuilderBase.h:46
MuonDigiCollection< RPCDetId, RPCDigi >::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
RPCDigiCollection.h
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
DigiContainerIterator
Definition: MuonDigiCollection.h:30