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 "TEveStraightLineSet.h"
13 
18 
20 
22 public:
25 
26  bool haveSingleProduct() const override { return false; }
27 
29 
30 private:
33 
35  void buildViewType(const RPCRecHit& iData,
36  unsigned int iIndex,
37  TEveElement& oItemHolder,
39  const FWViewContext*) override;
40 };
41 
43  unsigned int iIndex,
44  TEveElement& oItemHolder,
46  const FWViewContext*) {
47  RPCDetId rpcId = iData.rpcId();
48  unsigned int rawid = rpcId.rawId();
49 
50  const FWGeometry* geom = item()->getGeom();
51 
52  if (!geom->contains(rawid)) {
53  fwLog(fwlog::kError) << "failed to get geometry of RPC roll with detid: " << rawid << std::endl;
54  return;
55  }
56 
57  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
58  recHitSet->SetLineWidth(3);
59 
60  if (type == FWViewType::k3D || type == FWViewType::kISpy) {
61  TEveGeoShape* shape = geom->getEveShape(rawid);
62  shape->SetMainTransparency(75);
63  shape->SetMainColor(item()->defaultDisplayProperties().color());
64  recHitSet->AddElement(shape);
65  }
66 
67  float localX = iData.localPosition().x();
68  float localY = iData.localPosition().y();
69  float localZ = iData.localPosition().z();
70 
71  float localXerr = sqrt(iData.localPositionError().xx());
72  float localYerr = sqrt(iData.localPositionError().yy());
73 
74  float localU1[3] = {localX - localXerr, localY, localZ};
75 
76  float localU2[3] = {localX + localXerr, localY, localZ};
77 
78  float localV1[3] = {localX, localY - localYerr, localZ};
79 
80  float localV2[3] = {localX, localY + localYerr, localZ};
81 
82  float globalU1[3];
83  float globalU2[3];
84  float globalV1[3];
85  float globalV2[3];
86 
87  FWGeometry::IdToInfoItr det = geom->find(rawid);
88 
89  geom->localToGlobal(*det, localU1, globalU1);
90  geom->localToGlobal(*det, localU2, globalU2);
91  geom->localToGlobal(*det, localV1, globalV1);
92  geom->localToGlobal(*det, localV2, globalV2);
93 
94  recHitSet->AddLine(globalU1[0], globalU1[1], globalU1[2], globalU2[0], globalU2[1], globalU2[2]);
95 
96  recHitSet->AddLine(globalV1[0], globalV1[1], globalV1[2], globalV2[0], globalV2[1], globalV2[2]);
97 
98  setupAddElement(recHitSet, &oItemHolder);
99 }
100 
102  RPCRecHit,
103  "RPC RecHits",
type
Definition: HCALResponse.h:21
float xx() const
Definition: LocalError.h:22
static const int kAllRPZBits
Definition: FWViewType.h:67
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:458
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
constexpr uint16_t localY(uint16_t py)
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: RPCRecHit.h:40
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:68
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: RPCRecHit.h:37
RPCDetId rpcId() const
Return the rpcId.
Definition: RPCRecHit.h:71
float yy() const
Definition: LocalError.h:24
TEveGeoShape * getEveShape(unsigned int id) const
Definition: FWGeometry.cc:262
T sqrt(T t)
Definition: SSEVec.h:19
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:438
void buildViewType(const RPCRecHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
bool contains(unsigned int id) const
Definition: FWGeometry.h:139
const FWRPCRecHitProxyBuilder & operator=(const FWRPCRecHitProxyBuilder &)=delete
#define fwLog(_level_)
Definition: fwLog.h:45
constexpr uint16_t localX(uint16_t px)
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
bool haveSingleProduct() const override
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548