8 #include "TEveVSDStructs.h"
10 #include "TEveStraightLineSet.h"
11 #include "TEveGeoNode.h"
33 std::vector<TEveVector> getRecoTrajectoryPoints(
const reco::Muon*
muon,
36 std::vector<TEveVector> points;
39 float localTrajectoryPoint[3];
40 float globalTrajectoryPoint[3];
42 const std::vector<reco::MuonChamberMatch>& matches = muon->
matches();
43 for( std::vector<reco::MuonChamberMatch>::const_iterator chamber = matches.begin(),
44 chamberEnd = matches.end();
45 chamber != matches.end(); ++chamber )
48 localTrajectoryPoint[0] = chamber->x;
49 localTrajectoryPoint[1] = chamber->y;
50 localTrajectoryPoint[2] = 0;
52 unsigned int rawid = chamber->id.rawId();
55 geom->
localToGlobal( rawid, localTrajectoryPoint, globalTrajectoryPoint );
56 points.push_back( TEveVector(globalTrajectoryPoint[0],
57 globalTrajectoryPoint[1],
58 globalTrajectoryPoint[2] ));
66 void addMatchInformation(
const reco::Muon* muon,
68 TEveElement* parentList,
71 std::set<unsigned int> ids;
74 const std::vector<reco::MuonChamberMatch>& matches = muon->
matches();
77 std::auto_ptr<TEveStraightLineSet> segmentSet(
new TEveStraightLineSet );
79 segmentSet->SetLineWidth( 4 );
81 for( std::vector<reco::MuonChamberMatch>::const_iterator chamber = matches.begin(),
82 chambersEnd = matches.end();
83 chamber != chambersEnd; ++chamber )
85 unsigned int rawid = chamber->id.rawId();
86 float segmentLength = 0.0;
87 float segmentLimit = 0.0;
92 shape->SetElementName(
"Chamber" );
93 shape->RefMainTrans().Scale( 0.999, 0.999, 0.999 );
96 if( det->shape[0] == 1 )
98 segmentLength = det->shape[3];
99 segmentLimit = det->shape[4];
101 else if( det->shape[0] == 0 )
103 segmentLength = det->shape[3];
106 if( ids.insert( rawid ).second &&
112 for( std::vector<reco::MuonSegmentMatch>::const_iterator segment = chamber->segmentMatches.begin(),
113 segmentEnd = chamber->segmentMatches.end();
114 segment != segmentEnd; ++segment )
116 float segmentPosition[3] = { segment->x, segment->y, 0.0 };
117 float segmentDirection[3] = { segment->dXdZ, segment->dYdZ, 0.0 };
119 float localSegmentInnerPoint[3];
120 float localSegmentOuterPoint[3];
123 segmentLength, segmentLimit,
124 segmentPosition, segmentDirection,
125 localSegmentInnerPoint, localSegmentOuterPoint );
127 float globalSegmentInnerPoint[3];
128 float globalSegmentOuterPoint[3];
130 geom->
localToGlobal( *det, localSegmentInnerPoint, globalSegmentInnerPoint );
131 geom->
localToGlobal( *det, localSegmentOuterPoint, globalSegmentOuterPoint );
133 segmentSet->AddLine( globalSegmentInnerPoint[0], globalSegmentInnerPoint[1], globalSegmentInnerPoint[2],
134 globalSegmentOuterPoint[0], globalSegmentOuterPoint[1], globalSegmentOuterPoint[2] );
139 if( !matches.empty() )
153 float localTrajectoryPoint[3];
154 float globalTrajectoryPoint[3];
156 const std::vector<reco::MuonChamberMatch>& matches = muon->
matches();
157 for( std::vector<reco::MuonChamberMatch>::const_iterator chamber = matches.begin(),
158 chamberEnd = matches.end();
159 chamber != chamberEnd; ++chamber )
162 localTrajectoryPoint[0] = chamber->x;
163 localTrajectoryPoint[1] = chamber->y;
164 localTrajectoryPoint[2] = 0;
166 unsigned int rawid = chamber->id.rawId();
169 geom->
localToGlobal( rawid, localTrajectoryPoint, globalTrajectoryPoint );
170 double phi = atan2( globalTrajectoryPoint[1], globalTrajectoryPoint[0] );
203 if( fabs( iData.
eta() ) > 2.0 || iData.
pt() < 3 )
return;
207 if( estimate >= 0 ) field->
guessField( estimate );
228 TEveRecTrack recTrack;
247 getRecoTrajectoryPoints( muon, pb->
item()));
251 addMatchInformation( &(*muon), pb, tList, showEndcap );
258 std::vector<TEveVector> extraPoints;
261 extraPoints.push_back( TEveVector( muon->
innerTrack()->innerPosition().x(),
264 extraPoints.push_back( TEveVector( muon->
innerTrack()->outerPosition().x(),
270 extraPoints.push_back( TEveVector( muon->
outerTrack()->innerPosition().x(),
273 extraPoints.push_back( TEveVector( muon->
outerTrack()->outerPosition().x(),
const fireworks::Context & context() const
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
virtual TrackRef innerTrack() const
IdToInfoItr find(unsigned int) const
bool isTrackerMuon() const
const FWGeometry * getGeom() const
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
bool isGlobalMuon() const
bool isMatchesValid() const
void buildMuon(FWProxyBuilderBase *, const reco::Muon *muon, TEveElement *tList, bool showEndcap, bool onlyTracks=false)
void localToGlobal(unsigned int id, const float *local, float *global) const
virtual double eta() const
momentum pseudorapidity
const FWEventItem * item() const
double estimate_field(const reco::Track &track, bool highQuality=false)
void calculateField(const reco::Muon &iData, FWMagField *field)
void createSegment(int detector, bool matchedSegment, float segmentLength, float segmentLimit, float *segmentPosition, float *segmentDirection, float *segmentInnerPoint, float *segmentOuterPoint)
FWMagField * getField() const
TEveGeoShape * getEveShape(unsigned int id) const
void guessField(float estimate) const
Cos< T >::type cos(const T &t)
bool contains(unsigned int id) const
ESource getSource() const
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
TEveTrackPropagator * getMuonTrackPropagator() const
virtual double pt() const
transverse momentum
std::vector< MuonChamberMatch > & matches()
get muon matching information
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
void guessFieldIsOn(bool guess) const
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
const FWGeometry * getGeom() const
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
virtual TrackRef standAloneMuon() const
reference to a stand-alone muon Track