CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWMuonBuilder Class Reference

#include <FWMuonBuilder.h>

Public Member Functions

void buildMuon (FWProxyBuilderBase *, const reco::Muon *muon, TEveElement *tList, bool showEndcap, bool onlyTracks=false)
 
 FWMuonBuilder ()
 
void setLineWidth (int w)
 
virtual ~FWMuonBuilder ()
 

Private Member Functions

void calculateField (const reco::Muon &iData, FWMagField *field)
 
 FWMuonBuilder (const FWMuonBuilder &)=delete
 
const FWMuonBuilderoperator= (const FWMuonBuilder &)=delete
 

Private Attributes

int m_lineWidth
 

Detailed Description

Definition at line 22 of file FWMuonBuilder.h.

Constructor & Destructor Documentation

FWMuonBuilder::FWMuonBuilder ( )

Definition at line 199 of file FWMuonBuilder.cc.

199 : m_lineWidth(1) {}
FWMuonBuilder::~FWMuonBuilder ( )
virtual

Definition at line 201 of file FWMuonBuilder.cc.

201 {}
FWMuonBuilder::FWMuonBuilder ( const FWMuonBuilder )
privatedelete

Member Function Documentation

void FWMuonBuilder::buildMuon ( FWProxyBuilderBase pb,
const reco::Muon muon,
TEveElement *  tList,
bool  showEndcap,
bool  onlyTracks = false 
)

Definition at line 229 of file FWMuonBuilder.cc.

References calculateField(), FWProxyBuilderBase::context(), fireworks::Context::getField(), fireworks::Context::getGeom(), fireworks::Context::getMuonTrackPropagator(), reco::Muon::globalTrack(), reco::Muon::innerTrack(), edm::Ref< C, T, F >::isAvailable(), reco::Muon::isGlobalMuon(), reco::Muon::isMatchesValid(), reco::Muon::isTrackerMuon(), FWProxyBuilderBase::item(), m_lineWidth, reco::Muon::outerTrack(), fireworks::prepareCandidate(), fireworks::prepareTrack(), and FWProxyBuilderBase::setupAddElement().

Referenced by FWMuonRhoPhiProxyBuilder::build(), and FWMuonProxyBuilder::build().

230  {
231  calculateField(*muon, pb->context().getField());
232 
233  TEveRecTrack recTrack;
234  recTrack.fBeta = 1.;
235 
236  // If we deal with a tracker muon we use the inner track and guide it
237  // through the trajectory points from the reconstruction. Segments
238  // represent hits. Matching between hits and the trajectory shows
239  // how well the inner track matches with the muon hypothesis.
240  //
241  // In other cases we use a global muon track with a few states from
242  // the inner and outer tracks or just the outer track if it's the
243  // only option
244 
245  if (muon->isTrackerMuon() && muon->innerTrack().isAvailable() && muon->isMatchesValid() &&
246  !buggyMuon(&*muon, pb->context().getGeom())) {
247  TEveTrack* trk = fireworks::prepareTrack(
248  *(muon->innerTrack()), pb->context().getMuonTrackPropagator(), getRecoTrajectoryPoints(muon, pb->item()));
249  trk->MakeTrack();
250  trk->SetLineWidth(m_lineWidth);
251  pb->setupAddElement(trk, tList);
252  if (!tracksOnly)
253  addMatchInformation(&(*muon), pb, tList, showEndcap);
254  return;
255  }
256 
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()));
266  }
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()));
274  }
275  TEveTrack* trk = nullptr;
276  if (extraPoints.empty())
278  else
279  trk =
280  prepareMuonTrackWithExtraPoints(*(muon->globalTrack()), pb->context().getMuonTrackPropagator(), extraPoints);
281 
282  trk->MakeTrack();
283  trk->SetLineWidth(m_lineWidth);
284  pb->setupAddElement(trk, tList);
285  return;
286  }
287 
288  if (muon->innerTrack().isAvailable()) {
289  TEveTrack* trk = fireworks::prepareTrack(*(muon->innerTrack()), pb->context().getMuonTrackPropagator());
290  trk->MakeTrack();
291  pb->setupAddElement(trk, tList);
292  return;
293  }
294 
295  if (muon->outerTrack().isAvailable()) {
296  TEveTrack* trk = fireworks::prepareTrack(*(muon->outerTrack()), pb->context().getMuonTrackPropagator());
297  trk->MakeTrack();
298  trk->SetLineWidth(m_lineWidth);
299  pb->setupAddElement(trk, tList);
300  return;
301  }
302 
303  // if got that far it means we have nothing but a candidate
304  // show it anyway.
305  TEveTrack* trk = fireworks::prepareCandidate(*muon, pb->context().getMuonTrackPropagator());
306  trk->MakeTrack();
307  trk->SetLineWidth(m_lineWidth);
308  pb->setupAddElement(trk, tList);
309 }
const fireworks::Context & context() const
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:62
virtual TrackRef innerTrack() const
Definition: Muon.h:45
const FWGeometry * getGeom() const
Definition: Context.h:72
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
bool isMatchesValid() const
Definition: Muon.h:143
bool isAvailable() const
Definition: Ref.h:537
const FWEventItem * item() const
bool isTrackerMuon() const override
Definition: Muon.h:299
void calculateField(const reco::Muon &iData, FWMagField *field)
FWMagField * getField() const
Definition: Context.h:66
bool isGlobalMuon() const override
Definition: Muon.h:298
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:48
TEveTrackPropagator * getMuonTrackPropagator() const
Definition: Context.h:64
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
virtual TrackRef globalTrack() const
reference to Track reconstructed in both tracked and muon detector
Definition: Muon.h:51
void FWMuonBuilder::calculateField ( const reco::Muon iData,
FWMagField field 
)
private

Definition at line 208 of file FWMuonBuilder.cc.

References fw::estimate_field(), reco::LeafCandidate::eta(), FWMagField::getSource(), FWMagField::guessField(), FWMagField::guessFieldIsOn(), reco::Muon::innerTrack(), edm::Ref< C, T, F >::isAvailable(), FWMagField::kNone, reco::Muon::outerTrack(), and reco::LeafCandidate::pt().

Referenced by buildMuon().

208  {
209  // if auto field estimation mode, do extra loop over muons.
210  // use both inner and outer track if available
211  if (field->getSource() == FWMagField::kNone) {
212  if (fabs(iData.eta()) > 2.0 || iData.pt() < 3)
213  return;
214  if (iData.innerTrack().isAvailable()) {
215  double estimate = fw::estimate_field(*(iData.innerTrack()), true);
216  if (estimate >= 0)
217  field->guessField(estimate);
218  }
219  if (iData.outerTrack().isAvailable()) {
220  double estimate = fw::estimate_field(*(iData.outerTrack()));
221  if (estimate >= 0)
222  field->guessFieldIsOn(estimate > 0.5);
223  }
224  }
225 }
double eta() const final
momentum pseudorapidity
virtual TrackRef innerTrack() const
Definition: Muon.h:45
double pt() const final
transverse momentum
bool isAvailable() const
Definition: Ref.h:537
double estimate_field(const reco::Track &track, bool highQuality=false)
void guessField(float estimate) const
Definition: FWMagField.cc:129
ESource getSource() const
Definition: FWMagField.h:31
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:48
void guessFieldIsOn(bool guess) const
Definition: FWMagField.cc:122
const FWMuonBuilder& FWMuonBuilder::operator= ( const FWMuonBuilder )
privatedelete
void FWMuonBuilder::setLineWidth ( int  w)
inline

Definition at line 35 of file FWMuonBuilder.h.

References w.

Referenced by FWMuonRhoPhiProxyBuilder::build(), and FWMuonProxyBuilder::build().

35 { m_lineWidth = w; }
const double w
Definition: UKUtility.cc:23

Member Data Documentation

int FWMuonBuilder::m_lineWidth
private

Definition at line 45 of file FWMuonBuilder.h.

Referenced by buildMuon().