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 22 of file FWMuonBuilder.h.

Constructor & Destructor Documentation

FWMuonBuilder::FWMuonBuilder ( )

Definition at line 187 of file FWMuonBuilder.cc.

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

Definition at line 191 of file FWMuonBuilder.cc.

192 {
193 }
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 224 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().

229 {
230  calculateField( *muon, pb->context().getField());
231 
232  TEveRecTrack recTrack;
233  recTrack.fBeta = 1.;
234 
235  // If we deal with a tracker muon we use the inner track and guide it
236  // through the trajectory points from the reconstruction. Segments
237  // represent hits. Matching between hits and the trajectory shows
238  // how well the inner track matches with the muon hypothesis.
239  //
240  // In other cases we use a global muon track with a few states from
241  // the inner and outer tracks or just the outer track if it's the
242  // only option
243 
244  if( muon->isTrackerMuon() &&
245  muon->innerTrack().isAvailable() &&
246  muon->isMatchesValid() &&
247  !buggyMuon( &*muon, pb->context().getGeom()))
248  {
249  TEveTrack* trk = fireworks::prepareTrack( *(muon->innerTrack()),
251  getRecoTrajectoryPoints( muon, pb->item()));
252  trk->MakeTrack();
253  pb->setupAddElement( trk, tList );
254  if( ! tracksOnly )
255  addMatchInformation( &(*muon), pb, tList, showEndcap );
256  return;
257  }
258 
259  if( muon->isGlobalMuon() &&
260  muon->globalTrack().isAvailable())
261  {
262  std::vector<TEveVector> extraPoints;
263  if( muon->innerTrack().isAvailable() && muon->innerTrack()->extra().isAvailable())
264  {
265  extraPoints.push_back( TEveVector( muon->innerTrack()->innerPosition().x(),
266  muon->innerTrack()->innerPosition().y(),
267  muon->innerTrack()->innerPosition().z()));
268  extraPoints.push_back( TEveVector( muon->innerTrack()->outerPosition().x(),
269  muon->innerTrack()->outerPosition().y(),
270  muon->innerTrack()->outerPosition().z()));
271  }
272  if( muon->outerTrack().isAvailable() && muon->outerTrack()->extra().isAvailable())
273  {
274  extraPoints.push_back( TEveVector( muon->outerTrack()->innerPosition().x(),
275  muon->outerTrack()->innerPosition().y(),
276  muon->outerTrack()->innerPosition().z()));
277  extraPoints.push_back( TEveVector( muon->outerTrack()->outerPosition().x(),
278  muon->outerTrack()->outerPosition().y(),
279  muon->outerTrack()->outerPosition().z()));
280  }
281  TEveTrack* trk = fireworks::prepareTrack( *( muon->globalTrack()),
283  extraPoints );
284  trk->MakeTrack();
285  pb->setupAddElement( trk, tList );
286  return;
287  }
288 
289  if( muon->innerTrack().isAvailable())
290  {
291  TEveTrack* trk = fireworks::prepareTrack( *( muon->innerTrack()), pb->context().getMuonTrackPropagator());
292  trk->MakeTrack();
293  pb->setupAddElement( trk, tList );
294  return;
295  }
296 
297  if( muon->outerTrack().isAvailable())
298  {
299  TEveTrack* trk = fireworks::prepareTrack( *( muon->outerTrack()), pb->context().getMuonTrackPropagator());
300  trk->MakeTrack();
301  pb->setupAddElement( trk, tList );
302  return;
303  }
304 
305  // if got that far it means we have nothing but a candidate
306  // show it anyway.
307  TEveTrack* trk = fireworks::prepareCandidate( *muon, pb->context().getMuonTrackPropagator());
308  trk->MakeTrack();
309  pb->setupAddElement( trk, tList );
310 }
bool isAvailable() const
Definition: Ref.h:614
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
bool isTrackerMuon() const
Definition: Muon.h:219
const FWGeometry * getGeom() const
Definition: Context.h:83
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
bool isGlobalMuon() const
Definition: Muon.h:218
bool isMatchesValid() const
Definition: Muon.h:138
const FWEventItem * item() const
void calculateField(const reco::Muon &iData, FWMagField *field)
FWMagField * getField() const
Definition: Context.h:77
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 201 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().

202 {
203  // if auto field estimation mode, do extra loop over muons.
204  // use both inner and outer track if available
205  if( field->getSource() == FWMagField::kNone )
206  {
207  if( fabs( iData.eta() ) > 2.0 || iData.pt() < 3 ) return;
208  if( iData.innerTrack().isAvailable())
209  {
210  double estimate = fw::estimate_field( *( iData.innerTrack()), true );
211  if( estimate >= 0 ) field->guessField( estimate );
212  }
213  if( iData.outerTrack().isAvailable() )
214  {
215  double estimate = fw::estimate_field( *( iData.outerTrack()));
216  if( estimate >= 0 ) field->guessFieldIsOn( estimate > 0.5 );
217  }
218  }
219 }
bool isAvailable() const
Definition: Ref.h:614
virtual float pt() const
transverse momentum
virtual TrackRef innerTrack() const
Definition: Muon.h:48
double estimate_field(const reco::Track &track, bool highQuality=false)
virtual float eta() const
momentum pseudorapidity
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 )
private