test
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 
41  virtual void buildViewType(const GEMRecHit& iData,
42  unsigned int iIndex,
43  TEveElement& oItemHolder,
45  const FWViewContext*);
46 };
47 
48 
49 void
51  unsigned int iIndex,
52  TEveElement& oItemHolder,
54  const FWViewContext*)
55 {
56  GEMDetId gemId = iData.gemId();
57  unsigned int rawid = gemId.rawId();
58 
59  const FWGeometry *geom = item()->getGeom();
60 
61  if( ! geom->contains( rawid ))
62  {
63  fwLog( fwlog::kError ) << "failed to get geometry of GEM roll with detid: "
64  << rawid <<std::endl;
65  return;
66  }
67 
68  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
69  recHitSet->SetLineWidth(3);
70 
71  if( type == FWViewType::k3D || type == FWViewType::kISpy )
72  {
73  TEveGeoShape* shape = geom->getEveShape( rawid );
74  shape->SetMainTransparency( 75 );
75  shape->SetMainColor( item()->defaultDisplayProperties().color());
76  recHitSet->AddElement( shape );
77  }
78 
79  float localX = iData.localPosition().x();
80  float localY = iData.localPosition().y();
81  float localZ = iData.localPosition().z();
82 
83  float localXerr = sqrt(iData.localPositionError().xx());
84  float localYerr = sqrt(iData.localPositionError().yy());
85 
86  float localU1[3] =
87  {
88  localX - localXerr, localY, localZ
89  };
90 
91  float localU2[3] =
92  {
93  localX + localXerr, localY, localZ
94  };
95 
96  float localV1[3] =
97  {
98  localX, localY - localYerr, localZ
99  };
100 
101  float localV2[3] =
102  {
103  localX, localY + localYerr, localZ
104  };
105 
106  float globalU1[3];
107  float globalU2[3];
108  float globalV1[3];
109  float globalV2[3];
110 
111  FWGeometry::IdToInfoItr det = geom->find( rawid );
112 
113  geom->localToGlobal( *det, localU1, globalU1 );
114  geom->localToGlobal( *det, localU2, globalU2 );
115  geom->localToGlobal( *det, localV1, globalV1 );
116  geom->localToGlobal( *det, localV2, globalV2 );
117 
118  recHitSet->AddLine( globalU1[0], globalU1[1], globalU1[2],
119  globalU2[0], globalU2[1], globalU2[2] );
120 
121  recHitSet->AddLine( globalV1[0], globalV1[1], globalV1[2],
122  globalV2[0], globalV2[1], globalV2[2] );
123 
124  setupAddElement( recHitSet, &oItemHolder );
125 }
126 
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_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:58
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:358
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:253
T sqrt(T t)
Definition: SSEVec.h:18
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:328
bool contains(unsigned int id) const
Definition: FWGeometry.h:109
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:107
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683