CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions
FWMuonBuilder Class Reference

#include <FWMuonBuilder.h>

Public Member Functions

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

Private Member Functions

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

Detailed Description

Definition at line 23 of file FWMuonBuilder.h.

Constructor & Destructor Documentation

FWMuonBuilder::FWMuonBuilder ( )

Definition at line 188 of file FWMuonBuilder.cc.

189 {
190 }
FWMuonBuilder::~FWMuonBuilder ( )
virtual

Definition at line 192 of file FWMuonBuilder.cc.

193 {
194 }
FWMuonBuilder::FWMuonBuilder ( const FWMuonBuilder )
private

Member Function Documentation

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

Definition at line 225 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(), 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() &&
246  muon->innerTrack().isAvailable() &&
247  muon->isMatchesValid() &&
248  !buggyMuon( &*muon, pb->context().getGeom()))
249  {
250  TEveTrack* trk = fireworks::prepareTrack( *(muon->innerTrack()),
252  getRecoTrajectoryPoints( muon, pb->item()));
253  trk->MakeTrack();
254  pb->setupAddElement( trk, tList );
255  if( ! tracksOnly )
256  addMatchInformation( &(*muon), pb, tList, showEndcap );
257  return;
258  }
259 
260  if( muon->isGlobalMuon() &&
261  muon->globalTrack().isAvailable())
262  {
263  std::vector<TEveVector> extraPoints;
264  if( muon->innerTrack().isAvailable() && muon->innerTrack()->extra().isAvailable())
265  {
266  extraPoints.push_back( TEveVector( muon->innerTrack()->innerPosition().x(),
267  muon->innerTrack()->innerPosition().y(),
268  muon->innerTrack()->innerPosition().z()));
269  extraPoints.push_back( TEveVector( muon->innerTrack()->outerPosition().x(),
270  muon->innerTrack()->outerPosition().y(),
271  muon->innerTrack()->outerPosition().z()));
272  }
273  if( muon->outerTrack().isAvailable() && muon->outerTrack()->extra().isAvailable())
274  {
275  extraPoints.push_back( TEveVector( muon->outerTrack()->innerPosition().x(),
276  muon->outerTrack()->innerPosition().y(),
277  muon->outerTrack()->innerPosition().z()));
278  extraPoints.push_back( TEveVector( muon->outerTrack()->outerPosition().x(),
279  muon->outerTrack()->outerPosition().y(),
280  muon->outerTrack()->outerPosition().z()));
281  }
282  TEveTrack* trk = fireworks::prepareTrack( *( muon->globalTrack()),
284  extraPoints );
285  trk->MakeTrack();
286  pb->setupAddElement( trk, tList );
287  return;
288  }
289 
290  if( muon->innerTrack().isAvailable())
291  {
292  TEveTrack* trk = fireworks::prepareTrack( *( muon->innerTrack()), pb->context().getMuonTrackPropagator());
293  trk->MakeTrack();
294  pb->setupAddElement( trk, tList );
295  return;
296  }
297 
298  if( muon->outerTrack().isAvailable())
299  {
300  TEveTrack* trk = fireworks::prepareTrack( *( muon->outerTrack()), pb->context().getMuonTrackPropagator());
301  trk->MakeTrack();
302  pb->setupAddElement( trk, tList );
303  return;
304  }
305 
306  // if got that far it means we have nothing but a candidate
307  // show it anyway.
308  TEveTrack* trk = fireworks::prepareCandidate( *muon, pb->context().getMuonTrackPropagator());
309  trk->MakeTrack();
310  pb->setupAddElement( trk, tList );
311 }
const fireworks::Context & context() const
TEveTrack * prepareTrack(const reco::Track &track, TEveTrackPropagator *propagator, const std::vector< TEveVector > &extraRefPoints=std::vector< TEveVector >())
Definition: TrackUtils.cc:70
virtual TrackRef innerTrack() const
Definition: Muon.h:49
bool isTrackerMuon() const
Definition: Muon.h:212
const FWGeometry * getGeom() const
Definition: Context.h:84
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
bool isGlobalMuon() const
Definition: Muon.h:211
bool isMatchesValid() const
Definition: Muon.h:139
bool isAvailable() const
Definition: Ref.h:276
const FWEventItem * item() const
void calculateField(const reco::Muon &iData, FWMagField *field)
FWMagField * getField() const
Definition: Context.h:78
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:52
TEveTrackPropagator * getMuonTrackPropagator() const
Definition: Context.h:76
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:55
void FWMuonBuilder::calculateField ( const reco::Muon iData,
FWMagField field 
)
private

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

203 {
204  // if auto field estimation mode, do extra loop over muons.
205  // use both inner and outer track if available
206  if( field->getSource() == FWMagField::kNone )
207  {
208  if( fabs( iData.eta() ) > 2.0 || iData.pt() < 3 ) return;
209  if( iData.innerTrack().isAvailable())
210  {
211  double estimate = fw::estimate_field( *( iData.innerTrack()), true );
212  if( estimate >= 0 ) field->guessField( estimate );
213  }
214  if( iData.outerTrack().isAvailable() )
215  {
216  double estimate = fw::estimate_field( *( iData.outerTrack()));
217  if( estimate >= 0 ) field->guessFieldIsOn( estimate > 0.5 );
218  }
219  }
220 }
virtual TrackRef innerTrack() const
Definition: Muon.h:49
bool isAvailable() const
Definition: Ref.h:276
virtual double eta() const
momentum pseudorapidity
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:34
virtual TrackRef outerTrack() const
reference to Track reconstructed in the muon detector only
Definition: Muon.h:52
virtual double pt() const
transverse momentum
void guessFieldIsOn(bool guess) const
Definition: FWMagField.cc:148
const FWMuonBuilder& FWMuonBuilder::operator= ( const FWMuonBuilder )
private