CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTCombinatorialPatternReco.h
Go to the documentation of this file.
1 #ifndef DTSegment_DTCombinatorialPatternReco_h
2 #define DTSegment_DTCombinatorialPatternReco_h
3 
15 /* Base Class Headers */
17 #include <boost/unordered_set.hpp>
18 
19 /* Collaborating Class Declarations */
20 namespace edm {
21  class ParameterSet;
22  class EventSetup;
23  // class ESHandle;
24 }
25 class DTSegmentUpdator;
26 class DTSegmentCleaner;
27 class DTHitPairForFit;
28 class DTSegmentCand;
29 
30 /* C++ Headers */
31 #include <vector>
32 #include <deque>
33 #include <utility>
34 
37 
38 /* ====================================================================== */
39 
40 /* Class DTCombinatorialPatternReco Interface */
41 
43 
44  public:
45 
48 
50  virtual ~DTCombinatorialPatternReco() ;
51 
52  /* Operations */
53 
56  reconstruct(const DTSuperLayer* sl,
57  const std::vector<DTRecHit1DPair>& hits);
58 
60  virtual std::string algoName() const { return theAlgoName; }
61 
64  virtual void setES(const edm::EventSetup& setup);
65 
66  protected:
67 
68  private:
70 
71  typedef std::pair<DTHitPairForFit*, DTEnums::DTCellSide> AssPoint;
72 
73  // create the DTHitPairForFit from the pairs for easy use
74  std::vector<DTHitPairForFit*> initHits(const DTSuperLayer* sl,
75  const std::vector<DTRecHit1DPair>& hits);
76 
77  // search for candidate, starting from pairs of hits in different layers
78  std::vector<DTSegmentCand*> buildSegments(const DTSuperLayer* sl,
79  const std::vector<DTHitPairForFit*>& hits);
80 
81  // find all the hits compatible with the candidate
82  std::vector<AssPoint> findCompatibleHits(const LocalPoint& pos,
83  const LocalVector& dir,
84  const std::vector<DTHitPairForFit*>& hits);
85 
86  // build segments from hits collection
87  DTSegmentCand* buildBestSegment(std::vector<AssPoint>& assHits,
88  const DTSuperLayer* sl) ;
89 
90  bool checkDoubleCandidates(std::vector<DTSegmentCand*>& segs,
91  DTSegmentCand* seg);
92 
95  void buildPointsCollection(std::vector<AssPoint>& points,
96  std::deque<DTHitPairForFit* >& pointsNoLR,
97  std::vector<DTSegmentCand*>& candidates,
98  const DTSuperLayer* sl);
99  private:
100 
101  std::string theAlgoName;
102  unsigned int theMaxAllowedHits;
105  bool debug;
106  bool usePairs;
107  DTSegmentUpdator* theUpdator; // the updator and fitter
108  DTSegmentCleaner* theCleaner; // the cleaner
109 
111 
112  public:
113  // The type must be public, as otherwise the global 'hash_value' function can't locate it
114  class TriedPattern {
115  public:
116  typedef std::vector<short unsigned int> values;
117 
118  // empty costructor
119  TriedPattern() : hash_(1) { values_.reserve(8); }
120 
121  // equality operator
122  bool operator==(const TriedPattern & other) const {
123  return (hash_ == other.hash_) && // cheap
124  (values_ == other.values_); // expensive last resort
125  }
126 
128  void push_back(short unsigned int i) {
129  boost::hash_combine(hash_,i);
130  values_.push_back(i);
131  }
134  size_t hash() const { return hash_; }
135 
136  // some extra methods to look like a std::vector
137  typedef values::const_iterator const_iterator;
138  const_iterator begin() const { return values_.begin(); }
139  const_iterator end() const { return values_.end(); }
140  values::size_type size() const { return values_.size(); }
141  private:
143  size_t hash_;
144  };
145  typedef boost::unordered_set<TriedPattern> TriedPatterns;
146  private:
147 
149 };
150 
151 inline std::size_t hash_value(const DTCombinatorialPatternReco::TriedPattern &t) { return t.hash(); }
152 #endif // DTSegment_DTCombinatorialPatternReco_h
int i
Definition: DBlmapReader.cc:9
std::vector< DTHitPairForFit * > initHits(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
virtual void setES(const edm::EventSetup &setup)
virtual std::string algoName() const
return the algo name
bool operator==(const TriedPattern &other) const
std::vector< AssPoint > findCompatibleHits(const LocalPoint &pos, const LocalVector &dir, const std::vector< DTHitPairForFit * > &hits)
uint16_t size_type
bool checkDoubleCandidates(std::vector< DTSegmentCand * > &segs, DTSegmentCand *seg)
edm::ESHandle< DTGeometry > theDTGeometry
std::size_t hash_value(const DTCombinatorialPatternReco::TriedPattern &t)
virtual edm::OwnVector< DTSLRecSegment2D > reconstruct(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
this function is called in the producer
void buildPointsCollection(std::vector< AssPoint > &points, std::deque< DTHitPairForFit * > &pointsNoLR, std::vector< DTSegmentCand * > &candidates, const DTSuperLayer *sl)
void push_back(short unsigned int i)
push back value, and update the hash
DTCombinatorialPatternReco(const edm::ParameterSet &pset)
Constructor.
virtual ~DTCombinatorialPatternReco()
Destructor.
boost::unordered_set< TriedPattern > TriedPatterns
std::vector< DTSegmentCand * > buildSegments(const DTSuperLayer *sl, const std::vector< DTHitPairForFit * > &hits)
dbl *** dir
Definition: mlp_gen.cc:35
DTSegmentCand * buildBestSegment(std::vector< AssPoint > &assHits, const DTSuperLayer *sl)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
std::pair< DTHitPairForFit *, DTEnums::DTCellSide > AssPoint