CMS 3D CMS Logo

FWME0RecHitProxyBuilder.cc
Go to the documentation of this file.
1 #include "TEveGeoNode.h"
2 #include "TEveStraightLineSet.h"
3 
8 
10 
12 {
13 public:
16 
17  bool haveSingleProduct() const override
18  {
19  return false;
20  }
21 
23 
24 private:
27 
28  void buildViewType(const ME0RecHit& iData,
29  unsigned int iIndex,
30  TEveElement& oItemHolder,
32  const FWViewContext*) override;
33 };
34 
35 
36 void
38  unsigned int iIndex,
39  TEveElement& oItemHolder,
41  const FWViewContext*)
42 {
43  ME0DetId me0Id = iData.me0Id();
44  unsigned int rawid = me0Id.rawId();
45 
46  const FWGeometry *geom = item()->getGeom();
47 
48  if( ! geom->contains( rawid ))
49  {
50  fwLog( fwlog::kError ) << "failed to get geometry of ME0 roll with detid: "
51  << rawid <<std::endl;
52  return;
53  }
54 
55  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
56  recHitSet->SetLineWidth(3);
57 
58  if( type == FWViewType::k3D || type == FWViewType::kISpy )
59  {
60  TEveGeoShape* shape = geom->getEveShape( rawid );
61  shape->SetMainTransparency( 75 );
62  shape->SetMainColor( item()->defaultDisplayProperties().color());
63  recHitSet->AddElement( shape );
64  }
65 
66  float localX = iData.localPosition().x();
67  float localY = iData.localPosition().y();
68  float localZ = iData.localPosition().z();
69 
70  float localXerr = sqrt(iData.localPositionError().xx());
71  float localYerr = sqrt(iData.localPositionError().yy());
72 
73  float localU1[3] =
74  {
75  localX - localXerr, localY, localZ
76  };
77 
78  float localU2[3] =
79  {
80  localX + localXerr, localY, localZ
81  };
82 
83  float localV1[3] =
84  {
85  localX, localY - localYerr, localZ
86  };
87 
88  float localV2[3] =
89  {
90  localX, localY + localYerr, localZ
91  };
92 
93  float globalU1[3];
94  float globalU2[3];
95  float globalV1[3];
96  float globalV2[3];
97 
98  FWGeometry::IdToInfoItr det = geom->find( rawid );
99 
100  geom->localToGlobal( *det, localU1, globalU1 );
101  geom->localToGlobal( *det, localU2, globalU2 );
102  geom->localToGlobal( *det, localV1, globalV1 );
103  geom->localToGlobal( *det, localV2, globalV2 );
104 
105  recHitSet->AddLine( globalU1[0], globalU1[1], globalU1[2],
106  globalU2[0], globalU2[1], globalU2[2] );
107 
108  recHitSet->AddLine( globalV1[0], globalV1[1], globalV1[2],
109  globalV2[0], globalV2[1], globalV2[2] );
110 
111  setupAddElement( recHitSet, &oItemHolder );
112 }
113 
const FWME0RecHitProxyBuilder & operator=(const FWME0RecHitProxyBuilder &)=delete
LocalError localPositionError() const override
Return the 3-dimensional error on the local position.
Definition: ME0RecHit.h:53
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
IdToInfoItr find(unsigned int) const
Definition: FWGeometry.cc:375
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:44
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: ME0RecHit.h:47
float yy() const
Definition: LocalError.h:26
TEveGeoShape * getEveShape(unsigned int id) const
Definition: FWGeometry.cc:270
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:345
bool contains(unsigned int id) const
Definition: FWGeometry.h:113
#define fwLog(_level_)
Definition: fwLog.h:50
ME0DetId me0Id() const
Return the gemId.
Definition: ME0RecHit.h:91
bool haveSingleProduct() const override
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
Definition: FWGeometry.h:110
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683
void buildViewType(const ME0RecHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override