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 
36 
37 /* ====================================================================== */
38 
39 /* Class DTCombinatorialPatternReco Interface */
40 
42 
43  public:
44 
47 
49  virtual ~DTCombinatorialPatternReco() ;
50 
51  /* Operations */
52 
55  reconstruct(const DTSuperLayer* sl,
56  const std::vector<DTRecHit1DPair>& hits);
57 
59  virtual std::string algoName() const { return theAlgoName; }
60 
63  virtual void setES(const edm::EventSetup& setup);
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:
142  size_t hash_;
143  };
144  typedef boost::unordered_set<TriedPattern> TriedPatterns;
145  private:
146 
148 };
149 
150 inline std::size_t hash_value(const DTCombinatorialPatternReco::TriedPattern &t) { return t.hash(); }
151 #endif // DTSegment_DTCombinatorialPatternReco_h
void buildPointsCollection(std::vector< DTSegmentCand::AssPoint > &points, std::deque< std::shared_ptr< DTHitPairForFit > > &pointsNoLR, std::vector< DTSegmentCand * > &candidates, const DTSuperLayer *sl)
tuple t
Definition: tree.py:139
int i
Definition: DBlmapReader.cc:9
virtual void setES(const edm::EventSetup &setup)
std::vector< std::shared_ptr< DTHitPairForFit > > initHits(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
virtual std::string algoName() const
return the algo name
bool operator==(const TriedPattern &other) const
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 push_back(short unsigned int i)
push back value, and update the hash
DTCombinatorialPatternReco(const edm::ParameterSet &pset)
Constructor.
std::vector< DTSegmentCand * > buildSegments(const DTSuperLayer *sl, const std::vector< std::shared_ptr< DTHitPairForFit >> &hits)
DTSegmentCand * buildBestSegment(std::vector< DTSegmentCand::AssPoint > &assHits, const DTSuperLayer *sl)
virtual ~DTCombinatorialPatternReco()
Destructor.
boost::unordered_set< TriedPattern > TriedPatterns
std::vector< DTSegmentCand::AssPoint > findCompatibleHits(const LocalPoint &pos, const LocalVector &dir, const std::vector< std::shared_ptr< DTHitPairForFit >> &hits)
dbl *** dir
Definition: mlp_gen.cc:35
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")