CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWRPCRecHitProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Muons
4 // Class : FWRPCRecHitProxyBuilder
5 //
6 //
7 // Original Author:
8 // Created: Sun Jan 6 23:42:33 EST 2008
9 //
10 
11 #include "TEveGeoNode.h"
12 #include "TEveStraightLineSet.h"
13 
18 
20 
22 {
23 public:
26 
27  virtual bool haveSingleProduct() const override
28  {
29  return false;
30  }
31 
33 
34 private:
37 
39  virtual void buildViewType(const RPCRecHit& iData,
40  unsigned int iIndex,
41  TEveElement& oItemHolder,
43  const FWViewContext*) override;
44 };
45 
46 
47 void
49  unsigned int iIndex,
50  TEveElement& oItemHolder,
52  const FWViewContext*)
53 {
54  RPCDetId rpcId = iData.rpcId();
55  unsigned int rawid = rpcId.rawId();
56 
57  const FWGeometry *geom = item()->getGeom();
58 
59  if( ! geom->contains( rawid ))
60  {
61  fwLog( fwlog::kError ) << "failed to get geometry of RPC roll with detid: "
62  << rawid <<std::endl;
63  return;
64  }
65 
66  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
67  recHitSet->SetLineWidth(3);
68 
69  if( type == FWViewType::k3D || type == FWViewType::kISpy )
70  {
71  TEveGeoShape* shape = geom->getEveShape( rawid );
72  shape->SetMainTransparency( 75 );
73  shape->SetMainColor( item()->defaultDisplayProperties().color());
74  recHitSet->AddElement( shape );
75  }
76 
77  float localX = iData.localPosition().x();
78  float localY = iData.localPosition().y();
79  float localZ = iData.localPosition().z();
80 
81  float localXerr = sqrt(iData.localPositionError().xx());
82  float localYerr = sqrt(iData.localPositionError().yy());
83 
84  float localU1[3] =
85  {
86  localX - localXerr, localY, localZ
87  };
88 
89  float localU2[3] =
90  {
91  localX + localXerr, localY, localZ
92  };
93 
94  float localV1[3] =
95  {
96  localX, localY - localYerr, localZ
97  };
98 
99  float localV2[3] =
100  {
101  localX, localY + localYerr, localZ
102  };
103 
104  float globalU1[3];
105  float globalU2[3];
106  float globalV1[3];
107  float globalV2[3];
108 
109  FWGeometry::IdToInfoItr det = geom->find( rawid );
110 
111  geom->localToGlobal( *det, localU1, globalU1 );
112  geom->localToGlobal( *det, localU2, globalU2 );
113  geom->localToGlobal( *det, localV1, globalV1 );
114  geom->localToGlobal( *det, localV2, globalV2 );
115 
116  recHitSet->AddLine( globalU1[0], globalU1[1], globalU1[2],
117  globalU2[0], globalU2[1], globalU2[2] );
118 
119  recHitSet->AddLine( globalV1[0], globalV1[1], globalV1[2],
120  globalV2[0], globalV2[1], globalV2[2] );
121 
122  setupAddElement( recHitSet, &oItemHolder );
123 }
124 
type
Definition: HCALResponse.h:21
float xx() const
Definition: LocalError.h:24
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:58
const FWRPCRecHitProxyBuilder & operator=(const FWRPCRecHitProxyBuilder &)
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:355
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:59
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
RPCDetId rpcId() const
Return the rpcId.
Definition: RPCRecHit.h:97
float yy() const
Definition: LocalError.h:26
TEveGeoShape * getEveShape(unsigned int id) const
Definition: FWGeometry.cc:250
T sqrt(T t)
Definition: SSEVec.h:48
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:325
virtual void buildViewType(const RPCRecHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
bool contains(unsigned int id) const
Definition: FWGeometry.h:109
#define fwLog(_level_)
Definition: fwLog.h:50
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: RPCRecHit.h:59
virtual bool haveSingleProduct() const override
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: RPCRecHit.h:53
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:107
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681