CMS 3D CMS Logo

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 
21 private:
24 
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 
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",
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:12
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:32
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:15
FWME0RecHitProxyBuilder::haveSingleProduct
bool haveSingleProduct() const override
Definition: FWME0RecHitProxyBuilder.cc:17
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
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:14
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
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