CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/RecoTracker/TrackProducer/interface/TrackProducerAlgorithm.h

Go to the documentation of this file.
00001 #ifndef TrackProducerAlgorithm_h
00002 #define TrackProducerAlgorithm_h
00003 
00012 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00013 #include "FWCore/Framework/interface/Event.h"
00014 #include "DataFormats/TrackCandidate/interface/TrackCandidateCollection.h"
00015 #include "DataFormats/TrackReco/interface/Track.h"
00016 #include "DataFormats/TrackReco/interface/TrackExtra.h"
00017 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
00018 #include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHit.h"
00019 #include "TrackingTools/PatternTools/interface/TrackConstraintAssociation.h"
00020 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
00021 
00022 class MagneticField;
00023 class TrackingGeometry;
00024 class TrajectoryFitter;
00025 class Propagator;
00026 class Trajectory;
00027 class TrajectoryStateOnSurface;
00028 class TransientTrackingRecHitBuilder;
00029 
00030 
00031 template <class T>
00032 class TrackProducerAlgorithm {
00033 public:
00034   typedef std::vector<T> TrackCollection;
00035   typedef std::pair<Trajectory*, std::pair<T*,PropagationDirection> > AlgoProduct; 
00036   typedef std::vector< AlgoProduct >  AlgoProductCollection;
00037   typedef edm::RefToBase<TrajectorySeed> SeedRef;
00038   typedef edm::AssociationMap<edm::OneToOne<std::vector<T>,std::vector<VertexConstraint> > > 
00039   VtxConstraintAssociationCollection;
00040  public:
00041 
00043   TrackProducerAlgorithm(const edm::ParameterSet& conf) : 
00044     conf_(conf),
00045     algoName_(conf_.getParameter<std::string>( "AlgorithmName" )),
00046     algo_(reco::TrackBase::algoByName(algoName_)),
00047     reMatchSplitHits_(false)
00048       {
00049         if (conf_.exists("reMatchSplitHits"))
00050           reMatchSplitHits_=conf_.getParameter<bool>("reMatchSplitHits");
00051       }
00052 
00054   ~TrackProducerAlgorithm() {}
00055   
00057   void runWithCandidate(const TrackingGeometry *, 
00058                         const MagneticField *, 
00059                         const TrackCandidateCollection&,
00060                         const TrajectoryFitter *,
00061                         const Propagator *,
00062                         const TransientTrackingRecHitBuilder*,
00063                         const reco::BeamSpot&,
00064                         AlgoProductCollection &);
00065 
00067   void runWithTrack(const TrackingGeometry *, 
00068                     const MagneticField *, 
00069                     const TrackCollection&,
00070                     const TrajectoryFitter *,
00071                     const Propagator *,
00072                     const TransientTrackingRecHitBuilder*,
00073                     const reco::BeamSpot&,
00074                     AlgoProductCollection &);
00075 
00077   void runWithMomentum(const TrackingGeometry *, 
00078                        const MagneticField *, 
00079                        const TrackMomConstraintAssociationCollection&,
00080                        const TrajectoryFitter *,
00081                        const Propagator *,
00082                        const TransientTrackingRecHitBuilder*,
00083                        const reco::BeamSpot&,
00084                        AlgoProductCollection &);
00085 
00088   void runWithVertex(const TrackingGeometry *, 
00089                      const MagneticField *, 
00090                      const VtxConstraintAssociationCollection&,
00091                      const TrajectoryFitter *,
00092                      const Propagator *,
00093                      const TransientTrackingRecHitBuilder*,
00094                      const reco::BeamSpot&,
00095                      AlgoProductCollection &);
00096 
00099   void runWithTrackParameters(const TrackingGeometry *, 
00100                               const MagneticField *, 
00101                               const TrackParamConstraintAssociationCollection&,
00102                               const TrajectoryFitter *,
00103                               const Propagator *,
00104                               const TransientTrackingRecHitBuilder*,
00105                               const reco::BeamSpot&,
00106                               AlgoProductCollection &);
00107 
00109   bool buildTrack(const TrajectoryFitter *,
00110                   const Propagator *,
00111                   AlgoProductCollection& ,
00112                   TransientTrackingRecHit::RecHitContainer&,
00113                   TrajectoryStateOnSurface& ,
00114                   const TrajectorySeed&,                  
00115                   float,
00116                   const reco::BeamSpot&,
00117                   SeedRef seedRef = SeedRef(),
00118                   int qualityMask=0,
00119                   signed char nLoops=0);
00120 
00121  private:
00122   edm::ParameterSet conf_;  
00123   std::string algoName_;
00124   reco::TrackBase::TrackAlgorithm algo_;
00125   bool reMatchSplitHits_;
00126 
00127   TrajectoryStateOnSurface getInitialState(const T * theT,
00128                                            TransientTrackingRecHit::RecHitContainer& hits,
00129                                            const TrackingGeometry * theG,
00130                                            const MagneticField * theMF);
00131 
00132 };
00133 
00134 #include "RecoTracker/TrackProducer/interface/TrackProducerAlgorithm.icc"
00135 
00136 template <> bool
00137 TrackProducerAlgorithm<reco::Track>::buildTrack(const TrajectoryFitter *,
00138                                                 const Propagator *,
00139                                                 AlgoProductCollection& ,
00140                                                 TransientTrackingRecHit::RecHitContainer&,
00141                                                 TrajectoryStateOnSurface& ,
00142                                                 const TrajectorySeed&,
00143                                                 float,
00144                                                 const reco::BeamSpot&,
00145                                                 SeedRef seedRef,
00146                                                 int qualityMask,
00147                                                 signed char nLoops);
00148 
00149 
00150 template <> bool
00151 TrackProducerAlgorithm<reco::GsfTrack>::buildTrack(const TrajectoryFitter *,
00152                                                    const Propagator *,
00153                                                    AlgoProductCollection& ,
00154                                                    TransientTrackingRecHit::RecHitContainer&,
00155                                                    TrajectoryStateOnSurface& ,
00156                                                    const TrajectorySeed&,
00157                                                    float,
00158                                                    const reco::BeamSpot&,
00159                                                    SeedRef seedRef,
00160                                                    int qualityMask,
00161                                                    signed char nLoops);
00162 
00163 #endif