CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWDTRecHitProxyBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: Muons
4 // Class : FWDTRecHitProxyBuilder
5 //
6 // $Id: FWDTRecHitProxyBuilder.cc,v 1.13 2010/11/11 20:25:28 amraktad Exp $
7 //
8 
9 #include "TEvePointSet.h"
10 #include "TEveStraightLineSet.h"
11 
16 
19 
20 using namespace DTEnums;
21 
23 {
24 public:
26  virtual ~FWDTRecHitProxyBuilder( void ) {}
27 
28  virtual bool haveSingleProduct() const { return false; }
29 
31 
32 private:
33  // Disable default copy constructor
35  // Disable default assignment operator
37 
38  virtual void buildViewType( const DTRecHit1DPair& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type , const FWViewContext* );
39 };
40 
41 void
42 FWDTRecHitProxyBuilder::buildViewType( const DTRecHit1DPair& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type, const FWViewContext* )
43 {
44  const DTLayerId& layerId = iData.wireId().layerId();
45  int superLayer = layerId.superlayerId().superLayer();
46 
47  const FWGeometry *geom = item()->getGeom();
48 
49  if( ! geom->contains( layerId ))
50  {
51  fwLog( fwlog::kError ) << "failed get geometry of DT layer with detid: "
52  << layerId << std::endl;
53  return;
54  }
55 
56  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
57  setupAddElement( recHitSet, &oItemHolder );
58 
59  TEvePointSet* pointSet = new TEvePointSet;
60  setupAddElement( pointSet, &oItemHolder );
61 
62  const DTRecHit1D* leftRecHit = iData.componentRecHit( Left );
63  const DTRecHit1D* rightRecHit = iData.componentRecHit( Right );
64  float lLocalPos[3] = { leftRecHit->localPosition().x(), 0.0, 0.0 };
65  float rLocalPos[3] = { rightRecHit->localPosition().x(), 0.0, 0.0 };
66 
67  if(( (type == FWViewType::kRhoPhi || type == FWViewType::kRhoPhiPF) && superLayer != 2 ) ||
68  ( type == FWViewType::kRhoZ && superLayer == 2 ) ||
69  type == FWViewType::k3D ||
70  type == FWViewType::kISpy )
71  {
72  float leftGlobalPoint[3];
73  float rightGlobalPoint[3];
74 
75  geom->localToGlobal( layerId, lLocalPos, leftGlobalPoint, rLocalPos, rightGlobalPoint );
76 
77  pointSet->SetNextPoint( leftGlobalPoint[0], leftGlobalPoint[1], leftGlobalPoint[2] );
78  pointSet->SetNextPoint( rightGlobalPoint[0], rightGlobalPoint[1], rightGlobalPoint[2] );
79 
80  recHitSet->AddLine( leftGlobalPoint[0], leftGlobalPoint[1], leftGlobalPoint[2],
81  rightGlobalPoint[0], rightGlobalPoint[1], rightGlobalPoint[2] );
82  }
83 }
84 
86 
87 
nocap nocap const skelname & operator=(const skelname &)
type
Definition: HCALResponse.h:22
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
virtual bool haveSingleProduct() const
static const int kAllRPZBits
Definition: FWViewType.h:59
const DTRecHit1D * componentRecHit(DTEnums::DTCellSide lrSide) const
Return the left/right DTRecHit1D.
void localToGlobal(unsigned int id, const float *local, float *global) const
Definition: FWGeometry.cc:326
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:61
static const int kAll3DBits
Definition: FWViewType.h:60
virtual void buildViewType(const DTRecHit1DPair &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *)
int superLayer() const
Return the superlayer number.
bool contains(unsigned int id) const
Definition: FWGeometry.h:98
virtual LocalPoint localPosition() const
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:62
#define fwLog(_level_)
Definition: fwLog.h:51
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:64
DTWireId wireId() const
T x() const
Definition: PV3DBase.h:61
void setupAddElement(TEveElement *el, TEveElement *parent, const FWEventItem *item, bool master, bool color)
Definition: TrackUtils.cc:337