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();
45 localTrajectoryPoint[0] =
chamber->x;
46 localTrajectoryPoint[1] =
chamber->y;
47 localTrajectoryPoint[2] = 0;
49 unsigned int rawid =
chamber->id.rawId();
50 if (
geom->contains(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();
74 unsigned int rawid =
chamber->id.rawId();
75 float segmentLength = 0.0;
76 float segmentLimit = 0.0;
78 if (
geom->contains(rawid)) {
79 TEveGeoShape*
shape =
geom->getEveShape(rawid);
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]);
146 if (!
muon->standAloneMuon().isAvailable() || !
muon->standAloneMuon()->extra().isAvailable())
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();
157 localTrajectoryPoint[0] =
chamber->x;
158 localTrajectoryPoint[1] =
chamber->y;
159 localTrajectoryPoint[2] = 0;
161 unsigned int rawid =
chamber->id.rawId();
162 if (
geom->contains(rawid)) {
163 geom->localToGlobal(rawid, localTrajectoryPoint, globalTrajectoryPoint);
164 double phi = atan2(globalTrajectoryPoint[1], globalTrajectoryPoint[0]);
165 if (
cos(
phi -
muon->standAloneMuon()->innerPosition().phi()) < 0)
174 const std::vector<TEveVector>& extraPoints) {
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;
246 if (
muon->isTrackerMuon() &&
muon->innerTrack().isAvailable() &&
muon->isMatchesValid() &&
254 addMatchInformation(&(*
muon), pb, tList, showEndcap);
258 if (
muon->isGlobalMuon() &&
muon->globalTrack().isAvailable()) {
259 std::vector<TEveVector> extraPoints;
260 if (
muon->innerTrack().isAvailable() &&
muon->innerTrack()->extra().isAvailable()) {
261 extraPoints.push_back(TEveVector(
muon->innerTrack()->innerPosition().x(),
262 muon->innerTrack()->innerPosition().y(),
263 muon->innerTrack()->innerPosition().z()));
264 extraPoints.push_back(TEveVector(
muon->innerTrack()->outerPosition().x(),
265 muon->innerTrack()->outerPosition().y(),
266 muon->innerTrack()->outerPosition().z()));
268 if (
muon->outerTrack().isAvailable() &&
muon->outerTrack()->extra().isAvailable()) {
269 extraPoints.push_back(TEveVector(
muon->outerTrack()->innerPosition().x(),
270 muon->outerTrack()->innerPosition().y(),
271 muon->outerTrack()->innerPosition().z()));
272 extraPoints.push_back(TEveVector(
muon->outerTrack()->outerPosition().x(),
273 muon->outerTrack()->outerPosition().y(),
274 muon->outerTrack()->outerPosition().z()));
276 TEveTrack* trk =
nullptr;
277 if (extraPoints.empty())
289 if (
muon->innerTrack().isAvailable()) {
296 if (
muon->outerTrack().isAvailable()) {
double pt() const final
transverse momentum
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void guessFieldIsOn(bool guess) const
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
void buildMuon(FWProxyBuilderBase *, const reco::Muon *muon, TEveElement *tList, bool showEndcap, bool onlyTracks=false)
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
TEveTrackPropagator * getMuonTrackPropagator() const
const fireworks::Context & context() 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)
FWGeometry * getGeom() const
Cos< T >::type cos(const T &t)
virtual TrackRef innerTrack() const
const FWGeometry * getGeom() const
void guessField(float estimate) const
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
ESource getSource() const
const FWEventItem * item() const
std::vector< FWGeometry::GeomDetInfo >::const_iterator IdToInfoItr
FWMagField * getField() const
double eta() const final
momentum pseudorapidity