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

bool theAllowNoVtxFlag
 
edm::InputTag theBeamSpotInputTag
 
edm::EDGetTokenT< reco::BeamSpottheBeamSpotToken
 
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.

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 35 of file MuonTrackLoader.h.

Member Typedef Documentation

Definition at line 39 of file MuonTrackLoader.h.

Definition at line 38 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 44 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.

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

References theUpdatorAtVtx.

75  {
77 }
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 595 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().

595  {
596 
597  const string metname = "Muon|RecoMuon|MuonTrackLoader";
598 
600 
601  // FIXME: check the prop direction
602  TrajectoryStateOnSurface innerTSOS = trajectory.geometricalInnermostState();
603 
604  // This is needed to extrapolate the tsos at vertex
605  LogTrace(metname) << "Propagate to PCA...";
606  pair<bool,FreeTrajectoryState>
607  extrapolationResult = theUpdatorAtVtx->propagate(innerTSOS, beamSpot);
608  FreeTrajectoryState ftsAtVtx;
609 
610  if(extrapolationResult.first)
611  ftsAtVtx = extrapolationResult.second;
612  else{
613  if(TrackerBounds::isInside(innerTSOS.globalPosition())){
614  LogInfo(metname) << "Track in the Tracker: taking the innermost state instead of the state at PCA";
615  ftsAtVtx = *innerTSOS.freeState();
616  }
617  else{
618  if ( theAllowNoVtxFlag ) {
619  LogInfo(metname) << "Propagation to PCA failed, taking the innermost state instead of the state at PCA";
620  ftsAtVtx = *innerTSOS.freeState();
621  } else {
622  LogInfo(metname) << "Stand Alone track: this track will be rejected";
623  return pair<bool,reco::Track>(false,reco::Track());
624  }
625  }
626  }
627 
628  LogTrace(metname) << "TSOS after the extrapolation at vtx";
629  LogTrace(metname) << debug.dumpFTS(ftsAtVtx);
630 
631  GlobalPoint pca = ftsAtVtx.position();
632  math::XYZPoint persistentPCA(pca.x(),pca.y(),pca.z());
633  GlobalVector p = ftsAtVtx.momentum();
634  math::XYZVector persistentMomentum(p.x(),p.y(),p.z());
635 
636  bool bon = true;
637  if(fabs(theService->magneticField()->inTesla(GlobalPoint(0,0,0)).z()) < 0.01) bon=false;
638  double ndof = trajectory.ndof(bon);
639 
640  reco::Track track(trajectory.chiSquared(),
641  ndof,
642  persistentPCA,
643  persistentMomentum,
644  ftsAtVtx.charge(),
645  ftsAtVtx.curvilinearError());
646 
647  return pair<bool,reco::Track>(true,track);
648 }
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:233
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:74
#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
double chiSquared() const
Definition: Trajectory.h:254
reco::TrackExtra MuonTrackLoader::buildTrackExtra ( const Trajectory trajectory) const
private

Definition at line 689 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::recHits(), 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().

689  {
690 
691  const string metname = "Muon|RecoMuon|MuonTrackLoader";
692 
693  const Trajectory::RecHitContainer transRecHits = trajectory.recHits();
694 
695  // put the collection of TrackingRecHit in the event
696 
697  // sets the outermost and innermost TSOSs
698  // FIXME: check it!
699  TrajectoryStateOnSurface outerTSOS;
700  TrajectoryStateOnSurface innerTSOS;
701  unsigned int innerId=0, outerId=0;
703  DetId outerDetId;
704 
705  if (trajectory.direction() == alongMomentum) {
706  LogTrace(metname)<<"alongMomentum";
707  outerTSOS = trajectory.lastMeasurement().updatedState();
708  innerTSOS = trajectory.firstMeasurement().updatedState();
709  outerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
710  innerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
711  outerRecHit = trajectory.lastMeasurement().recHit();
712  outerDetId = trajectory.lastMeasurement().recHit()->geographicalId();
713  }
714  else if (trajectory.direction() == oppositeToMomentum) {
715  LogTrace(metname)<<"oppositeToMomentum";
716  outerTSOS = trajectory.firstMeasurement().updatedState();
717  innerTSOS = trajectory.lastMeasurement().updatedState();
718  outerId = trajectory.firstMeasurement().recHit()->geographicalId().rawId();
719  innerId = trajectory.lastMeasurement().recHit()->geographicalId().rawId();
720  outerRecHit = trajectory.firstMeasurement().recHit();
721  outerDetId = trajectory.firstMeasurement().recHit()->geographicalId();
722  }
723  else LogError(metname)<<"Wrong propagation direction!";
724 
725  const GeomDet *outerDet = theService->trackingGeometry()->idToDet(outerDetId);
726  GlobalPoint outerTSOSPos = outerTSOS.globalParameters().position();
727  bool inside = outerDet->surface().bounds().inside(outerDet->toLocal(outerTSOSPos));
728 
729 
730  GlobalPoint hitPos = (outerRecHit->isValid()) ? outerRecHit->globalPosition() : outerTSOS.globalParameters().position() ;
731 
732  if(!inside) {
733  LogTrace(metname)<<"The Global Muon outerMostMeasurementState is not compatible with the recHit detector! Setting outerMost postition to recHit position if recHit isValid: " << outerRecHit->isValid();
734  LogTrace(metname)<<"From " << outerTSOSPos << " to " << hitPos;
735  }
736 
737 
738  //build the TrackExtra
739  GlobalPoint v = (inside) ? outerTSOSPos : hitPos ;
740  GlobalVector p = outerTSOS.globalParameters().momentum();
741  math::XYZPoint outpos( v.x(), v.y(), v.z() );
742  math::XYZVector outmom( p.x(), p.y(), p.z() );
743 
744  v = innerTSOS.globalParameters().position();
745  p = innerTSOS.globalParameters().momentum();
746  math::XYZPoint inpos( v.x(), v.y(), v.z() );
747  math::XYZVector inmom( p.x(), p.y(), p.z() );
748 
749  reco::TrackExtra trackExtra(outpos, outmom, true, inpos, inmom, true,
750  outerTSOS.curvilinearError(), outerId,
751  innerTSOS.curvilinearError(), innerId,
752  trajectory.direction(),trajectory.seedRef());
753 
754  return trackExtra;
755 
756 }
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
ConstRecHitContainer recHits(bool splitting=false) const
Definition: Trajectory.cc:67
PropagationDirection const & direction() const
Definition: Trajectory.cc:196
TrajectoryMeasurement const & lastMeasurement() const
Definition: Trajectory.h:193
T z() const
Definition: PV3DBase.h:64
edm::RefToBase< TrajectorySeed > seedRef(void) const
Definition: Trajectory.h:308
#define LogTrace(id)
Definition: DetId.h:18
TrajectoryMeasurement const & firstMeasurement() const
Definition: Trajectory.h:206
const GlobalTrajectoryParameters & globalParameters() const
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
ConstRecHitContainer RecHitContainer
Definition: Trajectory.h:44
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 651 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().

651  {
652 
653  const string metname = "Muon|RecoMuon|MuonTrackLoader";
655 
656  // build the transient track
657  reco::TransientTrack transientTrack(track,
658  &*theService->magneticField(),
659  theService->trackingGeometry());
660 
661  LogTrace(metname) << "Apply the vertex constraint";
662  pair<bool,FreeTrajectoryState> updateResult = theUpdatorAtVtx->update(transientTrack,beamSpot);
663 
664  if(!updateResult.first){
665  return pair<bool,reco::Track>(false,reco::Track());
666  }
667 
668  LogTrace(metname) << "FTS after the vertex constraint";
669  FreeTrajectoryState &ftsAtVtx = updateResult.second;
670 
671  LogTrace(metname) << debug.dumpFTS(ftsAtVtx);
672 
673  GlobalPoint pca = ftsAtVtx.position();
674  math::XYZPoint persistentPCA(pca.x(),pca.y(),pca.z());
675  GlobalVector p = ftsAtVtx.momentum();
676  math::XYZVector persistentMomentum(p.x(),p.y(),p.z());
677 
678  reco::Track updatedTrack(track.chi2(),
679  track.ndof(),
680  persistentPCA,
681  persistentMomentum,
682  ftsAtVtx.charge(),
683  ftsAtVtx.curvilinearError());
684 
685  return pair<bool,reco::Track>(true,updatedTrack);
686 }
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 293 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.

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

Referenced by MuonTrackLoader().

edm::EDGetTokenT<reco::BeamSpot> MuonTrackLoader::theBeamSpotToken
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 78 of file MuonTrackLoader.h.

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

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

Definition at line 87 of file MuonTrackLoader.h.

std::string MuonTrackLoader::theSmootherName
private

Definition at line 86 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

bool MuonTrackLoader::theSmoothingStep
private

Definition at line 85 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 83 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

bool MuonTrackLoader::theUpdatingAtVtx
private

Definition at line 80 of file MuonTrackLoader.h.

Referenced by MuonTrackLoader().

MuonUpdatorAtVertex* MuonTrackLoader::theUpdatorAtVtx
private