CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWTrackingParticleProxyBuilder.cc
Go to the documentation of this file.
1 /*
2  * FWTrackingParticleProxyBuilder.cc
3  * FWorks
4  *
5  * Created by Ianna Osborne on 9/9/10.
6  *
7  */
8 
14 
17 
18 #include "TEveTrack.h"
19 
21 {
22 public:
25 
26  virtual void setItem(const FWEventItem* iItem) {
28  iItem->getConfig()->assertParam("Point Size", 1l, 3l, 1l);
29  }
30 
32 
33 private:
34  // Disable default copy constructor
36  // Disable default assignment operator
38 
39  void build( const TrackingParticle& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* );
40 };
41 
42 void
43 FWTrackingParticleProxyBuilder::build( const TrackingParticle& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* )
44 {
45  TEveRecTrack t;
46  t.fBeta = 1.0;
47  t.fP = TEveVector( iData.px(), iData.py(), iData.pz() );
48  t.fV = TEveVector( iData.vx(), iData.vy(), iData.vz() );
49  t.fSign = iData.charge();
50 
51  TEveTrack* track = new TEveTrack(&t, context().getTrackPropagator());
52  if( t.fSign == 0 )
53  track->SetLineStyle( 7 );
54 
55  TEvePointSet* pointSet = new TEvePointSet;
56  setupAddElement( pointSet, track );
57  pointSet->SetMarkerSize(item()->getConfig()->value<long>("Point Size"));
58 #warning "This file has been modified just to get it to compile without any regard as to whether it still functions as intended"
59 #ifdef REMOVED_JUST_TO_GET_IT_TO_COMPILE__THIS_CODE_NEEDS_TO_BE_CHECKED
60  const FWGeometry *geom = item()->getGeom();
61  const std::vector<PSimHit>& hits = iData.trackPSimHit();
62 
63  float local[3];
64  float localDir[3];
65  float global[3] = { 0.0, 0.0, 0.0 };
66  float globalDir[3] = { 0.0, 0.0, 0.0 };
67  std::vector<PSimHit>::const_iterator it = hits.begin();
68  std::vector<PSimHit>::const_iterator end = hits.end();
69  if( it != end )
70  {
71  unsigned int trackid = hits.begin()->trackId();
72 
73  for( ; it != end; ++it )
74  {
75  const PSimHit& phit = (*it);
76  if( phit.trackId() != trackid )
77  {
78  trackid = phit.trackId();
79  track->AddPathMark( TEvePathMark( TEvePathMark::kDecay, TEveVector( global[0], global[1], global[2] ),
80  TEveVector( globalDir[0], globalDir[1], globalDir[2] )));
81  }
82  local[0] = phit.localPosition().x();
83  local[1] = phit.localPosition().y();
84  local[2] = phit.localPosition().z();
85  localDir[0] = phit.momentumAtEntry().x();
86  localDir[1] = phit.momentumAtEntry().y();
87  localDir[2] = phit.momentumAtEntry().z();
88  geom->localToGlobal( phit.detUnitId(), local, global );
89  geom->localToGlobal( phit.detUnitId(), localDir, globalDir );
90  pointSet->SetNextPoint( global[0], global[1], global[2] );
91  track->AddPathMark( TEvePathMark( TEvePathMark::kReference/*kDaughter*/, TEveVector( global[0], global[1], global[2] ),
92  TEveVector( globalDir[0], globalDir[1], globalDir[2] )));
93  }
94  if( hits.size() > 1 )
95  track->AddPathMark( TEvePathMark( TEvePathMark::kDecay, TEveVector( global[0], global[1], global[2] ),
96  TEveVector( globalDir[0], globalDir[1], globalDir[2] )));
97  }
98 #endif
99 
100  track->MakeTrack();
101  setupAddElement( track, &oItemHolder );
102 }
103 
const fireworks::Context & context() const
FWProxyBuilderConfiguration * getConfig() const
Definition: FWEventItem.h:166
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
static const int kAllRPZBits
Definition: FWViewType.h:59
LocalVector momentumAtEntry() const
The momentum of the track that produced the hit, at entry point.
Definition: PSimHit.h:47
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
T y() const
Definition: PV3DBase.h:63
double py() const
y coordinate of momentum vector. Note this is taken from the first SimTrack only. ...
void localToGlobal(unsigned int id, const float *local, float *global) const
Definition: FWGeometry.cc:325
const FWEventItem * item() const
static const int kAll3DBits
Definition: FWViewType.h:60
double pz() const
z coordinate of momentum vector. Note this is taken from the first SimTrack only. ...
Local3DPoint localPosition() const
Definition: PSimHit.h:44
double vy() const
y coordinate of parent vertex position
virtual void setItem(const FWEventItem *iItem)
T z() const
Definition: PV3DBase.h:64
#define end
Definition: vmac.h:38
const FWTrackingParticleProxyBuilder & operator=(const FWTrackingParticleProxyBuilder &)
FWGenericParameter< T > * assertParam(const std::string &name, T def)
double vx() const
x coordinate of parent vertex position
unsigned int trackId() const
Definition: PSimHit.h:102
Monte Carlo truth information used for tracking validation.
int charge() const
Electric charge. Note this is taken from the first SimTrack only.
double px() const
x coordinate of momentum vector. Note this is taken from the first SimTrack only. ...
T x() const
Definition: PV3DBase.h:62
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:682
unsigned int detUnitId() const
Definition: PSimHit.h:93
double vz() const
z coordinate of parent vertex position
virtual void setItem(const FWEventItem *iItem)