CMS 3D CMS Logo

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  ~FWDTRecHitProxyBuilder( void ) override {}
26 
27  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& ) = delete;
36 
38  void buildViewType( const DTRecHit1DPair& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type , const FWViewContext* ) override;
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 
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:60
type
Definition: HCALResponse.h:21
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:58
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
bool haveSingleProduct() const override
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:478
int superLayer() const
Return the superlayer number.
bool contains(unsigned int id) const
Definition: FWGeometry.h:117
#define fwLog(_level_)
Definition: fwLog.h:50
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
~FWDTRecHitProxyBuilder(void) 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:323