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 
21 class FWDTRecHitProxyBuilder : public FWSimpleProxyBuilderTemplate<DTRecHit1DPair> {
22 public:
24  ~FWDTRecHitProxyBuilder(void) override {}
25 
26  bool haveSingleProduct() const override { return false; }
27 
29 
30 private:
31  // Disable default copy constructor
33  // Disable default assignment operator
34  const FWDTRecHitProxyBuilder& operator=(const FWDTRecHitProxyBuilder&) = delete;
35 
37  void buildViewType(const DTRecHit1DPair& iData,
38  unsigned int iIndex,
39  TEveElement& oItemHolder,
41  const FWViewContext*) override;
42 };
43 
45  unsigned int iIndex,
46  TEveElement& oItemHolder,
48  const FWViewContext*) {
49  const DTLayerId& layerId = iData.wireId().layerId();
50  int superLayer = layerId.superlayerId().superLayer();
51 
52  const FWGeometry* geom = item()->getGeom();
53 
54  if (!geom->contains(layerId)) {
55  fwLog(fwlog::kError) << "failed get geometry of DT layer with detid: " << layerId << std::endl;
56  return;
57  }
58 
59  TEveStraightLineSet* recHitSet = new TEveStraightLineSet;
60  setupAddElement(recHitSet, &oItemHolder);
61 
62  TEvePointSet* pointSet = new TEvePointSet;
63  setupAddElement(pointSet, &oItemHolder);
64 
65  const DTRecHit1D* leftRecHit = iData.componentRecHit(Left);
66  const DTRecHit1D* rightRecHit = iData.componentRecHit(Right);
67  float lLocalPos[3] = {leftRecHit->localPosition().x(), 0.0, 0.0};
68  float rLocalPos[3] = {rightRecHit->localPosition().x(), 0.0, 0.0};
69 
70  if (((type == FWViewType::kRhoPhi || type == FWViewType::kRhoPhiPF) && superLayer != 2) ||
71  (type == FWViewType::kRhoZ && superLayer == 2) || type == FWViewType::k3D || type == FWViewType::kISpy) {
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],
81  leftGlobalPoint[1],
82  leftGlobalPoint[2],
83  rightGlobalPoint[0],
84  rightGlobalPoint[1],
85  rightGlobalPoint[2]);
86  }
87 }
88 
91  "DT RecHits",
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
FWDTRecHitProxyBuilder::~FWDTRecHitProxyBuilder
~FWDTRecHitProxyBuilder(void) override
Definition: FWDTRecHitProxyBuilder.cc:24
FWGeometry
Definition: FWGeometry.h:27
FWSimpleProxyBuilderTemplate.h
DTRecHitCollection.h
FWViewType::EType
EType
Definition: FWViewType.h:31
DTRecHit1DPair::componentRecHit
const DTRecHit1D * componentRecHit(DTEnums::DTCellSide lrSide) const
Return the left/right DTRecHit1D.
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
FWViewType::kRhoZ
Definition: FWViewType.h:33
DTRecHit1D
Definition: DTRecHit1D.h:25
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:28
DTEnums
Definition: DTEnums.h:12
DTSuperLayerId::superLayer
int superLayer() const
Return the superlayer number.
Definition: DTSuperLayerId.h:39
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
DTEnums::Left
Definition: DTEnums.h:15
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
DTRecHit1DPair
Definition: DTRecHit1DPair.h:26
fireworks::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, const FWEventItem *item, bool master, bool color)
Definition: TrackUtils.cc:299
FWDTRecHitProxyBuilder::buildViewType
void buildViewType(const DTRecHit1DPair &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
Definition: FWDTRecHitProxyBuilder.cc:44
DTChamberId.h
DTLayerId
Definition: DTLayerId.h:12
DTRecHit1D::localPosition
LocalPoint localPosition() const override
Return the 3-dimensional local position.
Definition: DTRecHit1D.h:47
FWGeometry.h
DTRecHit1DPair::wireId
DTWireId wireId() const
Definition: DTRecHit1DPair.h:89
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
fwLog.h
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
DTEnums::Right
Definition: DTEnums.h:15
type
type
Definition: HCALResponse.h:21
FWViewType::kISpy
Definition: FWViewType.h:35
DTLayerId::superlayerId
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:45
FWViewType::k3D
Definition: FWViewType.h:34
fwlog::kError
Definition: fwLog.h:35
DTWireId::layerId
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:45
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
FWDTRecHitProxyBuilder::haveSingleProduct
bool haveSingleProduct() const override
Definition: FWDTRecHitProxyBuilder.cc:26
FWViewType::kRhoPhiPF
Definition: FWViewType.h:42
FWDTRecHitProxyBuilder
Definition: FWDTRecHitProxyBuilder.cc:21
FWDTRecHitProxyBuilder::FWDTRecHitProxyBuilder
FWDTRecHitProxyBuilder(void)
Definition: FWDTRecHitProxyBuilder.cc:23
FWViewType::kRhoPhi
Definition: FWViewType.h:32