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 ()
 
 FWMuonBuilder (const FWMuonBuilder &)=delete
 
const FWMuonBuilderoperator= (const FWMuonBuilder &)=delete
 
void setLineWidth (int w)
 
virtual ~FWMuonBuilder ()
 

Private Member Functions

void calculateField (const reco::Muon &iData, FWMagField *field)
 

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 200 of file FWMuonBuilder.cc.

200 : m_lineWidth(1) {}

◆ ~FWMuonBuilder()

FWMuonBuilder::~FWMuonBuilder ( )
virtual

Definition at line 202 of file FWMuonBuilder.cc.

202 {}

◆ FWMuonBuilder() [2/2]

FWMuonBuilder::FWMuonBuilder ( const FWMuonBuilder )
delete

Member Function Documentation

◆ buildMuon()

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

Definition at line 230 of file FWMuonBuilder.cc.

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

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

◆ calculateField()

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

Definition at line 209 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().

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

◆ operator=()

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

◆ setLineWidth()

void FWMuonBuilder::setLineWidth ( int  w)
inline

Definition at line 35 of file FWMuonBuilder.h.

References m_lineWidth, and w().

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

35 { m_lineWidth = w; }
T w() const

Member Data Documentation

◆ m_lineWidth

int FWMuonBuilder::m_lineWidth
private

Definition at line 45 of file FWMuonBuilder.h.

Referenced by buildMuon(), and setLineWidth().