CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HitPattern.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 #ifndef TrackReco_HitPattern_h
4 #define TrackReco_HitPattern_h
5 
6 //
7 // File: DataFormats/TrackReco/interface/HitPattern.h
8 //
9 // Marcel Vos, INFN Pisa
10 // v1.10 2007/05/08 bellan
11 // Zongru Wan, Kansas State University
12 // Jean-Roch Vlimant
13 // Kevin Burkett
14 // Boris Mangano
15 //
16 // Hit pattern is the summary information of the hits associated to track in
17 // AOD. When RecHits are no longer available, the compact hit pattern should
18 // allow basic track selection based on the hits in various subdetectors.
19 // The hits of a track are saved in unit16_t hitPattern[MaxHits].
20 //
21 // uint16_t
22 // +------------+---------------+---------------------------+-----------------+----------------+
23 // | tk/mu/mtd | sub-structure | sub-sub-structure | stereo | hit type |
24 // +------------+---------------+---------------------------+-----------------+----------------+
25 // | 11-10 | 9 8 7 | 6 5 4 3 | 2 | 1 0 | bit
26 // +------------+---------------+---------------------------+-----------------+----------------|
27 // | tk = 1 | PXB = 1 | layer = 1-3 | | hit type = 0-3 |
28 // | tk = 1 | PXF = 2 | disk = 1-2 | | hit type = 0-3 |
29 // | tk = 1 | TIB = 3 | layer = 1-4 | 0=rphi,1=stereo | hit type = 0-3 |
30 // | tk = 1 | TID = 4 | wheel = 1-3 | 0=rphi,1=stereo | hit type = 0-3 |
31 // | tk = 1 | TOB = 5 | layer = 1-6 | 0=rphi,1=stereo | hit type = 0-3 |
32 // | tk = 1 | TEC = 6 | wheel = 1-9 | 0=rphi,1=stereo | hit type = 0-3 |
33 // | mu = 0 | DT = 1 | 4*(stat-1)+superlayer | | hit type = 0-3 |
34 // | mu = 0 | CSC = 2 | 4*(stat-1)+(ring-1) | | hit type = 0-3 |
35 // | mu = 0 | RPC = 3 | 4*(stat-1)+2*layer+region | | hit type = 0-3 |
36 // | mu = 0 | GEM = 4 | 1xxx=st0, 0yxx=st y-1 la x| | hit type = 0-3 |
37 // | mu = 0 | ME0 = 5 | roll | | hit type = 0-3 |
38 // | mtd = 2 | BTL = 1 | moduleType = 1-3 | | hit type = 0-3 |
39 // | mtd = 2 | ETL = 2 | ring = 1-12 | | hit type = 0-3 |
40 // +------------+---------------+---------------------------+-----------------+----------------+
41 //
42 // hit type, see DataFormats/TrackingRecHit/interface/TrackingRecHit.h
43 // VALID = valid hit = 0
44 // MISSING = detector is good, but no rec hit found = 1
45 // INACTIVE = detector is off, so there was no hope = 2
46 // BAD = there were many bad strips within the ellipse = 3
47 //
48 // It had been shown by Zongru using a 100 GeV muon sample with 5000 events
49 // uniform in eta and phi, the average (maximum) number of tracker hits is
50 // 13 (17) and the average (maximum) number of muon detector hits is about
51 // 26 (50). If the number of hits of a track is larger than 80 then the extra
52 // hits are ignored by hit pattern. The static hit pattern array might be
53 // improved to a dynamic one in the future.
54 //
55 // Because of tracking with/without overlaps and with/without hit-splitting,
56 // the final number of hits per track is pretty "variable". Compared with the
57 // number of valid hits, the number of crossed layers with measurement should
58 // be more robust to discriminate between good and fake track.
59 //
60 // Since 4-bit for sub-sub-structure is not enough to specify a muon layer,
61 // the layer case counting methods are implemented for tracker only. This is
62 // different from the hit counting methods which are implemented for both
63 // tracker and muon detector.
64 //
65 // Given a tracker layer, specified by sub-structure and layer, the method
66 // getTrackerLayerCase(substr, layer) groups all of the hits in the hit pattern
67 // array for the layer together and returns one of the four cases
68 //
69 // crossed
70 // layer case 0: VALID + (MISSING, OFF, BAD) ==> with measurement
71 // layer case 1: MISSING + (OFF, BAD) ==> without measurement
72 // layer case 2: OFF, BAD ==> totally off or bad, cannot say much
73 // not crossed
74 // layer case NULL_RETURN: track outside acceptance or in gap ==> null
75 //
76 // Given a tracker layer, specified by sub-structure and layer, the method
77 // getTrackerMonoStereo(substr, layer) groups all of the valid hits in the hit
78 // pattern array for the layer together and returns
79 //
80 // 0: neither a valid mono nor a valid stereo hit
81 // MONO: valid mono hit
82 // STEREO: valid stereo hit
83 // MONO | STEREO: both
84 //
85 //
86 // Given a track, here is an example usage of hit pattern
87 //
88 // // hit pattern of the track
89 // const reco::HitPattern &p = track->hitPattern();
90 //
91 // // loop over the hits of the track.
92 // for (int i = 0; i < p.numberOfAllHits(HitPattern::TRACK_HITS); i++) {
93 // uint32_t hit = p.getHitPattern(HitPattern::TRACK_HITS, i);
94 //
95 // // if the hit is valid and in pixel barrel, print out the layer
96 // if (p.validHitFilter(hit) && p.pixelBarrelHitFilter(hit)){
97 // cout << "valid hit found in pixel barrel layer "
98 // << p.getLayer(hit)
99 // << endl;
100 // }
101 //
102 // // expert level: printout the hit in 11-bit binary format
103 // cout << "hit in 11-bit binary format = ";
104 // for (int j = 10; j >= 0; j--){
105 // int bit = (hit >> j) & 0x1;
106 // cout << bit;
107 // }
108 // cout << endl;
109 // }
110 //
111 // //count the number of valid pixel barrel *** hits ***
112 // cout << "number of of valid pixel barrel hits is "
113 // << p.numberOfValidPixelBarrelHits()
114 // << endl;
115 //
116 // //count the number of pixel barrel *** layers *** with measurement
117 // cout << "number of of pixel barrel layers with measurement is "
118 // << p.pixelBarrelLayersWithMeasurement()
119 // << endl;
120 //
121 
130 
131 #include <utility>
132 #include <algorithm>
133 #include <iostream>
134 #include <ostream>
135 #include <memory>
136 
137 class TrackerTopology;
138 
139 namespace test {
140  namespace TestHitPattern {
141  int test();
142  }
143 } // namespace test
144 
145 namespace reco {
146 
147  class HitPattern {
148  public:
149  enum { MONO = 1, STEREO = 2 };
150 
152 
153  enum HIT_TYPE { VALID = 0, MISSING = 1, INACTIVE = 2, BAD = 3 };
154 
156  const static unsigned short ARRAY_LENGTH = 57;
157  const static unsigned short HIT_LENGTH = 12;
158  const static unsigned short MaxHits = (8 * sizeof(uint16_t) * ARRAY_LENGTH) / HIT_LENGTH;
159 
160  static const uint32_t NULL_RETURN = 999999;
161  static const uint16_t EMPTY_PATTERN = 0x0;
162 
163  static bool trackerHitFilter(uint16_t pattern);
164  static bool muonHitFilter(uint16_t pattern);
165  static bool timingHitFilter(uint16_t pattern);
166 
167  static bool validHitFilter(uint16_t pattern);
168  static bool missingHitFilter(uint16_t pattern);
169  static bool inactiveHitFilter(uint16_t pattern);
170  static bool badHitFilter(uint16_t pattern);
171 
172  static bool pixelHitFilter(uint16_t pattern);
173  static bool pixelBarrelHitFilter(uint16_t pattern);
174  static bool pixelEndcapHitFilter(uint16_t pattern);
175  static bool stripHitFilter(uint16_t pattern);
176  static bool stripTIBHitFilter(uint16_t pattern);
177  static bool stripTIDHitFilter(uint16_t pattern);
178  static bool stripTOBHitFilter(uint16_t pattern);
179  static bool stripTECHitFilter(uint16_t pattern);
180 
181  static bool muonDTHitFilter(uint16_t pattern);
182  static bool muonCSCHitFilter(uint16_t pattern);
183  static bool muonRPCHitFilter(uint16_t pattern);
184  static bool muonGEMHitFilter(uint16_t pattern);
185  static bool muonME0HitFilter(uint16_t pattern);
186 
187  static bool timingBTLHitFilter(uint16_t pattern);
188  static bool timingETLHitFilter(uint16_t pattern);
189 
190  static uint32_t getHitType(uint16_t pattern);
191 
192  // mono (0) or stereo (1)
193  static uint32_t getSide(uint16_t pattern);
194  static uint32_t getLayer(uint16_t pattern);
195  static uint32_t getSubSubStructure(uint16_t pattern);
196  static uint32_t getSubStructure(uint16_t pattern);
197  static uint32_t getSubDetector(uint16_t pattern);
198 
200  static uint16_t getMuonStation(uint16_t pattern);
201 
203  static uint16_t getDTSuperLayer(uint16_t pattern); // only for DT patterns
204 
206  static uint16_t getCSCRing(uint16_t pattern);
207 
209  static uint16_t getRPCLayer(uint16_t pattern);
210 
212  static uint16_t getRPCregion(uint16_t pattern);
213 
215  static uint16_t getGEMStation(uint16_t pattern);
216 
218  static uint16_t getGEMLayer(uint16_t pattern);
219 
221  static uint16_t getBTLModType(uint16_t pattern);
222 
224  static uint16_t getETLRing(uint16_t pattern);
225 
226  HitPattern();
227 
228  ~HitPattern();
229 
230  HitPattern(const HitPattern &other);
231 
232  HitPattern &operator=(const HitPattern &other);
233 
234  template <typename I>
235  bool appendHits(const I &begin, const I &end, const TrackerTopology &ttopo);
236  bool appendHit(const TrackingRecHit &hit, const TrackerTopology &ttopo);
237  bool appendHit(const TrackingRecHitRef &ref, const TrackerTopology &ttopo);
238  bool appendHit(const DetId &id, TrackingRecHit::Type hitType, const TrackerTopology &ttopo);
239  bool appendHit(const uint16_t pattern, TrackingRecHit::Type hitType);
240 
247  bool appendTrackerHit(uint16_t subdet, uint16_t layer, uint16_t stereo, TrackingRecHit::Type hitType);
248 
255  bool appendMuonHit(const DetId &id, TrackingRecHit::Type hitType);
256 
257  // get the pattern of the position-th hit
258  uint16_t getHitPattern(HitCategory category, int position) const;
259 
260  void clear();
261 
262  // print the pattern of the position-th hit
263  void printHitPattern(HitCategory category, int position, std::ostream &stream) const;
264  void print(HitCategory category, std::ostream &stream = std::cout) const;
265 
266  // has valid hit in PXB/PXF layer x
268 
269  int numberOfAllHits(HitCategory category) const; // not-null
270  int numberOfValidHits() const; // not-null, valid
271 
272  int numberOfAllTrackerHits(HitCategory category) const; // not-null, tracker
273  int numberOfValidTrackerHits() const; // not-null, valid, tracker
274  int numberOfValidPixelHits() const; // not-null, valid, pixel
275  int numberOfValidPixelBarrelHits() const; // not-null, valid, pixel PXB
276  int numberOfValidPixelEndcapHits() const; // not-null, valid, pixel PXF
277  int numberOfValidStripHits() const; // not-null, valid, strip
278  int numberOfValidStripTIBHits() const; // not-null, valid, strip TIB
279  int numberOfValidStripTIDHits() const; // not-null, valid, strip TID
280  int numberOfValidStripTOBHits() const; // not-null, valid, strip TOB
281  int numberOfValidStripTECHits() const; // not-null, valid, strip TEC
282 
283  int numberOfLostHits(HitCategory category) const; // not-null, not valid
284  int numberOfLostTrackerHits(HitCategory category) const; // not-null, not valid, tracker
285  int numberOfLostPixelHits(HitCategory category) const; // not-null, not valid, pixel
286  int numberOfLostPixelBarrelHits(HitCategory category) const; // not-null, not valid, pixel PXB
287  int numberOfLostPixelEndcapHits(HitCategory category) const; // not-null, not valid, pixel PXF
288  int numberOfLostStripHits(HitCategory category) const; // not-null, not valid, strip
289  int numberOfLostStripTIBHits(HitCategory category) const; // not-null, not valid, strip TIB
290  int numberOfLostStripTIDHits(HitCategory category) const; // not-null, not valid, strip TID
291  int numberOfLostStripTOBHits(HitCategory category) const; // not-null, not valid, strip TOB
292  int numberOfLostStripTECHits(HitCategory category) const; // not-null, not valid, strip TEC
293 
294  int numberOfTimingHits() const; // not-null timing
295  int numberOfValidTimingHits() const; // not-null, valid, timing
296  int numberOfValidTimingBTLHits() const; // not-null, valid, timing BTL
297  int numberOfValidTimingETLHits() const; // not-null, valid, timing ETL
298 
299  int numberOfLostTimingHits() const; // not-null, not valid, timing
300  int numberOfLostTimingBTLHits() const; // not-null, not valid, timing BTL
301  int numberOfLostTimingETLHits() const; // not-null, not valid, timing ETL
302 
303  int numberOfMuonHits() const; // not-null, muon
304  int numberOfValidMuonHits() const; // not-null, valid, muon
305  int numberOfValidMuonDTHits() const; // not-null, valid, muon DT
306  int numberOfValidMuonCSCHits() const; // not-null, valid, muon CSC
307  int numberOfValidMuonRPCHits() const; // not-null, valid, muon RPC
308  int numberOfValidMuonGEMHits() const; // not-null, valid, muon GEM
309  int numberOfValidMuonME0Hits() const; // not-null, valid, muon ME0
310 
311  int numberOfLostMuonHits() const; // not-null, not valid, muon
312  int numberOfLostMuonDTHits() const; // not-null, not valid, muon DT
313  int numberOfLostMuonCSCHits() const; // not-null, not valid, muon CSC
314  int numberOfLostMuonRPCHits() const; // not-null, not valid, muon RPC
315  int numberOfLostMuonGEMHits() const; // not-null, not valid, muon GEM
316  int numberOfLostMuonME0Hits() const; // not-null, not valid, muon ME0
317 
318  int numberOfBadHits() const; // not-null, bad (only used in Muon Ch.)
319  int numberOfBadMuonHits() const; // not-null, bad, muon
320  int numberOfBadMuonDTHits() const; // not-null, bad, muon DT
321  int numberOfBadMuonCSCHits() const; // not-null, bad, muon CSC
322  int numberOfBadMuonRPCHits() const; // not-null, bad, muon RPC
323  int numberOfBadMuonGEMHits() const; // not-null, bad, muon GEM
324  int numberOfBadMuonME0Hits() const; // not-null, bad, muon ME0
325 
326  int numberOfInactiveHits() const; // not-null, inactive
327  int numberOfInactiveTrackerHits() const; // not-null, inactive, tracker
328  int numberOfInactiveTimingHits() const; // not-null, inactive, timing
329 
330  // count strip layers that have non-null, valid mono and stereo hits
331  int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const;
333  int numberOfValidTOBLayersWithMonoAndStereo(uint32_t layer = 0) const;
334  int numberOfValidTIBLayersWithMonoAndStereo(uint32_t layer = 0) const;
335  int numberOfValidTIDLayersWithMonoAndStereo(uint32_t layer = 0) const;
336  int numberOfValidTECLayersWithMonoAndStereo(uint32_t layer = 0) const;
337 
338  uint32_t getTrackerLayerCase(HitCategory category, uint16_t substr, uint16_t layer) const;
339  uint16_t getTrackerMonoStereo(HitCategory category, uint16_t substr, uint16_t layer) const;
340 
341  int trackerLayersWithMeasurementOld() const; // case 0: tracker
342  int trackerLayersWithMeasurement() const; // case 0: tracker
343  int pixelLayersWithMeasurementOld() const; // case 0: pixel
344  int pixelLayersWithMeasurement() const; // case 0: pixel
345  int stripLayersWithMeasurement() const; // case 0: strip
346  int pixelBarrelLayersWithMeasurement() const; // case 0: pixel PXB
347  int pixelEndcapLayersWithMeasurement() const; // case 0: pixel PXF
348  int stripTIBLayersWithMeasurement() const; // case 0: strip TIB
349  int stripTIDLayersWithMeasurement() const; // case 0: strip TID
350  int stripTOBLayersWithMeasurement() const; // case 0: strip TOB
351  int stripTECLayersWithMeasurement() const; // case 0: strip TEC
352 
353  int trackerLayersWithoutMeasurement(HitCategory category) const; // case 1: tracker
354  int trackerLayersWithoutMeasurementOld(HitCategory category) const; // case 1: tracker
355  int pixelLayersWithoutMeasurement(HitCategory category) const; // case 1: pixel
356  int stripLayersWithoutMeasurement(HitCategory category) const; // case 1: strip
357  int pixelBarrelLayersWithoutMeasurement(HitCategory category) const; // case 1: pixel PXB
358  int pixelEndcapLayersWithoutMeasurement(HitCategory category) const; // case 1: pixel PXF
359  int stripTIBLayersWithoutMeasurement(HitCategory category) const; // case 1: strip TIB
360  int stripTIDLayersWithoutMeasurement(HitCategory category) const; // case 1: strip TID
361  int stripTOBLayersWithoutMeasurement(HitCategory category) const; // case 1: strip TOB
362  int stripTECLayersWithoutMeasurement(HitCategory category) const; // case 1: strip TEC
363 
364  int trackerLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: tracker
365  int pixelLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: pixel
366  int stripLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: strip
367  int pixelBarrelLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: pixel PXB
368  int pixelEndcapLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: pixel PXF
369  int stripTIBLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: strip TIB
370  int stripTIDLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: strip TID
371  int stripTOBLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: strip TOB
372  int stripTECLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: strip TEC
373 
374  int trackerLayersNull() const; // case NULL_RETURN: tracker
375  int pixelLayersNull() const; // case NULL_RETURN: pixel
376  int stripLayersNull() const; // case NULL_RETURN: strip
377  int pixelBarrelLayersNull() const; // case NULL_RETURN: pixel PXB
378  int pixelEndcapLayersNull() const; // case NULL_RETURN: pixel PXF
379  int stripTIBLayersNull() const; // case NULL_RETURN: strip TIB
380  int stripTIDLayersNull() const; // case NULL_RETURN: strip TID
381  int stripTOBLayersNull() const; // case NULL_RETURN: strip TOB
382  int stripTECLayersNull() const; // case NULL_RETURN: strip TEC
383 
385  int muonStations(int subdet, int hitType) const;
386 
387  int muonStationsWithValidHits() const;
388  int muonStationsWithBadHits() const;
389  int muonStationsWithAnyHits() const;
390 
391  int dtStationsWithValidHits() const;
392  int dtStationsWithBadHits() const;
393  int dtStationsWithAnyHits() const;
394 
395  int cscStationsWithValidHits() const;
396  int cscStationsWithBadHits() const;
397  int cscStationsWithAnyHits() const;
398 
399  int rpcStationsWithValidHits() const;
400  int rpcStationsWithBadHits() const;
401  int rpcStationsWithAnyHits() const;
402 
403  int gemStationsWithValidHits() const;
404  int gemStationsWithBadHits() const;
405  int gemStationsWithAnyHits() const;
406 
407  int me0StationsWithValidHits() const;
408  int me0StationsWithBadHits() const;
409  int me0StationsWithAnyHits() const;
410 
412  int innermostMuonStationWithHits(int hitType) const;
416 
418  int outermostMuonStationWithHits(int hitType) const;
422 
423  int numberOfDTStationsWithRPhiView() const;
424  int numberOfDTStationsWithRZView() const;
426 
427  //only used by ROOT IO rule to read v12 HitPatterns
428  static bool fillNewHitPatternWithOldHitPattern_v12(const uint16_t oldHitPattern[],
429  uint8_t hitCount,
430  uint8_t beginTrackHits,
431  uint8_t endTrackHits,
432  uint8_t beginInner,
433  uint8_t endInner,
434  uint8_t beginOuter,
435  uint8_t endOuter,
436  reco::HitPattern *newObj);
437 
438  private:
439  // 3 bits for hit type
440  const static unsigned short HitTypeOffset = 0;
441  const static unsigned short HitTypeMask = 0x3;
442 
443  // 1 bit to identify the side in double-sided detectors
444  const static unsigned short SideOffset = 2;
445  const static unsigned short SideMask = 0x1;
446 
447  // 4 bits to identify the layer/disk/wheel within the substructure
448  const static unsigned short LayerOffset = 3;
449  const static unsigned short LayerMask = 0xF;
450 
451  // 3 bits to identify the tracker/muon detector substructure
452  const static unsigned short SubstrOffset = 7;
453  const static unsigned short SubstrMask = 0x7;
454 
455  // 2 bits to distinguish tracker, muon, mtd subsystems
456  const static unsigned short SubDetectorOffset = 10;
457  const static unsigned short SubDetectorMask = 0x3;
458 
459  const static unsigned short minTrackerWord = 1 << SubDetectorOffset;
460  const static unsigned short maxTrackerWord = (2 << SubDetectorOffset) - 1;
461  const static unsigned short minPixelWord = minTrackerWord | (1 << SubstrOffset);
462  const static unsigned short minStripWord = minTrackerWord | (3 << SubstrOffset);
463 
464  // detector side for tracker modules (mono/stereo)
465  static uint16_t isStereo(DetId i, const TrackerTopology &ttopo);
466  static bool stripSubdetectorHitFilter(uint16_t pattern, StripSubdetector::SubDetector substructure);
467 
468  static uint16_t encode(const TrackingRecHit &hit, const TrackerTopology &ttopo);
469  static uint16_t encode(const DetId &id, TrackingRecHit::Type hitType, const TrackerTopology &ttopo);
470  static uint16_t encode(uint16_t det, uint16_t subdet, uint16_t layer, uint16_t side, TrackingRecHit::Type hitType);
471 
472  // generic count methods
473  typedef bool filterType(uint16_t);
474 
475  template <typename F>
476  void call(HitCategory category, filterType typeFilter, F f) const;
477 
480 
481  bool insertTrackHit(const uint16_t pattern);
482  bool insertExpectedInnerHit(const uint16_t pattern);
483  bool insertExpectedOuterHit(const uint16_t pattern);
484  void insertHit(const uint16_t pattern);
485 
486  uint16_t getHitPatternByAbsoluteIndex(int position) const;
487 
488  std::pair<uint8_t, uint8_t> getCategoryIndexRange(HitCategory category) const;
489 
491  uint8_t hitCount;
492 
493  uint8_t beginTrackHits;
494  uint8_t endTrackHits;
495  uint8_t beginInner;
496  uint8_t endInner;
497  uint8_t beginOuter;
498  uint8_t endOuter;
499 
501 
502  template <int N>
503  friend struct PatternSet;
504  };
505 
506  inline std::pair<uint8_t, uint8_t> HitPattern::getCategoryIndexRange(HitCategory category) const {
507  switch (category) {
508  case TRACK_HITS:
509  return std::pair<uint8_t, uint8_t>(beginTrackHits, endTrackHits);
510  break;
511  case MISSING_INNER_HITS:
512  return std::pair<uint8_t, uint8_t>(beginInner, endInner);
513  break;
514  case MISSING_OUTER_HITS:
515  return std::pair<uint8_t, uint8_t>(beginOuter, endOuter);
516  break;
517  }
518  return std::pair<uint8_t, uint8_t>(-1, -1);
519  }
520 
521  template <typename I>
522  bool HitPattern::appendHits(const I &begin, const I &end, const TrackerTopology &ttopo) {
523  for (I hit = begin; hit != end; hit++) {
524  if UNLIKELY ((!appendHit(*hit, ttopo))) {
525  return false;
526  }
527  }
528  return true;
529  }
530 
532  std::pair<uint8_t, uint8_t> range = getCategoryIndexRange(category);
533  if UNLIKELY ((position < 0 || (position + range.first) >= range.second)) {
535  }
536 
537  return getHitPatternByAbsoluteIndex(range.first + position);
538  }
539 
540  inline int HitPattern::countHits(HitCategory category, filterType filter) const {
541  int count = 0;
542  std::pair<uint8_t, uint8_t> range = getCategoryIndexRange(category);
543  for (int i = range.first; i < range.second; ++i) {
545  ++count;
546  }
547  }
548  return count;
549  }
550 
551  template <typename F>
552  void HitPattern::call(HitCategory category, filterType typeFilter, F f) const {
553  std::pair<uint8_t, uint8_t> range = getCategoryIndexRange(category);
554  for (int i = range.first; i < range.second; i++) {
555  uint16_t pattern = getHitPatternByAbsoluteIndex(i);
556  // f() return false to ask to stop looping
557  if (typeFilter(pattern) && !f(pattern)) {
558  break;
559  }
560  }
561  }
562 
563  inline int HitPattern::countTypedHits(HitCategory category, filterType typeFilter, filterType filter) const {
564  int count = 0;
565  std::pair<uint8_t, uint8_t> range = getCategoryIndexRange(category);
566  for (int i = range.first; i < range.second; ++i) {
567  uint16_t pattern = getHitPatternByAbsoluteIndex(i);
568  if (typeFilter(pattern) && filter(pattern)) {
569  ++count;
570  }
571  }
572  return count;
573  }
574 
575  inline bool HitPattern::pixelHitFilter(uint16_t pattern) {
576  if UNLIKELY (!trackerHitFilter(pattern)) {
577  return false;
578  }
579 
580  uint32_t substructure = getSubStructure(pattern);
581  return (substructure == PixelSubdetector::PixelBarrel || substructure == PixelSubdetector::PixelEndcap);
582  }
583 
584  inline bool HitPattern::pixelBarrelHitFilter(uint16_t pattern) {
585  if UNLIKELY (!trackerHitFilter(pattern)) {
586  return false;
587  }
588 
589  uint32_t substructure = getSubStructure(pattern);
590  return (substructure == PixelSubdetector::PixelBarrel);
591  }
592 
593  inline bool HitPattern::pixelEndcapHitFilter(uint16_t pattern) {
594  if UNLIKELY (!trackerHitFilter(pattern)) {
595  return false;
596  }
597 
598  uint32_t substructure = getSubStructure(pattern);
599  return (substructure == PixelSubdetector::PixelEndcap);
600  }
601 
602  inline bool HitPattern::stripHitFilter(uint16_t pattern) {
603  return pattern > minStripWord && pattern <= maxTrackerWord;
604  }
605 
606  inline bool HitPattern::stripSubdetectorHitFilter(uint16_t pattern, StripSubdetector::SubDetector substructure) {
607  if UNLIKELY (!trackerHitFilter(pattern)) {
608  return false;
609  }
610 
611  return substructure == getSubStructure(pattern);
612  }
613 
614  inline bool HitPattern::stripTIBHitFilter(uint16_t pattern) {
616  }
617 
618  inline bool HitPattern::stripTIDHitFilter(uint16_t pattern) {
620  }
621 
622  inline bool HitPattern::stripTOBHitFilter(uint16_t pattern) {
624  }
625 
626  inline bool HitPattern::stripTECHitFilter(uint16_t pattern) {
628  }
629 
630  inline bool HitPattern::muonDTHitFilter(uint16_t pattern) {
631  if UNLIKELY (!muonHitFilter(pattern)) {
632  return false;
633  }
634 
635  uint32_t substructure = getSubStructure(pattern);
636  return (substructure == (uint32_t)MuonSubdetId::DT);
637  }
638 
639  inline bool HitPattern::muonCSCHitFilter(uint16_t pattern) {
640  if UNLIKELY (!muonHitFilter(pattern)) {
641  return false;
642  }
643 
644  uint32_t substructure = getSubStructure(pattern);
645  return (substructure == (uint32_t)MuonSubdetId::CSC);
646  }
647 
648  inline bool HitPattern::muonRPCHitFilter(uint16_t pattern) {
649  if UNLIKELY (!muonHitFilter(pattern)) {
650  return false;
651  }
652 
653  uint32_t substructure = getSubStructure(pattern);
654  return (substructure == (uint32_t)MuonSubdetId::RPC);
655  }
656 
657  inline bool HitPattern::muonGEMHitFilter(uint16_t pattern) {
658  if UNLIKELY (!muonHitFilter(pattern)) {
659  return false;
660  }
661 
662  uint32_t substructure = getSubStructure(pattern);
663  return (substructure == (uint32_t)MuonSubdetId::GEM);
664  }
665 
666  inline bool HitPattern::muonME0HitFilter(uint16_t pattern) {
667  if UNLIKELY (!muonHitFilter(pattern))
668  return false;
669  uint16_t substructure = getSubStructure(pattern);
670  return (substructure == (uint16_t)MuonSubdetId::ME0);
671  }
672 
673  inline bool HitPattern::trackerHitFilter(uint16_t pattern) {
674  return pattern > minTrackerWord && pattern <= maxTrackerWord;
675  }
676 
677  inline bool HitPattern::muonHitFilter(uint16_t pattern) {
678  if UNLIKELY (pattern == HitPattern::EMPTY_PATTERN) {
679  return false;
680  }
681 
682  return (((pattern >> SubDetectorOffset) & SubDetectorMask) == 0);
683  }
684 
685  inline bool HitPattern::timingBTLHitFilter(uint16_t pattern) {
686  if UNLIKELY (!timingHitFilter(pattern))
687  return false;
688  uint16_t substructure = getSubStructure(pattern);
689  return (substructure == (uint16_t)MTDDetId::BTL);
690  }
691 
692  inline bool HitPattern::timingETLHitFilter(uint16_t pattern) {
693  if UNLIKELY (!timingHitFilter(pattern))
694  return false;
695  uint16_t substructure = getSubStructure(pattern);
696  return (substructure == (uint16_t)MTDDetId::ETL);
697  }
698 
699  inline bool HitPattern::timingHitFilter(uint16_t pattern) {
700  if UNLIKELY (pattern == HitPattern::EMPTY_PATTERN) {
701  return false;
702  }
703 
704  return (((pattern >> SubDetectorOffset) & SubDetectorMask) == 2);
705  }
706 
707  inline uint32_t HitPattern::getSubStructure(uint16_t pattern) {
708  if UNLIKELY (pattern == HitPattern::EMPTY_PATTERN) {
709  return NULL_RETURN;
710  }
711 
712  return ((pattern >> SubstrOffset) & SubstrMask);
713  }
714 
715  inline uint32_t HitPattern::getLayer(uint16_t pattern) { return HitPattern::getSubSubStructure(pattern); }
716 
717  inline uint32_t HitPattern::getSubSubStructure(uint16_t pattern) {
718  if UNLIKELY (pattern == HitPattern::EMPTY_PATTERN) {
719  return NULL_RETURN;
720  }
721 
722  return ((pattern >> LayerOffset) & LayerMask);
723  }
724 
725  inline uint32_t HitPattern::getSubDetector(uint16_t pattern) {
726  if UNLIKELY (pattern == HitPattern::EMPTY_PATTERN) {
727  return NULL_RETURN;
728  }
729 
730  return ((pattern >> SubDetectorOffset) & SubDetectorMask);
731  }
732 
733  inline uint32_t HitPattern::getSide(uint16_t pattern) {
734  if UNLIKELY (pattern == HitPattern::EMPTY_PATTERN) {
735  return NULL_RETURN;
736  }
737 
738  return (pattern >> SideOffset) & SideMask;
739  }
740 
741  inline uint32_t HitPattern::getHitType(uint16_t pattern) {
742  if UNLIKELY (pattern == HitPattern::EMPTY_PATTERN) {
743  return NULL_RETURN;
744  }
745 
746  return ((pattern >> HitTypeOffset) & HitTypeMask);
747  }
748 
749  inline uint16_t HitPattern::getMuonStation(uint16_t pattern) {
750  return muonGEMHitFilter(pattern) ? getGEMStation(pattern) : (getSubSubStructure(pattern) >> 2) + 1;
751  }
752 
753  inline uint16_t HitPattern::getDTSuperLayer(uint16_t pattern) { return (getSubSubStructure(pattern) & 3); }
754 
755  inline uint16_t HitPattern::getCSCRing(uint16_t pattern) { return (getSubSubStructure(pattern) & 3) + 1; }
756 
757  inline uint16_t HitPattern::getRPCLayer(uint16_t pattern) {
758  uint16_t subSubStructure = getSubSubStructure(pattern);
759  uint16_t stat = subSubStructure >> 2;
760 
761  if LIKELY (stat <= 1) {
762  return ((subSubStructure >> 1) & 1) + 1;
763  }
764 
765  return 0;
766  }
767 
768  inline uint16_t HitPattern::getRPCregion(uint16_t pattern) { return getSubSubStructure(pattern) & 1; }
769 
771  inline uint16_t HitPattern::getGEMStation(uint16_t pattern) {
772  uint16_t sss = getSubSubStructure(pattern);
773  if (sss & 0b1000)
774  return 0;
775  return (sss >> 2) + 1;
776  }
777 
779  inline uint16_t HitPattern::getBTLModType(uint16_t pattern) { return getSubSubStructure(pattern); }
780 
781  inline uint16_t HitPattern::getETLRing(uint16_t pattern) { return getSubSubStructure(pattern); }
782 
783  inline uint16_t HitPattern::getGEMLayer(uint16_t pattern) {
784  uint16_t sss = getSubSubStructure(pattern);
785  if (sss & 0b1000)
786  return (sss & 0b0111) + 1;
787  return (sss & 0b11) + 1;
788  }
789 
790  inline bool HitPattern::validHitFilter(uint16_t pattern) { return getHitType(pattern) == HitPattern::VALID; }
791 
792  inline bool HitPattern::missingHitFilter(uint16_t pattern) { return getHitType(pattern) == HitPattern::MISSING; }
793 
794  inline bool HitPattern::inactiveHitFilter(uint16_t pattern) { return getHitType(pattern) == HitPattern::INACTIVE; }
795 
796  inline bool HitPattern::badHitFilter(uint16_t pattern) { return getHitType(pattern) == HitPattern::BAD; }
797 
799  std::pair<uint8_t, uint8_t> range = getCategoryIndexRange(category);
800  return range.second - range.first;
801  }
802 
804  return countHits(category, trackerHitFilter);
805  }
806 
808 
810 
812 
815  }
816 
819  }
820 
823  }
824 
827  }
828 
831  }
832 
835  }
836 
839  }
840 
843  }
844 
847  }
848 
851  }
852 
855  }
856 
859  }
860 
863  }
864 
867  }
868 
871  }
872 
875  }
876 
879  }
880 
883  }
884 
886 
889  }
890 
891  inline int HitPattern::numberOfLostMuonHits() const {
893  }
894 
897  }
898 
901  }
902 
905  }
906 
909  }
910 
913  }
914 
917  }
918 
921  }
922 
925  }
926 
929  }
930 
933  }
934 
937  }
938 
941  }
942 
945  }
946 
949  }
950 
953  }
954 
957  }
958 
960 
961  inline int HitPattern::numberOfBadMuonHits() const {
963  }
964 
967  }
968 
971  }
972 
975  }
976 
979  }
980 
983  }
984 
986 
989  }
990 
993  }
994 
997  }
998 
1002  }
1003 
1005  return pixelLayersWithoutMeasurement(category) + stripLayersWithoutMeasurement(category);
1006  }
1007 
1010  }
1011 
1015  }
1016 
1018  return pixelLayersTotallyOffOrBad(category) + stripLayersTotallyOffOrBad(category);
1019  }
1020 
1023  }
1024 
1026  return stripTIBLayersTotallyOffOrBad(category) + stripTIDLayersTotallyOffOrBad(category) +
1028  }
1029 
1031 
1033 
1034  inline int HitPattern::stripLayersNull() const {
1036  }
1037 
1038  inline int HitPattern::muonStationsWithValidHits() const { return muonStations(0, 0); }
1039 
1040  inline int HitPattern::muonStationsWithBadHits() const { return muonStations(0, 3); }
1041 
1042  inline int HitPattern::muonStationsWithAnyHits() const { return muonStations(0, -1); }
1043 
1044  inline int HitPattern::dtStationsWithValidHits() const { return muonStations(1, 0); }
1045 
1046  inline int HitPattern::dtStationsWithBadHits() const { return muonStations(1, 3); }
1047 
1048  inline int HitPattern::dtStationsWithAnyHits() const { return muonStations(1, -1); }
1049 
1050  inline int HitPattern::cscStationsWithValidHits() const { return muonStations(2, 0); }
1051 
1052  inline int HitPattern::cscStationsWithBadHits() const { return muonStations(2, 3); }
1053 
1054  inline int HitPattern::cscStationsWithAnyHits() const { return muonStations(2, -1); }
1055 
1056  inline int HitPattern::rpcStationsWithValidHits() const { return muonStations(3, 0); }
1057 
1058  inline int HitPattern::rpcStationsWithBadHits() const { return muonStations(3, 3); }
1059 
1060  inline int HitPattern::rpcStationsWithAnyHits() const { return muonStations(3, -1); }
1061 
1062  inline int HitPattern::gemStationsWithValidHits() const { return muonStations(4, 0); }
1063 
1064  inline int HitPattern::gemStationsWithBadHits() const { return muonStations(4, 3); }
1065 
1066  inline int HitPattern::gemStationsWithAnyHits() const { return muonStations(4, -1); }
1067 
1068  inline int HitPattern::me0StationsWithValidHits() const { return muonStations(5, 0); }
1069 
1070  inline int HitPattern::me0StationsWithBadHits() const { return muonStations(5, 3); }
1071 
1072  inline int HitPattern::me0StationsWithAnyHits() const { return muonStations(5, -1); }
1073 
1075 
1077 
1079 
1081 
1083 
1085 
1086  template <int N = HitPattern::MaxHits>
1087  struct PatternSet {
1088  static constexpr int MaxHits = N;
1089  unsigned char hit[N];
1090  unsigned char nhit;
1091 
1092  unsigned char const *begin() const { return hit; }
1093 
1094  unsigned char const *end() const { return hit + nhit; }
1095 
1096  unsigned char *begin() { return hit; }
1097 
1098  unsigned char *end() { return hit + nhit; }
1099 
1100  int size() const { return nhit; }
1101 
1102  unsigned char operator[](int i) const { return hit[i]; }
1103 
1104  PatternSet() : nhit(0) {}
1105 
1107 
1109  int lhit = 0;
1110  auto unpack = [&lhit, this](uint16_t pattern) -> bool {
1111  unsigned char p = 255 & (pattern >> 3);
1112  hit[lhit++] = p;
1113 
1114  // bouble sort
1115  if (lhit > 1) {
1116  for (auto h = hit + lhit - 1; h != hit; --h) {
1117  if ((*(h - 1)) <= p) {
1118  break;
1119  }
1120  (*h) = *(h - 1);
1121  *(h - 1) = p;
1122  }
1123  }
1124  return lhit < MaxHits;
1125  };
1126 
1127  hp.call(category, HitPattern::validHitFilter, unpack);
1128  nhit = lhit;
1129  }
1130  };
1131 
1132  template <int N>
1134  PatternSet<N> comm;
1135  comm.nhit = std::set_intersection(p1.begin(), p1.end(), p2.begin(), p2.end(), comm.begin()) - comm.begin();
1136  return comm;
1137  }
1138 
1139 } // namespace reco
1140 
1141 #endif
int stripTOBLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:729
unsigned char const * begin() const
Definition: HitPattern.h:1092
int stripTOBLayersWithMeasurement() const
Definition: HitPattern.cc:605
static uint16_t getCSCRing(uint16_t pattern)
CSC ring (1-4). Only valid for muon CSC patterns, of course.
Definition: HitPattern.h:755
static constexpr auto TEC
unsigned char const * end() const
Definition: HitPattern.h:1094
static bool stripTECHitFilter(uint16_t pattern)
Definition: HitPattern.h:626
int pixelBarrelLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:625
int cscStationsWithAnyHits() const
Definition: HitPattern.h:1054
int pixelLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.h:1021
static uint32_t getLayer(uint16_t pattern)
Definition: HitPattern.h:715
void insertHit(const uint16_t pattern)
Definition: HitPattern.cc:964
int numberOfLostStripTIBHits(HitCategory category) const
Definition: HitPattern.h:923
int outermostMuonStationWithHits(int hitType) const
hitType=-1(all), 0=valid, 3=bad; 0 = no stations at all
Definition: HitPattern.cc:914
static const unsigned short HIT_LENGTH
Definition: HitPattern.h:157
int outermostMuonStationWithValidHits() const
Definition: HitPattern.h:1080
static const unsigned short ARRAY_LENGTH
Definition: HitPattern.h:156
static const uint32_t NULL_RETURN
Definition: HitPattern.h:160
bool appendHits(const I &begin, const I &end, const TrackerTopology &ttopo)
Definition: HitPattern.h:522
static constexpr int GEM
Definition: MuonSubdetId.h:14
int pixelBarrelLayersNull() const
Definition: HitPattern.cc:749
int numberOfLostStripTOBHits(HitCategory category) const
Definition: HitPattern.h:931
static bool timingHitFilter(uint16_t pattern)
Definition: HitPattern.h:699
static bool pixelHitFilter(uint16_t pattern)
Definition: HitPattern.h:575
int stripTIBLayersNull() const
Definition: HitPattern.cc:771
PatternSet< N > commonHits(PatternSet< N > const &p1, PatternSet< N > const &p2)
Definition: HitPattern.h:1133
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
int numberOfInactiveHits() const
Definition: HitPattern.h:985
int pixelBarrelLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:687
bool hasValidHitInPixelLayer(enum PixelSubdetector::SubDetector, uint16_t layer) const
Definition: HitPattern.cc:345
int gemStationsWithBadHits() const
Definition: HitPattern.h:1064
static uint16_t isStereo(DetId i, const TrackerTopology &ttopo)
Definition: HitPattern.cc:864
static bool timingBTLHitFilter(uint16_t pattern)
Definition: HitPattern.h:685
int stripTIBLayersWithMeasurement() const
Definition: HitPattern.cc:585
const TString p2
Definition: fwPaths.cc:13
static bool badHitFilter(uint16_t pattern)
Definition: HitPattern.h:796
int stripTECLayersNull() const
Definition: HitPattern.cc:801
static const unsigned short SideOffset
Definition: HitPattern.h:444
static const char category[]
static const uint16_t EMPTY_PATTERN
Definition: HitPattern.h:161
int muonStations(int subdet, int hitType) const
subdet = 0(all), 1(DT), 2(CSC), 3(RPC) 4(GEM); hitType=-1(all), 0=valid, 3=bad
Definition: HitPattern.cc:886
static uint16_t getDTSuperLayer(uint16_t pattern)
DT superlayer (1-3). Where the &quot;hit&quot; was a DT segment, superlayer is 0. Only valid for muon DT patter...
Definition: HitPattern.h:753
static bool muonME0HitFilter(uint16_t pattern)
Definition: HitPattern.h:666
static const unsigned short SubstrOffset
Definition: HitPattern.h:452
int stripTOBLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:667
int numberOfValidHits() const
Definition: HitPattern.h:811
int numberOfLostPixelHits(HitCategory category) const
Definition: HitPattern.h:907
int numberOfDTStationsWithRPhiView() const
Definition: HitPattern.cc:928
int numberOfBadHits() const
Definition: HitPattern.h:959
int cscStationsWithValidHits() const
Definition: HitPattern.h:1050
int pixelLayersNull() const
Definition: HitPattern.h:1032
void call(HitCategory category, filterType typeFilter, F f) const
Definition: HitPattern.h:552
static uint16_t getETLRing(uint16_t pattern)
ETL Ring: 1-12. Only valid for ETL patterns of course.
Definition: HitPattern.h:781
HitPattern & operator=(const HitPattern &other)
Definition: HitPattern.cc:37
unsigned char nhit
Definition: HitPattern.h:1090
uint16_t getTrackerMonoStereo(HitCategory category, uint16_t substr, uint16_t layer) const
Definition: HitPattern.cc:466
int numberOfLostTimingETLHits() const
Definition: HitPattern.h:903
static const unsigned short MaxHits
Definition: HitPattern.h:158
uint32_t getTrackerLayerCase(HitCategory category, uint16_t substr, uint16_t layer) const
Definition: HitPattern.cc:438
int numberOfValidStripHits() const
Definition: HitPattern.h:837
#define LIKELY(x)
Definition: Likely.h:20
int numberOfLostTimingHits() const
Definition: HitPattern.h:895
static const unsigned short maxTrackerWord
Definition: HitPattern.h:460
int rpcStationsWithValidHits() const
Definition: HitPattern.h:1056
int me0StationsWithValidHits() const
Definition: HitPattern.h:1068
int numberOfValidTimingBTLHits() const
Definition: HitPattern.h:877
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:500
int countTypedHits(HitCategory category, filterType typeFilter, filterType filter) const
Definition: HitPattern.h:563
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
int numberOfValidStripLayersWithMonoAndStereo() const
Definition: HitPattern.cc:401
bool filterType(uint16_t)
Definition: HitPattern.h:473
int pixelEndcapLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:636
int numberOfLostMuonHits() const
Definition: HitPattern.h:891
int me0StationsWithAnyHits() const
Definition: HitPattern.h:1072
static bool missingHitFilter(uint16_t pattern)
Definition: HitPattern.h:792
static uint16_t getBTLModType(uint16_t pattern)
BTL Module type: 1,2,3. Only valid for BTL patterns of course.
Definition: HitPattern.h:779
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:521
static const unsigned short HitTypeMask
Definition: HitPattern.h:441
static bool pixelBarrelHitFilter(uint16_t pattern)
Definition: HitPattern.h:584
int pixelEndcapLayersWithMeasurement() const
Definition: HitPattern.cc:574
int numberOfValidStripTOBHits() const
Definition: HitPattern.h:849
int numberOfValidMuonCSCHits() const
Definition: HitPattern.h:861
int numberOfMuonHits() const
Definition: HitPattern.h:807
bool insertExpectedOuterHit(const uint16_t pattern)
Definition: HitPattern.cc:1005
constexpr std::array< uint8_t, layerIndexSize > layer
static bool pixelEndcapHitFilter(uint16_t pattern)
Definition: HitPattern.h:593
const uint16_t range(const Frame &aFrame)
int numberOfLostTrackerHits(HitCategory category) const
Definition: HitPattern.h:887
int numberOfLostStripHits(HitCategory category) const
Definition: HitPattern.h:919
int numberOfValidMuonRPCHits() const
Definition: HitPattern.h:865
static bool validHitFilter(uint16_t pattern)
Definition: HitPattern.h:790
int muonStationsWithBadHits() const
Definition: HitPattern.h:1040
uint8_t endInner
Definition: HitPattern.h:496
int trackerLayersWithoutMeasurementOld(HitCategory category) const
Definition: HitPattern.h:1004
void printHitPattern(HitCategory category, int position, std::ostream &stream) const
Definition: HitPattern.cc:811
int stripLayersNull() const
Definition: HitPattern.h:1034
unsigned char * begin()
Definition: HitPattern.h:1096
int numberOfLostStripTIDHits(HitCategory category) const
Definition: HitPattern.h:927
static uint16_t getGEMLayer(uint16_t pattern)
GEM layer: 1-6 for station 0, 1-2 for stations 1 and 2. Only valid for muon GEM patterns, of course.
Definition: HitPattern.h:783
int numberOfAllTrackerHits(HitCategory category) const
Definition: HitPattern.h:803
int muonStationsWithValidHits() const
Definition: HitPattern.h:1038
static constexpr int MaxHits
Definition: HitPattern.h:1088
int pixelLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.h:1008
int rpcStationsWithBadHits() const
Definition: HitPattern.h:1058
static const unsigned short minTrackerWord
Definition: HitPattern.h:459
int innermostMuonStationWithAnyHits() const
Definition: HitPattern.h:1078
uint16_t hitPattern[ARRAY_LENGTH]
Definition: HitPattern.h:490
int numberOfValidPixelBarrelHits() const
Definition: HitPattern.h:829
int stripTIBLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:709
static bool muonCSCHitFilter(uint16_t pattern)
Definition: HitPattern.h:639
static uint32_t getHitType(uint16_t pattern)
Definition: HitPattern.h:741
int numberOfBadMuonGEMHits() const
Definition: HitPattern.h:977
int numberOfValidTECLayersWithMonoAndStereo(uint32_t layer=0) const
Definition: HitPattern.cc:434
int stripTIDLayersWithMeasurement() const
Definition: HitPattern.cc:595
int stripLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.h:1025
static const unsigned short SubDetectorMask
Definition: HitPattern.h:457
int muonStationsWithAnyHits() const
Definition: HitPattern.h:1042
int numberOfLostMuonME0Hits() const
Definition: HitPattern.h:955
static bool stripHitFilter(uint16_t pattern)
Definition: HitPattern.h:602
int numberOfAllHits(HitCategory category) const
Definition: HitPattern.h:798
const TString p1
Definition: fwPaths.cc:12
int stripLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.h:1012
int numberOfBadMuonHits() const
Definition: HitPattern.h:961
bool appendHit(const TrackingRecHit &hit, const TrackerTopology &ttopo)
Definition: HitPattern.cc:210
int numberOfValidStripTIDHits() const
Definition: HitPattern.h:845
int size() const
Definition: HitPattern.h:1100
const std::complex< double > I
Definition: I.h:8
int numberOfDTStationsWithRZView() const
Definition: HitPattern.cc:940
static constexpr int ME0
Definition: MuonSubdetId.h:15
int numberOfTimingHits() const
Definition: HitPattern.h:809
int numberOfValidStripTECHits() const
Definition: HitPattern.h:853
uint8_t beginInner
Definition: HitPattern.h:495
int numberOfValidTimingETLHits() const
Definition: HitPattern.h:881
static constexpr auto TOB
int stripTIDLayersNull() const
Definition: HitPattern.cc:781
int numberOfLostMuonRPCHits() const
Definition: HitPattern.h:947
static const unsigned short HitTypeOffset
Definition: HitPattern.h:440
int gemStationsWithAnyHits() const
Definition: HitPattern.h:1066
int trackerLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.h:1017
int numberOfBadMuonRPCHits() const
Definition: HitPattern.h:973
int numberOfValidTIDLayersWithMonoAndStereo(uint32_t layer=0) const
Definition: HitPattern.cc:430
int dtStationsWithValidHits() const
Definition: HitPattern.h:1044
bool appendTrackerHit(uint16_t subdet, uint16_t layer, uint16_t stereo, TrackingRecHit::Type hitType)
Definition: HitPattern.cc:282
int cscStationsWithBadHits() const
Definition: HitPattern.h:1052
uint8_t beginTrackHits
Definition: HitPattern.h:493
static uint32_t getSubStructure(uint16_t pattern)
Definition: HitPattern.h:707
unsigned char * end()
Definition: HitPattern.h:1098
int numberOfDTStationsWithBothViews() const
Definition: HitPattern.cc:951
static bool inactiveHitFilter(uint16_t pattern)
Definition: HitPattern.h:794
static const unsigned short minPixelWord
Definition: HitPattern.h:461
int numberOfLostTimingBTLHits() const
Definition: HitPattern.h:899
int numberOfValidTIBLayersWithMonoAndStereo(uint32_t layer=0) const
Definition: HitPattern.cc:426
int gemStationsWithValidHits() const
Definition: HitPattern.h:1062
static uint16_t getRPCregion(uint16_t pattern)
RPC region: 0 = barrel, 1 = endcap. Only valid for muon RPC patterns, of course.
Definition: HitPattern.h:768
static uint32_t getSubDetector(uint16_t pattern)
Definition: HitPattern.h:725
int numberOfBadMuonME0Hits() const
Definition: HitPattern.h:981
int dtStationsWithAnyHits() const
Definition: HitPattern.h:1048
static bool muonGEMHitFilter(uint16_t pattern)
Definition: HitPattern.h:657
static uint16_t getGEMStation(uint16_t pattern)
GEM station: 1,2. Only valid for muon GEM patterns, of course.
Definition: HitPattern.h:771
int stripTIDLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:657
int pixelLayersWithMeasurementOld() const
Definition: HitPattern.h:995
Definition: DetId.h:17
int innermostMuonStationWithHits(int hitType) const
hitType=-1(all), 0=valid, 3=bad; 0 = no stations at all
Definition: HitPattern.cc:899
int numberOfInactiveTrackerHits() const
Definition: HitPattern.h:987
static bool muonHitFilter(uint16_t pattern)
Definition: HitPattern.h:677
static bool trackerHitFilter(uint16_t pattern)
Definition: HitPattern.h:673
uint8_t endTrackHits
Definition: HitPattern.h:494
int numberOfLostPixelEndcapHits(HitCategory category) const
Definition: HitPattern.h:915
static constexpr auto TIB
static const unsigned short SideMask
Definition: HitPattern.h:445
#define N
Definition: blowfish.cc:9
static const unsigned short minStripWord
Definition: HitPattern.h:462
std::pair< uint8_t, uint8_t > getCategoryIndexRange(HitCategory category) const
Definition: HitPattern.h:506
uint8_t hitCount
Definition: HitPattern.h:491
int innermostMuonStationWithBadHits() const
Definition: HitPattern.h:1076
uint8_t beginOuter
Definition: HitPattern.h:497
static const unsigned short SubDetectorOffset
Definition: HitPattern.h:456
int trackerLayersNull() const
Definition: HitPattern.h:1030
int stripLayersWithMeasurement() const
Definition: HitPattern.h:999
static constexpr int RPC
Definition: MuonSubdetId.h:13
int pixelBarrelLayersWithMeasurement() const
Definition: HitPattern.cc:563
static bool fillNewHitPatternWithOldHitPattern_v12(const uint16_t oldHitPattern[], uint8_t hitCount, uint8_t beginTrackHits, uint8_t endTrackHits, uint8_t beginInner, uint8_t endInner, uint8_t beginOuter, uint8_t endOuter, reco::HitPattern *newObj)
int numberOfBadMuonDTHits() const
Definition: HitPattern.h:965
int numberOfLostMuonGEMHits() const
Definition: HitPattern.h:951
int me0StationsWithBadHits() const
Definition: HitPattern.h:1070
int numberOfValidTimingHits() const
Definition: HitPattern.h:821
int outermostMuonStationWithBadHits() const
Definition: HitPattern.h:1082
int dtStationsWithBadHits() const
Definition: HitPattern.h:1046
int numberOfValidStripTIBHits() const
Definition: HitPattern.h:841
static bool stripTOBHitFilter(uint16_t pattern)
Definition: HitPattern.h:622
int numberOfLostHits(HitCategory category) const
Definition: HitPattern.h:885
int numberOfValidTrackerHits() const
Definition: HitPattern.h:813
int numberOfValidPixelEndcapHits() const
Definition: HitPattern.h:833
uint16_t getHitPatternByAbsoluteIndex(int position) const
Definition: HitPattern.cc:302
static uint32_t getSide(uint16_t pattern)
Definition: HitPattern.h:733
int numberOfLostPixelBarrelHits(HitCategory category) const
Definition: HitPattern.h:911
int stripTOBLayersNull() const
Definition: HitPattern.cc:791
static bool muonDTHitFilter(uint16_t pattern)
Definition: HitPattern.h:630
int stripTIDLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:719
int trackerLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:540
bool insertExpectedInnerHit(const uint16_t pattern)
Definition: HitPattern.cc:993
int numberOfLostStripTECHits(HitCategory category) const
Definition: HitPattern.h:935
static bool stripTIBHitFilter(uint16_t pattern)
Definition: HitPattern.h:614
int numberOfValidMuonGEMHits() const
Definition: HitPattern.h:869
int numberOfLostMuonDTHits() const
Definition: HitPattern.h:939
static const unsigned short SubstrMask
Definition: HitPattern.h:453
int numberOfBadMuonCSCHits() const
Definition: HitPattern.h:969
unsigned char hit[N]
Definition: HitPattern.h:1089
static const unsigned short LayerOffset
Definition: HitPattern.h:448
int numberOfValidMuonME0Hits() const
Definition: HitPattern.h:873
void fill(HitPattern::HitCategory category, HitPattern const &hp)
Definition: HitPattern.h:1108
static int position[264][3]
Definition: ReadPGInfo.cc:289
int numberOfValidMuonDTHits() const
Definition: HitPattern.h:857
string end
Definition: dataset.py:937
int pixelEndcapLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:698
bool insertTrackHit(const uint16_t pattern)
Definition: HitPattern.cc:975
int stripTECLayersWithMeasurement() const
Definition: HitPattern.cc:615
int stripTECLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:677
int numberOfValidPixelHits() const
Definition: HitPattern.h:825
static uint16_t getRPCLayer(uint16_t pattern)
RPC layer: for station 1 and 2, layer = 1(inner) or 2(outer); for station 3, 4 layer is always 0...
Definition: HitPattern.h:757
tuple cout
Definition: gather_cfg.py:144
static uint16_t getMuonStation(uint16_t pattern)
Muon station (1-4). Only valid for muon patterns, of course. only for patterns from muon...
Definition: HitPattern.h:749
void print(HitCategory category, std::ostream &stream=std::cout) const
Definition: HitPattern.cc:848
int numberOfValidTOBLayersWithMonoAndStereo(uint32_t layer=0) const
Definition: HitPattern.cc:422
static bool timingETLHitFilter(uint16_t pattern)
Definition: HitPattern.h:692
#define UNLIKELY(x)
Definition: Likely.h:21
int countHits(HitCategory category, filterType filter) const
Definition: HitPattern.h:540
int numberOfValidMuonHits() const
Definition: HitPattern.h:817
static uint32_t getSubSubStructure(uint16_t pattern)
Definition: HitPattern.h:717
static constexpr int DT
Definition: MuonSubdetId.h:11
int numberOfInactiveTimingHits() const
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:531
static const unsigned short LayerMask
Definition: HitPattern.h:449
static bool stripTIDHitFilter(uint16_t pattern)
Definition: HitPattern.h:618
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
static bool muonRPCHitFilter(uint16_t pattern)
Definition: HitPattern.h:648
static constexpr int CSC
Definition: MuonSubdetId.h:12
int rpcStationsWithAnyHits() const
Definition: HitPattern.h:1060
static constexpr auto TID
PatternSet(HitPattern::HitCategory category, HitPattern const &hp)
Definition: HitPattern.h:1106
uint8_t endOuter
Definition: HitPattern.h:498
static uint16_t encode(const TrackingRecHit &hit, const TrackerTopology &ttopo)
Definition: HitPattern.cc:74
int trackerLayersWithMeasurementOld() const
Definition: HitPattern.h:991
static bool stripSubdetectorHitFilter(uint16_t pattern, StripSubdetector::SubDetector substructure)
Definition: HitPattern.h:606
unsigned char operator[](int i) const
Definition: HitPattern.h:1102
int innermostMuonStationWithValidHits() const
Definition: HitPattern.h:1074
int stripTECLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:739
int numberOfLostMuonCSCHits() const
Definition: HitPattern.h:943
int outermostMuonStationWithAnyHits() const
Definition: HitPattern.h:1084
int stripTIBLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:647
bool appendMuonHit(const DetId &id, TrackingRecHit::Type hitType)
Definition: HitPattern.cc:286
int pixelEndcapLayersNull() const
Definition: HitPattern.cc:760
std::vector< std::string > set_intersection(std::vector< std::string > const &v1, std::vector< std::string > const &v2)