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 != chamberEnd; ++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] == 2 )
103 segmentLength = det->shape[3];
107 const double segmentLength = 15;
108 fwLog(
fwlog::kWarning ) << Form(
"FWMuonBuilder: unknown shape type in muon chamber with detId=%d. Setting segment length to %.0f cm.\n", rawid, segmentLength);
111 if( ids.insert( rawid ).second &&
117 for( std::vector<reco::MuonSegmentMatch>::const_iterator segment = chamber->segmentMatches.begin(),
118 segmentEnd = chamber->segmentMatches.end();
119 segment != segmentEnd; ++segment )
121 float segmentPosition[3] = { segment->x, segment->y, 0.0 };
122 float segmentDirection[3] = { segment->dXdZ, segment->dYdZ, 0.0 };
124 float localSegmentInnerPoint[3];
125 float localSegmentOuterPoint[3];
128 segmentLength, segmentLimit,
129 segmentPosition, segmentDirection,
130 localSegmentInnerPoint, localSegmentOuterPoint );
132 float globalSegmentInnerPoint[3];
133 float globalSegmentOuterPoint[3];
135 geom->
localToGlobal( *det, localSegmentInnerPoint, globalSegmentInnerPoint );
136 geom->
localToGlobal( *det, localSegmentOuterPoint, globalSegmentOuterPoint );
138 segmentSet->AddLine( globalSegmentInnerPoint[0], globalSegmentInnerPoint[1], globalSegmentInnerPoint[2],
139 globalSegmentOuterPoint[0], globalSegmentOuterPoint[1], globalSegmentOuterPoint[2] );
144 if( !matches.empty() )
158 float localTrajectoryPoint[3];
159 float globalTrajectoryPoint[3];
161 const std::vector<reco::MuonChamberMatch>& matches = muon->
matches();
162 for( std::vector<reco::MuonChamberMatch>::const_iterator chamber = matches.begin(),
163 chamberEnd = matches.end();
164 chamber != chamberEnd; ++chamber )
167 localTrajectoryPoint[0] = chamber->x;
168 localTrajectoryPoint[1] = chamber->y;
169 localTrajectoryPoint[2] = 0;
171 unsigned int rawid = chamber->id.rawId();
174 geom->
localToGlobal( rawid, localTrajectoryPoint, globalTrajectoryPoint );
175 double phi = atan2( globalTrajectoryPoint[1], globalTrajectoryPoint[0] );
208 if( fabs( iData.
eta() ) > 2.0 || iData.
pt() < 3 )
return;
212 if( estimate >= 0 ) field->
guessField( estimate );
233 TEveRecTrack recTrack;
252 getRecoTrajectoryPoints( muon, pb->
item()));
256 addMatchInformation( &(*muon), pb, tList, showEndcap );
263 std::vector<TEveVector> extraPoints;
266 extraPoints.push_back( TEveVector( muon->
innerTrack()->innerPosition().x(),
269 extraPoints.push_back( TEveVector( muon->
innerTrack()->outerPosition().x(),
275 extraPoints.push_back( TEveVector( muon->
outerTrack()->innerPosition().x(),
278 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
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 float eta() const GCC11_FINAL
momentum pseudorapidity
std::vector< MuonChamberMatch > & matches()
get muon matching information
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
void guessFieldIsOn(bool guess) const
virtual float pt() const GCC11_FINAL
transverse momentum
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