20 : hitCount(0), beginTrackHits(0), endTrackHits(0), beginInner(0), endInner(0), beginOuter(0), endOuter(0) {
25 : hitCount(other.hitCount),
26 beginTrackHits(other.beginTrackHits),
27 endTrackHits(other.endTrackHits),
28 beginInner(other.beginInner),
29 endInner(other.endInner),
30 beginOuter(other.beginOuter),
31 endOuter(other.endOuter) {
79 uint16_t encodeMuonLayer(
const DetId&
id) {
80 uint16_t detid =
id.det();
81 uint16_t subdet =
id.subdetId();
87 layer = ((
DTLayerId(
id.rawId()).station() - 1) << 2);
88 layer |=
DTLayerId(
id.rawId()).superLayer();
91 layer = ((
CSCDetId(
id.rawId()).station() - 1) << 2);
92 layer |= (
CSCDetId(
id.rawId()).ring() - 1);
96 layer = ((rpcid.station() - 1) << 2);
97 layer |= (rpcid.station() <= 2) ? ((rpcid.layer() - 1) << 1) : 0x0;
98 layer |=
abs(rpcid.region());
103 uint16_t st = gemid.station();
104 uint16_t la = gemid.layer();
109 layer |= (st - 1) << 2;
119 layer = (me0id.roll());
125 uint16_t encodeTimingLayer(
const DetId&
id) {
126 uint16_t detid =
id.det();
127 uint16_t subdet =
id.subdetId();
128 uint16_t layer = 0x0;
131 switch (mtdid.mtdSubDetector()) {
139 throw cms::Exception(
"HitPattern") <<
"Invalid MTD Subdetector " << mtdid.mtdSubDetector() <<
"!";
142 throw cms::Exception(
"HitPattern") <<
"Invalid DetId for FastTime det= " << detid <<
" subdet= " << subdet <<
"!";
149 uint16_t detid =
id.det();
150 uint16_t subdet =
id.subdetId();
153 uint16_t layer = 0x0;
155 layer = ttopo.
layer(
id);
157 layer = encodeMuonLayer(
id);
159 layer = encodeTimingLayer(
id);
180 return encode(detid, subdet, layer, side, hitType);
242 <<
" were stored on this object before hits of some other category were inserted "
243 <<
"but hits of the same category should be inserted in a row. "
244 <<
"Please rework the code so it inserts all "
255 <<
" were stored on this object before hits of some other category were inserted "
256 <<
"but hits of the same category should be inserted in a row. "
257 <<
"Please rework the code so it inserts all "
258 <<
"MISSING_INNER_HITS"
268 <<
" were stored on this object before hits of some other category were inserted "
269 <<
"but hits of the same category should be inserted in a row. "
270 <<
"Please rework the code so it inserts all "
271 <<
"MISSING_OUTER_HITS"
294 <<
"Got DetId from det " <<
id.det()
295 <<
" that is not Muon in appendMuonHit(), which should only be used for muon hits in the HitPattern IO rule";
298 uint16_t subdet =
id.subdetId();
327 uint16_t bitEndOffset = (position + 1) *
HIT_LENGTH;
328 uint8_t secondWord = (bitEndOffset >> 4);
329 uint8_t secondWordBits = bitEndOffset & (16 - 1);
331 uint8_t lowBitsToTrash = secondWordBits -
HIT_LENGTH;
332 uint16_t myResult = (
hitPattern[secondWord] >> lowBitsToTrash) & ((1 << HIT_LENGTH) - 1);
335 uint8_t firstWordBits =
HIT_LENGTH - secondWordBits;
336 uint16_t firstWordBlock =
hitPattern[secondWord - 1] >> (16 - firstWordBits);
337 if (secondWordBits == 0)
338 return firstWordBlock;
339 uint16_t secondWordBlock =
hitPattern[secondWord] & ((1 << secondWordBits) - 1);
340 uint16_t myResult = firstWordBlock + (secondWordBlock << firstWordBits);
359 memset(hasMono, 0,
sizeof(hasMono));
360 memset(hasStereo, 0,
sizeof(hasStereo));
368 if (stripdet != 0 && subStructure != stripdet) {
378 hasMono[subStructure][
getLayer(pattern)] =
true;
381 hasStereo[subStructure][
getLayer(pattern)] =
true;
393 if (hasMono[
i][
j] && hasStereo[
i][
j]) {
403 std::bitset<128> side[2];
405 for (
int i = range.first;
i < range.second; ++
i) {
412 if (hitType != HIT_TYPE::VALID)
416 side[
getSide(pattern)].set(apattern);
419 return (side[0] & side[1]).count();
439 uint16_t tk_substr_layer =
450 for (
int i = range.first;
i < range.second; ++
i) {
452 if ((pattern & mask) == tk_substr_layer) {
454 if (hitType < layerCase) {
456 layerCase = (hitType ==
HIT_TYPE::BAD ? (uint32_t)HIT_TYPE::INACTIVE : hitType);
457 if (layerCase == HIT_TYPE::VALID) {
467 uint16_t tk_substr_layer =
475 uint16_t monoStereo = 0x0;
477 for (
int i = range.first;
i < range.second; ++
i) {
479 if ((pattern & mask) == tk_substr_layer) {
481 if (hitType == HIT_TYPE::VALID) {
502 std::bitset<128> layerOk;
504 for (
int i = range.first;
i < range.second; ++
i) {
511 if (hitType != HIT_TYPE::VALID)
515 layerOk.set(pattern);
518 return layerOk.count();
523 std::bitset<128> layerOk;
525 for (
int i = range.first;
i < range.second; ++
i) {
530 if (hitType != HIT_TYPE::VALID)
534 layerOk.set(pattern);
537 return layerOk.count();
541 std::bitset<128> layerOk;
542 std::bitset<128> layerMissed;
544 for (
int i = range.first;
i < range.second; ++
i) {
551 if (hitType == HIT_TYPE::VALID)
552 layerOk.set(pattern);
553 if (hitType == HIT_TYPE::MISSING)
554 layerMissed.set(pattern);
556 layerMissed &= ~layerOk;
560 return layerMissed.count();
565 uint16_t NPixBarrel = 4;
566 for (uint16_t layer = 1; layer <= NPixBarrel; layer++) {
576 uint16_t NPixForward = 3;
577 for (uint16_t layer = 1; layer <= NPixForward; layer++) {
587 for (uint16_t layer = 1; layer <= 4; layer++) {
597 for (uint16_t layer = 1; layer <= 3; layer++) {
607 for (uint16_t layer = 1; layer <= 6; layer++) {
617 for (uint16_t layer = 1; layer <= 9; layer++) {
627 uint16_t NPixBarrel = 4;
628 for (uint16_t layer = 1; layer <= NPixBarrel; layer++) {
638 uint16_t NPixForward = 3;
639 for (uint16_t layer = 1; layer <= NPixForward; layer++) {
649 for (uint16_t layer = 1; layer <= 4; layer++) {
659 for (uint16_t layer = 1; layer <= 3; layer++) {
669 for (uint16_t layer = 1; layer <= 6; layer++) {
679 for (uint16_t layer = 1; layer <= 9; layer++) {
689 uint16_t NPixBarrel = 4;
690 for (uint16_t layer = 1; layer <= NPixBarrel; layer++) {
700 uint16_t NPixForward = 3;
701 for (uint16_t layer = 1; layer <= NPixForward; layer++) {
711 for (uint16_t layer = 1; layer <= 4; layer++) {
721 for (uint16_t layer = 1; layer <= 3; layer++) {
731 for (uint16_t layer = 1; layer <= 6; layer++) {
741 for (uint16_t layer = 1; layer <= 9; layer++) {
751 uint16_t NPixBarrel = 4;
752 for (uint16_t layer = 1; layer <= NPixBarrel; layer++) {
762 uint16_t NPixForward = 3;
763 for (uint16_t layer = 1; layer <= NPixForward; layer++) {
773 for (uint16_t layer = 1; layer <= 4; layer++) {
783 for (uint16_t layer = 1; layer <= 3; layer++) {
793 for (uint16_t layer = 1; layer <= 6; layer++) {
803 for (uint16_t layer = 1; layer <= 9; layer++) {
828 stream <<
"\tcsc ring " <<
getCSCRing(pattern);
837 stream <<
"(UNKNOWN Muon SubStructure!) \tsubsubstructure " <<
getSubStructure(pattern);
842 stream <<
"\tlayer " <<
getLayer(pattern);
844 stream <<
"\thit type " <<
getHitType(pattern);
849 stream <<
"HitPattern" << std::endl;
853 std::ios_base::fmtflags flags = stream.flags();
854 stream.setf(std::ios_base::hex, std::ios_base::basefield);
855 stream.setf(std::ios_base::showbase);
891 (hitType == -1 ||
int(
getHitType(pattern)) == hitType)) {
896 return stations[0] + stations[1] + stations[2] + stations[3] + stations[4];
905 if (ret == 0 || stat < ret) {
920 if (ret == 0 || stat > ret) {
937 return stations[0] + stations[1] + stations[2] + stations[3];
948 return stations[0] + stations[1] + stations[2] + stations[3];
952 int stations[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
960 return stations[0][0] * stations[0][1] + stations[1][0] * stations[1][1] + stations[2][0] * stations[2][1] +
961 stations[3][0] * stations[3][1];
967 int pos = offset +
i;
968 uint16_t bit = (pattern >>
i) & 0x1;
970 hitPattern[pos >> 4] += bit << ((offset +
i) & (16 - 1));
int stripTOBLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
int stripTOBLayersWithMeasurement() const
static uint16_t getCSCRing(uint16_t pattern)
CSC ring (1-4). Only valid for muon CSC patterns, of course.
static constexpr auto TEC
int pixelBarrelLayersWithoutMeasurement(HitCategory category) const
static uint32_t getLayer(uint16_t pattern)
void insertHit(const uint16_t pattern)
tuple ret
prodAgent to be discontinued
int outermostMuonStationWithHits(int hitType) const
hitType=-1(all), 0=valid, 3=bad; 0 = no stations at all
static const unsigned short HIT_LENGTH
static const unsigned short ARRAY_LENGTH
static const uint32_t NULL_RETURN
int pixelBarrelLayersNull() const
static bool timingHitFilter(uint16_t pattern)
static bool pixelHitFilter(uint16_t pattern)
int stripTIBLayersNull() const
int pixelBarrelLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
bool hasValidHitInPixelLayer(enum PixelSubdetector::SubDetector, uint16_t layer) const
static uint16_t isStereo(DetId i, const TrackerTopology &ttopo)
bool tobIsStereo(const DetId &id) const
int stripTIBLayersWithMeasurement() const
int stripTECLayersNull() const
static const unsigned short SideOffset
static const char category[]
static const uint16_t EMPTY_PATTERN
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
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...
static bool muonME0HitFilter(uint16_t pattern)
static const unsigned short SubstrOffset
int stripTOBLayersWithoutMeasurement(HitCategory category) const
int numberOfDTStationsWithRPhiView() const
HitPattern & operator=(const HitPattern &other)
uint16_t getTrackerMonoStereo(HitCategory category, uint16_t substr, uint16_t layer) const
static const unsigned short MaxHits
uint32_t getTrackerLayerCase(HitCategory category, uint16_t substr, uint16_t layer) const
static const unsigned short maxTrackerWord
int pixelLayersWithMeasurement() const
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream
int numberOfValidStripLayersWithMonoAndStereo() const
int pixelEndcapLayersWithoutMeasurement(HitCategory category) const
int trackerLayersWithMeasurement() const
static const unsigned short HitTypeMask
static bool pixelBarrelHitFilter(uint16_t pattern)
int pixelEndcapLayersWithMeasurement() const
Detector identifier base class for the MIP Timing Layer.
bool insertExpectedOuterHit(const uint16_t pattern)
bool tidIsStereo(const DetId &id) const
constexpr std::array< uint8_t, layerIndexSize > layer
static bool pixelEndcapHitFilter(uint16_t pattern)
const uint16_t range(const Frame &aFrame)
static bool validHitFilter(uint16_t pattern)
void printHitPattern(HitCategory category, int position, std::ostream &stream) const
bool tecIsStereo(const DetId &id) const
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.
static const unsigned short minTrackerWord
uint16_t hitPattern[ARRAY_LENGTH]
int stripTIBLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
static bool muonCSCHitFilter(uint16_t pattern)
static uint32_t getHitType(uint16_t pattern)
int numberOfValidTECLayersWithMonoAndStereo(uint32_t layer=0) const
int stripTIDLayersWithMeasurement() const
static const unsigned short SubDetectorMask
static bool stripHitFilter(uint16_t pattern)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
int numberOfAllHits(HitCategory category) const
Abs< T >::type abs(const T &t)
bool appendHit(const TrackingRecHit &hit, const TrackerTopology &ttopo)
int numberOfDTStationsWithRZView() const
static constexpr auto TOB
int stripTIDLayersNull() const
static const unsigned short HitTypeOffset
int numberOfValidTIDLayersWithMonoAndStereo(uint32_t layer=0) const
bool appendTrackerHit(uint16_t subdet, uint16_t layer, uint16_t stereo, TrackingRecHit::Type hitType)
static uint32_t getSubStructure(uint16_t pattern)
int numberOfDTStationsWithBothViews() const
int numberOfValidTIBLayersWithMonoAndStereo(uint32_t layer=0) const
static uint16_t getRPCregion(uint16_t pattern)
RPC region: 0 = barrel, 1 = endcap. Only valid for muon RPC patterns, of course.
static bool muonGEMHitFilter(uint16_t pattern)
static uint16_t getGEMStation(uint16_t pattern)
GEM station: 1,2. Only valid for muon GEM patterns, of course.
int stripTIDLayersWithoutMeasurement(HitCategory category) const
int innermostMuonStationWithHits(int hitType) const
hitType=-1(all), 0=valid, 3=bad; 0 = no stations at all
static bool muonHitFilter(uint16_t pattern)
static bool trackerHitFilter(uint16_t pattern)
static constexpr auto TIB
static const unsigned short SideMask
static const unsigned short minStripWord
std::pair< uint8_t, uint8_t > getCategoryIndexRange(HitCategory category) const
static const unsigned short SubDetectorOffset
bool tibIsStereo(const DetId &id) const
int pixelBarrelLayersWithMeasurement() const
unsigned int layer(const DetId &id) const
uint16_t getHitPatternByAbsoluteIndex(int position) const
static uint32_t getSide(uint16_t pattern)
int stripTOBLayersNull() const
static bool muonDTHitFilter(uint16_t pattern)
int stripTIDLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
int trackerLayersWithoutMeasurement(HitCategory category) const
bool insertExpectedInnerHit(const uint16_t pattern)
Detector identifier class for the Endcap Timing Layer.
static const unsigned short SubstrMask
static const unsigned short LayerOffset
static int position[264][3]
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
int pixelEndcapLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
bool insertTrackHit(const uint16_t pattern)
int stripTECLayersWithMeasurement() const
int stripTECLayersWithoutMeasurement(HitCategory category) const
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...
static uint16_t getMuonStation(uint16_t pattern)
Muon station (1-4). Only valid for muon patterns, of course. only for patterns from muon...
void print(HitCategory category, std::ostream &stream=std::cout) const
int numberOfValidTOBLayersWithMonoAndStereo(uint32_t layer=0) const
DetId geographicalId() const
static uint32_t getSubSubStructure(uint16_t pattern)
uint16_t getHitPattern(HitCategory category, int position) const
static const unsigned short LayerMask
static bool muonRPCHitFilter(uint16_t pattern)
static constexpr auto TID
static uint16_t encode(const TrackingRecHit &hit, const TrackerTopology &ttopo)
int stripTECLayersTotallyOffOrBad(HitCategory category=TRACK_HITS) const
int stripTIBLayersWithoutMeasurement(HitCategory category) const
bool appendMuonHit(const DetId &id, TrackingRecHit::Type hitType)
int pixelEndcapLayersNull() const
constexpr Detector det() const
get the detector field from this detid