CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
25 public:
28 
29  virtual bool haveSingleProduct() const
30  {
31  return false;
32  }
33 
35 
36 private:
39 
40  virtual void buildViewType(const GEMRecHit& iData,
41  unsigned int iIndex,
42  TEveElement& oItemHolder,
44  const FWViewContext*);
45 };
46 
47 
48 void
50  unsigned int iIndex,
51  TEveElement& oItemHolder,
53  const FWViewContext*)
54 {
55  GEMDetId gemId = iData.gemId();
56  unsigned int rawid = gemId.rawId();
57 
58  const FWGeometry *geom = item()->getGeom();
59 
60  if( ! geom->contains( rawid ))
61  {
62  fwLog( fwlog::kError ) << "failed to get geometry of GEM roll with detid: "
63  << rawid <<std::endl;
64  return;
65  }
66 
67  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
68  recHitSet->SetLineWidth(3);
69 
70  if( type == FWViewType::k3D || type == FWViewType::kISpy )
71  {
72  TEveGeoShape* shape = geom->getEveShape( rawid );
73  shape->SetMainTransparency( 75 );
74  shape->SetMainColor( item()->defaultDisplayProperties().color());
75  recHitSet->AddElement( shape );
76  }
77 
78  float localX = iData.localPosition().x();
79  float localY = iData.localPosition().y();
80  float localZ = iData.localPosition().z();
81 
82  float localXerr = sqrt(iData.localPositionError().xx());
83  float localYerr = sqrt(iData.localPositionError().yy());
84 
85  float localU1[3] =
86  {
87  localX - localXerr, localY, localZ
88  };
89 
90  float localU2[3] =
91  {
92  localX + localXerr, localY, localZ
93  };
94 
95  float localV1[3] =
96  {
97  localX, localY - localYerr, localZ
98  };
99 
100  float localV2[3] =
101  {
102  localX, localY + localYerr, localZ
103  };
104 
105  float globalU1[3];
106  float globalU2[3];
107  float globalV1[3];
108  float globalV2[3];
109 
110  FWGeometry::IdToInfoItr det = geom->find( rawid );
111 
112  geom->localToGlobal( *det, localU1, globalU1 );
113  geom->localToGlobal( *det, localU2, globalU2 );
114  geom->localToGlobal( *det, localV1, globalV1 );
115  geom->localToGlobal( *det, localV2, globalV2 );
116 
117  recHitSet->AddLine( globalU1[0], globalU1[1], globalU1[2],
118  globalU2[0], globalU2[1], globalU2[2] );
119 
120  recHitSet->AddLine( globalV1[0], globalV1[1], globalV1[2],
121  globalV2[0], globalV2[1], globalV2[2] );
122 
123  setupAddElement( recHitSet, &oItemHolder );
124 }
125 
type
Definition: HCALResponse.h:21
float xx() const
Definition: LocalError.h:24
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: GEMRecHit.h:53
const FWGEMRecHitProxyBuilder & operator=(const FWGEMRecHitProxyBuilder &)
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:58
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:355
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
virtual void buildViewType(const GEMRecHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *)
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:59
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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
bool contains(unsigned int id) const
Definition: FWGeometry.h:98
virtual LocalError localPositionError() const
Return the 3-dimensional error on the local position.
Definition: GEMRecHit.h:59
#define fwLog(_level_)
Definition: fwLog.h:50
virtual bool haveSingleProduct() const
GEMDetId gemId() const
Return the gemId.
Definition: GEMRecHit.h:97
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:96
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681