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 
38  virtual void buildViewType(const RPCRecHit& iData,
39  unsigned int iIndex,
40  TEveElement& oItemHolder,
42  const FWViewContext*) override;
43 };
44 
45 
46 void
48  unsigned int iIndex,
49  TEveElement& oItemHolder,
51  const FWViewContext*)
52 {
53  RPCDetId rpcId = iData.rpcId();
54  unsigned int rawid = rpcId.rawId();
55 
56  const FWGeometry *geom = item()->getGeom();
57 
58  if( ! geom->contains( rawid ))
59  {
60  fwLog( fwlog::kError ) << "failed to get geometry of RPC roll with detid: "
61  << rawid <<std::endl;
62  return;
63  }
64 
65  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
66  recHitSet->SetLineWidth(3);
67 
68  if( type == FWViewType::k3D || type == FWViewType::kISpy )
69  {
70  TEveGeoShape* shape = geom->getEveShape( rawid );
71  shape->SetMainTransparency( 75 );
72  shape->SetMainColor( item()->defaultDisplayProperties().color());
73  recHitSet->AddElement( shape );
74  }
75 
76  float localX = iData.localPosition().x();
77  float localY = iData.localPosition().y();
78  float localZ = iData.localPosition().z();
79 
80  float localXerr = sqrt(iData.localPositionError().xx());
81  float localYerr = sqrt(iData.localPositionError().yy());
82 
83  float localU1[3] =
84  {
85  localX - localXerr, localY, localZ
86  };
87 
88  float localU2[3] =
89  {
90  localX + localXerr, localY, localZ
91  };
92 
93  float localV1[3] =
94  {
95  localX, localY - localYerr, localZ
96  };
97 
98  float localV2[3] =
99  {
100  localX, localY + localYerr, localZ
101  };
102 
103  float globalU1[3];
104  float globalU2[3];
105  float globalV1[3];
106  float globalV2[3];
107 
108  FWGeometry::IdToInfoItr det = geom->find( rawid );
109 
110  geom->localToGlobal( *det, localU1, globalU1 );
111  geom->localToGlobal( *det, localU2, globalU2 );
112  geom->localToGlobal( *det, localV1, globalV1 );
113  geom->localToGlobal( *det, localV2, globalV2 );
114 
115  recHitSet->AddLine( globalU1[0], globalU1[1], globalU1[2],
116  globalU2[0], globalU2[1], globalU2[2] );
117 
118  recHitSet->AddLine( globalV1[0], globalV1[1], globalV1[2],
119  globalV2[0], globalV2[1], globalV2[2] );
120 
121  setupAddElement( recHitSet, &oItemHolder );
122 }
123 
type
Definition: HCALResponse.h:21
float xx() const
Definition: LocalError.h:24
#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:98
#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:96
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681