CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoTracker/TkTrackingRegions/interface/TkTrackingRegionsMargin.h

Go to the documentation of this file.
00001 #ifndef TkTrackingRegionsMargin_H
00002 #define TkTrackingRegionsMargin_H
00003 
00006 #include <utility>
00007 #include <iostream>
00008 
00009 template <class T> class TkTrackingRegionsMargin : public std::pair<T,T> {
00010 public:
00011 
00012   TkTrackingRegionsMargin() { }
00013 
00014   TkTrackingRegionsMargin(const T & aLeft, const T & aRight) 
00015     : std::pair<T,T> (aLeft,aRight) { }
00016 
00017   TkTrackingRegionsMargin( const std::pair<T,T> & aPair)
00018     : std::pair<T,T> (aPair) { }
00019 
00020   const T & left() const { return this->first; }
00021   const T & right() const { return this->second; }
00022 
00023   void operator += ( const T & v) { add(v,v); }
00024   void add( const T & addLeft, const T & addRight) { 
00025     this->first += addLeft; 
00026     this->second += addRight; 
00027   } 
00028 };
00029 
00030 template <class T> std::ostream & operator<< ( 
00031     std::ostream& out, const TkTrackingRegionsMargin<T> & m) 
00032 {
00033   return out  << "("<<m.left()<<","<<m.right()<<")";
00034 }
00035 #endif
00036