7 #include "TEveVSDStructs.h"
9 #include "TEveStraightLineSet.h"
10 #include "TEveGeoNode.h"
33 std::vector<TEveVector>
points;
36 float localTrajectoryPoint[3];
37 float globalTrajectoryPoint[3];
39 const std::vector<reco::MuonChamberMatch>&
matches =
muon->matches();
40 for (std::vector<reco::MuonChamberMatch>::const_iterator
chamber =
matches.begin(), chamberEnd =
matches.end();
44 localTrajectoryPoint[0] =
chamber->x;
45 localTrajectoryPoint[1] =
chamber->y;
46 localTrajectoryPoint[2] = 0;
48 unsigned int rawid =
chamber->id.rawId();
49 if (
geom->contains(rawid)) {
50 geom->localToGlobal(rawid, localTrajectoryPoint, globalTrajectoryPoint);
51 points.push_back(TEveVector(globalTrajectoryPoint[0], globalTrajectoryPoint[1], globalTrajectoryPoint[2]));
60 std::set<unsigned int> ids;
63 const std::vector<reco::MuonChamberMatch>&
matches =
muon->matches();
66 std::unique_ptr<TEveStraightLineSet> segmentSet(
new TEveStraightLineSet);
68 segmentSet->SetLineWidth(4);
70 for (std::vector<reco::MuonChamberMatch>::const_iterator
chamber =
matches.begin(), chambersEnd =
matches.end();
73 unsigned int rawid =
chamber->id.rawId();
74 float segmentLength = 0.0;
75 float segmentLimit = 0.0;
77 if (
geom->contains(rawid)) {
78 TEveGeoShape* shape =
geom->getEveShape(rawid);
79 shape->SetElementName(
"Chamber");
80 shape->RefMainTrans().Scale(0.999, 0.999, 0.999);
83 if (det->shape[0] == 1)
85 segmentLength = det->shape[3];
86 segmentLimit = det->shape[4];
87 }
else if (det->shape[0] == 2)
89 segmentLength = det->shape[3];
91 const double segmentLength = 15;
93 "FWMuonBuilder: unknown shape type in muon chamber with detId=%d. Setting segment length to %.0f cm.\n",
98 if (ids.insert(rawid).second &&
103 for (std::vector<reco::MuonSegmentMatch>::const_iterator segment =
chamber->segmentMatches.begin(),
104 segmentEnd =
chamber->segmentMatches.end();
105 segment != segmentEnd;
107 float segmentPosition[3] = {segment->x, segment->y, 0.0};
108 float segmentDirection[3] = {segment->dXdZ, segment->dYdZ, 0.0};
110 float localSegmentInnerPoint[3];
111 float localSegmentOuterPoint[3];
119 localSegmentInnerPoint,
120 localSegmentOuterPoint);
122 float globalSegmentInnerPoint[3];
123 float globalSegmentOuterPoint[3];
125 geom->localToGlobal(*det, localSegmentInnerPoint, globalSegmentInnerPoint);
126 geom->localToGlobal(*det, localSegmentOuterPoint, globalSegmentOuterPoint);
128 segmentSet->AddLine(globalSegmentInnerPoint[0],
129 globalSegmentInnerPoint[1],
130 globalSegmentInnerPoint[2],
131 globalSegmentOuterPoint[0],
132 globalSegmentOuterPoint[1],
133 globalSegmentOuterPoint[2]);
145 if (!
muon->standAloneMuon().isAvailable() || !
muon->standAloneMuon()->extra().isAvailable())
148 float localTrajectoryPoint[3];
149 float globalTrajectoryPoint[3];
151 const std::vector<reco::MuonChamberMatch>&
matches =
muon->matches();
152 for (std::vector<reco::MuonChamberMatch>::const_iterator
chamber =
matches.begin(), chamberEnd =
matches.end();
156 localTrajectoryPoint[0] =
chamber->x;
157 localTrajectoryPoint[1] =
chamber->y;
158 localTrajectoryPoint[2] = 0;
160 unsigned int rawid =
chamber->id.rawId();
161 if (
geom->contains(rawid)) {
162 geom->localToGlobal(rawid, localTrajectoryPoint, globalTrajectoryPoint);
163 double phi = atan2(globalTrajectoryPoint[1], globalTrajectoryPoint[0]);
164 if (
cos(
phi -
muon->standAloneMuon()->innerPosition().phi()) < 0)
173 const std::vector<TEveVector>& extraPoints) {
183 size_t n = extraPoints.size();
186 int lastDaughter =
n - 2;
187 for (
int i = 0;
i <= lastDaughter; ++
i)
188 trk->AddPathMark(TEvePathMark(TEvePathMark::kDaughter, extraPoints[
i]));
190 trk->AddPathMark(TEvePathMark(TEvePathMark::kDecay, extraPoints.back()));
212 if (fabs(iData.
eta()) > 2.0 || iData.
pt() < 3)
233 TEveRecTrack recTrack;
245 if (
muon->isTrackerMuon() &&
muon->innerTrack().isAvailable() &&
muon->isMatchesValid() &&
253 addMatchInformation(&(*
muon), pb, tList, showEndcap);
257 if (
muon->isGlobalMuon() &&
muon->globalTrack().isAvailable()) {
258 std::vector<TEveVector> extraPoints;
259 if (
muon->innerTrack().isAvailable() &&
muon->innerTrack()->extra().isAvailable()) {
260 extraPoints.push_back(TEveVector(
muon->innerTrack()->innerPosition().x(),
261 muon->innerTrack()->innerPosition().y(),
262 muon->innerTrack()->innerPosition().z()));
263 extraPoints.push_back(TEveVector(
muon->innerTrack()->outerPosition().x(),
264 muon->innerTrack()->outerPosition().y(),
265 muon->innerTrack()->outerPosition().z()));
267 if (
muon->outerTrack().isAvailable() &&
muon->outerTrack()->extra().isAvailable()) {
268 extraPoints.push_back(TEveVector(
muon->outerTrack()->innerPosition().x(),
269 muon->outerTrack()->innerPosition().y(),
270 muon->outerTrack()->innerPosition().z()));
271 extraPoints.push_back(TEveVector(
muon->outerTrack()->outerPosition().x(),
272 muon->outerTrack()->outerPosition().y(),
273 muon->outerTrack()->outerPosition().z()));
275 TEveTrack* trk =
nullptr;
276 if (extraPoints.empty())
288 if (
muon->innerTrack().isAvailable()) {
295 if (
muon->outerTrack().isAvailable()) {