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 
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",
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
FWME0RecHitProxyBuilder::operator=
const FWME0RecHitProxyBuilder & operator=(const FWME0RecHitProxyBuilder &)=delete
FWGeometry
Definition: FWGeometry.h:27
ME0RecHitCollection.h
ME0RecHit::localPosition
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: ME0RecHit.h:36
FWME0RecHitProxyBuilder
Definition: FWME0RecHitProxyBuilder.cc:11
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
FWME0RecHitProxyBuilder::buildViewType
void buildViewType(const ME0RecHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
Definition: FWME0RecHitProxyBuilder.cc:31
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
LocalError::xx
float xx() const
Definition: LocalError.h:22
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
phase1PixelTopology::localX
constexpr uint16_t localX(uint16_t px)
Definition: phase1PixelTopology.h:49
FWGeometry.h
FWME0RecHitProxyBuilder::~FWME0RecHitProxyBuilder
~FWME0RecHitProxyBuilder() override
Definition: FWME0RecHitProxyBuilder.cc:14
FWME0RecHitProxyBuilder::haveSingleProduct
bool haveSingleProduct() const override
Definition: FWME0RecHitProxyBuilder.cc:16
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
ME0RecHit::me0Id
ME0DetId me0Id() const
Return the gemId.
Definition: ME0RecHit.h:64
ME0DetId
Definition: ME0DetId.h:16
fwLog.h
FWME0RecHitProxyBuilder::FWME0RecHitProxyBuilder
FWME0RecHitProxyBuilder()
Definition: FWME0RecHitProxyBuilder.cc:13
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
type
type
Definition: HCALResponse.h:21
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
ME0RecHit
Definition: ME0RecHit.h:16
FWViewType::kISpy
Definition: FWViewType.h:35
FWViewType::k3D
Definition: FWViewType.h:34
ME0RecHit::localPositionError
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: ME0RecHit.h:39
fwlog::kError
Definition: fwLog.h:35
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
LocalError::yy
float yy() const
Definition: LocalError.h:24