CMS 3D CMS Logo

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 
131 
132 #include <utility>
133 #include <algorithm>
134 #include <iostream>
135 #include <ostream>
136 #include <memory>
137 
138 class TrackerTopology;
139 
140 namespace test {
141  namespace TestHitPattern {
142  int test();
143  }
144 } // namespace test
145 
146 namespace reco {
147 
148  class HitPattern {
149  public:
150  enum { MONO = 1, STEREO = 2 };
151 
153 
154  enum HIT_TYPE { VALID = 0, MISSING = 1, INACTIVE = 2, BAD = 3 };
155 
157  const static unsigned short ARRAY_LENGTH = 57;
158  const static unsigned short HIT_LENGTH = 12;
159  const static unsigned short MaxHits = (8 * sizeof(uint16_t) * ARRAY_LENGTH) / HIT_LENGTH;
160 
161  static const uint32_t NULL_RETURN = 999999;
162  static const uint16_t EMPTY_PATTERN = 0x0;
163 
164  static bool trackerHitFilter(uint16_t pattern);
165  static bool muonHitFilter(uint16_t pattern);
166  static bool timingHitFilter(uint16_t pattern);
167 
168  static bool validHitFilter(uint16_t pattern);
169  static bool missingHitFilter(uint16_t pattern);
170  static bool inactiveHitFilter(uint16_t pattern);
171  static bool badHitFilter(uint16_t pattern);
172 
173  static bool pixelHitFilter(uint16_t pattern);
174  static bool pixelBarrelHitFilter(uint16_t pattern);
175  static bool pixelEndcapHitFilter(uint16_t pattern);
176  static bool stripHitFilter(uint16_t pattern);
177  static bool stripTIBHitFilter(uint16_t pattern);
178  static bool stripTIDHitFilter(uint16_t pattern);
179  static bool stripTOBHitFilter(uint16_t pattern);
180  static bool stripTECHitFilter(uint16_t pattern);
181 
182  static bool muonDTHitFilter(uint16_t pattern);
183  static bool muonCSCHitFilter(uint16_t pattern);
184  static bool muonRPCHitFilter(uint16_t pattern);
185  static bool muonGEMHitFilter(uint16_t pattern);
186  static bool muonME0HitFilter(uint16_t pattern);
187 
188  static bool timingBTLHitFilter(uint16_t pattern);
189  static bool timingETLHitFilter(uint16_t pattern);
190 
191  static uint32_t getHitType(uint16_t pattern);
192 
193  // mono (0) or stereo (1)
194  static uint32_t getSide(uint16_t pattern);
195  static uint32_t getLayer(uint16_t pattern);
196  static uint32_t getSubSubStructure(uint16_t pattern);
197  static uint32_t getSubStructure(uint16_t pattern);
198  static uint32_t getSubDetector(uint16_t pattern);
199 
201  static uint16_t getMuonStation(uint16_t pattern);
202 
204  static uint16_t getDTSuperLayer(uint16_t pattern); // only for DT patterns
205 
207  static uint16_t getCSCRing(uint16_t pattern);
208 
210  static uint16_t getRPCLayer(uint16_t pattern);
211 
213  static uint16_t getRPCregion(uint16_t pattern);
214 
216  static uint16_t getGEMStation(uint16_t pattern);
217 
219  static uint16_t getGEMLayer(uint16_t pattern);
220 
222  static uint16_t getBTLModType(uint16_t pattern);
223 
225  static uint16_t getETLRing(uint16_t pattern);
226 
227  HitPattern();
228 
229  ~HitPattern();
230 
231  HitPattern(const HitPattern &other);
232 
234 
236 
237  template <typename I>
238  bool appendHits(const I &begin, const I &end, const TrackerTopology &ttopo);
239  bool appendHit(const TrackingRecHit &hit, const TrackerTopology &ttopo);
240  bool appendHit(const TrackingRecHitRef &ref, const TrackerTopology &ttopo);
241  bool appendHit(const DetId &id, TrackingRecHit::Type hitType, const TrackerTopology &ttopo);
242  bool appendHit(const uint16_t pattern, TrackingRecHit::Type hitType);
243 
250  bool appendTrackerHit(uint16_t subdet, uint16_t layer, uint16_t stereo, TrackingRecHit::Type hitType);
251 
258  bool appendMuonHit(const DetId &id, TrackingRecHit::Type hitType);
259 
260  // get the pattern of the position-th hit
261  uint16_t getHitPattern(HitCategory category, int position) const;
262 
263  void clear();
264 
265  // print the pattern of the position-th hit
266  void printHitPattern(HitCategory category, int position, std::ostream &stream) const;
267  void print(HitCategory category, std::ostream &stream = std::cout) const;
268 
269  // has valid hit in PXB/PXF layer x
271 
272  int numberOfAllHits(HitCategory category) const; // not-null
273  int numberOfValidHits() const; // not-null, valid
274 
275  int numberOfAllTrackerHits(HitCategory category) const; // not-null, tracker
276  int numberOfValidTrackerHits() const; // not-null, valid, tracker
277  int numberOfValidPixelHits() const; // not-null, valid, pixel
278  int numberOfValidPixelBarrelHits() const; // not-null, valid, pixel PXB
279  int numberOfValidPixelEndcapHits() const; // not-null, valid, pixel PXF
280  int numberOfValidStripHits() const; // not-null, valid, strip
281  int numberOfValidStripTIBHits() const; // not-null, valid, strip TIB
282  int numberOfValidStripTIDHits() const; // not-null, valid, strip TID
283  int numberOfValidStripTOBHits() const; // not-null, valid, strip TOB
284  int numberOfValidStripTECHits() const; // not-null, valid, strip TEC
285 
286  int numberOfLostHits(HitCategory category) const; // not-null, not valid
287  int numberOfLostTrackerHits(HitCategory category) const; // not-null, not valid, tracker
288  int numberOfLostPixelHits(HitCategory category) const; // not-null, not valid, pixel
289  int numberOfLostPixelBarrelHits(HitCategory category) const; // not-null, not valid, pixel PXB
290  int numberOfLostPixelEndcapHits(HitCategory category) const; // not-null, not valid, pixel PXF
291  int numberOfLostStripHits(HitCategory category) const; // not-null, not valid, strip
292  int numberOfLostStripTIBHits(HitCategory category) const; // not-null, not valid, strip TIB
293  int numberOfLostStripTIDHits(HitCategory category) const; // not-null, not valid, strip TID
294  int numberOfLostStripTOBHits(HitCategory category) const; // not-null, not valid, strip TOB
295  int numberOfLostStripTECHits(HitCategory category) const; // not-null, not valid, strip TEC
296 
297  int numberOfTimingHits() const; // not-null timing
298  int numberOfValidTimingHits() const; // not-null, valid, timing
299  int numberOfValidTimingBTLHits() const; // not-null, valid, timing BTL
300  int numberOfValidTimingETLHits() const; // not-null, valid, timing ETL
301 
302  int numberOfLostTimingHits() const; // not-null, not valid, timing
303  int numberOfLostTimingBTLHits() const; // not-null, not valid, timing BTL
304  int numberOfLostTimingETLHits() const; // not-null, not valid, timing ETL
305 
306  int numberOfMuonHits() const; // not-null, muon
307  int numberOfValidMuonHits() const; // not-null, valid, muon
308  int numberOfValidMuonDTHits() const; // not-null, valid, muon DT
309  int numberOfValidMuonCSCHits() const; // not-null, valid, muon CSC
310  int numberOfValidMuonRPCHits() const; // not-null, valid, muon RPC
311  int numberOfValidMuonGEMHits() const; // not-null, valid, muon GEM
312  int numberOfValidMuonME0Hits() const; // not-null, valid, muon ME0
313 
314  int numberOfLostMuonHits() const; // not-null, not valid, muon
315  int numberOfLostMuonDTHits() const; // not-null, not valid, muon DT
316  int numberOfLostMuonCSCHits() const; // not-null, not valid, muon CSC
317  int numberOfLostMuonRPCHits() const; // not-null, not valid, muon RPC
318  int numberOfLostMuonGEMHits() const; // not-null, not valid, muon GEM
319  int numberOfLostMuonME0Hits() const; // not-null, not valid, muon ME0
320 
321  int numberOfBadHits() const; // not-null, bad (only used in Muon Ch.)
322  int numberOfBadMuonHits() const; // not-null, bad, muon
323  int numberOfBadMuonDTHits() const; // not-null, bad, muon DT
324  int numberOfBadMuonCSCHits() const; // not-null, bad, muon CSC
325  int numberOfBadMuonRPCHits() const; // not-null, bad, muon RPC
326  int numberOfBadMuonGEMHits() const; // not-null, bad, muon GEM
327  int numberOfBadMuonME0Hits() const; // not-null, bad, muon ME0
328 
329  int numberOfInactiveHits() const; // not-null, inactive
330  int numberOfInactiveTrackerHits() const; // not-null, inactive, tracker
331  int numberOfInactiveTimingHits() const; // not-null, inactive, timing
332 
333  // count strip layers that have non-null, valid mono and stereo hits
334  int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const;
336  int numberOfValidTOBLayersWithMonoAndStereo(uint32_t layer = 0) const;
337  int numberOfValidTIBLayersWithMonoAndStereo(uint32_t layer = 0) const;
338  int numberOfValidTIDLayersWithMonoAndStereo(uint32_t layer = 0) const;
339  int numberOfValidTECLayersWithMonoAndStereo(uint32_t layer = 0) const;
340 
341  uint32_t getTrackerLayerCase(HitCategory category, uint16_t substr, uint16_t layer) const;
342  uint16_t getTrackerMonoStereo(HitCategory category, uint16_t substr, uint16_t layer) const;
343 
344  int trackerLayersWithMeasurementOld() const; // case 0: tracker
345  int trackerLayersWithMeasurement() const; // case 0: tracker
346  int pixelLayersWithMeasurementOld() const; // case 0: pixel
347  int pixelLayersWithMeasurement() const; // case 0: pixel
348  int stripLayersWithMeasurement() const; // case 0: strip
349  int pixelBarrelLayersWithMeasurement() const; // case 0: pixel PXB
350  int pixelEndcapLayersWithMeasurement() const; // case 0: pixel PXF
351  int stripTIBLayersWithMeasurement() const; // case 0: strip TIB
352  int stripTIDLayersWithMeasurement() const; // case 0: strip TID
353  int stripTOBLayersWithMeasurement() const; // case 0: strip TOB
354  int stripTECLayersWithMeasurement() const; // case 0: strip TEC
355 
356  int trackerLayersWithoutMeasurement(HitCategory category) const; // case 1: tracker
357  int trackerLayersWithoutMeasurementOld(HitCategory category) const; // case 1: tracker
358  int pixelLayersWithoutMeasurement(HitCategory category) const; // case 1: pixel
359  int stripLayersWithoutMeasurement(HitCategory category) const; // case 1: strip
360  int pixelBarrelLayersWithoutMeasurement(HitCategory category) const; // case 1: pixel PXB
361  int pixelEndcapLayersWithoutMeasurement(HitCategory category) const; // case 1: pixel PXF
362  int stripTIBLayersWithoutMeasurement(HitCategory category) const; // case 1: strip TIB
363  int stripTIDLayersWithoutMeasurement(HitCategory category) const; // case 1: strip TID
364  int stripTOBLayersWithoutMeasurement(HitCategory category) const; // case 1: strip TOB
365  int stripTECLayersWithoutMeasurement(HitCategory category) const; // case 1: strip TEC
366 
367  int trackerLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: tracker
368  int pixelLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: pixel
369  int stripLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: strip
370  int pixelBarrelLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: pixel PXB
371  int pixelEndcapLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: pixel PXF
372  int stripTIBLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: strip TIB
373  int stripTIDLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: strip TID
374  int stripTOBLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: strip TOB
375  int stripTECLayersTotallyOffOrBad(HitCategory category = TRACK_HITS) const; // case 2: strip TEC
376 
377  int trackerLayersNull() const; // case NULL_RETURN: tracker
378  int pixelLayersNull() const; // case NULL_RETURN: pixel
379  int stripLayersNull() const; // case NULL_RETURN: strip
380  int pixelBarrelLayersNull() const; // case NULL_RETURN: pixel PXB
381  int pixelEndcapLayersNull() const; // case NULL_RETURN: pixel PXF
382  int stripTIBLayersNull() const; // case NULL_RETURN: strip TIB
383  int stripTIDLayersNull() const; // case NULL_RETURN: strip TID
384  int stripTOBLayersNull() const; // case NULL_RETURN: strip TOB
385  int stripTECLayersNull() const; // case NULL_RETURN: strip TEC
386 
388  int muonStations(int subdet, int hitType) const;
389 
390  int muonStationsWithValidHits() const;
391  int muonStationsWithBadHits() const;
392  int muonStationsWithAnyHits() const;
393 
394  int dtStationsWithValidHits() const;
395  int dtStationsWithBadHits() const;
396  int dtStationsWithAnyHits() const;
397 
398  int cscStationsWithValidHits() const;
399  int cscStationsWithBadHits() const;
400  int cscStationsWithAnyHits() const;
401 
402  int rpcStationsWithValidHits() const;
403  int rpcStationsWithBadHits() const;
404  int rpcStationsWithAnyHits() const;
405 
406  int gemStationsWithValidHits() const;
407  int gemStationsWithBadHits() const;
408  int gemStationsWithAnyHits() const;
409 
410  int me0StationsWithValidHits() const;
411  int me0StationsWithBadHits() const;
412  int me0StationsWithAnyHits() const;
413 
415  int innermostMuonStationWithHits(int hitType) const;
419 
421  int outermostMuonStationWithHits(int hitType) const;
425 
426  int numberOfDTStationsWithRPhiView() const;
427  int numberOfDTStationsWithRZView() const;
429 
430  // fill Run3ScoutingHitPatternPOD struct
432 
433  //only used by ROOT IO rule to read v12 HitPatterns
434  static bool fillNewHitPatternWithOldHitPattern_v12(const uint16_t oldHitPattern[],
435  uint8_t hitCount,
436  uint8_t beginTrackHits,
437  uint8_t endTrackHits,
438  uint8_t beginInner,
439  uint8_t endInner,
440  uint8_t beginOuter,
441  uint8_t endOuter,
442  reco::HitPattern *newObj);
443 
444  private:
445  // 3 bits for hit type
446  const static unsigned short HitTypeOffset = 0;
447  const static unsigned short HitTypeMask = 0x3;
448 
449  // 1 bit to identify the side in double-sided detectors
450  const static unsigned short SideOffset = 2;
451  const static unsigned short SideMask = 0x1;
452 
453  // 4 bits to identify the layer/disk/wheel within the substructure
454  const static unsigned short LayerOffset = 3;
455  const static unsigned short LayerMask = 0xF;
456 
457  // 3 bits to identify the tracker/muon detector substructure
458  const static unsigned short SubstrOffset = 7;
459  const static unsigned short SubstrMask = 0x7;
460 
461  // 2 bits to distinguish tracker, muon, mtd subsystems
462  const static unsigned short SubDetectorOffset = 10;
463  const static unsigned short SubDetectorMask = 0x3;
464 
465  const static unsigned short minTrackerWord = 1 << SubDetectorOffset;
466  const static unsigned short maxTrackerWord = (2 << SubDetectorOffset) - 1;
467  const static unsigned short minPixelWord = minTrackerWord | (1 << SubstrOffset);
468  const static unsigned short minStripWord = minTrackerWord | (3 << SubstrOffset);
469 
470  // detector side for tracker modules (mono/stereo)
471  static uint16_t isStereo(DetId i, const TrackerTopology &ttopo);
472  static bool stripSubdetectorHitFilter(uint16_t pattern, StripSubdetector::SubDetector substructure);
473 
474  static uint16_t encode(const TrackingRecHit &hit, const TrackerTopology &ttopo);
475  static uint16_t encode(const DetId &id, TrackingRecHit::Type hitType, const TrackerTopology &ttopo);
476  static uint16_t encode(uint16_t det, uint16_t subdet, uint16_t layer, uint16_t side, TrackingRecHit::Type hitType);
477 
478  // generic count methods
479  typedef bool filterType(uint16_t);
480 
481  template <typename F>
482  void call(HitCategory category, filterType typeFilter, F f) const;
483 
486 
487  bool insertTrackHit(const uint16_t pattern);
488  bool insertExpectedInnerHit(const uint16_t pattern);
489  bool insertExpectedOuterHit(const uint16_t pattern);
490  void insertHit(const uint16_t pattern);
491 
492  uint16_t getHitPatternByAbsoluteIndex(int position) const;
493 
494  std::pair<uint8_t, uint8_t> getCategoryIndexRange(HitCategory category) const;
495 
497  uint8_t hitCount;
498 
499  uint8_t beginTrackHits;
500  uint8_t endTrackHits;
501  uint8_t beginInner;
502  uint8_t endInner;
503  uint8_t beginOuter;
504  uint8_t endOuter;
505 
507 
508  template <int N>
509  friend struct PatternSet;
510  };
511 
512  inline std::pair<uint8_t, uint8_t> HitPattern::getCategoryIndexRange(HitCategory category) const {
513  switch (category) {
514  case TRACK_HITS:
515  return std::pair<uint8_t, uint8_t>(beginTrackHits, endTrackHits);
516  break;
517  case MISSING_INNER_HITS:
518  return std::pair<uint8_t, uint8_t>(beginInner, endInner);
519  break;
520  case MISSING_OUTER_HITS:
521  return std::pair<uint8_t, uint8_t>(beginOuter, endOuter);
522  break;
523  }
524  return std::pair<uint8_t, uint8_t>(-1, -1);
525  }
526 
527  template <typename I>
528  bool HitPattern::appendHits(const I &begin, const I &end, const TrackerTopology &ttopo) {
529  for (I hit = begin; hit != end; hit++) {
530  if UNLIKELY ((!appendHit(*hit, ttopo))) {
531  return false;
532  }
533  }
534  return true;
535  }
536 
538  std::pair<uint8_t, uint8_t> range = getCategoryIndexRange(category);
539  if UNLIKELY ((position < 0 || (position + range.first) >= range.second)) {
541  }
542 
544  }
545 
547  int count = 0;
548  std::pair<uint8_t, uint8_t> range = getCategoryIndexRange(category);
549  for (int i = range.first; i < range.second; ++i) {
551  ++count;
552  }
553  }
554  return count;
555  }
556 
557  template <typename F>
558  void HitPattern::call(HitCategory category, filterType typeFilter, F f) const {
559  std::pair<uint8_t, uint8_t> range = getCategoryIndexRange(category);
560  for (int i = range.first; i < range.second; i++) {
562  // f() return false to ask to stop looping
563  if (typeFilter(pattern) && !f(pattern)) {
564  break;
565  }
566  }
567  }
568 
570  int count = 0;
571  std::pair<uint8_t, uint8_t> range = getCategoryIndexRange(category);
572  for (int i = range.first; i < range.second; ++i) {
574  if (typeFilter(pattern) && filter(pattern)) {
575  ++count;
576  }
577  }
578  return count;
579  }
580 
581  inline bool HitPattern::pixelHitFilter(uint16_t pattern) {
583  return false;
584  }
585 
586  uint32_t substructure = getSubStructure(pattern);
587  return (substructure == PixelSubdetector::PixelBarrel || substructure == PixelSubdetector::PixelEndcap);
588  }
589 
592  return false;
593  }
594 
595  uint32_t substructure = getSubStructure(pattern);
596  return (substructure == PixelSubdetector::PixelBarrel);
597  }
598 
601  return false;
602  }
603 
604  uint32_t substructure = getSubStructure(pattern);
605  return (substructure == PixelSubdetector::PixelEndcap);
606  }
607 
608  inline bool HitPattern::stripHitFilter(uint16_t pattern) {
610  }
611 
614  return false;
615  }
616 
617  return substructure == getSubStructure(pattern);
618  }
619 
620  inline bool HitPattern::stripTIBHitFilter(uint16_t pattern) {
622  }
623 
624  inline bool HitPattern::stripTIDHitFilter(uint16_t pattern) {
626  }
627 
628  inline bool HitPattern::stripTOBHitFilter(uint16_t pattern) {
630  }
631 
632  inline bool HitPattern::stripTECHitFilter(uint16_t pattern) {
634  }
635 
636  inline bool HitPattern::muonDTHitFilter(uint16_t pattern) {
638  return false;
639  }
640 
641  uint32_t substructure = getSubStructure(pattern);
642  return (substructure == (uint32_t)MuonSubdetId::DT);
643  }
644 
645  inline bool HitPattern::muonCSCHitFilter(uint16_t pattern) {
647  return false;
648  }
649 
650  uint32_t substructure = getSubStructure(pattern);
651  return (substructure == (uint32_t)MuonSubdetId::CSC);
652  }
653 
654  inline bool HitPattern::muonRPCHitFilter(uint16_t pattern) {
656  return false;
657  }
658 
659  uint32_t substructure = getSubStructure(pattern);
660  return (substructure == (uint32_t)MuonSubdetId::RPC);
661  }
662 
663  inline bool HitPattern::muonGEMHitFilter(uint16_t pattern) {
665  return false;
666  }
667 
668  uint32_t substructure = getSubStructure(pattern);
669  return (substructure == (uint32_t)MuonSubdetId::GEM);
670  }
671 
672  inline bool HitPattern::muonME0HitFilter(uint16_t pattern) {
674  return false;
675  uint16_t substructure = getSubStructure(pattern);
676  return (substructure == (uint16_t)MuonSubdetId::ME0);
677  }
678 
679  inline bool HitPattern::trackerHitFilter(uint16_t pattern) {
681  }
682 
683  inline bool HitPattern::muonHitFilter(uint16_t pattern) {
685  return false;
686  }
687 
688  return (((pattern >> SubDetectorOffset) & SubDetectorMask) == 0);
689  }
690 
691  inline bool HitPattern::timingBTLHitFilter(uint16_t pattern) {
693  return false;
694  uint16_t substructure = getSubStructure(pattern);
695  return (substructure == (uint16_t)MTDDetId::BTL);
696  }
697 
698  inline bool HitPattern::timingETLHitFilter(uint16_t pattern) {
700  return false;
701  uint16_t substructure = getSubStructure(pattern);
702  return (substructure == (uint16_t)MTDDetId::ETL);
703  }
704 
705  inline bool HitPattern::timingHitFilter(uint16_t pattern) {
707  return false;
708  }
709 
710  return (((pattern >> SubDetectorOffset) & SubDetectorMask) == 2);
711  }
712 
713  inline uint32_t HitPattern::getSubStructure(uint16_t pattern) {
715  return NULL_RETURN;
716  }
717 
718  return ((pattern >> SubstrOffset) & SubstrMask);
719  }
720 
722 
723  inline uint32_t HitPattern::getSubSubStructure(uint16_t pattern) {
725  return NULL_RETURN;
726  }
727 
728  return ((pattern >> LayerOffset) & LayerMask);
729  }
730 
731  inline uint32_t HitPattern::getSubDetector(uint16_t pattern) {
733  return NULL_RETURN;
734  }
735 
736  return ((pattern >> SubDetectorOffset) & SubDetectorMask);
737  }
738 
739  inline uint32_t HitPattern::getSide(uint16_t pattern) {
741  return NULL_RETURN;
742  }
743 
744  return (pattern >> SideOffset) & SideMask;
745  }
746 
747  inline uint32_t HitPattern::getHitType(uint16_t pattern) {
749  return NULL_RETURN;
750  }
751 
752  return ((pattern >> HitTypeOffset) & HitTypeMask);
753  }
754 
755  inline uint16_t HitPattern::getMuonStation(uint16_t pattern) {
757  }
758 
759  inline uint16_t HitPattern::getDTSuperLayer(uint16_t pattern) { return (getSubSubStructure(pattern) & 3); }
760 
761  inline uint16_t HitPattern::getCSCRing(uint16_t pattern) { return (getSubSubStructure(pattern) & 3) + 1; }
762 
763  inline uint16_t HitPattern::getRPCLayer(uint16_t pattern) {
764  uint16_t subSubStructure = getSubSubStructure(pattern);
765  uint16_t stat = subSubStructure >> 2;
766 
767  if LIKELY (stat <= 1) {
768  return ((subSubStructure >> 1) & 1) + 1;
769  }
770 
771  return 0;
772  }
773 
774  inline uint16_t HitPattern::getRPCregion(uint16_t pattern) { return getSubSubStructure(pattern) & 1; }
775 
777  inline uint16_t HitPattern::getGEMStation(uint16_t pattern) {
778  uint16_t sss = getSubSubStructure(pattern);
779  if (sss & 0b1000)
780  return 0;
781  return (sss >> 2) + 1;
782  }
783 
785  inline uint16_t HitPattern::getBTLModType(uint16_t pattern) { return getSubSubStructure(pattern); }
786 
787  inline uint16_t HitPattern::getETLRing(uint16_t pattern) { return getSubSubStructure(pattern); }
788 
789  inline uint16_t HitPattern::getGEMLayer(uint16_t pattern) {
790  uint16_t sss = getSubSubStructure(pattern);
791  if (sss & 0b1000)
792  return (sss & 0b0111) + 1;
793  return (sss & 0b11) + 1;
794  }
795 
797 
799 
801 
802  inline bool HitPattern::badHitFilter(uint16_t pattern) { return getHitType(pattern) == HitPattern::BAD; }
803 
805  std::pair<uint8_t, uint8_t> range = getCategoryIndexRange(category);
806  return range.second - range.first;
807  }
808 
811  }
812 
814 
816 
818 
821  }
822 
825  }
826 
829  }
830 
833  }
834 
837  }
838 
841  }
842 
845  }
846 
849  }
850 
853  }
854 
857  }
858 
861  }
862 
865  }
866 
869  }
870 
873  }
874 
877  }
878 
881  }
882 
885  }
886 
889  }
890 
892 
895  }
896 
897  inline int HitPattern::numberOfLostMuonHits() const {
899  }
900 
903  }
904 
907  }
908 
911  }
912 
915  }
916 
919  }
920 
923  }
924 
927  }
928 
931  }
932 
935  }
936 
939  }
940 
943  }
944 
947  }
948 
951  }
952 
955  }
956 
959  }
960 
963  }
964 
966 
967  inline int HitPattern::numberOfBadMuonHits() const {
969  }
970 
973  }
974 
977  }
978 
981  }
982 
985  }
986 
989  }
990 
992 
995  }
996 
999  }
1000 
1003  }
1004 
1008  }
1009 
1012  }
1013 
1016  }
1017 
1021  }
1022 
1025  }
1026 
1029  }
1030 
1034  }
1035 
1037 
1039 
1040  inline int HitPattern::stripLayersNull() const {
1042  }
1043 
1044  inline int HitPattern::muonStationsWithValidHits() const { return muonStations(0, 0); }
1045 
1046  inline int HitPattern::muonStationsWithBadHits() const { return muonStations(0, 3); }
1047 
1048  inline int HitPattern::muonStationsWithAnyHits() const { return muonStations(0, -1); }
1049 
1050  inline int HitPattern::dtStationsWithValidHits() const { return muonStations(1, 0); }
1051 
1052  inline int HitPattern::dtStationsWithBadHits() const { return muonStations(1, 3); }
1053 
1054  inline int HitPattern::dtStationsWithAnyHits() const { return muonStations(1, -1); }
1055 
1056  inline int HitPattern::cscStationsWithValidHits() const { return muonStations(2, 0); }
1057 
1058  inline int HitPattern::cscStationsWithBadHits() const { return muonStations(2, 3); }
1059 
1060  inline int HitPattern::cscStationsWithAnyHits() const { return muonStations(2, -1); }
1061 
1062  inline int HitPattern::rpcStationsWithValidHits() const { return muonStations(3, 0); }
1063 
1064  inline int HitPattern::rpcStationsWithBadHits() const { return muonStations(3, 3); }
1065 
1066  inline int HitPattern::rpcStationsWithAnyHits() const { return muonStations(3, -1); }
1067 
1068  inline int HitPattern::gemStationsWithValidHits() const { return muonStations(4, 0); }
1069 
1070  inline int HitPattern::gemStationsWithBadHits() const { return muonStations(4, 3); }
1071 
1072  inline int HitPattern::gemStationsWithAnyHits() const { return muonStations(4, -1); }
1073 
1074  inline int HitPattern::me0StationsWithValidHits() const { return muonStations(5, 0); }
1075 
1076  inline int HitPattern::me0StationsWithBadHits() const { return muonStations(5, 3); }
1077 
1078  inline int HitPattern::me0StationsWithAnyHits() const { return muonStations(5, -1); }
1079 
1081 
1083 
1085 
1087 
1089 
1091 
1092  template <int N = HitPattern::MaxHits>
1093  struct PatternSet {
1094  static constexpr int MaxHits = N;
1095  unsigned char hit[N];
1096  unsigned char nhit;
1097 
1098  unsigned char const *begin() const { return hit; }
1099 
1100  unsigned char const *end() const { return hit + nhit; }
1101 
1102  unsigned char *begin() { return hit; }
1103 
1104  unsigned char *end() { return hit + nhit; }
1105 
1106  int size() const { return nhit; }
1107 
1108  unsigned char operator[](int i) const { return hit[i]; }
1109 
1110  PatternSet() : nhit(0) {}
1111 
1113 
1115  int lhit = 0;
1116  auto unpack = [&lhit, this](uint16_t pattern) -> bool {
1117  unsigned char p = 255 & (pattern >> 3);
1118  hit[lhit++] = p;
1119 
1120  // bouble sort
1121  if (lhit > 1) {
1122  for (auto h = hit + lhit - 1; h != hit; --h) {
1123  if ((*(h - 1)) <= p) {
1124  break;
1125  }
1126  (*h) = *(h - 1);
1127  *(h - 1) = p;
1128  }
1129  }
1130  return lhit < MaxHits;
1131  };
1132 
1134  nhit = lhit;
1135  }
1136  };
1137 
1138  template <int N>
1140  PatternSet<N> comm;
1141  comm.nhit = std::set_intersection(p1.begin(), p1.end(), p2.begin(), p2.end(), comm.begin()) - comm.begin();
1142  return comm;
1143  }
1144 
1145 } // namespace reco
1146 
1147 #endif
int numberOfLostTrackerHits(HitCategory category) const
Definition: HitPattern.h:893
int numberOfValidPixelHits() const
Definition: HitPattern.h:831
std::pair< uint8_t, uint8_t > getCategoryIndexRange(HitCategory category) const
Definition: HitPattern.h:512
static uint16_t getCSCRing(uint16_t pattern)
CSC ring (1-4). Only valid for muon CSC patterns, of course.
Definition: HitPattern.h:761
static constexpr auto TEC
int stripLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.h:1031
static bool stripTECHitFilter(uint16_t pattern)
Definition: HitPattern.h:632
int countHits(HitCategory category, filterType filter) const
Definition: HitPattern.h:546
static uint32_t getLayer(uint16_t pattern)
Definition: HitPattern.h:721
void insertHit(const uint16_t pattern)
Definition: HitPattern.cc:977
int numberOfValidStripLayersWithMonoAndStereo() const
Definition: HitPattern.cc:414
int numberOfValidMuonME0Hits() const
Definition: HitPattern.h:879
int innermostMuonStationWithAnyHits() const
Definition: HitPattern.h:1084
int pixelEndcapLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:649
int numberOfValidMuonRPCHits() const
Definition: HitPattern.h:871
static const unsigned short HIT_LENGTH
Definition: HitPattern.h:158
int numberOfLostHits(HitCategory category) const
Definition: HitPattern.h:891
int numberOfLostTimingHits() const
Definition: HitPattern.h:901
int numberOfValidHits() const
Definition: HitPattern.h:817
static const unsigned short ARRAY_LENGTH
Definition: HitPattern.h:157
int stripTECLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:752
int size() const
Definition: HitPattern.h:1106
static const uint32_t NULL_RETURN
Definition: HitPattern.h:161
bool appendHits(const I &begin, const I &end, const TrackerTopology &ttopo)
Definition: HitPattern.h:528
int outermostMuonStationWithAnyHits() const
Definition: HitPattern.h:1090
static constexpr int GEM
Definition: MuonSubdetId.h:14
int rpcStationsWithValidHits() const
Definition: HitPattern.h:1062
static bool timingHitFilter(uint16_t pattern)
Definition: HitPattern.h:705
int me0StationsWithBadHits() const
Definition: HitPattern.h:1076
static bool pixelHitFilter(uint16_t pattern)
Definition: HitPattern.h:581
unsigned char const * begin() const
Definition: HitPattern.h:1098
int numberOfValidTECLayersWithMonoAndStereo(uint32_t layer=0) const
Definition: HitPattern.cc:447
int muonStationsWithBadHits() const
Definition: HitPattern.h:1046
PatternSet< N > commonHits(PatternSet< N > const &p1, PatternSet< N > const &p2)
Definition: HitPattern.h:1139
std::pair< unsigned int, unsigned int > unpack(cond::Time_t since)
int countTypedHits(HitCategory category, filterType typeFilter, filterType filter) const
Definition: HitPattern.h:569
int pixelLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.h:1027
int trackerLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.h:1023
static uint16_t isStereo(DetId i, const TrackerTopology &ttopo)
Definition: HitPattern.cc:877
int pixelLayersWithMeasurementOld() const
Definition: HitPattern.h:1001
static bool timingBTLHitFilter(uint16_t pattern)
Definition: HitPattern.h:691
static bool badHitFilter(uint16_t pattern)
Definition: HitPattern.h:802
static const unsigned short SideOffset
Definition: HitPattern.h:450
int gemStationsWithValidHits() const
Definition: HitPattern.h:1068
static const uint16_t EMPTY_PATTERN
Definition: HitPattern.h:162
static uint16_t getDTSuperLayer(uint16_t pattern)
DT superlayer (1-3). Where the "hit" was a DT segment, superlayer is 0. Only valid for muon DT patter...
Definition: HitPattern.h:759
int numberOfInactiveTrackerHits() const
Definition: HitPattern.h:993
int dtStationsWithAnyHits() const
Definition: HitPattern.h:1054
int numberOfLostMuonCSCHits() const
Definition: HitPattern.h:949
uint16_t getHitPatternByAbsoluteIndex(int position) const
Definition: HitPattern.cc:315
static bool muonME0HitFilter(uint16_t pattern)
Definition: HitPattern.h:672
static const unsigned short SubstrOffset
Definition: HitPattern.h:458
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:534
int numberOfAllHits(HitCategory category) const
Definition: HitPattern.h:804
int numberOfValidMuonDTHits() const
Definition: HitPattern.h:863
int rpcStationsWithAnyHits() const
Definition: HitPattern.h:1066
int me0StationsWithAnyHits() const
Definition: HitPattern.h:1078
int trackerLayersWithMeasurementOld() const
Definition: HitPattern.h:997
int numberOfLostMuonGEMHits() const
Definition: HitPattern.h:957
int stripLayersWithMeasurement() const
Definition: HitPattern.h:1005
static uint16_t getETLRing(uint16_t pattern)
ETL Ring: 1-12. Only valid for ETL patterns of course.
Definition: HitPattern.h:787
HitPattern & operator=(const HitPattern &other)
Definition: HitPattern.cc:50
unsigned char nhit
Definition: HitPattern.h:1096
int numberOfLostMuonDTHits() const
Definition: HitPattern.h:945
int numberOfValidStripTIBHits() const
Definition: HitPattern.h:847
static const unsigned short MaxHits
Definition: HitPattern.h:159
int stripTOBLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:742
int numberOfValidTimingETLHits() const
Definition: HitPattern.h:887
#define LIKELY(x)
Definition: Likely.h:20
int stripTIDLayersWithMeasurement() const
Definition: HitPattern.cc:608
int pixelEndcapLayersWithMeasurement() const
Definition: HitPattern.cc:587
int numberOfValidStripTECHits() const
Definition: HitPattern.h:859
int numberOfLostPixelBarrelHits(HitCategory category) const
Definition: HitPattern.h:917
static const unsigned short maxTrackerWord
Definition: HitPattern.h:466
unsigned char const * end() const
Definition: HitPattern.h:1100
int innermostMuonStationWithHits(int hitType) const
hitType=-1(all), 0=valid, 3=bad; 0 = no stations at all
Definition: HitPattern.cc:912
int stripTIBLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:660
int pixelEndcapLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:711
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
bool filterType(uint16_t)
Definition: HitPattern.h:479
static bool missingHitFilter(uint16_t pattern)
Definition: HitPattern.h:798
int numberOfAllTrackerHits(HitCategory category) const
Definition: HitPattern.h:809
static uint16_t getBTLModType(uint16_t pattern)
BTL Module type: 1,2,3. Only valid for BTL patterns of course.
Definition: HitPattern.h:785
int muonStationsWithAnyHits() const
Definition: HitPattern.h:1048
int stripLayersNull() const
Definition: HitPattern.h:1040
int numberOfLostMuonME0Hits() const
Definition: HitPattern.h:961
static const unsigned short HitTypeMask
Definition: HitPattern.h:447
static bool pixelBarrelHitFilter(uint16_t pattern)
Definition: HitPattern.h:590
int numberOfDTStationsWithBothViews() const
Definition: HitPattern.cc:964
int stripTECLayersWithMeasurement() const
Definition: HitPattern.cc:628
int gemStationsWithBadHits() const
Definition: HitPattern.h:1070
bool insertExpectedOuterHit(const uint16_t pattern)
Definition: HitPattern.cc:1018
constexpr std::array< uint8_t, layerIndexSize > layer
static bool pixelEndcapHitFilter(uint16_t pattern)
Definition: HitPattern.h:599
int numberOfLostStripHits(HitCategory category) const
Definition: HitPattern.h:925
int numberOfValidStripHits() const
Definition: HitPattern.h:843
int stripTIBLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:722
int stripTIBLayersNull() const
Definition: HitPattern.cc:784
Run3ScoutingHitPatternPOD run3ScoutingHitPatternPOD() const
Definition: HitPattern.cc:1030
static bool validHitFilter(uint16_t pattern)
Definition: HitPattern.h:796
int numberOfBadMuonHits() const
Definition: HitPattern.h:967
int numberOfLostStripTECHits(HitCategory category) const
Definition: HitPattern.h:941
uint8_t endInner
Definition: HitPattern.h:502
int numberOfValidTimingHits() const
Definition: HitPattern.h:827
int cscStationsWithValidHits() const
Definition: HitPattern.h:1056
int cscStationsWithBadHits() const
Definition: HitPattern.h:1058
int outermostMuonStationWithHits(int hitType) const
hitType=-1(all), 0=valid, 3=bad; 0 = no stations at all
Definition: HitPattern.cc:927
int numberOfDTStationsWithRPhiView() const
Definition: HitPattern.cc:941
unsigned char * begin()
Definition: HitPattern.h:1102
int dtStationsWithValidHits() const
Definition: HitPattern.h:1050
int numberOfMuonHits() const
Definition: HitPattern.h:813
int numberOfBadMuonCSCHits() const
Definition: HitPattern.h:975
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:789
int me0StationsWithValidHits() const
Definition: HitPattern.h:1074
static constexpr int MaxHits
Definition: HitPattern.h:1094
static const unsigned short minTrackerWord
Definition: HitPattern.h:465
int trackerLayersWithoutMeasurementOld(HitCategory category) const
Definition: HitPattern.h:1010
uint16_t hitPattern[ARRAY_LENGTH]
Definition: HitPattern.h:496
static bool muonCSCHitFilter(uint16_t pattern)
Definition: HitPattern.h:645
static uint32_t getHitType(uint16_t pattern)
Definition: HitPattern.h:747
void call(HitCategory category, filterType typeFilter, F f) const
Definition: HitPattern.h:558
int numberOfLostMuonRPCHits() const
Definition: HitPattern.h:953
unsigned char operator[](int i) const
Definition: HitPattern.h:1108
int numberOfValidPixelEndcapHits() const
Definition: HitPattern.h:839
static const unsigned short SubDetectorMask
Definition: HitPattern.h:463
static bool stripHitFilter(uint16_t pattern)
Definition: HitPattern.h:608
int numberOfLostPixelEndcapHits(HitCategory category) const
Definition: HitPattern.h:921
uint16_t getTrackerMonoStereo(HitCategory category, uint16_t substr, uint16_t layer) const
Definition: HitPattern.cc:479
int numberOfDTStationsWithRZView() const
Definition: HitPattern.cc:953
int stripTOBLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:680
int pixelLayersNull() const
Definition: HitPattern.h:1038
int pixelEndcapLayersNull() const
Definition: HitPattern.cc:773
int numberOfValidTIBLayersWithMonoAndStereo(uint32_t layer=0) const
Definition: HitPattern.cc:439
int stripTOBLayersWithMeasurement() const
Definition: HitPattern.cc:618
bool appendHit(const TrackingRecHit &hit, const TrackerTopology &ttopo)
Definition: HitPattern.cc:223
int numberOfValidMuonGEMHits() const
Definition: HitPattern.h:875
int innermostMuonStationWithValidHits() const
Definition: HitPattern.h:1080
const std::complex< double > I
Definition: I.h:8
int numberOfValidStripTIDHits() const
Definition: HitPattern.h:851
double f[11][100]
int numberOfBadMuonDTHits() const
Definition: HitPattern.h:971
int numberOfValidTimingBTLHits() const
Definition: HitPattern.h:883
static constexpr int ME0
Definition: MuonSubdetId.h:15
int cscStationsWithAnyHits() const
Definition: HitPattern.h:1060
int stripTECLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:690
uint8_t beginInner
Definition: HitPattern.h:501
int stripTOBLayersNull() const
Definition: HitPattern.cc:804
static constexpr auto TOB
int numberOfLostStripTIDHits(HitCategory category) const
Definition: HitPattern.h:933
static const unsigned short HitTypeOffset
Definition: HitPattern.h:446
int muonStationsWithValidHits() const
Definition: HitPattern.h:1044
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:537
bool appendTrackerHit(uint16_t subdet, uint16_t layer, uint16_t stereo, TrackingRecHit::Type hitType)
Definition: HitPattern.cc:295
uint8_t beginTrackHits
Definition: HitPattern.h:499
int numberOfValidMuonHits() const
Definition: HitPattern.h:823
static uint32_t getSubStructure(uint16_t pattern)
Definition: HitPattern.h:713
unsigned char * end()
Definition: HitPattern.h:1104
static bool inactiveHitFilter(uint16_t pattern)
Definition: HitPattern.h:800
int numberOfLostStripTOBHits(HitCategory category) const
Definition: HitPattern.h:937
static const unsigned short minPixelWord
Definition: HitPattern.h:467
int trackerLayersNull() const
Definition: HitPattern.h:1036
int numberOfTimingHits() const
Definition: HitPattern.h:815
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:899
int numberOfBadMuonGEMHits() const
Definition: HitPattern.h:983
int stripTIDLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:732
int gemStationsWithAnyHits() const
Definition: HitPattern.h:1072
static uint16_t getRPCregion(uint16_t pattern)
RPC region: 0 = barrel, 1 = endcap. Only valid for muon RPC patterns, of course.
Definition: HitPattern.h:774
static uint32_t getSubDetector(uint16_t pattern)
Definition: HitPattern.h:731
int numberOfLostTimingETLHits() const
Definition: HitPattern.h:909
static bool muonGEMHitFilter(uint16_t pattern)
Definition: HitPattern.h:663
static uint16_t getGEMStation(uint16_t pattern)
GEM station: 1,2. Only valid for muon GEM patterns, of course.
Definition: HitPattern.h:777
Definition: DetId.h:17
int dtStationsWithBadHits() const
Definition: HitPattern.h:1052
static bool muonHitFilter(uint16_t pattern)
Definition: HitPattern.h:683
static bool trackerHitFilter(uint16_t pattern)
Definition: HitPattern.h:679
uint8_t endTrackHits
Definition: HitPattern.h:500
int trackerLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:553
static constexpr auto TIB
static const unsigned short SideMask
Definition: HitPattern.h:451
#define N
Definition: blowfish.cc:9
int pixelLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.h:1014
static const unsigned short minStripWord
Definition: HitPattern.h:468
uint8_t hitCount
Definition: HitPattern.h:497
int numberOfValidTIDLayersWithMonoAndStereo(uint32_t layer=0) const
Definition: HitPattern.cc:443
int numberOfValidMuonCSCHits() const
Definition: HitPattern.h:867
uint8_t beginOuter
Definition: HitPattern.h:503
static const unsigned short SubDetectorOffset
Definition: HitPattern.h:462
static constexpr int RPC
Definition: MuonSubdetId.h:13
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)
void printHitPattern(HitCategory category, int position, std::ostream &stream) const
Definition: HitPattern.cc:824
int rpcStationsWithBadHits() const
Definition: HitPattern.h:1064
int stripLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.h:1018
int outermostMuonStationWithValidHits() const
Definition: HitPattern.h:1086
static bool stripTOBHitFilter(uint16_t pattern)
Definition: HitPattern.h:628
int stripTECLayersNull() const
Definition: HitPattern.cc:814
int numberOfBadHits() const
Definition: HitPattern.h:965
static uint32_t getSide(uint16_t pattern)
Definition: HitPattern.h:739
static bool muonDTHitFilter(uint16_t pattern)
Definition: HitPattern.h:636
bool insertExpectedInnerHit(const uint16_t pattern)
Definition: HitPattern.cc:1006
int numberOfBadMuonRPCHits() const
Definition: HitPattern.h:979
int pixelBarrelLayersNull() const
Definition: HitPattern.cc:762
int numberOfLostPixelHits(HitCategory category) const
Definition: HitPattern.h:913
static bool stripTIBHitFilter(uint16_t pattern)
Definition: HitPattern.h:620
fixed size matrix
static const unsigned short SubstrMask
Definition: HitPattern.h:459
unsigned char hit[N]
Definition: HitPattern.h:1095
int numberOfBadMuonME0Hits() const
Definition: HitPattern.h:987
static const unsigned short LayerOffset
Definition: HitPattern.h:454
void fill(HitPattern::HitCategory category, HitPattern const &hp)
Definition: HitPattern.h:1114
static int position[264][3]
Definition: ReadPGInfo.cc:289
bool insertTrackHit(const uint16_t pattern)
Definition: HitPattern.cc:988
int numberOfValidPixelBarrelHits() const
Definition: HitPattern.h:835
int stripTIDLayersNull() const
Definition: HitPattern.cc:794
int pixelBarrelLayersWithMeasurement() const
Definition: HitPattern.cc:576
int stripTIDLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:670
int numberOfLostMuonHits() const
Definition: HitPattern.h:897
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:763
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:755
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:513
int innermostMuonStationWithBadHits() const
Definition: HitPattern.h:1082
static bool timingETLHitFilter(uint16_t pattern)
Definition: HitPattern.h:698
#define UNLIKELY(x)
Definition: Likely.h:21
static uint32_t getSubSubStructure(uint16_t pattern)
Definition: HitPattern.h:723
static constexpr int DT
Definition: MuonSubdetId.h:11
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:163
static const unsigned short LayerMask
Definition: HitPattern.h:455
static bool stripTIDHitFilter(uint16_t pattern)
Definition: HitPattern.h:624
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
int pixelBarrelLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
Definition: HitPattern.cc:700
static bool muonRPCHitFilter(uint16_t pattern)
Definition: HitPattern.h:654
int outermostMuonStationWithBadHits() const
Definition: HitPattern.h:1088
static constexpr int CSC
Definition: MuonSubdetId.h:12
static constexpr auto TID
int numberOfValidTrackerHits() const
Definition: HitPattern.h:819
PatternSet(HitPattern::HitCategory category, HitPattern const &hp)
Definition: HitPattern.h:1112
uint8_t endOuter
Definition: HitPattern.h:504
int numberOfInactiveTimingHits() const
static uint16_t encode(const TrackingRecHit &hit, const TrackerTopology &ttopo)
Definition: HitPattern.cc:87
static bool stripSubdetectorHitFilter(uint16_t pattern, StripSubdetector::SubDetector substructure)
Definition: HitPattern.h:612
int numberOfLostStripTIBHits(HitCategory category) const
Definition: HitPattern.h:929
int numberOfLostTimingBTLHits() const
Definition: HitPattern.h:905
uint32_t getTrackerLayerCase(HitCategory category, uint16_t substr, uint16_t layer) const
Definition: HitPattern.cc:451
int numberOfInactiveHits() const
Definition: HitPattern.h:991
bool hasValidHitInPixelLayer(enum PixelSubdetector::SubDetector, uint16_t layer) const
Definition: HitPattern.cc:358
int numberOfValidTOBLayersWithMonoAndStereo(uint32_t layer=0) const
Definition: HitPattern.cc:435
int pixelBarrelLayersWithoutMeasurement(HitCategory category) const
Definition: HitPattern.cc:638
int numberOfValidStripTOBHits() const
Definition: HitPattern.h:855
bool appendMuonHit(const DetId &id, TrackingRecHit::Type hitType)
Definition: HitPattern.cc:299
int stripTIBLayersWithMeasurement() const
Definition: HitPattern.cc:598
void print(HitCategory category, std::ostream &stream=std::cout) const
Definition: HitPattern.cc:861
std::vector< std::string > set_intersection(std::vector< std::string > const &v1, std::vector< std::string > const &v2)