CMS 3D CMS Logo

FWRPCRecHitProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Muons
4 // Class : FWRPCRecHitProxyBuilder
5 //
6 //
7 // Original Author:
8 // Created: Sun Jan 6 23:42:33 EST 2008
9 //
10 
11 #include "TEveGeoNode.h"
12 #include "TEveGeoShape.h"
13 #include "TEveStraightLineSet.h"
14 
19 
21 
23 public:
26 
27  bool haveSingleProduct() const override { return false; }
28 
30 
31 private:
34 
36  void buildViewType(const RPCRecHit& iData,
37  unsigned int iIndex,
38  TEveElement& oItemHolder,
40  const FWViewContext*) override;
41 };
42 
44  unsigned int iIndex,
45  TEveElement& oItemHolder,
47  const FWViewContext*) {
48  RPCDetId rpcId = iData.rpcId();
49  unsigned int rawid = rpcId.rawId();
50 
51  const FWGeometry* geom = item()->getGeom();
52 
53  if (!geom->contains(rawid)) {
54  fwLog(fwlog::kError) << "failed to get geometry of RPC roll with detid: " << rawid << std::endl;
55  return;
56  }
57 
58  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
59  recHitSet->SetLineWidth(3);
60 
62  TEveGeoShape* shape = geom->getEveShape(rawid);
63  shape->SetMainTransparency(75);
64  shape->SetMainColor(item()->defaultDisplayProperties().color());
65  recHitSet->AddElement(shape);
66  }
67 
68  float localX = iData.localPosition().x();
69  float localY = iData.localPosition().y();
70  float localZ = iData.localPosition().z();
71 
72  float localXerr = sqrt(iData.localPositionError().xx());
73  float localYerr = sqrt(iData.localPositionError().yy());
74 
75  float localU1[3] = {localX - localXerr, localY, localZ};
76 
77  float localU2[3] = {localX + localXerr, localY, localZ};
78 
79  float localV1[3] = {localX, localY - localYerr, localZ};
80 
81  float localV2[3] = {localX, localY + localYerr, localZ};
82 
83  float globalU1[3];
84  float globalU2[3];
85  float globalV1[3];
86  float globalV2[3];
87 
88  FWGeometry::IdToInfoItr det = geom->find(rawid);
89 
90  geom->localToGlobal(*det, localU1, globalU1);
91  geom->localToGlobal(*det, localU2, globalU2);
92  geom->localToGlobal(*det, localV1, globalV1);
93  geom->localToGlobal(*det, localV2, globalV2);
94 
95  recHitSet->AddLine(globalU1[0], globalU1[1], globalU1[2], globalU2[0], globalU2[1], globalU2[2]);
96 
97  recHitSet->AddLine(globalV1[0], globalV1[1], globalV1[2], globalV2[0], globalV2[1], globalV2[2]);
98 
99  setupAddElement(recHitSet, &oItemHolder);
100 }
101 
103  RPCRecHit,
104  "RPC RecHits",
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
FWGeometry
Definition: FWGeometry.h:27
FWRPCRecHitProxyBuilder::FWRPCRecHitProxyBuilder
FWRPCRecHitProxyBuilder()
Definition: FWRPCRecHitProxyBuilder.cc:24
FWSimpleProxyBuilderTemplate.h
phase1PixelTopology::localY
constexpr uint16_t localY(uint16_t py)
Definition: phase1PixelTopology.h:58
FWViewType::EType
EType
Definition: FWViewType.h:31
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
RPCDetId
Definition: RPCDetId.h:16
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:28
FWGeometry::IdToInfoItr
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
FWRPCRecHitProxyBuilder::~FWRPCRecHitProxyBuilder
~FWRPCRecHitProxyBuilder() override
Definition: FWRPCRecHitProxyBuilder.cc:25
LocalError::xx
float xx() const
Definition: LocalError.h:22
FWRPCRecHitProxyBuilder
Definition: FWRPCRecHitProxyBuilder.cc:22
RPCRecHit
Definition: RPCRecHit.h:14
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
RPCRecHit::localPositionError
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: RPCRecHit.h:40
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
FWRPCRecHitProxyBuilder::operator=
const FWRPCRecHitProxyBuilder & operator=(const FWRPCRecHitProxyBuilder &)=delete
RPCRecHitCollection.h
phase1PixelTopology::localX
constexpr uint16_t localX(uint16_t px)
Definition: phase1PixelTopology.h:49
FWGeometry.h
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
RPCRecHit::localPosition
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: RPCRecHit.h:37
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
fwLog.h
FWRPCRecHitProxyBuilder::buildViewType
void buildViewType(const RPCRecHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
Definition: FWRPCRecHitProxyBuilder.cc:43
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
FWViewType::kISpy
Definition: FWViewType.h:35
FWViewType::k3D
Definition: FWViewType.h:34
fwlog::kError
Definition: fwLog.h:35
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
RPCRecHit::rpcId
RPCDetId rpcId() const
Return the rpcId.
Definition: RPCRecHit.h:71
FWRPCRecHitProxyBuilder::haveSingleProduct
bool haveSingleProduct() const override
Definition: FWRPCRecHitProxyBuilder.cc:27
LocalError::yy
float yy() const
Definition: LocalError.h:24