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 
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 
35 
36 /* ====================================================================== */
37 
38 /* Class DTCombinatorialPatternReco Interface */
39 
41 
42  public:
43 
46 
48  virtual ~DTCombinatorialPatternReco() ;
49 
50  /* Operations */
51 
54  reconstruct(const DTSuperLayer* sl,
55  const std::vector<DTRecHit1DPair>& hits);
56 
58  virtual std::string algoName() const { return theAlgoName; }
59 
62  virtual void setES(const edm::EventSetup& setup);
63 
64  protected:
65 
66  private:
68 
69  typedef std::pair<DTHitPairForFit*, DTEnums::DTCellSide> AssPoint;
70 
71  // create the DTHitPairForFit from the pairs for easy use
72  std::vector<DTHitPairForFit*> initHits(const DTSuperLayer* sl,
73  const std::vector<DTRecHit1DPair>& hits);
74 
75  // search for candidate, starting from pairs of hits in different layers
76  std::vector<DTSegmentCand*> buildSegments(const DTSuperLayer* sl,
77  const std::vector<DTHitPairForFit*>& hits);
78 
79  // find all the hits compatible with the candidate
80  std::vector<AssPoint> findCompatibleHits(const LocalPoint& pos,
81  const LocalVector& dir,
82  const std::vector<DTHitPairForFit*>& hits);
83 
84  // build segments from hits collection
85  DTSegmentCand* buildBestSegment(std::vector<AssPoint>& assHits,
86  const DTSuperLayer* sl) ;
87 
88  bool checkDoubleCandidates(std::vector<DTSegmentCand*>& segs,
89  DTSegmentCand* seg);
90 
93  void buildPointsCollection(std::vector<AssPoint>& points,
94  std::deque<DTHitPairForFit* >& pointsNoLR,
95  std::vector<DTSegmentCand*>& candidates,
96  const DTSuperLayer* sl);
97  private:
98 
100  unsigned int theMaxAllowedHits;
103  bool debug;
104  bool usePairs;
105  DTSegmentUpdator* theUpdator; // the updator and fitter
106  DTSegmentCleaner* theCleaner; // the cleaner
107 
109 
110  public:
111  // The type must be public, as otherwise the global 'hash_value' function can't locate it
112  class TriedPattern {
113  public:
114  typedef std::vector<short unsigned int> values;
115 
116  // empty costructor
117  TriedPattern() : hash_(1) { values_.reserve(8); }
118 
119  // equality operator
120  bool operator==(const TriedPattern & other) const {
121  return (hash_ == other.hash_) && // cheap
122  (values_ == other.values_); // expensive last resort
123  }
124 
126  void push_back(short unsigned int i) {
127  boost::hash_combine(hash_,i);
128  values_.push_back(i);
129  }
132  size_t hash() const { return hash_; }
133 
134  // some extra methods to look like a std::vector
135  typedef values::const_iterator const_iterator;
136  const_iterator begin() const { return values_.begin(); }
137  const_iterator end() const { return values_.end(); }
138  values::size_type size() const { return values_.size(); }
139  private:
141  size_t hash_;
142  };
143  typedef boost::unordered_set<TriedPattern> TriedPatterns;
144  private:
145 
147 };
148 
149 inline std::size_t hash_value(const DTCombinatorialPatternReco::TriedPattern &t) { return t.hash(); }
150 #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