CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/RecoTracker/SingleTrackPattern/interface/CosmicTrajectoryBuilder.h

Go to the documentation of this file.
00001 #ifndef CosmicTrajectoryBuilder_h
00002 #define CosmicTrajectoryBuilder_h
00003 
00004 //
00005 // Package:         RecoTracker/SingleTrackPattern
00006 // Class:           CosmicTrajectoryBuilder
00007 // Original Author:  Michele Pioppi-INFN perugia
00008 
00009 #include <string>
00010 
00011 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00012 #include "FWCore/Framework/interface/EventSetup.h"
00013 
00014 #include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
00015 #include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHitCollection.h"
00016 #include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h"
00017 #include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2DCollection.h"
00018 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
00019 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00020 #include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
00021 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
00022 #include "TrackingTools/GeomPropagators/interface/AnalyticalPropagator.h"
00023 #include "TrackingTools/KalmanUpdators/interface/KFUpdator.h"
00024 #include "TrackingTools/KalmanUpdators/interface/Chi2MeasurementEstimator.h"
00025 #include "MagneticField/Engine/interface/MagneticField.h"
00026 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00027 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
00028 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
00029 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
00030 #include "DataFormats/TrackReco/interface/Track.h"
00031 #include "DataFormats/TrackReco/interface/TrackExtra.h"
00032 #include "TrackingTools/TrackFitters/interface/KFTrajectoryFitter.h"
00033 #include "TrackingTools/TrackFitters/interface/KFTrajectorySmoother.h"
00034 #include "TrackingTools/MeasurementDet/interface/LayerMeasurements.h"
00035 #include "RecoTracker/MeasurementDet/interface/MeasurementTracker.h"
00036 #include "TrackingTools/MaterialEffects/interface/PropagatorWithMaterial.h"
00037 
00038 #include "FWCore/Framework/interface/ESHandle.h"
00039 
00040 #ifndef TrajectoryBuilder_CompareHitY
00041 #define TrajectoryBuilder_CompareHitY
00042 
00043 class CompareHitY {
00044  public:
00045    CompareHitY(const TrackerGeometry& tracker):_tracker(tracker){}
00046    bool operator()( const TrackingRecHit *rh1,
00047                     const TrackingRecHit *rh2)
00048    {
00049      GlobalPoint gp1=_tracker.idToDet(rh1->geographicalId())->surface().toGlobal(rh1->localPosition());
00050      GlobalPoint gp2=_tracker.idToDet(rh2->geographicalId())->surface().toGlobal(rh2->localPosition());
00051      return gp1.y()<gp2.y();};
00052  private:
00053    //   edm::ESHandle<TrackerGeometry> _tracker;
00054    const TrackerGeometry& _tracker;
00055 };
00056  
00057 class CompareHitY_plus {
00058  public:
00059    CompareHitY_plus(const TrackerGeometry& tracker):_tracker(tracker){}
00060    bool operator()( const TrackingRecHit *rh1,
00061                     const TrackingRecHit *rh2)
00062    {
00063      GlobalPoint gp1=_tracker.idToDet(rh1->geographicalId())->surface().toGlobal(rh1->localPosition());
00064      GlobalPoint gp2=_tracker.idToDet(rh2->geographicalId())->surface().toGlobal(rh2->localPosition());
00065      return gp1.y()>gp2.y();};
00066  private:
00067    //   edm::ESHandle<TrackerGeometry> _tracker;
00068    const TrackerGeometry& _tracker;
00069 };
00070  
00071 #endif
00072 
00073 class CosmicTrajectoryBuilder 
00074 {
00075 
00076   typedef TrajectoryStateOnSurface     TSOS;
00077   typedef TrajectoryMeasurement        TM;
00078 
00079  public:
00080   
00081   CosmicTrajectoryBuilder(const edm::ParameterSet& conf);
00082   ~CosmicTrajectoryBuilder();
00083 
00085     
00086     void run(const TrajectorySeedCollection &collseed,
00087              const SiStripRecHit2DCollection &collstereo,
00088              const SiStripRecHit2DCollection &collrphi ,
00089              const SiStripMatchedRecHit2DCollection &collmatched,
00090              const SiPixelRecHitCollection &collpixel,
00091              const edm::EventSetup& es,
00092              edm::Event& e,
00093              std::vector<Trajectory> &trajoutput);
00094 
00095     void init(const edm::EventSetup& es,bool);
00096     Trajectory createStartingTrajectory( const TrajectorySeed& seed) const;
00097  private:
00098     std::vector<TrajectoryMeasurement> seedMeasurements(const TrajectorySeed& seed) const;
00099  
00100  
00101     std::vector<const TrackingRecHit*> SortHits(const SiStripRecHit2DCollection &collstereo,
00102                                            const SiStripRecHit2DCollection &collrphi ,
00103                                            const SiStripMatchedRecHit2DCollection &collmatched,
00104                                            const SiPixelRecHitCollection &collpixel,
00105                                            const TrajectorySeed &seed);
00106 
00107     TSOS startingTSOS(const TrajectorySeed& seed)const;
00108     void updateTrajectory( Trajectory& traj,
00109                            const TM& tm,
00110                            const TransientTrackingRecHit& hit) const;
00111     
00112     void AddHit(Trajectory &traj,
00113                 std::vector<const TrackingRecHit*>Hits);
00114     //          edm::OwnVector<TransientTrackingRecHit> hits);
00115     bool qualityFilter(Trajectory traj);
00116 
00117 
00118  
00119  private:
00120    edm::ESHandle<MagneticField> magfield;
00121    edm::ESHandle<TrackerGeometry> tracker;
00122    edm::ParameterSet conf_;
00123    TrajectoryStateTransform tsTransform;
00124    PropagatorWithMaterial  *thePropagator;
00125    PropagatorWithMaterial  *thePropagatorOp;
00126    KFUpdator *theUpdator;
00127    Chi2MeasurementEstimator *theEstimator;
00128    const TransientTrackingRecHitBuilder *RHBuilder;
00129    const KFTrajectorySmoother * theSmoother;
00130    const KFTrajectoryFitter * theFitter;
00131  
00132  
00133 
00134    int theMinHits;
00135    double chi2cut;
00136    std::vector<Trajectory> trajFit;
00137    //RC edm::OwnVector<const TransientTrackingRecHit> hits;
00138    TransientTrackingRecHit::RecHitContainer  hits;
00139    bool seed_plus;
00140    std::string geometry;
00141 };
00142 
00143 #endif