CMS 3D CMS Logo

FWPSimHitProxyBuilder.cc
Go to the documentation of this file.
1 /*
2  * FWPSimHitProxyBuilder.cc
3  * FWorks
4  *
5  * Created by Ianna Osborne on 9/9/10.
6  *
7  */
8 
15 
16 #include "TEvePointSet.h"
17 
19 public:
21  ~FWPSimHitProxyBuilder(void) override {}
22 
23  bool haveSingleProduct() const override { return false; }
24 
26 
27 private:
28  // Disable default copy constructor
30  // Disable default assignment operator
32 
34  void buildViewType(const PSimHit& iData,
35  unsigned int iIndex,
36  TEveElement& oItemHolder,
38  const FWViewContext*) override;
39 };
40 
42  const PSimHit& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type, const FWViewContext*) {
43  TEvePointSet* pointSet = new TEvePointSet;
44  setupAddElement(pointSet, &oItemHolder);
45  const FWGeometry* geom = item()->getGeom();
46  unsigned int rawid = iData.detUnitId();
47  if (!geom->contains(rawid)) {
48  fwLog(fwlog::kError) << "failed to get geometry of detid: " << rawid << std::endl;
49  return;
50  }
51 
52  float local[3] = {iData.localPosition().x(), iData.localPosition().y(), iData.localPosition().z()};
53  float global[3];
54 
55  // Specialized for DT simhits
56  DetId id(rawid);
57  if (id.det() == DetId::Muon && id.subdetId() == 1) {
58  DTWireId wId(rawid);
59  rawid = wId.layerId().rawId(); // DT simhits are in the RF of the DTLayer, but their ID is the id of the wire!
60  if (abs(iData.particleType()) != 13) {
61  pointSet->SetMarkerStyle(26); // Draw non-muon simhits (e.g. delta rays) with a different marker
62  }
63  if (type == FWViewType::kRhoZ) { //
64  // In RhoZ view, draw hits at the middle of the layer in the global Z coordinate,
65  // otherwise they won't align with 1D rechits, for which only one coordinate is known.
66  if (wId.superLayer() == 2) {
67  local[1] = 0;
68  } else {
69  local[0] = 0;
70  }
71  }
72  }
73 
74  geom->localToGlobal(rawid, local, global);
75  pointSet->SetNextPoint(global[0], global[1], global[2]);
76 }
77 
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
FWGeometry
Definition: FWGeometry.h:27
FWSimpleProxyBuilderTemplate.h
FWViewType::EType
EType
Definition: FWViewType.h:31
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
FWPSimHitProxyBuilder::buildViewType
void buildViewType(const PSimHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
Definition: FWPSimHitProxyBuilder.cc:41
FWViewType::kAllRPZBits
static const int kAllRPZBits
Definition: FWViewType.h:67
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
FWPSimHitProxyBuilder
Definition: FWPSimHitProxyBuilder.cc:18
FWPSimHitProxyBuilder::~FWPSimHitProxyBuilder
~FWPSimHitProxyBuilder(void) override
Definition: FWPSimHitProxyBuilder.cc:21
FWViewType::kRhoZ
Definition: FWViewType.h:33
REGISTER_PROXYBUILDER_METHODS
#define REGISTER_PROXYBUILDER_METHODS()
Definition: register_dataproxybuilder_macro.h:28
DTSuperLayerId::superLayer
int superLayer() const
Return the superlayer number.
Definition: DTSuperLayerId.h:39
PSimHit::detUnitId
unsigned int detUnitId() const
Definition: PSimHit.h:97
FWViewType::kAll3DBits
static const int kAll3DBits
Definition: FWViewType.h:68
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
PSimHit.h
DTWireId
Definition: DTWireId.h:12
PSimHit::localPosition
Local3DPoint localPosition() const
Definition: PSimHit.h:52
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
FWGeometry.h
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
fwLog.h
FWPSimHitProxyBuilder::operator=
const FWPSimHitProxyBuilder & operator=(const FWPSimHitProxyBuilder &)=delete
FWEventItem.h
FWViewContext
Definition: FWViewContext.h:32
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
FWPSimHitProxyBuilder::haveSingleProduct
bool haveSingleProduct() const override
Definition: FWPSimHitProxyBuilder.cc:23
DTWireId.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
PSimHit::particleType
int particleType() const
Definition: PSimHit.h:89
fwlog::kError
Definition: fwLog.h:35
DTWireId::layerId
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:45
FWPSimHitProxyBuilder::FWPSimHitProxyBuilder
FWPSimHitProxyBuilder(void)
Definition: FWPSimHitProxyBuilder.cc:20
FWSimpleProxyBuilderTemplate
Definition: FWSimpleProxyBuilderTemplate.h:30
DetId::Muon
Definition: DetId.h:26
DTRecHitClients_cfi.local
local
Definition: DTRecHitClients_cfi.py:10
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PSimHit
Definition: PSimHit.h:15