7 #include "TEveVSDStructs.h"
9 #include "TEveStraightLineSet.h"
10 #include "TEveGeoNode.h"
11 #include "TEveGeoShape.h"
34 std::vector<TEveVector> points;
37 float localTrajectoryPoint[3];
38 float globalTrajectoryPoint[3];
40 const std::vector<reco::MuonChamberMatch>& matches = muon->
matches();
41 for (std::vector<reco::MuonChamberMatch>::const_iterator chamber = matches.begin(), chamberEnd = matches.end();
42 chamber != chamberEnd;
45 localTrajectoryPoint[0] = chamber->x;
46 localTrajectoryPoint[1] = chamber->y;
47 localTrajectoryPoint[2] = 0;
49 unsigned int rawid = chamber->id.rawId();
51 geom->
localToGlobal(rawid, localTrajectoryPoint, globalTrajectoryPoint);
52 points.push_back(TEveVector(globalTrajectoryPoint[0], globalTrajectoryPoint[1], globalTrajectoryPoint[2]));
61 std::set<unsigned int> ids;
64 const std::vector<reco::MuonChamberMatch>& matches = muon->
matches();
67 std::unique_ptr<TEveStraightLineSet> segmentSet(
new TEveStraightLineSet);
69 segmentSet->SetLineWidth(4);
71 for (std::vector<reco::MuonChamberMatch>::const_iterator chamber = matches.begin(), chambersEnd = matches.end();
72 chamber != chambersEnd;
74 unsigned int rawid = chamber->id.rawId();
75 float segmentLength = 0.0;
76 float segmentLimit = 0.0;
80 shape->SetElementName(
"Chamber");
81 shape->RefMainTrans().Scale(0.999, 0.999, 0.999);
84 if (det->shape[0] == 1)
86 segmentLength = det->shape[3];
87 segmentLimit = det->shape[4];
88 }
else if (det->shape[0] == 2)
90 segmentLength = det->shape[3];
92 const double segmentLength = 15;
94 "FWMuonBuilder: unknown shape type in muon chamber with detId=%d. Setting segment length to %.0f cm.\n",
99 if (ids.insert(rawid).second &&
104 for (std::vector<reco::MuonSegmentMatch>::const_iterator segment = chamber->segmentMatches.begin(),
105 segmentEnd = chamber->segmentMatches.end();
106 segment != segmentEnd;
108 float segmentPosition[3] = {segment->x, segment->y, 0.0};
109 float segmentDirection[3] = {segment->dXdZ, segment->dYdZ, 0.0};
111 float localSegmentInnerPoint[3];
112 float localSegmentOuterPoint[3];
120 localSegmentInnerPoint,
121 localSegmentOuterPoint);
123 float globalSegmentInnerPoint[3];
124 float globalSegmentOuterPoint[3];
126 geom->
localToGlobal(*det, localSegmentInnerPoint, globalSegmentInnerPoint);
127 geom->
localToGlobal(*det, localSegmentOuterPoint, globalSegmentOuterPoint);
129 segmentSet->AddLine(globalSegmentInnerPoint[0],
130 globalSegmentInnerPoint[1],
131 globalSegmentInnerPoint[2],
132 globalSegmentOuterPoint[0],
133 globalSegmentOuterPoint[1],
134 globalSegmentOuterPoint[2]);
139 if (!matches.empty())
149 float localTrajectoryPoint[3];
150 float globalTrajectoryPoint[3];
152 const std::vector<reco::MuonChamberMatch>& matches = muon->
matches();
153 for (std::vector<reco::MuonChamberMatch>::const_iterator chamber = matches.begin(), chamberEnd = matches.end();
154 chamber != chamberEnd;
157 localTrajectoryPoint[0] = chamber->x;
158 localTrajectoryPoint[1] = chamber->y;
159 localTrajectoryPoint[2] = 0;
161 unsigned int rawid = chamber->id.rawId();
163 geom->
localToGlobal(rawid, localTrajectoryPoint, globalTrajectoryPoint);
164 double phi = atan2(globalTrajectoryPoint[1], globalTrajectoryPoint[0]);
174 const std::vector<TEveVector>& extraPoints) {
178 t.fV.Set(track.
vx(), track.
vy(), track.
vz());
179 t.fP.Set(track.
px(), track.
py(), track.
pz());
183 TEveTrack* trk =
new TEveTrack(&t, propagator);
184 size_t n = extraPoints.size();
187 int lastDaughter = n - 2;
188 for (
int i = 0;
i <= lastDaughter; ++
i)
189 trk->AddPathMark(TEvePathMark(TEvePathMark::kDaughter, extraPoints[
i]));
191 trk->AddPathMark(TEvePathMark(TEvePathMark::kDecay, extraPoints.back()));
213 if (fabs(iData.
eta()) > 2.0 || iData.
pt() < 3)
234 TEveRecTrack recTrack;
254 addMatchInformation(&(*muon), pb, tList, showEndcap);
259 std::vector<TEveVector> extraPoints;
261 extraPoints.push_back(TEveVector(muon->
innerTrack()->innerPosition().x(),
264 extraPoints.push_back(TEveVector(muon->
innerTrack()->outerPosition().x(),
269 extraPoints.push_back(TEveVector(muon->
outerTrack()->innerPosition().x(),
272 extraPoints.push_back(TEveVector(muon->
outerTrack()->outerPosition().x(),
276 TEveTrack* trk =
nullptr;
277 if (extraPoints.empty())
const fireworks::Context & context() const
double pt() const final
transverse momentum
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
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) 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
bool isTrackerMuon() const override
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
TrackRef standAloneMuon() const override
reference to a stand-alone muon Track
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
FWGeometry * getGeom() const
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
bool isGlobalMuon() const override
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
double eta() const final
momentum pseudorapidity