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 &, const 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, edm::ConsumesCollector &iC, 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

TkClonerImpl hitCloner
 
bool theAllowNoVtxFlag
 
edm::InputTag theBeamSpotInputTag
 
edm::EDGetTokenT< reco::BeamSpottheBeamSpotToken
 
std::string theL2SeededTkLabel
 Label for L2SeededTracks. More...
 
bool thePutTkTrackFlag
 
const MuonServiceProxytheService
 
std::unique_ptr
< TrajectorySmoother
theSmoother
 
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.

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

Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 38 of file MuonTrackLoader.h.

Member Typedef Documentation

Definition at line 42 of file MuonTrackLoader.h.

Definition at line 41 of file MuonTrackLoader.h.

Constructor & Destructor Documentation

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

Constructor for the STA reco the args must be specify!

Definition at line 47 of file MuonTrackLoader.cc.

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

47  :
48  theService(service){
49 
50 
51  // option to do or not the smoothing step.
52  // the trajectories which are passed to the track loader are supposed to be non-smoothed
53  theSmoothingStep = parameterSet.getParameter<bool>("DoSmoothing");
55  theSmootherName = parameterSet.getParameter<string>("Smoother");
56 
57  // update at vertex
58  theUpdatingAtVtx = parameterSet.getParameter<bool>("VertexConstraint");
59 
60  // beam spot input tag
61  theBeamSpotInputTag = parameterSet.getParameter<edm::InputTag>("beamSpot");
63 
64 
65  // Flag to put the trajectory into the event
66  theTrajectoryFlag = parameterSet.getUntrackedParameter<bool>("PutTrajectoryIntoEvent",true);
67 
68  theL2SeededTkLabel = parameterSet.getUntrackedParameter<string>("MuonSeededTracksInstance",string());
69 
70  ParameterSet updatorPar = parameterSet.getParameter<ParameterSet>("MuonUpdatorAtVertexParameters");
71  theUpdatorAtVtx = new MuonUpdatorAtVertex(updatorPar,service);
72 
73  thePutTkTrackFlag = parameterSet.getUntrackedParameter<bool>("PutTkTrackIntoEvent",false);
74  theSmoothTkTrackFlag = parameterSet.getUntrackedParameter<bool>("SmoothTkTrack",false);
75  theAllowNoVtxFlag = parameterSet.getUntrackedParameter<bool>("AllowNoVertex",false);
76 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::BeamSpot > theBeamSpotToken
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 78 of file MuonTrackLoader.cc.

References theUpdatorAtVtx.

78  {
80 }
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 624 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().

624  {
625 
626  const string metname = "Muon|RecoMuon|MuonTrackLoader";
627 
629 
630  // FIXME: check the prop direction
631  TrajectoryStateOnSurface innerTSOS = trajectory.geometricalInnermostState();
632 
633  // This is needed to extrapolate the tsos at vertex
634  LogTrace(metname) << "Propagate to PCA...";
635  pair<bool,FreeTrajectoryState>
636  extrapolationResult = theUpdatorAtVtx->propagate(innerTSOS, beamSpot);
637  FreeTrajectoryState ftsAtVtx;
638 
639  if(extrapolationResult.first)
640  ftsAtVtx = extrapolationResult.second;
641  else{
642  if(TrackerBounds::isInside(innerTSOS.globalPosition())){
643  LogInfo(metname) << "Track in the Tracker: taking the innermost state instead of the state at PCA";
644  ftsAtVtx = *innerTSOS.freeState();
645  }
646  else{
647  if ( theAllowNoVtxFlag ) {
648  LogInfo(metname) << "Propagation to PCA failed, taking the innermost state instead of the state at PCA";
649  ftsAtVtx = *innerTSOS.freeState();
650  } else {
651  LogInfo(metname) << "Stand Alone track: this track will be rejected";
652  return pair<bool,reco::Track>(false,reco::Track());
653  }
654  }
655  }
656 
657  LogTrace(metname) << "TSOS after the extrapolation at vtx";
658  LogTrace(metname) << debug.dumpFTS(ftsAtVtx);
659 
660  GlobalPoint pca = ftsAtVtx.position();
661  math::XYZPoint persistentPCA(pca.x(),pca.y(),pca.z());
662  GlobalVector p = ftsAtVtx.momentum();
663  math::XYZVector persistentMomentum(p.x(),p.y(),p.z());
664 
665  bool bon = true;
666  if(fabs(theService->magneticField()->inTesla(GlobalPoint(0,0,0)).z()) < 0.01) bon=false;
667  double ndof = trajectory.ndof(bon);
668 
669  reco::Track track(trajectory.chiSquared(),
670  ndof,
671  persistentPCA,
672  persistentMomentum,
673  ftsAtVtx.charge(),
674  ftsAtVtx.curvilinearError());
675 
676  return pair<bool,reco::Track>(true,track);
677 }
static bool isInside(const GlobalPoint &)
const std::string metname
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
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:155
const CurvilinearTrajectoryError & curvilinearError() const
std::string dumpFTS(const FreeTrajectoryState &fts) const
FreeTrajectoryState const * freeState(bool withErrors=true) const
T z() const
Definition: PV3DBase.h:64
MuonUpdatorAtVertex * theUpdatorAtVtx
GlobalVector momentum() const
#define LogTrace(id)
GlobalPoint position() const
int ndof(bool bon=true) const
Definition: Trajectory.cc:78
#define debug
Definition: HDRShower.cc:19
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
float chiSquared() const
Definition: Trajectory.h:252
const MuonServiceProxy * theService
T x() const
Definition: PV3DBase.h:62
reco::TrackExtra MuonTrackLoader::buildTrackExtra ( const Trajectory trajectory) const
private

Definition at line 718 of file MuonTrackLoader.cc.

References alongMomentum, Surface::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::seedRef(), GeomDet::surface(), theService, GeomDet::toLocal(), TrajectoryMeasurement::updatedState(), findQualityFiles::v, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

718  {
719 
720  const string metname = "Muon|RecoMuon|MuonTrackLoader";
721 
722  const Trajectory::RecHitContainer transRecHits = trajectory.recHits();
723 
724  // put the collection of TrackingRecHit in the event
725 
726  // sets the outermost and innermost TSOSs
727  // FIXME: check it!
728  TrajectoryStateOnSurface outerTSOS;
729  TrajectoryStateOnSurface innerTSOS;
730  unsigned int innerId=0, outerId=0;
732  DetId outerDetId;
733 
734  if (trajectory.direction() == alongMomentum) {
735  LogTrace(metname)<<"alongMomentum";
736  outerTSOS = trajectory.lastMeasurement().updatedState();
737  innerTSOS = trajectory.firstMeasurement().updatedState();
738  outerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
739  innerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
740  outerRecHit = trajectory.lastMeasurement().recHit();
741  outerDetId = trajectory.lastMeasurement().recHit()->geographicalId();
742  }
743  else if (trajectory.direction() == oppositeToMomentum) {
744  LogTrace(metname)<<"oppositeToMomentum";
745  outerTSOS = trajectory.firstMeasurement().updatedState();
746  innerTSOS = trajectory.lastMeasurement().updatedState();
747  outerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
748  innerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
749  outerRecHit = trajectory.firstMeasurement().recHit();
750  outerDetId = trajectory.firstMeasurement().recHit()->geographicalId();
751  }
752  else LogError(metname)<<"Wrong propagation direction!";
753 
754  const GeomDet *outerDet = theService->trackingGeometry()->idToDet(outerDetId);
755  GlobalPoint outerTSOSPos = outerTSOS.globalParameters().position();
756  bool inside = outerDet->surface().bounds().inside(outerDet->toLocal(outerTSOSPos));
757 
758 
759  GlobalPoint hitPos = (outerRecHit->isValid()) ? outerRecHit->globalPosition() : outerTSOS.globalParameters().position() ;
760 
761  if(!inside) {
762  LogTrace(metname)<<"The Global Muon outerMostMeasurementState is not compatible with the recHit detector! Setting outerMost postition to recHit position if recHit isValid: " << outerRecHit->isValid();
763  LogTrace(metname)<<"From " << outerTSOSPos << " to " << hitPos;
764  }
765 
766 
767  //build the TrackExtra
768  GlobalPoint v = (inside) ? outerTSOSPos : hitPos ;
769  GlobalVector p = outerTSOS.globalParameters().momentum();
770  math::XYZPoint outpos( v.x(), v.y(), v.z() );
771  math::XYZVector outmom( p.x(), p.y(), p.z() );
772 
773  v = innerTSOS.globalParameters().position();
774  p = innerTSOS.globalParameters().momentum();
775  math::XYZPoint inpos( v.x(), v.y(), v.z() );
776  math::XYZVector inmom( p.x(), p.y(), p.z() );
777 
778  reco::TrackExtra trackExtra(outpos, outmom, true, inpos, inmom, true,
779  outerTSOS.curvilinearError(), outerId,
780  innerTSOS.curvilinearError(), innerId,
781  trajectory.direction(),trajectory.seedRef());
782 
783  return trackExtra;
784 
785 }
ConstRecHitPointer const & recHit() const
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:63
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
const Bounds & bounds() const
Definition: Surface.h:128
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
PropagationDirection const & direction() const
Definition: Trajectory.cc:118
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:181
T z() const
Definition: PV3DBase.h:64
TrackingRecHit::ConstRecHitPointer ConstRecHitPointer
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:306
#define LogTrace(id)
Definition: DetId.h:18
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:194
const GlobalTrajectoryParameters & globalParameters() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:48
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const MuonServiceProxy * theService
TrajectoryStateOnSurface const & updatedState() const
T x() const
Definition: PV3DBase.h:62
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 680 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().

680  {
681 
682  const string metname = "Muon|RecoMuon|MuonTrackLoader";
684 
685  // build the transient track
686  reco::TransientTrack transientTrack(track,
687  &*theService->magneticField(),
688  theService->trackingGeometry());
689 
690  LogTrace(metname) << "Apply the vertex constraint";
691  pair<bool,FreeTrajectoryState> updateResult = theUpdatorAtVtx->update(transientTrack,beamSpot);
692 
693  if(!updateResult.first){
694  return pair<bool,reco::Track>(false,reco::Track());
695  }
696 
697  LogTrace(metname) << "FTS after the vertex constraint";
698  FreeTrajectoryState &ftsAtVtx = updateResult.second;
699 
700  LogTrace(metname) << debug.dumpFTS(ftsAtVtx);
701 
702  GlobalPoint pca = ftsAtVtx.position();
703  math::XYZPoint persistentPCA(pca.x(),pca.y(),pca.z());
704  GlobalVector p = ftsAtVtx.momentum();
705  math::XYZVector persistentMomentum(p.x(),p.y(),p.z());
706 
707  reco::Track updatedTrack(track.chi2(),
708  track.ndof(),
709  persistentPCA,
710  persistentMomentum,
711  ftsAtVtx.charge(),
712  ftsAtVtx.curvilinearError());
713 
714  return pair<bool,reco::Track>(true,updatedTrack);
715 }
const std::string metname
T y() const
Definition: PV3DBase.h:63
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:64
MuonUpdatorAtVertex * theUpdatorAtVtx
GlobalVector momentum() const
#define LogTrace(id)
GlobalPoint position() const
#define debug
Definition: HDRShower.cc:19
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const MuonServiceProxy * theService
T x() const
Definition: PV3DBase.h:62
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 ,
const 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 310 of file MuonTrackLoader.cc.

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

311  {
312 
313  const string metname = "Muon|RecoMuon|MuonTrackLoader";
314 
315  // the muon collection, it will be loaded in the event
316  auto_ptr<reco::MuonTrackLinksCollection> trackLinksCollection(new reco::MuonTrackLinksCollection());
317 
318  // don't waste any time...
319  if ( muonCands.empty() ) {
320  auto_ptr<reco::TrackExtraCollection> trackExtraCollection(new reco::TrackExtraCollection() );
321  auto_ptr<TrackingRecHitCollection> recHitCollection(new TrackingRecHitCollection() );
322  auto_ptr<reco::TrackCollection> trackCollection( new reco::TrackCollection() );
323 
324  event.put(recHitCollection);
325  event.put(trackExtraCollection);
326  event.put(trackCollection);
327 
328  //need to also put the tracker tracks collection if requested
329  if(thePutTkTrackFlag){
330  //will take care of putting nothing in the event but the empty collection
331  TrajectoryContainer trackerTrajs;
332  loadTracks(trackerTrajs, event, theL2SeededTkLabel, theSmoothTkTrackFlag);
333  }
334 
335  return event.put(trackLinksCollection);
336  }
337 
338  // get combined Trajectories
339  TrajectoryContainer combinedTrajs;
340  TrajectoryContainer trackerTrajs;
341  for (CandidateContainer::const_iterator it = muonCands.begin(); it != muonCands.end(); ++it) {
342  LogDebug(metname) << "Loader glbSeedRef " << (*it)->trajectory()->seedRef().isNonnull();
343  if ((*it)->trackerTrajectory() ) LogDebug(metname) << " " << "tkSeedRef " << (*it)->trackerTrajectory()->seedRef().isNonnull();
344 
345  combinedTrajs.push_back((*it)->trajectory());
346  if ( thePutTkTrackFlag ) trackerTrajs.push_back((*it)->trackerTrajectory());
347 
348  else {
349  if ((*it)->trackerTrajectory()) delete ((*it)->trackerTrajectory());
350  }
351 
352  // // Create the links between sta and tracker tracks
353  // reco::MuonTrackLinks links;
354  // links.setStandAloneTrack((*it)->muonTrack());
355  // links.setTrackerTrack((*it)->trackerTrack());
356  // trackLinksCollection->push_back(links);
357  // delete *it;
358  }
359 
360  // create the TrackCollection of combined Trajectories
361  // FIXME: could this be done one track at a time in the previous loop?
362  LogTrace(metname) << "Build combinedTracks";
363  std::vector<bool> combTksVec(combinedTrajs.size(), false);
364  OrphanHandle<reco::TrackCollection> combinedTracks = loadTracks(combinedTrajs, event, combTksVec);
365 
367  std::vector<bool> trackerTksVec(trackerTrajs.size(), false);
368  if(thePutTkTrackFlag) {
369  LogTrace(metname) << "Build trackerTracks: "
370  << trackerTrajs.size();
371  trackerTracks = loadTracks(trackerTrajs, event, trackerTksVec, theL2SeededTkLabel, theSmoothTkTrackFlag);
372  } else {
373  for (TrajectoryContainer::iterator it = trackerTrajs.begin(); it != trackerTrajs.end(); ++it) {
374  if(*it) delete *it;
375  }
376  }
377 
378  LogTrace(metname) << "Set the final links in the MuonTrackLinks collection";
379 
380  unsigned int candposition(0), position(0), tkposition(0);
381  //reco::TrackCollection::const_iterator glIt = combinedTracks->begin(),
382  // glEnd = combinedTracks->end();
383 
384  for (CandidateContainer::const_iterator it = muonCands.begin(); it != muonCands.end(); ++it, ++candposition) {
385 
386  // The presence of the global track determines whether to fill the MuonTrackLinks or not
387  // N.B. We are assuming here that the global tracks in "combinedTracks"
388  // have the same order as the muon candidates in "muonCands"
389  // (except for possible missing tracks), which should always be the case...
390  //if( glIt == glEnd ) break;
391  if(combTksVec[candposition]) {
392  reco::TrackRef combinedTR(combinedTracks, position++);
393  //++glIt;
394 
395  // Create the links between sta and tracker tracks
397  links.setStandAloneTrack((*it)->muonTrack());
398  links.setTrackerTrack((*it)->trackerTrack());
399  links.setGlobalTrack(combinedTR);
400 
401  if(thePutTkTrackFlag && trackerTksVec[candposition]) {
402  reco::TrackRef trackerTR(trackerTracks, tkposition++);
403  links.setTrackerTrack(trackerTR);
404  }
405 
406  trackLinksCollection->push_back(links);
407  }
408 
409  else { // if no global track, still increment the tracker-track counter when appropriate
410  if(thePutTkTrackFlag && trackerTksVec[candposition]) tkposition++;
411  }
412 
413  delete *it;
414  }
415 
416  if( thePutTkTrackFlag && trackerTracks.isValid() && !(combinedTracks->size() > 0 && trackerTracks->size() > 0 ) )
417  LogWarning(metname)<<"The MuonTrackLinkCollection is incomplete";
418 
419  // put the MuonCollection in the event
420  LogTrace(metname) << "put the MuonCollection in the event" << "\n";
421 
422  return event.put(trackLinksCollection);
423 }
#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

TkClonerImpl MuonTrackLoader::hitCloner
private

Definition at line 91 of file MuonTrackLoader.h.

bool MuonTrackLoader::theAllowNoVtxFlag
private

Definition at line 101 of file MuonTrackLoader.h.

Referenced by buildTrackAtPCA(), and MuonTrackLoader().

edm::InputTag MuonTrackLoader::theBeamSpotInputTag
private

Definition at line 94 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

edm::EDGetTokenT<reco::BeamSpot> MuonTrackLoader::theBeamSpotToken
private

Definition at line 95 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

std::string MuonTrackLoader::theL2SeededTkLabel
private

Label for L2SeededTracks.

Definition at line 98 of file MuonTrackLoader.h.

Referenced by loadTracks(), and MuonTrackLoader().

bool MuonTrackLoader::thePutTkTrackFlag
private

Definition at line 99 of file MuonTrackLoader.h.

Referenced by loadTracks(), and MuonTrackLoader().

const MuonServiceProxy* MuonTrackLoader::theService
private

Definition at line 81 of file MuonTrackLoader.h.

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

std::unique_ptr<TrajectorySmoother> MuonTrackLoader::theSmoother
private

Definition at line 90 of file MuonTrackLoader.h.

std::string MuonTrackLoader::theSmootherName
private

Definition at line 89 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

bool MuonTrackLoader::theSmoothingStep
private

Definition at line 88 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

bool MuonTrackLoader::theSmoothTkTrackFlag
private

Definition at line 100 of file MuonTrackLoader.h.

Referenced by loadTracks(), and MuonTrackLoader().

bool MuonTrackLoader::theTrajectoryFlag
private

Definition at line 86 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

bool MuonTrackLoader::theUpdatingAtVtx
private

Definition at line 83 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

MuonUpdatorAtVertex* MuonTrackLoader::theUpdatorAtVtx
private