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

212  :m_lineWidth(1)
213 {
214 }
FWMuonBuilder::~FWMuonBuilder ( )
virtual

Definition at line 216 of file FWMuonBuilder.cc.

217 {
218 }
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 249 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().

254 {
255  calculateField( *muon, pb->context().getField());
256 
257  TEveRecTrack recTrack;
258  recTrack.fBeta = 1.;
259 
260  // If we deal with a tracker muon we use the inner track and guide it
261  // through the trajectory points from the reconstruction. Segments
262  // represent hits. Matching between hits and the trajectory shows
263  // how well the inner track matches with the muon hypothesis.
264  //
265  // In other cases we use a global muon track with a few states from
266  // the inner and outer tracks or just the outer track if it's the
267  // only option
268 
269  if( muon->isTrackerMuon() &&
270  muon->innerTrack().isAvailable() &&
271  muon->isMatchesValid() &&
272  !buggyMuon( &*muon, pb->context().getGeom()))
273  {
274  TEveTrack* trk = fireworks::prepareTrack( *(muon->innerTrack()),
276  getRecoTrajectoryPoints( muon, pb->item()));
277  trk->MakeTrack();
278  trk->SetLineWidth(m_lineWidth);
279  pb->setupAddElement( trk, tList );
280  if( ! tracksOnly )
281  addMatchInformation( &(*muon), pb, tList, showEndcap );
282  return;
283  }
284 
285  if( muon->isGlobalMuon() &&
286  muon->globalTrack().isAvailable())
287  {
288  std::vector<TEveVector> extraPoints;
289  if( muon->innerTrack().isAvailable() && muon->innerTrack()->extra().isAvailable())
290  {
291  extraPoints.push_back( TEveVector( muon->innerTrack()->innerPosition().x(),
292  muon->innerTrack()->innerPosition().y(),
293  muon->innerTrack()->innerPosition().z()));
294  extraPoints.push_back( TEveVector( muon->innerTrack()->outerPosition().x(),
295  muon->innerTrack()->outerPosition().y(),
296  muon->innerTrack()->outerPosition().z()));
297  }
298  if( muon->outerTrack().isAvailable() && muon->outerTrack()->extra().isAvailable())
299  {
300  extraPoints.push_back( TEveVector( muon->outerTrack()->innerPosition().x(),
301  muon->outerTrack()->innerPosition().y(),
302  muon->outerTrack()->innerPosition().z()));
303  extraPoints.push_back( TEveVector( muon->outerTrack()->outerPosition().x(),
304  muon->outerTrack()->outerPosition().y(),
305  muon->outerTrack()->outerPosition().z()));
306  }
307  TEveTrack* trk = nullptr;
308  if (extraPoints.empty())
310  else
311  trk = prepareMuonTrackWithExtraPoints(*( muon->globalTrack()),pb->context().getMuonTrackPropagator(), extraPoints);
312 
313  trk->MakeTrack();
314  trk->SetLineWidth(m_lineWidth);
315  pb->setupAddElement( trk, tList );
316  return;
317  }
318 
319  if( muon->innerTrack().isAvailable())
320  {
321  TEveTrack* trk = fireworks::prepareTrack( *( muon->innerTrack()), pb->context().getMuonTrackPropagator());
322  trk->MakeTrack();
323  pb->setupAddElement( trk, tList );
324  return;
325  }
326 
327  if( muon->outerTrack().isAvailable())
328  {
329  TEveTrack* trk = fireworks::prepareTrack( *( muon->outerTrack()), pb->context().getMuonTrackPropagator());
330  trk->MakeTrack();
331  trk->SetLineWidth(m_lineWidth);
332  pb->setupAddElement( trk, tList );
333  return;
334  }
335 
336  // if got that far it means we have nothing but a candidate
337  // show it anyway.
338  TEveTrack* trk = fireworks::prepareCandidate( *muon, pb->context().getMuonTrackPropagator());
339  trk->MakeTrack();
340  trk->SetLineWidth(m_lineWidth);
341  pb->setupAddElement( trk, tList );
342 }
bool isAvailable() const
Definition: Ref.h:577
const fireworks::Context & context() const
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:69
virtual TrackRef innerTrack() const
Definition: Muon.h:48
const FWGeometry * getGeom() const
Definition: Context.h:83
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
bool isMatchesValid() const
Definition: Muon.h:142
const FWEventItem * item() const
bool isTrackerMuon() const override
Definition: Muon.h:266
void calculateField(const reco::Muon &iData, FWMagField *field)
FWMagField * getField() const
Definition: Context.h:77
bool isGlobalMuon() const override
Definition: Muon.h:265
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:51
TEveTrackPropagator * getMuonTrackPropagator() const
Definition: Context.h:75
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:54
void FWMuonBuilder::calculateField ( const reco::Muon iData,
FWMagField field 
)
private

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

227 {
228  // if auto field estimation mode, do extra loop over muons.
229  // use both inner and outer track if available
230  if( field->getSource() == FWMagField::kNone )
231  {
232  if( fabs( iData.eta() ) > 2.0 || iData.pt() < 3 ) return;
233  if( iData.innerTrack().isAvailable())
234  {
235  double estimate = fw::estimate_field( *( iData.innerTrack()), true );
236  if( estimate >= 0 ) field->guessField( estimate );
237  }
238  if( iData.outerTrack().isAvailable() )
239  {
240  double estimate = fw::estimate_field( *( iData.outerTrack()));
241  if( estimate >= 0 ) field->guessFieldIsOn( estimate > 0.5 );
242  }
243  }
244 }
bool isAvailable() const
Definition: Ref.h:577
double eta() const final
momentum pseudorapidity
virtual TrackRef innerTrack() const
Definition: Muon.h:48
double pt() const final
transverse momentum
double estimate_field(const reco::Track &track, bool highQuality=false)
void guessField(float estimate) const
Definition: FWMagField.cc:155
ESource getSource() const
Definition: FWMagField.h:33
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:51
void guessFieldIsOn(bool guess) const
Definition: FWMagField.cc:148
const FWMuonBuilder& FWMuonBuilder::operator= ( const FWMuonBuilder )
privatedelete
void FWMuonBuilder::setLineWidth ( int  w)
inline

Definition at line 40 of file FWMuonBuilder.h.

References w.

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

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

Member Data Documentation

int FWMuonBuilder::m_lineWidth
private

Definition at line 49 of file FWMuonBuilder.h.

Referenced by buildMuon().