CMS 3D CMS Logo

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

#include <MuonTrackLoader.h>

Public Types

typedef
MuonCandidate::CandidateContainer 
CandidateContainer
 
typedef
MuonCandidate::TrajectoryContainer 
TrajectoryContainer
 

Public Member Functions

edm::OrphanHandle
< reco::TrackCollection
loadTracks (const TrajectoryContainer &, edm::Event &, const std::string &="", bool=true)
 Convert the trajectories into tracks and load the tracks in the event. More...
 
edm::OrphanHandle
< reco::TrackCollection
loadTracks (const TrajectoryContainer &, edm::Event &, std::vector< bool > &, const std::string &="", bool=true)
 Convert the trajectories into tracks and load the tracks in the event. More...
 
edm::OrphanHandle
< reco::TrackCollection
loadTracks (const TrajectoryContainer &, edm::Event &, std::vector< std::pair< Trajectory *, reco::TrackRef > >, const std::string &="", bool=true)
 Convert the trajectories into tracks and load the tracks in the event. More...
 
edm::OrphanHandle
< reco::MuonTrackLinksCollection
loadTracks (const CandidateContainer &, edm::Event &)
 Convert the trajectories into tracks and load the tracks in the event. More...
 
 MuonTrackLoader (edm::ParameterSet &parameterSet, const MuonServiceProxy *service=0)
 Constructor for the STA reco the args must be specify! More...
 
virtual ~MuonTrackLoader ()
 Destructor. More...
 

Private Member Functions

std::pair< bool, reco::TrackbuildTrackAtPCA (const Trajectory &trajectory, const reco::BeamSpot &) const
 Build a track at the PCA WITHOUT any vertex constriant. More...
 
reco::TrackExtra buildTrackExtra (const Trajectory &) const
 
std::pair< bool, reco::TrackbuildTrackUpdatedAtPCA (const reco::Track &trackAtPCA, const reco::BeamSpot &) const
 Takes a track at the PCA and applies the vertex constriant. More...
 

Private Attributes

bool theAllowNoVtxFlag
 
edm::InputTag theBeamSpotInputTag
 
std::string theL2SeededTkLabel
 Label for L2SeededTracks. More...
 
bool thePutTkTrackFlag
 
const MuonServiceProxytheService
 
edm::ESHandle< TrajectorySmoothertheSmoother
 
std::string theSmootherName
 
bool theSmoothingStep
 
bool theSmoothTkTrackFlag
 
bool theTrajectoryFlag
 
bool theUpdatingAtVtx
 
MuonUpdatorAtVertextheUpdatorAtVtx
 

Detailed Description

Class to load the tracks in the event, it provide some common functionalities both for all the RecoMuon producers.

Date:
2012/08/16 16:25:56
Revision:
1.30
Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Class to load the product in the event

Date:
2012/08/16 16:26:08
Revision:
1.89
Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 36 of file MuonTrackLoader.h.

Member Typedef Documentation

Definition at line 40 of file MuonTrackLoader.h.

Definition at line 39 of file MuonTrackLoader.h.

Constructor & Destructor Documentation

MuonTrackLoader::MuonTrackLoader ( edm::ParameterSet parameterSet,
const MuonServiceProxy service = 0 
)

Constructor for the STA reco the args must be specify!

Definition at line 46 of file MuonTrackLoader.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), MuonUpdatorAtVertex_cff::MuonUpdatorAtVertex, theAllowNoVtxFlag, theBeamSpotInputTag, theL2SeededTkLabel, thePutTkTrackFlag, theSmootherName, theSmoothingStep, theSmoothTkTrackFlag, theTrajectoryFlag, theUpdatingAtVtx, and theUpdatorAtVtx.

46  :
47  theService(service){
48 
49  // option to do or not the smoothing step.
50  // the trajectories which are passed to the track loader are supposed to be non-smoothed
51  theSmoothingStep = parameterSet.getParameter<bool>("DoSmoothing");
53  theSmootherName = parameterSet.getParameter<string>("Smoother");
54 
55  // update at vertex
56  theUpdatingAtVtx = parameterSet.getParameter<bool>("VertexConstraint");
57 
58  // beam spot input tag
59  theBeamSpotInputTag = parameterSet.getParameter<edm::InputTag>("beamSpot");
60 
61  // Flag to put the trajectory into the event
62  theTrajectoryFlag = parameterSet.getUntrackedParameter<bool>("PutTrajectoryIntoEvent",true);
63 
64  theL2SeededTkLabel = parameterSet.getUntrackedParameter<string>("MuonSeededTracksInstance",string());
65 
66  ParameterSet updatorPar = parameterSet.getParameter<ParameterSet>("MuonUpdatorAtVertexParameters");
67  theUpdatorAtVtx = new MuonUpdatorAtVertex(updatorPar,service);
68 
69  thePutTkTrackFlag = parameterSet.getUntrackedParameter<bool>("PutTkTrackIntoEvent",false);
70  theSmoothTkTrackFlag = parameterSet.getUntrackedParameter<bool>("SmoothTkTrack",false);
71  theAllowNoVtxFlag = parameterSet.getUntrackedParameter<bool>("AllowNoVertex",false);
72 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string theSmootherName
edm::InputTag theBeamSpotInputTag
MuonUpdatorAtVertex * theUpdatorAtVtx
std::string theL2SeededTkLabel
Label for L2SeededTracks.
const MuonServiceProxy * theService
MuonTrackLoader::~MuonTrackLoader ( )
virtual

Destructor.

Definition at line 74 of file MuonTrackLoader.cc.

References theUpdatorAtVtx.

74  {
76 }
MuonUpdatorAtVertex * theUpdatorAtVtx

Member Function Documentation

pair< bool, reco::Track > MuonTrackLoader::buildTrackAtPCA ( const Trajectory trajectory,
const reco::BeamSpot beamSpot 
) const
private

Build a track at the PCA WITHOUT any vertex constriant.

Definition at line 594 of file MuonTrackLoader.cc.

References FreeTrajectoryState::charge(), Trajectory::chiSquared(), FreeTrajectoryState::curvilinearError(), debug, MuonPatternRecoDumper::dumpFTS(), TrajectoryStateOnSurface::freeState(), Trajectory::geometricalInnermostState(), TrajectoryStateOnSurface::globalPosition(), TrackerBounds::isInside(), LogTrace, FreeTrajectoryState::momentum(), Trajectory::ndof(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), MuonUpdatorAtVertex::propagate(), theAllowNoVtxFlag, theService, theUpdatorAtVtx, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

594  {
595 
596  const string metname = "Muon|RecoMuon|MuonTrackLoader";
597 
599 
600  // FIXME: check the prop direction
601  TrajectoryStateOnSurface innerTSOS = trajectory.geometricalInnermostState();
602 
603  // This is needed to extrapolate the tsos at vertex
604  LogTrace(metname) << "Propagate to PCA...";
605  pair<bool,FreeTrajectoryState>
606  extrapolationResult = theUpdatorAtVtx->propagate(innerTSOS, beamSpot);
607  FreeTrajectoryState ftsAtVtx;
608 
609  if(extrapolationResult.first)
610  ftsAtVtx = extrapolationResult.second;
611  else{
612  if(TrackerBounds::isInside(innerTSOS.globalPosition())){
613  LogInfo(metname) << "Track in the Tracker: taking the innermost state instead of the state at PCA";
614  ftsAtVtx = *innerTSOS.freeState();
615  }
616  else{
617  if ( theAllowNoVtxFlag ) {
618  LogInfo(metname) << "Propagation to PCA failed, taking the innermost state instead of the state at PCA";
619  ftsAtVtx = *innerTSOS.freeState();
620  } else {
621  LogInfo(metname) << "Stand Alone track: this track will be rejected";
622  return pair<bool,reco::Track>(false,reco::Track());
623  }
624  }
625  }
626 
627  LogTrace(metname) << "TSOS after the extrapolation at vtx";
628  LogTrace(metname) << debug.dumpFTS(ftsAtVtx);
629 
630  GlobalPoint pca = ftsAtVtx.position();
631  math::XYZPoint persistentPCA(pca.x(),pca.y(),pca.z());
632  GlobalVector p = ftsAtVtx.momentum();
633  math::XYZVector persistentMomentum(p.x(),p.y(),p.z());
634 
635  bool bon = true;
636  if(fabs(theService->magneticField()->inTesla(GlobalPoint(0,0,0)).z()) < 0.01) bon=false;
637  double ndof = trajectory.ndof(bon);
638 
639  reco::Track track(trajectory.chiSquared(),
640  ndof,
641  persistentPCA,
642  persistentMomentum,
643  ftsAtVtx.charge(),
644  ftsAtVtx.curvilinearError());
645 
646  return pair<bool,reco::Track>(true,track);
647 }
static bool isInside(const GlobalPoint &)
const std::string metname
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:62
std::pair< bool, FreeTrajectoryState > propagate(const TrajectoryStateOnSurface &tsos, const reco::BeamSpot &beamSpot) const
Propagate the state to the 2D-PCA.
GlobalPoint globalPosition() const
TrackCharge charge() const
TrajectoryStateOnSurface geometricalInnermostState() const
Definition: Trajectory.cc:232
const CurvilinearTrajectoryError & curvilinearError() const
std::string dumpFTS(const FreeTrajectoryState &fts) const
FreeTrajectoryState * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:63
MuonUpdatorAtVertex * theUpdatorAtVtx
GlobalVector momentum() const
#define LogTrace(id)
GlobalPoint position() const
int ndof(bool bon=true) const
Definition: Trajectory.cc:74
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
const MuonServiceProxy * theService
#define debug
Definition: MEtoEDMFormat.h:34
T x() const
Definition: PV3DBase.h:61
double chiSquared() const
Definition: Trajectory.h:242
reco::TrackExtra MuonTrackLoader::buildTrackExtra ( const Trajectory trajectory) const
private

Definition at line 688 of file MuonTrackLoader.cc.

References alongMomentum, BoundSurface::bounds(), TrajectoryStateOnSurface::curvilinearError(), Trajectory::direction(), Trajectory::firstMeasurement(), TrajectoryStateOnSurface::globalParameters(), Bounds::inside(), Trajectory::lastMeasurement(), LogTrace, GlobalTrajectoryParameters::momentum(), oppositeToMomentum, AlCaHLTBitMon_ParallelJobs::p, GlobalTrajectoryParameters::position(), TrajectoryMeasurement::recHit(), Trajectory::recHits(), Trajectory::seedRef(), GeomDet::surface(), theService, GeomDet::toLocal(), TrajectoryMeasurement::updatedState(), v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

688  {
689 
690  const string metname = "Muon|RecoMuon|MuonTrackLoader";
691 
692  const Trajectory::RecHitContainer transRecHits = trajectory.recHits();
693 
694  // put the collection of TrackingRecHit in the event
695 
696  // sets the outermost and innermost TSOSs
697  // FIXME: check it!
698  TrajectoryStateOnSurface outerTSOS;
699  TrajectoryStateOnSurface innerTSOS;
700  unsigned int innerId=0, outerId=0;
702  DetId outerDetId;
703 
704  if (trajectory.direction() == alongMomentum) {
705  LogTrace(metname)<<"alongMomentum";
706  outerTSOS = trajectory.lastMeasurement().updatedState();
707  innerTSOS = trajectory.firstMeasurement().updatedState();
708  outerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
709  innerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
710  outerRecHit = trajectory.lastMeasurement().recHit();
711  outerDetId = trajectory.lastMeasurement().recHit()->geographicalId();
712  }
713  else if (trajectory.direction() == oppositeToMomentum) {
714  LogTrace(metname)<<"oppositeToMomentum";
715  outerTSOS = trajectory.firstMeasurement().updatedState();
716  innerTSOS = trajectory.lastMeasurement().updatedState();
717  outerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
718  innerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
719  outerRecHit = trajectory.firstMeasurement().recHit();
720  outerDetId = trajectory.firstMeasurement().recHit()->geographicalId();
721  }
722  else LogError(metname)<<"Wrong propagation direction!";
723 
724  const GeomDet *outerDet = theService->trackingGeometry()->idToDet(outerDetId);
725  GlobalPoint outerTSOSPos = outerTSOS.globalParameters().position();
726  bool inside = outerDet->surface().bounds().inside(outerDet->toLocal(outerTSOSPos));
727 
728 
729  GlobalPoint hitPos = (outerRecHit->isValid()) ? outerRecHit->globalPosition() : outerTSOS.globalParameters().position() ;
730 
731  if(!inside) {
732  LogTrace(metname)<<"The Global Muon outerMostMeasurementState is not compatible with the recHit detector! Setting outerMost postition to recHit position if recHit isValid: " << outerRecHit->isValid();
733  LogTrace(metname)<<"From " << outerTSOSPos << " to " << hitPos;
734  }
735 
736 
737  //build the TrackExtra
738  GlobalPoint v = (inside) ? outerTSOSPos : hitPos ;
739  GlobalVector p = outerTSOS.globalParameters().momentum();
740  math::XYZPoint outpos( v.x(), v.y(), v.z() );
741  math::XYZVector outmom( p.x(), p.y(), p.z() );
742 
743  v = innerTSOS.globalParameters().position();
744  p = innerTSOS.globalParameters().momentum();
745  math::XYZPoint inpos( v.x(), v.y(), v.z() );
746  math::XYZVector inmom( p.x(), p.y(), p.z() );
747 
748  reco::TrackExtra trackExtra(outpos, outmom, true, inpos, inmom, true,
749  outerTSOS.curvilinearError(), outerId,
750  innerTSOS.curvilinearError(), innerId,
751  trajectory.direction(),trajectory.seedRef());
752 
753  return trackExtra;
754 
755 }
virtual bool inside(const Local3DPoint &) const =0
Determine if the point is inside the bounds.
const std::string metname
const CurvilinearTrajectoryError & curvilinearError() const
T y() const
Definition: PV3DBase.h:62
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
ConstRecHitPointer recHit() const
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
PropagationDirection const & direction() const
Definition: Trajectory.cc:195
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
T z() const
Definition: PV3DBase.h:63
TrajectoryStateOnSurface updatedState() const
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:296
#define LogTrace(id)
Definition: DetId.h:20
const Bounds & bounds() const
Definition: BoundSurface.h:89
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:194
const GlobalTrajectoryParameters & globalParameters() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:44
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
const MuonServiceProxy * theService
T x() const
Definition: PV3DBase.h:61
mathSSE::Vec4< T > v
pair< bool, reco::Track > MuonTrackLoader::buildTrackUpdatedAtPCA ( const reco::Track trackAtPCA,
const reco::BeamSpot beamSpot 
) const
private

Takes a track at the PCA and applies the vertex constriant.

Definition at line 650 of file MuonTrackLoader.cc.

References FreeTrajectoryState::charge(), reco::TrackBase::chi2(), FreeTrajectoryState::curvilinearError(), debug, MuonPatternRecoDumper::dumpFTS(), LogTrace, FreeTrajectoryState::momentum(), reco::TrackBase::ndof(), AlCaHLTBitMon_ParallelJobs::p, FreeTrajectoryState::position(), theService, theUpdatorAtVtx, MuonUpdatorAtVertex::update(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

650  {
651 
652  const string metname = "Muon|RecoMuon|MuonTrackLoader";
654 
655  // build the transient track
656  reco::TransientTrack transientTrack(track,
657  &*theService->magneticField(),
658  theService->trackingGeometry());
659 
660  LogTrace(metname) << "Apply the vertex constraint";
661  pair<bool,FreeTrajectoryState> updateResult = theUpdatorAtVtx->update(transientTrack,beamSpot);
662 
663  if(!updateResult.first){
664  return pair<bool,reco::Track>(false,reco::Track());
665  }
666 
667  LogTrace(metname) << "FTS after the vertex constraint";
668  FreeTrajectoryState &ftsAtVtx = updateResult.second;
669 
670  LogTrace(metname) << debug.dumpFTS(ftsAtVtx);
671 
672  GlobalPoint pca = ftsAtVtx.position();
673  math::XYZPoint persistentPCA(pca.x(),pca.y(),pca.z());
674  GlobalVector p = ftsAtVtx.momentum();
675  math::XYZVector persistentMomentum(p.x(),p.y(),p.z());
676 
677  reco::Track updatedTrack(track.chi2(),
678  track.ndof(),
679  persistentPCA,
680  persistentMomentum,
681  ftsAtVtx.charge(),
682  ftsAtVtx.curvilinearError());
683 
684  return pair<bool,reco::Track>(true,updatedTrack);
685 }
const std::string metname
T y() const
Definition: PV3DBase.h:62
TrackCharge charge() const
const CurvilinearTrajectoryError & curvilinearError() const
std::string dumpFTS(const FreeTrajectoryState &fts) const
std::pair< bool, FreeTrajectoryState > update(const reco::TransientTrack &track, const reco::BeamSpot &beamSpot) const
Applies the vertex constraint.
T z() const
Definition: PV3DBase.h:63
MuonUpdatorAtVertex * theUpdatorAtVtx
GlobalVector momentum() const
#define LogTrace(id)
GlobalPoint position() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:31
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
const MuonServiceProxy * theService
#define debug
Definition: MEtoEDMFormat.h:34
T x() const
Definition: PV3DBase.h:61
edm::OrphanHandle<reco::TrackCollection> MuonTrackLoader::loadTracks ( const TrajectoryContainer ,
edm::Event ,
const std::string &  = "",
bool  = true 
)

Convert the trajectories into tracks and load the tracks in the event.

Referenced by MuonTrackFinder::load(), and loadTracks().

edm::OrphanHandle<reco::TrackCollection> MuonTrackLoader::loadTracks ( const TrajectoryContainer ,
edm::Event ,
std::vector< bool > &  ,
const std::string &  = "",
bool  = true 
)

Convert the trajectories into tracks and load the tracks in the event.

edm::OrphanHandle<reco::TrackCollection> MuonTrackLoader::loadTracks ( const TrajectoryContainer ,
edm::Event ,
std::vector< std::pair< Trajectory *, reco::TrackRef > >  ,
const std::string &  = "",
bool  = true 
)

Convert the trajectories into tracks and load the tracks in the event.

OrphanHandle< reco::MuonTrackLinksCollection > MuonTrackLoader::loadTracks ( const CandidateContainer muonCands,
edm::Event event 
)

Convert the trajectories into tracks and load the tracks in the event.

Definition at line 292 of file MuonTrackLoader.cc.

References edm::OrphanHandleBase::isValid(), loadTracks(), LogDebug, LogTrace, position, reco::MuonTrackLinks::setGlobalTrack(), reco::MuonTrackLinks::setStandAloneTrack(), reco::MuonTrackLinks::setTrackerTrack(), theL2SeededTkLabel, thePutTkTrackFlag, and theSmoothTkTrackFlag.

293  {
294 
295  const string metname = "Muon|RecoMuon|MuonTrackLoader";
296 
297  // the muon collection, it will be loaded in the event
298  auto_ptr<reco::MuonTrackLinksCollection> trackLinksCollection(new reco::MuonTrackLinksCollection());
299 
300  // don't waste any time...
301  if ( muonCands.empty() ) {
302  auto_ptr<reco::TrackExtraCollection> trackExtraCollection(new reco::TrackExtraCollection() );
303  auto_ptr<TrackingRecHitCollection> recHitCollection(new TrackingRecHitCollection() );
304  auto_ptr<reco::TrackCollection> trackCollection( new reco::TrackCollection() );
305 
306  event.put(recHitCollection);
307  event.put(trackExtraCollection);
308  event.put(trackCollection);
309 
310  //need to also put the tracker tracks collection if requested
311  if(thePutTkTrackFlag){
312  //will take care of putting nothing in the event but the empty collection
313  TrajectoryContainer trackerTrajs;
314  loadTracks(trackerTrajs, event, theL2SeededTkLabel, theSmoothTkTrackFlag);
315  }
316 
317  return event.put(trackLinksCollection);
318  }
319 
320  // get combined Trajectories
321  TrajectoryContainer combinedTrajs;
322  TrajectoryContainer trackerTrajs;
323  for (CandidateContainer::const_iterator it = muonCands.begin(); it != muonCands.end(); ++it) {
324  LogDebug(metname) << "Loader glbSeedRef " << (*it)->trajectory()->seedRef().isNonnull();
325  if ((*it)->trackerTrajectory() ) LogDebug(metname) << " " << "tkSeedRef " << (*it)->trackerTrajectory()->seedRef().isNonnull();
326 
327  combinedTrajs.push_back((*it)->trajectory());
328  if ( thePutTkTrackFlag ) trackerTrajs.push_back((*it)->trackerTrajectory());
329 
330  else {
331  if ((*it)->trackerTrajectory()) delete ((*it)->trackerTrajectory());
332  }
333 
334  // // Create the links between sta and tracker tracks
335  // reco::MuonTrackLinks links;
336  // links.setStandAloneTrack((*it)->muonTrack());
337  // links.setTrackerTrack((*it)->trackerTrack());
338  // trackLinksCollection->push_back(links);
339  // delete *it;
340  }
341 
342  // create the TrackCollection of combined Trajectories
343  // FIXME: could this be done one track at a time in the previous loop?
344  LogTrace(metname) << "Build combinedTracks";
345  std::vector<bool> combTksVec(combinedTrajs.size(), false);
346  OrphanHandle<reco::TrackCollection> combinedTracks = loadTracks(combinedTrajs, event, combTksVec);
347 
349  std::vector<bool> trackerTksVec(trackerTrajs.size(), false);
350  if(thePutTkTrackFlag) {
351  LogTrace(metname) << "Build trackerTracks: "
352  << trackerTrajs.size();
353  trackerTracks = loadTracks(trackerTrajs, event, trackerTksVec, theL2SeededTkLabel, theSmoothTkTrackFlag);
354  } else {
355  for (TrajectoryContainer::iterator it = trackerTrajs.begin(); it != trackerTrajs.end(); ++it) {
356  if(*it) delete *it;
357  }
358  }
359 
360  LogTrace(metname) << "Set the final links in the MuonTrackLinks collection";
361 
362  unsigned int candposition(0), position(0), tkposition(0);
363  //reco::TrackCollection::const_iterator glIt = combinedTracks->begin(),
364  // glEnd = combinedTracks->end();
365 
366  for (CandidateContainer::const_iterator it = muonCands.begin(); it != muonCands.end(); ++it, ++candposition) {
367 
368  // The presence of the global track determines whether to fill the MuonTrackLinks or not
369  // N.B. We are assuming here that the global tracks in "combinedTracks"
370  // have the same order as the muon candidates in "muonCands"
371  // (except for possible missing tracks), which should always be the case...
372  //if( glIt == glEnd ) break;
373  if(combTksVec[candposition]) {
374  reco::TrackRef combinedTR(combinedTracks, position++);
375  //++glIt;
376 
377  // Create the links between sta and tracker tracks
378  reco::MuonTrackLinks links;
379  links.setStandAloneTrack((*it)->muonTrack());
380  links.setTrackerTrack((*it)->trackerTrack());
381  links.setGlobalTrack(combinedTR);
382 
383  if(thePutTkTrackFlag && trackerTksVec[candposition]) {
384  reco::TrackRef trackerTR(trackerTracks, tkposition++);
385  links.setTrackerTrack(trackerTR);
386  }
387 
388  trackLinksCollection->push_back(links);
389  }
390 
391  else { // if no global track, still increment the tracker-track counter when appropriate
392  if(thePutTkTrackFlag && trackerTksVec[candposition]) tkposition++;
393  }
394 
395  delete *it;
396  }
397 
398  if( thePutTkTrackFlag && trackerTracks.isValid() && !(combinedTracks->size() > 0 && trackerTracks->size() > 0 ) )
399  LogWarning(metname)<<"The MuonTrackLinkCollection is incomplete";
400 
401  // put the MuonCollection in the event
402  LogTrace(metname) << "put the MuonCollection in the event" << "\n";
403 
404  return event.put(trackLinksCollection);
405 }
#define LogDebug(id)
const std::string metname
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
std::vector< MuonTrackLinks > MuonTrackLinksCollection
collection of MuonTrackLinks
Definition: MuonFwd.h:22
#define LogTrace(id)
MuonCandidate::TrajectoryContainer TrajectoryContainer
edm::OrphanHandle< reco::TrackCollection > loadTracks(const TrajectoryContainer &, edm::Event &, const std::string &="", bool=true)
Convert the trajectories into tracks and load the tracks in the event.
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:9
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
std::string theL2SeededTkLabel
Label for L2SeededTracks.

Member Data Documentation

bool MuonTrackLoader::theAllowNoVtxFlag
private

Definition at line 96 of file MuonTrackLoader.h.

Referenced by buildTrackAtPCA(), and MuonTrackLoader().

edm::InputTag MuonTrackLoader::theBeamSpotInputTag
private

Definition at line 90 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

std::string MuonTrackLoader::theL2SeededTkLabel
private

Label for L2SeededTracks.

Definition at line 93 of file MuonTrackLoader.h.

Referenced by loadTracks(), and MuonTrackLoader().

bool MuonTrackLoader::thePutTkTrackFlag
private

Definition at line 94 of file MuonTrackLoader.h.

Referenced by loadTracks(), and MuonTrackLoader().

const MuonServiceProxy* MuonTrackLoader::theService
private

Definition at line 79 of file MuonTrackLoader.h.

Referenced by buildTrackAtPCA(), buildTrackExtra(), and buildTrackUpdatedAtPCA().

edm::ESHandle<TrajectorySmoother> MuonTrackLoader::theSmoother
private

Definition at line 88 of file MuonTrackLoader.h.

std::string MuonTrackLoader::theSmootherName
private

Definition at line 87 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

bool MuonTrackLoader::theSmoothingStep
private

Definition at line 86 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

bool MuonTrackLoader::theSmoothTkTrackFlag
private

Definition at line 95 of file MuonTrackLoader.h.

Referenced by loadTracks(), and MuonTrackLoader().

bool MuonTrackLoader::theTrajectoryFlag
private

Definition at line 84 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

bool MuonTrackLoader::theUpdatingAtVtx
private

Definition at line 81 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

MuonUpdatorAtVertex* MuonTrackLoader::theUpdatorAtVtx
private