CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/RecoMuon/L3TrackFinder/src/MuonRoadTrajectoryBuilder.cc File Reference

#include <RecoMuon/L3TrackFinder/interface/MuonRoadTrajectoryBuilder.h>
#include <FWCore/MessageLogger/interface/MessageLogger.h>
#include <DataFormats/GeometrySurface/interface/TkRotation.h>
#include <DataFormats/GeometryCommonDetAlgo/interface/ErrorFrameTransformer.h>
#include <DataFormats/GeometryVector/interface/LocalPoint.h>
#include <DataFormats/GeometryVector/interface/LocalVector.h>
#include <DataFormats/GeometrySurface/interface/BoundPlane.h>
#include <DataFormats/GeometrySurface/interface/OpenBounds.h>
#include <DataFormats/GeometrySurface/interface/SimpleDiskBounds.h>
#include <DataFormats/TrajectoryState/interface/PTrajectoryStateOnDet.h>
#include <DataFormats/DetId/interface/DetId.h>
#include <TrackingTools/TransientTrackingRecHit/interface/GenericTransientTrackingRecHit.h>
#include <TrackingTools/MeasurementDet/interface/MeasurementDet.h>
#include <TrackingTools/KalmanUpdators/interface/KFUpdator.h>
#include <TrackingTools/TrackFitters/interface/KFTrajectorySmoother.h>
#include <RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h>
#include <RecoTracker/Record/interface/CkfComponentsRecord.h>
#include <DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h>
#include <DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2D.h>

Go to the source code of this file.

Functions

void sortTrajectoryMeasurements (Trajectory &traj)
bool trajectorymeasurementInverseOrder (const TrajectoryMeasurement &meas_1, const TrajectoryMeasurement &meas_2)
bool trajectorymeasurementOrder (const TrajectoryMeasurement &meas_1, const TrajectoryMeasurement &meas_2)
bool trajectoryOrder (const MuonRoadTrajectoryBuilder::trajectory &traj1, const MuonRoadTrajectoryBuilder::trajectory &traj2)

Function Documentation

void sortTrajectoryMeasurements ( Trajectory traj)

Definition at line 421 of file MuonRoadTrajectoryBuilder.cc.

References Trajectory::direction(), Trajectory::measurements(), oppositeToMomentum, Trajectory::push(), Trajectory::seed(), python::multivaluedict::sort(), trajectorymeasurementInverseOrder(), and trajectorymeasurementOrder().

Referenced by MuonRoadTrajectoryBuilder::smooth().

                                                   {
  Trajectory::DataContainer meas =traj.measurements();
  
  //  edm::LogInfo(theCategory)<<"sorting ("<< meas.size() <<") measurements.";
  //sort the measurements
  if (traj.direction() == oppositeToMomentum)
    {std::sort(meas.begin(),meas.end(),trajectorymeasurementInverseOrder);}
  else
    {std::sort(meas.begin(),meas.end(),trajectorymeasurementOrder);}

  //create a new one
  Trajectory newTraj(traj.seed(),traj.direction());
  for (Trajectory::DataContainer::iterator mit=meas.begin();mit!=meas.end();++mit)
    {newTraj.push(*mit);}

  //exchange now.
  traj = newTraj;
 }
bool trajectorymeasurementInverseOrder ( const TrajectoryMeasurement meas_1,
const TrajectoryMeasurement meas_2 
)

Definition at line 389 of file MuonRoadTrajectoryBuilder.cc.

References trajectorymeasurementOrder().

Referenced by sortTrajectoryMeasurements().

 {return trajectorymeasurementOrder(meas_2,meas_1);}
bool trajectorymeasurementOrder ( const TrajectoryMeasurement meas_1,
const TrajectoryMeasurement meas_2 
)

Definition at line 379 of file MuonRoadTrajectoryBuilder.cc.

References Vector3DBase< T, FrameTag >::dot(), TrajectoryStateOnSurface::globalDirection(), TrajectoryStateOnSurface::globalPosition(), TrajectoryMeasurement::predictedState(), csvLumiCalc::unit, and Vector3DBase< T, FrameTag >::unit().

Referenced by sortTrajectoryMeasurements(), and trajectorymeasurementInverseOrder().

 {
   //   GlobalVector d= (meas_2.recHit()->globalPosition () - meas_1.recHit()->globalPosition ()).unit();
   GlobalVector d= (meas_2.predictedState().globalPosition() - meas_1.predictedState().globalPosition()).unit();

   GlobalVector u1= meas_1.predictedState().globalDirection().unit(); //was using only that before
   GlobalVector u2= meas_2.predictedState().globalDirection().unit();
   GlobalVector u =(u1+u2)/2.; //the average momentum to be sure that the relation is symetrical.
   return   d.dot(u) > 0;
 }
bool trajectoryOrder ( const MuonRoadTrajectoryBuilder::trajectory traj1,
const MuonRoadTrajectoryBuilder::trajectory traj2 
)

Definition at line 108 of file MuonRoadTrajectoryBuilder.cc.

References MuonRoadTrajectoryBuilder::trajectory::chi2, MuonRoadTrajectoryBuilder::trajectory::measurements, and indexGen::s2.

Referenced by MuonRoadTrajectoryBuilder::checkStep(), and MuonRoadTrajectoryBuilder::makeTrajectories_0().

{ //order so that first element of the list have
  //most hits, if equal smallest chi2
  unsigned int s1=traj1.measurements.size();
  unsigned int s2=traj2.measurements.size();
  if (s1>s2) return true; //decreasing order of measurements.size()
  else {
      if (s1==s2) return (traj1.chi2<traj2.chi2); //increase order of chi2
      else return false; }}