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 | 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 &)
 
const FWMuonBuilderoperator= (const FWMuonBuilder &)
 

Private Attributes

int m_lineWidth
 

Detailed Description

Definition at line 22 of file FWMuonBuilder.h.

Constructor & Destructor Documentation

FWMuonBuilder::FWMuonBuilder ( )

Definition at line 187 of file FWMuonBuilder.cc.

187  :m_lineWidth(1)
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(), m_lineWidth, 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  trk->SetLineWidth(m_lineWidth);
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  trk->SetLineWidth(m_lineWidth);
287  pb->setupAddElement( trk, tList );
288  return;
289  }
290 
291  if( muon->innerTrack().isAvailable())
292  {
293  TEveTrack* trk = fireworks::prepareTrack( *( muon->innerTrack()), pb->context().getMuonTrackPropagator());
294  trk->MakeTrack();
295  pb->setupAddElement( trk, tList );
296  return;
297  }
298 
299  if( muon->outerTrack().isAvailable())
300  {
301  TEveTrack* trk = fireworks::prepareTrack( *( muon->outerTrack()), pb->context().getMuonTrackPropagator());
302  trk->MakeTrack();
303  trk->SetLineWidth(m_lineWidth);
304  pb->setupAddElement( trk, tList );
305  return;
306  }
307 
308  // if got that far it means we have nothing but a candidate
309  // show it anyway.
310  TEveTrack* trk = fireworks::prepareCandidate( *muon, pb->context().getMuonTrackPropagator());
311  trk->MakeTrack();
312  trk->SetLineWidth(m_lineWidth);
313  pb->setupAddElement( trk, tList );
314 }
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:73
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 TrackRef innerTrack() const
Definition: Muon.h:48
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
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 )
private
void FWMuonBuilder::setLineWidth ( int  w)
inline

Definition at line 40 of file FWMuonBuilder.h.

References m_lineWidth, and 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(), and setLineWidth().