CMS 3D CMS Logo

DTCombinatorialPatternReco.h
Go to the documentation of this file.
1 #ifndef DTSegment_DTCombinatorialPatternReco_h
2 #define DTSegment_DTCombinatorialPatternReco_h
3 
13 /* Base Class Headers */
15 #include <boost/unordered_set.hpp>
16 
17 /* Collaborating Class Declarations */
18 namespace edm {
19  class ParameterSet;
20  class EventSetup;
21  // class ESHandle;
22 }
23 class DTSegmentUpdator;
24 class DTSegmentCleaner;
25 class DTHitPairForFit;
26 class DTSegmentCand;
27 
28 /* C++ Headers */
29 #include <vector>
30 #include <deque>
31 #include <utility>
32 
36 
37 /* ====================================================================== */
38 
39 /* Class DTCombinatorialPatternReco Interface */
40 
42 
43  public:
44 
47 
49  ~DTCombinatorialPatternReco() override ;
50 
51  /* Operations */
52 
55  reconstruct(const DTSuperLayer* sl,
56  const std::vector<DTRecHit1DPair>& hits) override;
57 
59  std::string algoName() const override { return theAlgoName; }
60 
63  void setES(const edm::EventSetup& setup) override;
64 
65  protected:
66 
67  private:
69 
70  // typedef std::pair<DTHitPairForFit*, DTEnums::DTCellSide> AssPoint;
71 
72  // create the DTHitPairForFit from the pairs for easy use
73  std::vector<std::shared_ptr<DTHitPairForFit>> initHits(const DTSuperLayer* sl,
74  const std::vector<DTRecHit1DPair>& hits);
75 
76  // search for candidate, starting from pairs of hits in different layers
77  std::vector<DTSegmentCand*> buildSegments(const DTSuperLayer* sl,
78  const std::vector<std::shared_ptr<DTHitPairForFit>>& hits);
79 
80  // find all the hits compatible with the candidate
81  std::vector<DTSegmentCand::AssPoint> findCompatibleHits(const LocalPoint& pos,
82  const LocalVector& dir,
83  const std::vector<std::shared_ptr<DTHitPairForFit>>& hits);
84 
85  // build segments from hits collection
86  DTSegmentCand* buildBestSegment(std::vector<DTSegmentCand::AssPoint>& assHits,
87  const DTSuperLayer* sl) ;
88 
89  bool checkDoubleCandidates(std::vector<DTSegmentCand*>& segs,
90  DTSegmentCand* seg);
91 
94  void buildPointsCollection(std::vector<DTSegmentCand::AssPoint>& points,
95  std::deque<std::shared_ptr<DTHitPairForFit> >& pointsNoLR,
96  std::vector<DTSegmentCand*>& candidates,
97  const DTSuperLayer* sl);
98  private:
99 
101  unsigned int theMaxAllowedHits;
104  bool debug;
105  bool usePairs;
106  DTSegmentUpdator* theUpdator; // the updator and fitter
107  DTSegmentCleaner* theCleaner; // the cleaner
108 
110 
111  public:
112  // The type must be public, as otherwise the global 'hash_value' function can't locate it
113  class TriedPattern {
114  public:
115  typedef std::vector<short unsigned int> values;
116 
117  // empty costructor
118  TriedPattern() : hash_(1) { values_.reserve(8); }
119 
120  // equality operator
121  bool operator==(const TriedPattern & other) const {
122  return (hash_ == other.hash_) && // cheap
123  (values_ == other.values_); // expensive last resort
124  }
125 
127  void push_back(short unsigned int i) {
128  boost::hash_combine(hash_,i);
129  values_.push_back(i);
130  }
133  size_t hash() const { return hash_; }
134 
135  // some extra methods to look like a std::vector
136  typedef values::const_iterator const_iterator;
137  const_iterator begin() const { return values_.begin(); }
138  const_iterator end() const { return values_.end(); }
139  values::size_type size() const { return values_.size(); }
140  private:
141  values values_;
142  size_t hash_;
143  };
144  typedef boost::unordered_set<TriedPattern> TriedPatterns;
145  private:
146 
147  TriedPatterns theTriedPattern;
148 };
149 
150 inline std::size_t hash_value(const DTCombinatorialPatternReco::TriedPattern &t) { return t.hash(); }
151 #endif // DTSegment_DTCombinatorialPatternReco_h
bool operator==(const TriedPattern &other) const
def setup(process, global_tag, zero_tesla=False)
Definition: GeneralSetup.py:1
uint16_t size_type
edm::ESHandle< DTGeometry > theDTGeometry
std::string algoName() const override
return the algo name
std::size_t hash_value(const DTCombinatorialPatternReco::TriedPattern &t)
void push_back(short unsigned int i)
push back value, and update the hash
boost::unordered_set< TriedPattern > TriedPatterns
HLT enums.
dbl *** dir
Definition: mlp_gen.cc:35