CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWSiStripClusterProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: FWSiStripClusterProxyBuilder.cc,v 1.18 2010/09/06 09:52:45 yana Exp $
3 //
4 
5 #include "TEveGeoNode.h"
6 #include "TEveStraightLineSet.h"
7 
13 
15 
17 {
18 public:
20  virtual ~FWSiStripClusterProxyBuilder( void ) {}
21 
23 
24 protected:
25  virtual void build( const SiStripCluster& iData, unsigned int iIndex,
26  TEveElement& oItemHolder, const FWViewContext* );
27  virtual void localModelChanges( const FWModelId& iId, TEveElement* iCompound,
28  FWViewType::EType viewType, const FWViewContext* vc );
29 
30 private:
33 };
34 
35 void
37  unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* )
38 {
39  unsigned int rawid = iData.geographicalId();
40  const FWGeometry *geom = item()->getGeom();
41 
42  TEveGeoShape* shape = geom->getEveShape( rawid );
43 
44  if( shape )
45  {
46  shape->SetElementName( "Det" );
47  setupAddElement( shape, &oItemHolder );
48  }
49  else
50  {
52  << "failed to get shape of SiStripCluster with detid: "
53  << rawid << std::endl;
54  }
55  increaseComponentTransparency( iIndex, &oItemHolder, "Det", 60 );
56 
57  TEveStraightLineSet *lineSet = new TEveStraightLineSet( "strip" );
58  setupAddElement( lineSet, &oItemHolder );
59 
60  if( ! geom->contains( rawid ))
61  {
63  << "failed to geometry of SiStripCluster with detid: "
64  << rawid << std::endl;
65 
66  return;
67  }
68 
69  float localTop[3] = { 0.0, 0.0, 0.0 };
70  float localBottom[3] = { 0.0, 0.0, 0.0 };
71 
72  fireworks::localSiStrip( iData.firstStrip(), localTop, localBottom, geom->getParameters( rawid ), rawid );
73 
74  float globalTop[3];
75  float globalBottom[3];
76  geom->localToGlobal( rawid, localTop, globalTop, localBottom, globalBottom );
77 
78  lineSet->AddLine( globalTop[0], globalTop[1], globalTop[2],
79  globalBottom[0], globalBottom[1], globalBottom[2] );
80 }
81 
82 void
83 FWSiStripClusterProxyBuilder::localModelChanges( const FWModelId& iId, TEveElement* iCompound,
84  FWViewType::EType viewType, const FWViewContext* vc )
85 {
86  increaseComponentTransparency( iId.index(), iCompound, "Det", 60 );
87 }
88 
89 
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:56
const float * getParameters(unsigned int id) const
Definition: FWGeometry.cc:294
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
uint16_t firstStrip() const
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
void localSiStrip(short strip, float *localTop, float *localBottom, const float *pars, unsigned int id)
Definition: TrackUtils.cc:292
uint32_t geographicalId() const
const FWSiStripClusterProxyBuilder & operator=(const FWSiStripClusterProxyBuilder &)
int index() const
Definition: FWModelId.h:50
TEveGeoShape * getEveShape(unsigned int id) const
Definition: FWGeometry.cc:251
virtual void localModelChanges(const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
bool contains(unsigned int id) const
Definition: FWGeometry.h:98
#define fwLog(_level_)
Definition: fwLog.h:51
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:688
void increaseComponentTransparency(unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)