CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch12/src/RecoTracker/RoadMapRecord/interface/Roads.h

Go to the documentation of this file.
00001 #ifndef RECOTRACKER_ROADS_H
00002 #define RECOTRACKER_ROADS_H
00003 
00004 //
00005 // Package:         RecoTracker/RoadMapRecord
00006 // Class:           Roads
00007 // 
00008 // Description:     The Roads object holds the RoadSeeds
00009 //                  and the RoadSets of all Roads through 
00010 //                  the detector. A RoadSeed consists
00011 //                  of the inner and outer SeedRing,
00012 //                  a RoadSet consists of all Rings in
00013 //                  in the Road.
00014 //
00015 // Original Author: Oliver Gutsche, gutsche@fnal.gov
00016 // Created:         Thu Jan 12 21:00:00 UTC 2006
00017 //
00018 // $Author: gutsche $
00019 // $Date: 2007/04/17 21:56:53 $
00020 // $Revision: 1.6 $
00021 //
00022 
00023 #include <vector>
00024 #include <map>
00025 #include <utility>
00026 #include <string>
00027 #include <fstream>
00028 
00029 #include "RecoTracker/RingRecord/interface/Ring.h"
00030 #include "RecoTracker/RingRecord/interface/Rings.h"
00031 
00032 #include "RecoTracker/RoadMapRecord/interface/RoadMapSorting.h"
00033 
00034 class Roads {
00035  
00036  public:
00037   
00038   typedef std::pair<std::vector<const Ring*>, std::vector<const Ring*> > RoadSeed;
00039   typedef std::vector<std::vector<const Ring*> > RoadSet;
00040   typedef std::multimap<RoadSeed,RoadSet,RoadMapSorting> RoadMap;
00041   
00042   typedef RoadMap::iterator iterator;
00043   typedef RoadMap::const_iterator const_iterator;
00044 
00045   enum type {
00046     RPhi,
00047     ZPhi
00048   };
00049 
00050   Roads();
00051   Roads(std::string ascii_file, const Rings *rings);
00052 
00053   ~Roads();
00054 
00055   inline void insert(RoadSeed *seed, RoadSet *set) { roadMap_.insert(make_pair(*seed,*set)); }
00056   inline void insert(RoadSeed seed, RoadSet set) { roadMap_.insert(make_pair(seed,set)); }
00057 
00058   inline iterator begin() { return roadMap_.begin(); }
00059   inline iterator end()   { return roadMap_.end();   }
00060 
00061   inline const_iterator begin() const { return roadMap_.begin(); }
00062   inline const_iterator end()   const { return roadMap_.end();   }
00063 
00064   inline RoadMap::size_type size() const { return roadMap_.size(); }
00065 
00066   void dump(std::string ascii_filename = "roads.dat") const;
00067   
00068   void dumpHeader(std::ofstream &stream) const;
00069 
00070   void readInFromAsciiFile(std::string ascii_file);
00071 
00072   const RoadSeed* getRoadSeed(DetId InnerSeedRing, 
00073                               DetId OuterSeedRing, 
00074                               double InnerSeedRingPhi = 999999., 
00075                               double OuterSeedRingPhi = 999999.,
00076                               double dphi_scalefactor=1.5) const;
00077 
00078   const RoadSeed* getRoadSeed(std::vector<DetId> seedRingDetIds,
00079                               std::vector<double> seedRingHitsPhi,
00080                               double dphi_scalefactor=1.5) const;
00081 
00082   inline const_iterator getRoadSet(const RoadSeed *seed) const { return roadMap_.find(*seed); }
00083 
00084   const type getRoadType(const RoadSeed *const seed) const;
00085 
00086   const Ring::type getRingType(DetId id) const;
00087 
00088   inline void erase(iterator entry) { roadMap_.erase(entry); }
00089 
00090   inline const Ring* getRing(DetId id, double phi = 999999., double z = 999999.) const {
00091     return rings_->getRing(id,phi,z);
00092   }
00093 
00094  private:
00095 
00096   const Rings *rings_;
00097   RoadMap roadMap_;
00098 
00099 };
00100 
00101 #endif