CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Roads.h
Go to the documentation of this file.
1 #ifndef RECOTRACKER_ROADS_H
2 #define RECOTRACKER_ROADS_H
3 
4 //
5 // Package: RecoTracker/RoadMapRecord
6 // Class: Roads
7 //
8 // Description: The Roads object holds the RoadSeeds
9 // and the RoadSets of all Roads through
10 // the detector. A RoadSeed consists
11 // of the inner and outer SeedRing,
12 // a RoadSet consists of all Rings in
13 // in the Road.
14 //
15 // Original Author: Oliver Gutsche, gutsche@fnal.gov
16 // Created: Thu Jan 12 21:00:00 UTC 2006
17 //
18 // $Author: gutsche $
19 // $Date: 2007/04/17 21:56:53 $
20 // $Revision: 1.6 $
21 //
22 
23 #include <vector>
24 #include <map>
25 #include <utility>
26 #include <string>
27 #include <fstream>
28 
31 
33 
34 class Roads {
35 
36  public:
37 
38  typedef std::pair<std::vector<const Ring*>, std::vector<const Ring*> > RoadSeed;
39  typedef std::vector<std::vector<const Ring*> > RoadSet;
40  typedef std::multimap<RoadSeed,RoadSet,RoadMapSorting> RoadMap;
41 
42  typedef RoadMap::iterator iterator;
43  typedef RoadMap::const_iterator const_iterator;
44 
45  enum type {
48  };
49 
50  Roads();
51  Roads(std::string ascii_file, const Rings *rings);
52 
53  ~Roads();
54 
55  inline void insert(RoadSeed *seed, RoadSet *set) { roadMap_.insert(make_pair(*seed,*set)); }
56  inline void insert(RoadSeed seed, RoadSet set) { roadMap_.insert(make_pair(seed,set)); }
57 
58  inline iterator begin() { return roadMap_.begin(); }
59  inline iterator end() { return roadMap_.end(); }
60 
61  inline const_iterator begin() const { return roadMap_.begin(); }
62  inline const_iterator end() const { return roadMap_.end(); }
63 
64  inline RoadMap::size_type size() const { return roadMap_.size(); }
65 
66  void dump(std::string ascii_filename = "roads.dat") const;
67 
68  void dumpHeader(std::ofstream &stream) const;
69 
70  void readInFromAsciiFile(std::string ascii_file);
71 
72  const RoadSeed* getRoadSeed(DetId InnerSeedRing,
73  DetId OuterSeedRing,
74  double InnerSeedRingPhi = 999999.,
75  double OuterSeedRingPhi = 999999.,
76  double dphi_scalefactor=1.5) const;
77 
78  const RoadSeed* getRoadSeed(std::vector<DetId> seedRingDetIds,
79  std::vector<double> seedRingHitsPhi,
80  double dphi_scalefactor=1.5) const;
81 
82  inline const_iterator getRoadSet(const RoadSeed *seed) const { return roadMap_.find(*seed); }
83 
84  const type getRoadType(const RoadSeed *const seed) const;
85 
86  const Ring::type getRingType(DetId id) const;
87 
88  inline void erase(iterator entry) { roadMap_.erase(entry); }
89 
90  inline const Ring* getRing(DetId id, double phi = 999999., double z = 999999.) const {
91  return rings_->getRing(id,phi,z);
92  }
93 
94  private:
95 
96  const Rings *rings_;
98 
99 };
100 
101 #endif
void insert(RoadSeed *seed, RoadSet *set)
Definition: Roads.h:55
const Rings * rings_
Definition: Roads.h:96
const Ring * getRing(DetId id, double phi=999999., double z=999999.) const
Definition: Rings.cc:152
type
Definition: HCALResponse.h:22
RoadMap::iterator iterator
Definition: Roads.h:42
void dumpHeader(std::ofstream &stream) const
Definition: Roads.cc:224
RoadMap roadMap_
Definition: Roads.h:97
void readInFromAsciiFile(std::string ascii_file)
Definition: Roads.cc:47
Definition: Roads.h:34
uint16_t size_type
double double double z
std::vector< std::vector< const Ring * > > RoadSet
Definition: Roads.h:39
Definition: Ring.h:31
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
Roads()
Definition: Roads.cc:33
Definition: Rings.h:27
iterator begin()
Definition: Roads.h:58
void erase(iterator entry)
Definition: Roads.h:88
std::pair< std::vector< const Ring * >, std::vector< const Ring * > > RoadSeed
Definition: Roads.h:38
Definition: DetId.h:20
RoadMap::const_iterator const_iterator
Definition: Roads.h:43
const Ring::type getRingType(DetId id) const
Definition: Roads.cc:390
type
Definition: Roads.h:45
const type getRoadType(const RoadSeed *const seed) const
Definition: Roads.cc:370
std::multimap< RoadSeed, RoadSet, RoadMapSorting > RoadMap
Definition: Roads.h:40
void dump(std::string ascii_filename="roads.dat") const
Definition: Roads.cc:173
RoadMap::size_type size() const
Definition: Roads.h:64
const_iterator end() const
Definition: Roads.h:62
void insert(RoadSeed seed, RoadSet set)
Definition: Roads.h:56
const_iterator begin() const
Definition: Roads.h:61
iterator end()
Definition: Roads.h:59
type
Definition: Ring.h:41
const_iterator getRoadSet(const RoadSeed *seed) const
Definition: Roads.h:82
const Ring * getRing(DetId id, double phi=999999., double z=999999.) const
Definition: Roads.h:90
const RoadSeed * getRoadSeed(DetId InnerSeedRing, DetId OuterSeedRing, double InnerSeedRingPhi=999999., double OuterSeedRingPhi=999999., double dphi_scalefactor=1.5) const
Definition: Roads.cc:272
~Roads()
Definition: Roads.cc:43
void set(const std::string &name, int value)
set the flag, with a run-time name
Definition: DDAxes.h:10