CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
FWME0RecHitProxyBuilder.cc
Go to the documentation of this file.
1 #include "TEveGeoNode.h"
2 #include "TEveGeoShape.h"
3 #include "TEveStraightLineSet.h"
4 
9 
11 
13 public:
16 
17  bool haveSingleProduct() const override { return false; }
18 
20 
23 
24 private:
25  void buildViewType(const ME0RecHit& iData,
26  unsigned int iIndex,
27  TEveElement& oItemHolder,
29  const FWViewContext*) override;
30 };
31 
33  unsigned int iIndex,
34  TEveElement& oItemHolder,
36  const FWViewContext*) {
37  ME0DetId me0Id = iData.me0Id();
38  unsigned int rawid = me0Id.rawId();
39 
40  const FWGeometry* geom = item()->getGeom();
41 
42  if (!geom->contains(rawid)) {
43  fwLog(fwlog::kError) << "failed to get geometry of ME0 roll with detid: " << rawid << std::endl;
44  return;
45  }
46 
47  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
48  recHitSet->SetLineWidth(3);
49 
50  if (type == FWViewType::k3D || type == FWViewType::kISpy) {
51  TEveGeoShape* shape = geom->getEveShape(rawid);
52  shape->SetMainTransparency(75);
53  shape->SetMainColor(item()->defaultDisplayProperties().color());
54  recHitSet->AddElement(shape);
55  }
56 
57  float localX = iData.localPosition().x();
58  float localY = iData.localPosition().y();
59  float localZ = iData.localPosition().z();
60 
61  float localXerr = sqrt(iData.localPositionError().xx());
62  float localYerr = sqrt(iData.localPositionError().yy());
63 
64  float localU1[3] = {localX - localXerr, localY, localZ};
65 
66  float localU2[3] = {localX + localXerr, localY, localZ};
67 
68  float localV1[3] = {localX, localY - localYerr, localZ};
69 
70  float localV2[3] = {localX, localY + localYerr, localZ};
71 
72  float globalU1[3];
73  float globalU2[3];
74  float globalV1[3];
75  float globalV2[3];
76 
77  FWGeometry::IdToInfoItr det = geom->find(rawid);
78 
79  geom->localToGlobal(*det, localU1, globalU1);
80  geom->localToGlobal(*det, localU2, globalU2);
81  geom->localToGlobal(*det, localV1, globalV1);
82  geom->localToGlobal(*det, localV2, globalV2);
83 
84  recHitSet->AddLine(globalU1[0], globalU1[1], globalU1[2], globalU2[0], globalU2[1], globalU2[2]);
85 
86  recHitSet->AddLine(globalV1[0], globalV1[1], globalV1[2], globalV2[0], globalV2[1], globalV2[2]);
87 
88  setupAddElement(recHitSet, &oItemHolder);
89 }
90 
92  ME0RecHit,
93  "ME0 RecHits",
const FWME0RecHitProxyBuilder & operator=(const FWME0RecHitProxyBuilder &)=delete
float xx() const
Definition: LocalError.h:22
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:67
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: ME0RecHit.h:36
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:514
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:68
float yy() const
Definition: LocalError.h:24
TEveGeoShape * getEveShape(unsigned int id) const
Definition: FWGeometry.cc:318
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:494
bool contains(unsigned int id) const
Definition: FWGeometry.h:139
bool haveSingleProduct() const override
#define fwLog(_level_)
Definition: fwLog.h:45
constexpr uint16_t localX(uint16_t px)
constexpr uint16_t localY(uint16_t py, uint16_t n)
ME0DetId me0Id() const
Return the gemId.
Definition: ME0RecHit.h:64
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: ME0RecHit.h:39
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