CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/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 
00014 class TrackingRegion;
00015 namespace edm { class Event; class EventSetup; }
00016 
00017 class HitPairGenerator : public OrderedHitsGenerator {
00018 public:
00019 
00020   explicit HitPairGenerator(unsigned int size=7500);
00021 
00022   virtual ~HitPairGenerator() { }
00023 
00024   virtual const OrderedHitPairs & run(
00025     const TrackingRegion& region, const edm::Event & ev, const edm::EventSetup& es);
00026 
00027   // temporary interface for backward compatibility only
00028   virtual void hitPairs( 
00029     const TrackingRegion& reg, OrderedHitPairs & prs, const edm::EventSetup& es) {}
00030 
00031   virtual void hitPairs( const TrackingRegion& reg, OrderedHitPairs & prs, 
00032       const edm::Event & ev,  const edm::EventSetup& es) = 0;
00033 
00034   virtual HitPairGenerator* clone() const = 0;
00035 
00036   virtual void clear() {
00037      // back to initial allocation if too large
00038      if (thePairs.capacity()> 4*m_capacity) {
00039        OrderedHitPairs tmp; tmp.reserve(m_capacity); tmp.swap(thePairs);
00040      } 
00041      thePairs.clear(); 
00042   } 
00043 
00044 private:
00045   OrderedHitPairs thePairs;
00046   unsigned int m_capacity;
00047 
00048 };
00049 
00050 #endif