Go to the documentation of this file.00001 #ifndef RECOTRACKER_ROADS_H
00002 #define RECOTRACKER_ROADS_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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