CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoMuon/L3TrackFinder/interface/MuonRoadTrajectoryBuilder.h

Go to the documentation of this file.
00001 #ifndef RecoMuon_L3TrackFinder_MuonRoadTrajectoryBuilder_h
00002 #define RecoMuon_L3TrackFinder_MuonRoadTrajectoryBuilder_h
00003 
00016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00017 
00018 #include <DataFormats/TrajectorySeed/interface/TrajectorySeed.h>
00019 #include <DataFormats/TrackReco/interface/Track.h>
00020 
00021 #include <DataFormats/GeometryVector/interface/GlobalPoint.h>
00022 #include <DataFormats/GeometryVector/interface/GlobalVector.h>
00023 #include <DataFormats/GeometrySurface/interface/BoundCylinder.h>
00024 #include <DataFormats/GeometrySurface/interface/BoundDisk.h>
00025 
00026 #include <Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h>
00027 #include <RecoTracker/MeasurementDet/interface/MeasurementTracker.h>
00028 
00029 #include <TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h>
00030 #include <TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h>
00031 #include <TrackingTools/PatternTools/interface/Trajectory.h>
00032 #include <TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h>
00033 #include <TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h>
00034 #include <TrackingTools/PatternTools/interface/TrajectorySmoother.h>
00035 #include <TrackingTools/TrackFitters/interface/KFTrajectorySmoother.h>
00036 
00037 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00038 #include <TrackingTools/DetLayers/interface/DetLayer.h>
00039 
00040 #include <MagneticField/Engine/interface/MagneticField.h>
00041 
00042 #include "FWCore/Framework/interface/EventSetup.h"
00043 #include "FWCore/Framework/interface/Event.h"
00044 
00045 #include "TrackingTools/PatternTools/interface/TrajectoryBuilder.h"
00046 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00047 
00048 
00049 #include <vector>
00050 
00051 class MuonRoadTrajectoryBuilder :public TrajectoryBuilder {
00052  public:
00054    MuonRoadTrajectoryBuilder(const edm::ParameterSet & par,const MeasurementTracker * mt,const MagneticField * f,const Propagator * p);
00055 
00057    ~MuonRoadTrajectoryBuilder();
00058      
00060    void setEvent(const edm::Event&) const ;
00061      
00063    std::vector<Trajectory> trajectories(const TrajectorySeed & seed) const ;
00064 
00066    void trajectories(const TrajectorySeed & seed, TrajectoryContainer &ret) const ; 
00067          
00068  private:
00069          
00071    std::string theCategory ;
00072    
00073  public:
00075    class trajectory {
00076                                  public:
00077      trajectory():duplicate(false),chi2(0),missed(0),lastmissed(false),missedinarow(0){;}
00078      bool duplicate;
00079      double chi2;
00080      int missed;
00081      bool lastmissed;
00082      int missedinarow;
00083      std::list <TrajectoryMeasurement > measurements;
00084      TrajectoryStateOnSurface TSOS;
00085      Trajectory traj; //the only thing to keep eventually
00086    };
00087  private:
00088    
00089    template <class A> class flippingPair : public std::pair<A,A>{
00090    public:
00091      flippingPair(): theFlip(false) {;}
00092      void flip(){theFlip=!theFlip;}
00093      A & head(){ if (theFlip) return this->first ;else return this->second;}
00094      A & tail(){if (theFlip) return this->second ;else return this->first;}
00095    private:
00096      bool theFlip;
00097    };
00098    
00099    typedef std::list< trajectory > TrajectoryCollection;
00100    typedef flippingPair<TrajectoryCollection> TrajectoryCollectionFPair ;
00101    
00102    //  const MuonServiceProxy * theProxyService;
00103    
00105    void makeTrajectories(const TrajectorySeed & seed, std::vector<Trajectory> & result ,int version=0) const ;
00107    void makeTrajectories_0(const TrajectorySeed & seed, std::vector<Trajectory> & result) const ;
00109    int GatherHits(const TrajectoryStateOnSurface & step,const DetLayer * thislayer, TrajectoryCollectionFPair & Trajectories) const ;
00111    void makeTrajectories_1(const TrajectorySeed & seed, std::vector<Trajectory> & result) const ;
00112           
00114    bool checkStep(TrajectoryCollection & collection) const ;
00116    void checkDuplicate(TrajectoryCollection & collection) const ;
00117               
00118    Trajectory smooth(Trajectory &) const ;
00119    void cleanTrajectory(Trajectory & traj) const ;
00120               
00121    //only global scope variable
00122    mutable bool theFirstlayer;
00123    //algorithm options
00124    //limit the total number of possible trajectories taken into account for a single seed
00125    unsigned int theMaxTrajectories;
00126               
00127    //limit the type of module considered to gather rechits
00131    bool theDynamicMaxNumberOfHitPerModule;
00132    unsigned int theNumberOfHitPerModuleDefault;
00133    mutable unsigned int theNumberOfHitPerModule;
00134    std::vector<unsigned int> theMaxTrajectoriesThreshold;
00135    std::vector<unsigned int> theNumberOfHitPerModuleThreshold;
00136   
00137    //fixed parameters
00138    bool theBranchonfirstlayer;
00139    bool theCarriedIPatfirstlayer;
00140    bool theCarriedIPatfirstlayerModule;
00141   
00142    //output track candidate selection
00144    unsigned int  theMinNumberOfHitOnCandidate;
00146    bool theOutputAllTraj;
00147   
00148   
00149    //tools and usefull pointers
00151    const MeasurementTracker * theMeasurementTracker;
00152     
00153    //kalman tools
00155    Chi2MeasurementEstimator * theRoadEstimator;
00157    Chi2MeasurementEstimator * theHitEstimator;
00159    TrajectoryStateUpdator * theUpdator;
00161    KFTrajectorySmoother * theSmoother;
00162    
00164    
00165    
00167    const MagneticField * theField;
00168    
00170    const Propagator * thePropagator;
00171    
00172 };
00173 
00174 
00175 #endif