CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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         geometricInnerState_ = (conf_.exists("GeometricInnerState") ?
00050           conf_.getParameter<bool>( "GeometricInnerState" ) : true);
00051         if (conf_.exists("reMatchSplitHits"))
00052           reMatchSplitHits_=conf_.getParameter<bool>("reMatchSplitHits");
00053       }
00054 
00056   ~TrackProducerAlgorithm() {}
00057   
00059   void runWithCandidate(const TrackingGeometry *, 
00060                         const MagneticField *, 
00061                         const TrackCandidateCollection&,
00062                         const TrajectoryFitter *,
00063                         const Propagator *,
00064                         const TransientTrackingRecHitBuilder*,
00065                         const reco::BeamSpot&,
00066                         AlgoProductCollection &);
00067 
00069   void runWithTrack(const TrackingGeometry *, 
00070                     const MagneticField *, 
00071                     const TrackCollection&,
00072                     const TrajectoryFitter *,
00073                     const Propagator *,
00074                     const TransientTrackingRecHitBuilder*,
00075                     const reco::BeamSpot&,
00076                     AlgoProductCollection &);
00077 
00079   void runWithMomentum(const TrackingGeometry *, 
00080                        const MagneticField *, 
00081                        const TrackMomConstraintAssociationCollection&,
00082                        const TrajectoryFitter *,
00083                        const Propagator *,
00084                        const TransientTrackingRecHitBuilder*,
00085                        const reco::BeamSpot&,
00086                        AlgoProductCollection &);
00087 
00090   void runWithVertex(const TrackingGeometry *, 
00091                      const MagneticField *, 
00092                      const VtxConstraintAssociationCollection&,
00093                      const TrajectoryFitter *,
00094                      const Propagator *,
00095                      const TransientTrackingRecHitBuilder*,
00096                      const reco::BeamSpot&,
00097                      AlgoProductCollection &);
00098 
00101   void runWithTrackParameters(const TrackingGeometry *, 
00102                               const MagneticField *, 
00103                               const TrackParamConstraintAssociationCollection&,
00104                               const TrajectoryFitter *,
00105                               const Propagator *,
00106                               const TransientTrackingRecHitBuilder*,
00107                               const reco::BeamSpot&,
00108                               AlgoProductCollection &);
00109 
00111   bool buildTrack(const TrajectoryFitter *,
00112                   const Propagator *,
00113                   AlgoProductCollection& ,
00114                   TransientTrackingRecHit::RecHitContainer&,
00115                   TrajectoryStateOnSurface& ,
00116                   const TrajectorySeed&,                  
00117                   float,
00118                   const reco::BeamSpot&,
00119                   SeedRef seedRef = SeedRef(),
00120                   int qualityMask=0,
00121                   signed char nLoops=0);
00122 
00123  private:
00124   edm::ParameterSet conf_;  
00125   std::string algoName_;
00126   reco::TrackBase::TrackAlgorithm algo_;
00127   bool reMatchSplitHits_;
00128   bool geometricInnerState_;
00129 
00130   TrajectoryStateOnSurface getInitialState(const T * theT,
00131                                            TransientTrackingRecHit::RecHitContainer& hits,
00132                                            const TrackingGeometry * theG,
00133                                            const MagneticField * theMF);
00134 
00135 };
00136 
00137 #include "RecoTracker/TrackProducer/interface/TrackProducerAlgorithm.icc"
00138 
00139 template <> bool
00140 TrackProducerAlgorithm<reco::Track>::buildTrack(const TrajectoryFitter *,
00141                                                 const Propagator *,
00142                                                 AlgoProductCollection& ,
00143                                                 TransientTrackingRecHit::RecHitContainer&,
00144                                                 TrajectoryStateOnSurface& ,
00145                                                 const TrajectorySeed&,
00146                                                 float,
00147                                                 const reco::BeamSpot&,
00148                                                 SeedRef seedRef,
00149                                                 int qualityMask,
00150                                                 signed char nLoops);
00151 
00152 
00153 template <> bool
00154 TrackProducerAlgorithm<reco::GsfTrack>::buildTrack(const TrajectoryFitter *,
00155                                                    const Propagator *,
00156                                                    AlgoProductCollection& ,
00157                                                    TransientTrackingRecHit::RecHitContainer&,
00158                                                    TrajectoryStateOnSurface& ,
00159                                                    const TrajectorySeed&,
00160                                                    float,
00161                                                    const reco::BeamSpot&,
00162                                                    SeedRef seedRef,
00163                                                    int qualityMask,
00164                                                    signed char nLoops);
00165 
00166 #endif