7 #include "TEveVSDStructs.h" 9 #include "TEveStraightLineSet.h" 10 #include "TEveGeoNode.h" 32 std::vector<TEveVector> getRecoTrajectoryPoints(
const reco::Muon*
muon,
35 std::vector<TEveVector>
points;
38 float localTrajectoryPoint[3];
39 float globalTrajectoryPoint[3];
41 const std::vector<reco::MuonChamberMatch>&
matches = muon->
matches();
42 for( std::vector<reco::MuonChamberMatch>::const_iterator
chamber = matches.begin(),
43 chamberEnd = matches.end();
47 localTrajectoryPoint[0] =
chamber->x;
48 localTrajectoryPoint[1] =
chamber->y;
49 localTrajectoryPoint[2] = 0;
51 unsigned int rawid =
chamber->id.rawId();
54 geom->
localToGlobal( rawid, localTrajectoryPoint, globalTrajectoryPoint );
55 points.push_back( TEveVector(globalTrajectoryPoint[0],
56 globalTrajectoryPoint[1],
57 globalTrajectoryPoint[2] ));
65 void addMatchInformation(
const reco::Muon* muon,
67 TEveElement* parentList,
70 std::set<unsigned int> ids;
73 const std::vector<reco::MuonChamberMatch>& matches = muon->
matches();
76 std::auto_ptr<TEveStraightLineSet> segmentSet(
new TEveStraightLineSet );
78 segmentSet->SetLineWidth( 4 );
80 for( std::vector<reco::MuonChamberMatch>::const_iterator
chamber = matches.begin(),
81 chambersEnd = matches.end();
84 unsigned int rawid =
chamber->id.rawId();
85 float segmentLength = 0.0;
86 float segmentLimit = 0.0;
91 shape->SetElementName(
"Chamber" );
92 shape->RefMainTrans().Scale( 0.999, 0.999, 0.999 );
95 if( det->shape[0] == 1 )
97 segmentLength = det->shape[3];
98 segmentLimit = det->shape[4];
100 else if( det->shape[0] == 2 )
102 segmentLength = det->shape[3];
106 const double segmentLength = 15;
107 fwLog(
fwlog::kWarning ) << Form(
"FWMuonBuilder: unknown shape type in muon chamber with detId=%d. Setting segment length to %.0f cm.\n", rawid, segmentLength);
110 if( ids.insert( rawid ).second &&
116 for( std::vector<reco::MuonSegmentMatch>::const_iterator segment =
chamber->segmentMatches.begin(),
117 segmentEnd =
chamber->segmentMatches.end();
118 segment != segmentEnd; ++segment )
120 float segmentPosition[3] = { segment->x, segment->y, 0.0 };
121 float segmentDirection[3] = { segment->dXdZ, segment->dYdZ, 0.0 };
123 float localSegmentInnerPoint[3];
124 float localSegmentOuterPoint[3];
127 segmentLength, segmentLimit,
128 segmentPosition, segmentDirection,
129 localSegmentInnerPoint, localSegmentOuterPoint );
131 float globalSegmentInnerPoint[3];
132 float globalSegmentOuterPoint[3];
134 geom->
localToGlobal( *det, localSegmentInnerPoint, globalSegmentInnerPoint );
135 geom->
localToGlobal( *det, localSegmentOuterPoint, globalSegmentOuterPoint );
137 segmentSet->AddLine( globalSegmentInnerPoint[0], globalSegmentInnerPoint[1], globalSegmentInnerPoint[2],
138 globalSegmentOuterPoint[0], globalSegmentOuterPoint[1], globalSegmentOuterPoint[2] );
143 if( !matches.empty() )
157 float localTrajectoryPoint[3];
158 float globalTrajectoryPoint[3];
160 const std::vector<reco::MuonChamberMatch>& matches = muon->
matches();
161 for( std::vector<reco::MuonChamberMatch>::const_iterator
chamber = matches.begin(),
162 chamberEnd = matches.end();
166 localTrajectoryPoint[0] =
chamber->x;
167 localTrajectoryPoint[1] =
chamber->y;
168 localTrajectoryPoint[2] = 0;
170 unsigned int rawid =
chamber->id.rawId();
173 geom->
localToGlobal( rawid, localTrajectoryPoint, globalTrajectoryPoint );
174 double phi = atan2( globalTrajectoryPoint[1], globalTrajectoryPoint[0] );
184 const std::vector<TEveVector>& extraPoints )
189 t.fV.Set(track.
vx(), track.
vy(), track.
vz());
190 t.fP.Set(track.
px(), track.
py(), track.
pz());
194 TEveTrack* trk =
new TEveTrack( &t, propagator );
195 size_t n = extraPoints.size();
198 int lastDaughter = n-2;
199 for (
int i = 0;
i <= lastDaughter; ++
i)
200 trk->AddPathMark( TEvePathMark( TEvePathMark::kDaughter, extraPoints[
i] ) );
202 trk->AddPathMark( TEvePathMark( TEvePathMark::kDecay, extraPoints.back() ) );
232 if( fabs( iData.
eta() ) > 2.0 || iData.
pt() < 3 )
return;
236 if( estimate >= 0 ) field->
guessField( estimate );
257 TEveRecTrack recTrack;
276 getRecoTrajectoryPoints( muon, pb->
item()));
281 addMatchInformation( &(*muon), pb, tList, showEndcap );
288 std::vector<TEveVector> extraPoints;
291 extraPoints.push_back( TEveVector( muon->
innerTrack()->innerPosition().x(),
294 extraPoints.push_back( TEveVector( muon->
innerTrack()->outerPosition().x(),
300 extraPoints.push_back( TEveVector( muon->
outerTrack()->innerPosition().x(),
303 extraPoints.push_back( TEveVector( muon->
outerTrack()->outerPosition().x(),
308 if (extraPoints.empty())
virtual double pt() const final
transverse momentum
const fireworks::Context & context() const
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
virtual double eta() const final
momentum pseudorapidity
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)
double px() const
x coordinate of momentum vector
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)
void localToGlobal(unsigned int id, const float *local, float *global, bool translatep=true) const
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
double pz() const
z coordinate of momentum vector
double vz() const
z coordinate of the reference point on track
std::vector< MuonChamberMatch > & matches()
get muon matching information
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
double vy() const
y coordinate of the reference point on track
void guessFieldIsOn(bool guess) const
int charge() const
track electric charge
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
const FWGeometry * getGeom() const
double py() const
y coordinate of momentum vector
double vx() const
x coordinate of the reference point on track
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