CMS 3D CMS Logo

FWGEMRecHitProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Muons
4 // Class : FWGEMRecHitProxyBuilder
5 //
6 //
7 // Original Author:
8 // Created: Sun Jan 6 23:42:33 EST 2008
9 // $Id: FWRPCRecHitProxyBuilder.cc,v 1.16 2010/11/11 20:25:28 amraktad Exp $
10 // $Id: FWGEMRecHitProxyBuilder.cc,v 1.17 2013/10/10 21:57:00 Yusang Kim $
11 //
12 
13 #include "TEveGeoNode.h"
14 #include "TEveStraightLineSet.h"
15 
20 
22 
24 public:
27 
28  bool haveSingleProduct() const override { return false; }
29 
31 
32 private:
35 
37  void buildViewType(const GEMRecHit& iData,
38  unsigned int iIndex,
39  TEveElement& oItemHolder,
41  const FWViewContext*) override;
42 };
43 
45  unsigned int iIndex,
46  TEveElement& oItemHolder,
48  const FWViewContext*) {
49  GEMDetId gemId = iData.gemId();
50  unsigned int rawid = gemId.rawId();
51 
52  const FWGeometry* geom = item()->getGeom();
53 
54  if (!geom->contains(rawid)) {
55  fwLog(fwlog::kError) << "failed to get geometry of GEM roll with detid: " << rawid << std::endl;
56  return;
57  }
58 
59  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
60  recHitSet->SetLineWidth(3);
61 
63  TEveGeoShape* shape = geom->getEveShape(rawid);
64  shape->SetMainTransparency(75);
65  shape->SetMainColor(item()->defaultDisplayProperties().color());
66  recHitSet->AddElement(shape);
67  }
68 
69  float localX = iData.localPosition().x();
70  float localY = iData.localPosition().y();
71  float localZ = iData.localPosition().z();
72 
73  float localXerr = sqrt(iData.localPositionError().xx());
74  float localYerr = sqrt(iData.localPositionError().yy());
75 
76  float localU1[3] = {localX - localXerr, localY, localZ};
77 
78  float localU2[3] = {localX + localXerr, localY, localZ};
79 
80  float localV1[3] = {localX, localY - localYerr, localZ};
81 
82  float localV2[3] = {localX, localY + localYerr, localZ};
83 
84  float globalU1[3];
85  float globalU2[3];
86  float globalV1[3];
87  float globalV2[3];
88 
89  FWGeometry::IdToInfoItr det = geom->find(rawid);
90 
91  geom->localToGlobal(*det, localU1, globalU1);
92  geom->localToGlobal(*det, localU2, globalU2);
93  geom->localToGlobal(*det, localV1, globalV1);
94  geom->localToGlobal(*det, localV2, globalV2);
95 
96  recHitSet->AddLine(globalU1[0], globalU1[1], globalU1[2], globalU2[0], globalU2[1], globalU2[2]);
97 
98  recHitSet->AddLine(globalV1[0], globalV1[1], globalV1[2], globalV2[0], globalV2[1], globalV2[2]);
99 
100  setupAddElement(recHitSet, &oItemHolder);
101 }
102 
104  GEMRecHit,
105  "GEM RecHits",
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
FWGeometry
Definition: FWGeometry.h:27
FWSimpleProxyBuilderTemplate.h
phase1PixelTopology::localY
constexpr uint16_t localY(uint16_t py)
Definition: phase1PixelTopology.h:58
FWViewType::EType
EType
Definition: FWViewType.h:31
GEMRecHit::localPositionError
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: GEMRecHit.h:40
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
FWGEMRecHitProxyBuilder::haveSingleProduct
bool haveSingleProduct() const override
Definition: FWGEMRecHitProxyBuilder.cc:28
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
FWGEMRecHitProxyBuilder::~FWGEMRecHitProxyBuilder
~FWGEMRecHitProxyBuilder() override
Definition: FWGEMRecHitProxyBuilder.cc:26
LocalError::xx
float xx() const
Definition: LocalError.h:22
FWGEMRecHitProxyBuilder::FWGEMRecHitProxyBuilder
FWGEMRecHitProxyBuilder()
Definition: FWGEMRecHitProxyBuilder.cc:25
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
FWGEMRecHitProxyBuilder::operator=
const FWGEMRecHitProxyBuilder & operator=(const FWGEMRecHitProxyBuilder &)=delete
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
phase1PixelTopology::localX
constexpr uint16_t localX(uint16_t px)
Definition: phase1PixelTopology.h:49
FWGeometry.h
FWGEMRecHitProxyBuilder
Definition: FWGEMRecHitProxyBuilder.cc:23
GEMDetId
Definition: GEMDetId.h:17
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
GEMRecHitCollection.h
GEMRecHit::gemId
GEMDetId gemId() const
Return the gemId.
Definition: GEMRecHit.h:65
fwLog.h
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
FWViewType::kISpy
Definition: FWViewType.h:35
FWViewType::k3D
Definition: FWViewType.h:34
FWGEMRecHitProxyBuilder::buildViewType
void buildViewType(const GEMRecHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
Definition: FWGEMRecHitProxyBuilder.cc:44
GEMRecHit
Definition: GEMRecHit.h:14
fwlog::kError
Definition: fwLog.h:35
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
LocalError::yy
float yy() const
Definition: LocalError.h:24
GEMRecHit::localPosition
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: GEMRecHit.h:37