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 //
7 
8 #include "TEvePointSet.h"
9 #include "TEveStraightLineSet.h"
10 
15 
18 
19 using namespace DTEnums;
20 
22 {
23 public:
25  virtual ~FWDTRecHitProxyBuilder( void ) {}
26 
27  virtual bool haveSingleProduct() const override { return false; }
28 
30 
31 private:
32  // Disable default copy constructor
34  // Disable default assignment operator
35  const FWDTRecHitProxyBuilder& operator=( const FWDTRecHitProxyBuilder& );
36 
37  virtual void buildViewType( const DTRecHit1DPair& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type , const FWViewContext* ) override;
38 };
39 
40 void
41 FWDTRecHitProxyBuilder::buildViewType( const DTRecHit1DPair& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type, const FWViewContext* )
42 {
43  const DTLayerId& layerId = iData.wireId().layerId();
44  int superLayer = layerId.superlayerId().superLayer();
45 
46  const FWGeometry *geom = item()->getGeom();
47 
48  if( ! geom->contains( layerId ))
49  {
50  fwLog( fwlog::kError ) << "failed get geometry of DT layer with detid: "
51  << layerId << std::endl;
52  return;
53  }
54 
55  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
56  setupAddElement( recHitSet, &oItemHolder );
57 
58  TEvePointSet* pointSet = new TEvePointSet;
59  setupAddElement( pointSet, &oItemHolder );
60 
61  const DTRecHit1D* leftRecHit = iData.componentRecHit( Left );
62  const DTRecHit1D* rightRecHit = iData.componentRecHit( Right );
63  float lLocalPos[3] = { leftRecHit->localPosition().x(), 0.0, 0.0 };
64  float rLocalPos[3] = { rightRecHit->localPosition().x(), 0.0, 0.0 };
65 
66  if(( (type == FWViewType::kRhoPhi || type == FWViewType::kRhoPhiPF) && superLayer != 2 ) ||
67  ( type == FWViewType::kRhoZ && superLayer == 2 ) ||
68  type == FWViewType::k3D ||
69  type == FWViewType::kISpy )
70  {
71  float leftGlobalPoint[3];
72  float rightGlobalPoint[3];
73 
74  geom->localToGlobal( layerId, lLocalPos, leftGlobalPoint, rLocalPos, rightGlobalPoint );
75 
76  pointSet->SetNextPoint( leftGlobalPoint[0], leftGlobalPoint[1], leftGlobalPoint[2] );
77  pointSet->SetNextPoint( rightGlobalPoint[0], rightGlobalPoint[1], rightGlobalPoint[2] );
78 
79  recHitSet->AddLine( leftGlobalPoint[0], leftGlobalPoint[1], leftGlobalPoint[2],
80  rightGlobalPoint[0], rightGlobalPoint[1], rightGlobalPoint[2] );
81  }
82 }
83 
85 
86 
type
Definition: HCALResponse.h:21
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:58
virtual void buildViewType(const DTRecHit1DPair &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
const DTRecHit1D * componentRecHit(DTEnums::DTCellSide lrSide) const
Return the left/right DTRecHit1D.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
static const int kAll3DBits
Definition: FWViewType.h:59
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:325
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:60
#define fwLog(_level_)
Definition: fwLog.h:50
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
virtual bool haveSingleProduct() const override
DTWireId wireId() const
T x() const
Definition: PV3DBase.h:62
void setupAddElement(TEveElement *el, TEveElement *parent, const FWEventItem *item, bool master, bool color)
Definition: TrackUtils.cc:336