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