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  // Disable default copy constructor
29  // Disable default assignment operator
31 
32 private:
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 
const FWPSimHitProxyBuilder & operator=(const FWPSimHitProxyBuilder &)=delete
#define REGISTER_PROXYBUILDER_METHODS()
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
~FWPSimHitProxyBuilder(void) override
int superLayer() const
Return the superlayer number.
static const int kAllRPZBits
Definition: FWViewType.h:67
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
unsigned int detUnitId() const
Definition: PSimHit.h:97
bool haveSingleProduct() const override
T z() const
Definition: PV3DBase.h:61
static const int kAll3DBits
Definition: FWViewType.h:68
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:17
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
#define fwLog(_level_)
Definition: fwLog.h:45
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
Local3DPoint localPosition() const
Definition: PSimHit.h:52
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:45
int particleType() const
Definition: PSimHit.h:89
const FWEventItem * item() const
void buildViewType(const PSimHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override