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 
34  void buildViewType( const PSimHit& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type, const FWViewContext* ) override;
35 };
36 
37 void
38 FWPSimHitProxyBuilder::buildViewType( const PSimHit& iData, unsigned int iIndex, TEveElement& oItemHolder, FWViewType::EType type, const FWViewContext* )
39 {
40  TEvePointSet* pointSet = new TEvePointSet;
41  setupAddElement( pointSet, &oItemHolder );
42  const FWGeometry *geom = item()->getGeom();
43  unsigned int rawid = iData.detUnitId();
44  if( ! geom->contains( rawid ))
45  {
47  << "failed to get geometry of detid: "
48  << 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
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:325
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