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 // $Id: FWRPCRecHitProxyBuilder.cc,v 1.15 2010/09/07 15:46:48 yana Exp $
10 //
11 
12 #include "TEveGeoNode.h"
13 #include "TEveStraightLineSet.h"
14 
19 
21 
23 {
24 public:
27 
28  virtual bool haveSingleProduct() const
29  {
30  return false;
31  }
32 
34 
35 private:
38 
39  virtual void buildViewType(const RPCRecHit& iData,
40  unsigned int iIndex,
41  TEveElement& oItemHolder,
43  const FWViewContext*);
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:22
float xx() const
Definition: LocalError.h:19
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:56
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
T y() const
Definition: PV3DBase.h:57
void localToGlobal(unsigned int id, const float *local, float *global) const
Definition: FWGeometry.cc:326
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:57
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
RPCDetId rpcId() const
Return the rpcId.
Definition: RPCRecHit.h:99
virtual void buildViewType(const RPCRecHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *)
float yy() const
Definition: LocalError.h:21
TEveGeoShape * getEveShape(unsigned int id) const
Definition: FWGeometry.cc:251
T sqrt(T t)
Definition: SSEVec.h:28
T z() const
Definition: PV3DBase.h:58
bool contains(unsigned int id) const
Definition: FWGeometry.h:98
virtual bool haveSingleProduct() const
#define fwLog(_level_)
Definition: fwLog.h:51
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: RPCRecHit.h:61
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: RPCRecHit.h:55
T x() const
Definition: PV3DBase.h:56
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:688