CMS 3D CMS Logo

FWME0RecHitProxyBuilder.cc
Go to the documentation of this file.
1 #include "TEveGeoNode.h"
2 #include "TEveStraightLineSet.h"
3 
8 
10 
12 public:
15 
16  bool haveSingleProduct() const override { return false; }
17 
19 
20 private:
23 
24  void buildViewType(const ME0RecHit& iData,
25  unsigned int iIndex,
26  TEveElement& oItemHolder,
28  const FWViewContext*) override;
29 };
30 
32  unsigned int iIndex,
33  TEveElement& oItemHolder,
35  const FWViewContext*) {
36  ME0DetId me0Id = iData.me0Id();
37  unsigned int rawid = me0Id.rawId();
38 
39  const FWGeometry* geom = item()->getGeom();
40 
41  if (!geom->contains(rawid)) {
42  fwLog(fwlog::kError) << "failed to get geometry of ME0 roll with detid: " << rawid << std::endl;
43  return;
44  }
45 
46  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
47  recHitSet->SetLineWidth(3);
48 
49  if (type == FWViewType::k3D || type == FWViewType::kISpy) {
50  TEveGeoShape* shape = geom->getEveShape(rawid);
51  shape->SetMainTransparency(75);
52  shape->SetMainColor(item()->defaultDisplayProperties().color());
53  recHitSet->AddElement(shape);
54  }
55 
56  float localX = iData.localPosition().x();
57  float localY = iData.localPosition().y();
58  float localZ = iData.localPosition().z();
59 
60  float localXerr = sqrt(iData.localPositionError().xx());
61  float localYerr = sqrt(iData.localPositionError().yy());
62 
63  float localU1[3] = {localX - localXerr, localY, localZ};
64 
65  float localU2[3] = {localX + localXerr, localY, localZ};
66 
67  float localV1[3] = {localX, localY - localYerr, localZ};
68 
69  float localV2[3] = {localX, localY + localYerr, localZ};
70 
71  float globalU1[3];
72  float globalU2[3];
73  float globalV1[3];
74  float globalV2[3];
75 
76  FWGeometry::IdToInfoItr det = geom->find(rawid);
77 
78  geom->localToGlobal(*det, localU1, globalU1);
79  geom->localToGlobal(*det, localU2, globalU2);
80  geom->localToGlobal(*det, localV1, globalV1);
81  geom->localToGlobal(*det, localV2, globalV2);
82 
83  recHitSet->AddLine(globalU1[0], globalU1[1], globalU1[2], globalU2[0], globalU2[1], globalU2[2]);
84 
85  recHitSet->AddLine(globalV1[0], globalV1[1], globalV1[2], globalV2[0], globalV2[1], globalV2[2]);
86 
87  setupAddElement(recHitSet, &oItemHolder);
88 }
89 
91  ME0RecHit,
92  "ME0 RecHits",
const FWME0RecHitProxyBuilder & operator=(const FWME0RecHitProxyBuilder &)=delete
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: ME0RecHit.h:39
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)
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:68
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: ME0RecHit.h:36
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
bool contains(unsigned int id) const
Definition: FWGeometry.h:139
#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_)
ME0DetId me0Id() const
Return the gemId.
Definition: ME0RecHit.h:64
bool haveSingleProduct() const override
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:137
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
void buildViewType(const ME0RecHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override