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();
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;
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]);
138 if (!matches.empty())
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();
162 geom->
localToGlobal(rawid, localTrajectoryPoint, globalTrajectoryPoint);
163 double phi = atan2(globalTrajectoryPoint[1], globalTrajectoryPoint[0]);
173 const std::vector<TEveVector>& extraPoints) {
177 t.fV.Set(track.
vx(), track.
vy(), track.
vz());
178 t.fP.Set(track.
px(), track.
py(), track.
pz());
182 TEveTrack* trk =
new TEveTrack(&t, propagator);
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;
253 addMatchInformation(&(*muon), pb, tList, showEndcap);
258 std::vector<TEveVector> extraPoints;
260 extraPoints.push_back(TEveVector(muon->
innerTrack()->innerPosition().x(),
263 extraPoints.push_back(TEveVector(muon->
innerTrack()->outerPosition().x(),
268 extraPoints.push_back(TEveVector(muon->
outerTrack()->innerPosition().x(),
271 extraPoints.push_back(TEveVector(muon->
outerTrack()->outerPosition().x(),
275 TEveTrack* trk =
nullptr;
276 if (extraPoints.empty())
const fireworks::Context & context() const
double eta() const final
momentum pseudorapidity
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
double pt() const final
transverse momentum
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)
bool isTrackerMuon() const override
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
bool isGlobalMuon() const override
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
TrackRef standAloneMuon() const override
reference to a stand-alone muon Track
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
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