CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoTracker/TkHitPairs/interface/HitPairGenerator.h

Go to the documentation of this file.
00001 #ifndef HitPairGenerator_H
00002 #define HitPairGenerator_H
00003 
00004 #include <vector>
00005 
00011 #include "RecoTracker/TkTrackingRegions/interface/OrderedHitsGenerator.h"
00012 #include "RecoTracker/TkHitPairs/interface/OrderedHitPairs.h"
00013 #include "RecoTracker/TkHitPairs/interface/RecHitsSortedInPhi.h"
00014 
00015 class TrackingRegion;
00016 namespace edm { class Event; class EventSetup; }
00017 
00018 class HitPairGenerator : public OrderedHitsGenerator {
00019 public:
00020 
00021   explicit HitPairGenerator(unsigned int size=7500);
00022 
00023   virtual ~HitPairGenerator() { }
00024 
00025   virtual const OrderedHitPairs & run(
00026     const TrackingRegion& region, const edm::Event & ev, const edm::EventSetup& es);
00027 
00028   // temporary interface for backward compatibility only
00029   virtual void hitPairs( 
00030     const TrackingRegion& reg, OrderedHitPairs & prs, const edm::EventSetup& es) {}
00031 
00032   // new interface with no temphits copy
00033   virtual HitDoublets doublets( const TrackingRegion& reg, 
00034                              const edm::Event & ev,  const edm::EventSetup& es) {
00035     assert(0=="not implemented");
00036   }
00037 
00038 
00039   virtual void hitPairs( const TrackingRegion& reg, OrderedHitPairs & prs, 
00040       const edm::Event & ev,  const edm::EventSetup& es) = 0;
00041 
00042   virtual HitPairGenerator* clone() const = 0;
00043 
00044   virtual void clear() {
00045      // back to initial allocation if too large
00046      if (thePairs.capacity()> 4*m_capacity) {
00047        OrderedHitPairs tmp; tmp.reserve(m_capacity); tmp.swap(thePairs);
00048      } 
00049      thePairs.clear(); 
00050   } 
00051 
00052 private:
00053   OrderedHitPairs thePairs;
00054   unsigned int m_capacity;
00055 
00056 };
00057 
00058 #endif