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() [1/2]

FWMuonBuilder::FWMuonBuilder ( )

Definition at line 199 of file FWMuonBuilder.cc.

199 : m_lineWidth(1) {}

◆ ~FWMuonBuilder()

FWMuonBuilder::~FWMuonBuilder ( )
virtual

Definition at line 201 of file FWMuonBuilder.cc.

201 {}

◆ FWMuonBuilder() [2/2]

FWMuonBuilder::FWMuonBuilder ( const FWMuonBuilder )
privatedelete

Member Function Documentation

◆ buildMuon()

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

Definition at line 229 of file FWMuonBuilder.cc.

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())
277  trk = fireworks::prepareTrack(*(muon->globalTrack()), pb->context().getMuonTrackPropagator());
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.
306  trk->MakeTrack();
307  trk->SetLineWidth(m_lineWidth);
308  pb->setupAddElement(trk, tList);
309 }

References calculateField(), FWProxyBuilderBase::context(), fireworks::Context::getField(), fireworks::Context::getGeom(), fireworks::Context::getMuonTrackPropagator(), FWProxyBuilderBase::item(), m_lineWidth, fireworks::prepareCandidate(), fireworks::prepareTrack(), and FWProxyBuilderBase::setupAddElement().

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

◆ calculateField()

void FWMuonBuilder::calculateField ( const reco::Muon iData,
FWMagField field 
)
private

Definition at line 208 of file FWMuonBuilder.cc.

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 }

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().

◆ operator=()

const FWMuonBuilder& FWMuonBuilder::operator= ( const FWMuonBuilder )
privatedelete

◆ setLineWidth()

void FWMuonBuilder::setLineWidth ( int  w)
inline

Definition at line 35 of file FWMuonBuilder.h.

35 { m_lineWidth = w; }

References m_lineWidth, and w.

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

Member Data Documentation

◆ m_lineWidth

int FWMuonBuilder::m_lineWidth
private

Definition at line 45 of file FWMuonBuilder.h.

Referenced by buildMuon(), and setLineWidth().

FWMagField::guessField
void guessField(float estimate) const
Definition: FWMagField.cc:129
FWMagField::kNone
Definition: FWMagField.h:18
fireworks::Context::getMuonTrackPropagator
TEveTrackPropagator * getMuonTrackPropagator() const
Definition: Context.h:64
muon
Definition: MuonCocktails.h:17
edm::Ref::isAvailable
bool isAvailable() const
Definition: Ref.h:537
reco::LeafCandidate::pt
double pt() const final
transverse momentum
Definition: LeafCandidate.h:146
w
const double w
Definition: UKUtility.cc:23
reco::Muon::outerTrack
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:48
FWMagField::getSource
ESource getSource() const
Definition: FWMagField.h:31
reco::LeafCandidate::eta
double eta() const final
momentum pseudorapidity
Definition: LeafCandidate.h:152
fireworks::prepareTrack
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:62
fireworks::Context::getGeom
FWGeometry * getGeom() const
Definition: Context.h:72
FWMuonBuilder::calculateField
void calculateField(const reco::Muon &iData, FWMagField *field)
Definition: FWMuonBuilder.cc:208
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
reco::Muon::innerTrack
virtual TrackRef innerTrack() const
Definition: Muon.h:45
fireworks::Context::getField
FWMagField * getField() const
Definition: Context.h:66
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
FWMagField::guessFieldIsOn
void guessFieldIsOn(bool guess) const
Definition: FWMagField.cc:122
fireworks::prepareCandidate
TEveTrack * prepareCandidate(const reco::Candidate &track, TEveTrackPropagator *propagator)
Definition: CandidateUtils.cc:9
FWMuonBuilder::m_lineWidth
int m_lineWidth
Definition: FWMuonBuilder.h:45
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition: FWProxyBuilderBase.cc:412
fw::estimate_field
double estimate_field(const reco::Track &track, bool highQuality=false)
Definition: estimate_field.cc:11