CMS 3D CMS Logo

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