CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 {
20 public:
22  virtual ~FWPSimHitProxyBuilder( void ) {}
23 
24  virtual bool haveSingleProduct() const override { return false; }
25 
27 
28 private:
29  // Disable default copy constructor
31  // Disable default assignment operator
33 
35  void buildViewType( const PSimHit& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type, const FWViewContext* ) override;
36 };
37 
38 void
39 FWPSimHitProxyBuilder::buildViewType( const PSimHit& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type, const FWViewContext* )
40 {
41  TEvePointSet* pointSet = new TEvePointSet;
42  setupAddElement( pointSet, &oItemHolder );
43  const FWGeometry *geom = item()->getGeom();
44  unsigned int rawid = iData.detUnitId();
45  if( ! geom->contains( rawid ))
46  {
48  << "failed to get geometry of detid: "
49  << rawid << std::endl;
50  return;
51  }
52 
53  float local[3] = { iData.localPosition().x(), iData.localPosition().y(), iData.localPosition().z() };
54  float global[3];
55 
56  // Specialized for DT simhits
57  DetId id(rawid);
58  if (id.det()==DetId::Muon && id.subdetId()==1) {
59  DTWireId wId(rawid);
60  rawid = wId.layerId().rawId(); // DT simhits are in the RF of the DTLayer, but their ID is the id of the wire!
61  if (abs(iData.particleType())!=13){
62  pointSet->SetMarkerStyle(26); // Draw non-muon simhits (e.g. delta rays) with a different marker
63  }
64  if (type == FWViewType::kRhoZ) { //
65  // In RhoZ view, draw hits at the middle of the layer in the global Z coordinate,
66  // otherwise they won't align with 1D rechits, for which only one coordinate is known.
67  if (wId.superLayer()==2) {
68  local[1]=0;
69  } else {
70  local[0]=0;
71  }
72  }
73  }
74 
75  geom->localToGlobal( rawid, local, global );
76  pointSet->SetNextPoint( global[0], global[1], global[2] );
77 }
78 
type
Definition: HCALResponse.h:21
virtual ~FWPSimHitProxyBuilder(void)
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:58
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
T y() const
Definition: PV3DBase.h:63
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:59
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
Local3DPoint localPosition() const
Definition: PSimHit.h:44
const FWPSimHitProxyBuilder & operator=(const FWPSimHitProxyBuilder &)
T z() const
Definition: PV3DBase.h:64
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
Definition: FWGeometry.cc:309
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:98
Definition: DetId.h:18
#define fwLog(_level_)
Definition: fwLog.h:50
virtual bool haveSingleProduct() const override
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
int particleType() const
Definition: PSimHit.h:85
T x() const
Definition: PV3DBase.h:62
void buildViewType(const PSimHit &iData, unsigned int iIndex, TEveElement &oItemHolder, FWViewType::EType type, const FWViewContext *) override
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681
unsigned int detUnitId() const
Definition: PSimHit.h:93