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 
16 /* Collaborating Class Declarations */
17 namespace edm {
18  class ParameterSet;
19  class EventSetup;
20  // class ESHandle;
21 } // namespace edm
22 class DTSegmentUpdator;
23 class DTSegmentCleaner;
24 class DTHitPairForFit;
25 class DTSegmentCand;
26 
27 /* C++ Headers */
28 #include <deque>
29 #include <functional>
30 #include <unordered_set>
31 #include <utility>
32 #include <vector>
33 
37 
38 /* ====================================================================== */
39 
40 /* Class DTCombinatorialPatternReco Interface */
41 
43 public:
46 
48  ~DTCombinatorialPatternReco() override;
49 
50  /* Operations */
51 
54  const std::vector<DTRecHit1DPair>& hits) override;
55 
57  std::string algoName() const override { return theAlgoName; }
58 
61  void setES(const edm::EventSetup& setup) override;
62 
63 protected:
64 private:
66 
67  // typedef std::pair<DTHitPairForFit*, DTEnums::DTCellSide> AssPoint;
68 
69  // create the DTHitPairForFit from the pairs for easy use
70  std::vector<std::shared_ptr<DTHitPairForFit>> initHits(const DTSuperLayer* sl,
71  const std::vector<DTRecHit1DPair>& hits);
72 
73  // search for candidate, starting from pairs of hits in different layers
74  std::vector<DTSegmentCand*> buildSegments(const DTSuperLayer* sl,
75  const std::vector<std::shared_ptr<DTHitPairForFit>>& hits);
76 
77  // find all the hits compatible with the candidate
78  std::vector<DTSegmentCand::AssPoint> findCompatibleHits(const LocalPoint& pos,
79  const LocalVector& dir,
80  const std::vector<std::shared_ptr<DTHitPairForFit>>& hits);
81 
82  // build segments from hits collection
83  DTSegmentCand* buildBestSegment(std::vector<DTSegmentCand::AssPoint>& assHits, const DTSuperLayer* sl);
84 
85  bool checkDoubleCandidates(std::vector<DTSegmentCand*>& segs, DTSegmentCand* seg);
86 
89  void buildPointsCollection(std::vector<DTSegmentCand::AssPoint>& points,
90  std::deque<std::shared_ptr<DTHitPairForFit>>& pointsNoLR,
91  std::vector<DTSegmentCand*>& candidates,
92  const DTSuperLayer* sl);
93 
94 private:
96  unsigned int theMaxAllowedHits;
99  bool debug;
100  bool usePairs;
101  DTSegmentUpdator* theUpdator; // the updator and fitter
102  DTSegmentCleaner* theCleaner; // the cleaner
103 
105 
106 public:
107  // The type must be public, as otherwise the global 'hash_value' function can't locate it
108  class TriedPattern {
109  public:
110  typedef std::vector<short unsigned int> values;
111 
112  // empty costructor
113  TriedPattern() : hash_(1) { values_.reserve(8); }
114 
115  // equality operator
116  bool operator==(const TriedPattern& other) const {
117  return (hash_ == other.hash_) && // cheap
118  (values_ == other.values_); // expensive last resort
119  }
120 
121  //Same implementation as boost::hash_combine
122  template <class T>
123  inline void hash_combine(std::size_t& seed, const T& v) {
124  std::hash<T> hasher;
125  seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
126  }
127 
129  void push_back(short unsigned int i) {
130  hash_combine(hash_, i);
131  values_.push_back(i);
132  }
135  size_t hash() const { return hash_; }
136 
137  // some extra methods to look like a std::vector
138  typedef values::const_iterator const_iterator;
139  const_iterator begin() const { return values_.begin(); }
140  const_iterator end() const { return values_.end(); }
141  values::size_type size() const { return values_.size(); }
142 
143  //Custom hash functor for std::unordered_set
144  class HashFunction {
145  public:
146  size_t operator()(const TriedPattern& p) const { return p.hash(); }
147  };
148 
149  private:
151  size_t hash_;
152  };
153  typedef std::unordered_set<TriedPattern, TriedPattern::HashFunction> TriedPatterns;
154 
155 private:
157 };
158 
159 inline std::size_t hash_value(const DTCombinatorialPatternReco::TriedPattern& t) { return t.hash(); }
160 
161 #endif // DTSegment_DTCombinatorialPatternReco_h
Vector3DBase< float, LocalTag >
DTCombinatorialPatternReco::theCleaner
DTSegmentCleaner * theCleaner
Definition: DTCombinatorialPatternReco.h:102
DTRecSegment2DBaseAlgo.h
mps_fire.i
i
Definition: mps_fire.py:428
DTCombinatorialPatternReco::theDTGeometry
edm::ESHandle< DTGeometry > theDTGeometry
Definition: DTCombinatorialPatternReco.h:104
hash_value
std::size_t hash_value(const DTCombinatorialPatternReco::TriedPattern &t)
Definition: DTCombinatorialPatternReco.h:159
DTCombinatorialPatternReco::algoName
std::string algoName() const override
return the algo name
Definition: DTCombinatorialPatternReco.h:57
hfClusterShapes_cfi.hits
hits
Definition: hfClusterShapes_cfi.py:5
ESHandle.h
HLT_FULL_cff.points
points
Definition: HLT_FULL_cff.py:21449
DTCombinatorialPatternReco::TriedPattern::hash_
size_t hash_
Definition: DTCombinatorialPatternReco.h:151
edm
HLT enums.
Definition: AlignableModifier.h:19
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
pos
Definition: PixelAliasList.h:18
DTCombinatorialPatternReco::usePairs
bool usePairs
Definition: DTCombinatorialPatternReco.h:100
DTCombinatorialPatternReco
Definition: DTCombinatorialPatternReco.h:42
DTCombinatorialPatternReco::TriedPattern::end
const_iterator end() const
Definition: DTCombinatorialPatternReco.h:140
DTSuperLayer
Definition: DTSuperLayer.h:24
DTCombinatorialPatternReco::checkDoubleCandidates
bool checkDoubleCandidates(std::vector< DTSegmentCand * > &segs, DTSegmentCand *seg)
Definition: DTCombinatorialPatternReco.cc:408
findQualityFiles.v
v
Definition: findQualityFiles.py:179
DTCombinatorialPatternReco::buildBestSegment
DTSegmentCand * buildBestSegment(std::vector< DTSegmentCand::AssPoint > &assHits, const DTSuperLayer *sl)
Definition: DTCombinatorialPatternReco.cc:289
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
DTCombinatorialPatternReco::initHits
std::vector< std::shared_ptr< DTHitPairForFit > > initHits(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits)
Definition: DTCombinatorialPatternReco.cc:83
DTSegmentUpdator
Definition: DTSegmentUpdator.h:43
fileCollector.seed
seed
Definition: fileCollector.py:127
DTSegmentCand.h
DTSegmentCleaner
Definition: DTSegmentCleaner.h:31
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
DTCombinatorialPatternReco::TriedPattern
Definition: DTCombinatorialPatternReco.h:108
edm::ESHandle< DTGeometry >
DTCombinatorialPatternReco::TriedPattern::HashFunction
Definition: DTCombinatorialPatternReco.h:144
trackingPlots.other
other
Definition: trackingPlots.py:1460
DTSegmentCand
Definition: DTSegmentCand.h:34
DTCombinatorialPatternReco::buildPointsCollection
void buildPointsCollection(std::vector< DTSegmentCand::AssPoint > &points, std::deque< std::shared_ptr< DTHitPairForFit >> &pointsNoLR, std::vector< DTSegmentCand * > &candidates, const DTSuperLayer *sl)
Definition: DTCombinatorialPatternReco.cc:353
DTCombinatorialPatternReco::theMaxAllowedHits
unsigned int theMaxAllowedHits
Definition: DTCombinatorialPatternReco.h:96
Point3DBase< float, LocalTag >
DTCombinatorialPatternReco::TriedPattern::operator==
bool operator==(const TriedPattern &other) const
Definition: DTCombinatorialPatternReco.h:116
DTCombinatorialPatternReco::theAlgoName
std::string theAlgoName
Definition: DTCombinatorialPatternReco.h:95
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTGeometry.h
DTCombinatorialPatternReco::DTCombinatorialPatternReco
DTCombinatorialPatternReco(const edm::ParameterSet &pset)
Constructor.
Definition: DTCombinatorialPatternReco.cc:33
DTCombinatorialPatternReco4D
Definition: DTCombinatorialPatternReco4D.h:40
edm::ParameterSet
Definition: ParameterSet.h:47
ParameterSet
Definition: Functions.h:16
DTCombinatorialPatternReco::TriedPattern::TriedPattern
TriedPattern()
Definition: DTCombinatorialPatternReco.h:113
DTCombinatorialPatternReco::TriedPattern::size
values::size_type size() const
Definition: DTCombinatorialPatternReco.h:141
visDQMUpload.hasher
hasher
Definition: visDQMUpload.py:152
DTCombinatorialPatternReco::TriedPattern::begin
const_iterator begin() const
Definition: DTCombinatorialPatternReco.h:139
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
DTCombinatorialPatternReco::theTriedPattern
TriedPatterns theTriedPattern
Definition: DTCombinatorialPatternReco.h:156
DTCombinatorialPatternReco::TriedPattern::HashFunction::operator()
size_t operator()(const TriedPattern &p) const
Definition: DTCombinatorialPatternReco.h:146
edm::EventSetup
Definition: EventSetup.h:58
DTCombinatorialPatternReco::theUpdator
DTSegmentUpdator * theUpdator
Definition: DTCombinatorialPatternReco.h:101
DTCombinatorialPatternReco::~DTCombinatorialPatternReco
~DTCombinatorialPatternReco() override
Destructor.
Definition: DTCombinatorialPatternReco.cc:46
DTCombinatorialPatternReco::TriedPattern::values_
values values_
Definition: DTCombinatorialPatternReco.h:150
DTCombinatorialPatternReco::TriedPattern::values
std::vector< short unsigned int > values
Definition: DTCombinatorialPatternReco.h:110
DTCombinatorialPatternReco::TriedPattern::hash_combine
void hash_combine(std::size_t &seed, const T &v)
Definition: DTCombinatorialPatternReco.h:123
DTCombinatorialPatternReco::setES
void setES(const edm::EventSetup &setup) override
Definition: DTCombinatorialPatternReco.cc:77
T
long double T
Definition: Basic3DVectorLD.h:48
HLT_FULL_cff.candidates
candidates
Definition: HLT_FULL_cff.py:54992
DTCombinatorialPatternReco::findCompatibleHits
std::vector< DTSegmentCand::AssPoint > findCompatibleHits(const LocalPoint &pos, const LocalVector &dir, const std::vector< std::shared_ptr< DTHitPairForFit >> &hits)
Definition: DTCombinatorialPatternReco.cc:216
DTCombinatorialPatternReco::TriedPattern::push_back
void push_back(short unsigned int i)
push back value, and update the hash
Definition: DTCombinatorialPatternReco.h:129
DTHitPairForFit
Definition: DTHitPairForFit.h:31
DTCombinatorialPatternReco::reconstruct
edm::OwnVector< DTSLRecSegment2D > reconstruct(const DTSuperLayer *sl, const std::vector< DTRecHit1DPair > &hits) override
this function is called in the producer
Definition: DTCombinatorialPatternReco.cc:52
DTCombinatorialPatternReco::theAlphaMaxTheta
double theAlphaMaxTheta
Definition: DTCombinatorialPatternReco.h:97
DTCombinatorialPatternReco::buildSegments
std::vector< DTSegmentCand * > buildSegments(const DTSuperLayer *sl, const std::vector< std::shared_ptr< DTHitPairForFit >> &hits)
Definition: DTCombinatorialPatternReco.cc:92
EventSetup
DTCombinatorialPatternReco::theAlphaMaxPhi
double theAlphaMaxPhi
Definition: DTCombinatorialPatternReco.h:98
DTCombinatorialPatternReco::debug
bool debug
Definition: DTCombinatorialPatternReco.h:99
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
DTCombinatorialPatternReco::TriedPatterns
std::unordered_set< TriedPattern, TriedPattern::HashFunction > TriedPatterns
Definition: DTCombinatorialPatternReco.h:153
DTCombinatorialPatternReco::TriedPattern::hash
size_t hash() const
Definition: DTCombinatorialPatternReco.h:135
DTCombinatorialPatternReco::TriedPattern::const_iterator
values::const_iterator const_iterator
Definition: DTCombinatorialPatternReco.h:138
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
DTRecSegment2DBaseAlgo
Definition: DTRecSegment2DBaseAlgo.h:32
edm::OwnVector
Definition: OwnVector.h:24
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23