35 hitCount(other.hitCount),
36 beginTrackHits(other.beginTrackHits),
37 endTrackHits(other.endTrackHits),
38 beginInner(other.beginInner),
39 endInner(other.endInner),
40 beginOuter(other.beginOuter),
41 endOuter(other.endOuter)
97 uint16_t encodeMuonLayer(
const DetId&
id) {
98 uint16_t detid =
id.det();
99 uint16_t subdet =
id.subdetId();
101 uint16_t layer = 0x0;
105 layer = ((
DTLayerId(
id.rawId()).station() - 1) << 2);
106 layer |=
DTLayerId(
id.rawId()).superLayer();
109 layer = ((
CSCDetId(
id.rawId()).station() - 1) << 2);
110 layer |= (
CSCDetId(
id.rawId()).ring() - 1);
115 layer = ((rpcid.station() - 1) << 2);
116 layer |= (rpcid.station() <= 2) ? ((rpcid.layer() - 1) << 1) : 0x0;
117 layer |=
abs(rpcid.region());
123 layer = ((gemid.station()-1)<<2);
124 layer |=
abs(gemid.layer()-1);
133 layer = (me0id.roll());
144 uint16_t detid =
id.det();
145 uint16_t subdet =
id.subdetId();
148 uint16_t layer = 0x0;
150 layer = ttopo.
layer(
id);
152 layer = encodeMuonLayer(
id);
163 return encode(detid, subdet, layer, side, hitType);
225 <<
" were stored on this object before hits of some other category were inserted "
226 <<
"but hits of the same category should be inserted in a row. "
227 <<
"Please rework the code so it inserts all "
237 <<
"MISSING_INNER_HITS"
238 <<
" were stored on this object before hits of some other category were inserted "
239 <<
"but hits of the same category should be inserted in a row. "
240 <<
"Please rework the code so it inserts all "
241 <<
"MISSING_INNER_HITS"
250 <<
"MISSING_OUTER_HITS"
251 <<
" were stored on this object before hits of some other category were inserted "
252 <<
"but hits of the same category should be inserted in a row. "
253 <<
"Please rework the code so it inserts all "
254 <<
"MISSING_OUTER_HITS"
276 throw cms::Exception(
"HitPattern") <<
"Got DetId from det " <<
id.det() <<
" that is not Muon in appendMuonHit(), which should only be used for muon hits in the HitPattern IO rule";
279 uint16_t detid =
id.det();
280 uint16_t subdet =
id.subdetId();
281 return appendHit(
encode(detid, subdet, encodeMuonLayer(
id), 0, hitType), hitType);
310 uint16_t bitEndOffset = (position + 1) *
HIT_LENGTH;
311 uint8_t secondWord = (bitEndOffset >> 4);
312 uint8_t secondWordBits = bitEndOffset & (16 - 1);
314 uint8_t lowBitsToTrash = secondWordBits -
HIT_LENGTH;
315 uint16_t myResult = (
hitPattern[secondWord] >> lowBitsToTrash) & ((1 << HIT_LENGTH) - 1);
318 uint8_t firstWordBits =
HIT_LENGTH - secondWordBits;
319 uint16_t firstWordBlock =
hitPattern[secondWord - 1] >> (16 - firstWordBits);
320 uint16_t secondWordBlock =
hitPattern[secondWord] & ((1 << secondWordBits) - 1);
321 uint16_t myResult = firstWordBlock + (secondWordBlock << firstWordBits);
354 memset(hasMono, 0,
sizeof(hasMono));
355 memset(hasStereo, 0,
sizeof(hasStereo));
363 if (stripdet != 0 && subStructure != stripdet) {
373 hasMono[subStructure][
getLayer(pattern)] =
true;
376 hasStereo[subStructure][
getLayer(pattern)] =
true;
389 if (hasMono[
i][
j] && hasStereo[
i][
j]) {
400 std::bitset<128> side[2];
402 for (
int i = range.first;
i < range.second; ++
i) {
406 if (hitType != HIT_TYPE::VALID)
continue;
412 return (side[0]&side[1]).count();
453 for (
int i = range.first;
i < range.second; ++
i) {
455 if ((pattern & mask) == tk_substr_layer) {
457 if (hitType < layerCase) {
459 layerCase = (hitType ==
HIT_TYPE::BAD ? HIT_TYPE::INACTIVE : hitType);
460 if (layerCase == HIT_TYPE::VALID) {
482 uint16_t monoStereo = 0x0;
484 for (
int i = range.first;
i < range.second; ++
i) {
486 if ((pattern & mask) == tk_substr_layer) {
488 if (hitType == HIT_TYPE::VALID) {
510 std::bitset<128> layerOk;
512 for (
int i = range.first;
i < range.second; ++
i) {
517 if (hitType != HIT_TYPE::VALID)
continue;
523 return layerOk.count();
529 std::bitset<128> layerOk;
531 for (
int i = range.first;
i < range.second; ++
i) {
535 if (hitType != HIT_TYPE::VALID)
continue;
541 return layerOk.count();
545 std::bitset<128> layerOk;
546 std::bitset<128> layerMissed;
548 for (
int i = range.first;
i < range.second; ++
i) {
554 if (hitType == HIT_TYPE::VALID) layerOk.set(
pattern);
555 if (hitType == HIT_TYPE::MISSING) layerMissed.set(
pattern);
557 layerMissed &= ~layerOk;
561 return layerMissed.count();
570 uint16_t NPixBarrel = 4;
571 for (uint16_t layer = 1; layer <= NPixBarrel; layer++) {
582 uint16_t NPixForward = 3;
583 for (uint16_t layer = 1; layer <= NPixForward; layer++) {
594 for (uint16_t layer = 1; layer <= 4; layer++) {
605 for (uint16_t layer = 1; layer <= 3; layer++) {
616 for (uint16_t layer = 1; layer <= 6; layer++) {
627 for (uint16_t layer = 1; layer <= 9; layer++) {
638 uint16_t NPixBarrel = 4;
639 for (uint16_t layer = 1; layer <= NPixBarrel; layer++) {
650 uint16_t NPixForward = 3;
651 for (uint16_t layer = 1; layer <= NPixForward; layer++) {
662 for (uint16_t layer = 1; layer <= 4; layer++) {
673 for (uint16_t layer = 1; layer <= 3; layer++) {
684 for (uint16_t layer = 1; layer <= 6; layer++) {
695 for (uint16_t layer = 1; layer <= 9; layer++) {
707 uint16_t NPixBarrel = 4;
708 for (uint16_t layer = 1; layer <= NPixBarrel; layer++) {
719 uint16_t NPixForward = 3;
720 for (uint16_t layer = 1; layer <= NPixForward; layer++) {
731 for (uint16_t layer = 1; layer <= 4; layer++) {
742 for (uint16_t layer = 1; layer <= 3; layer++) {
753 for (uint16_t layer = 1; layer <= 6; layer++) {
765 for (uint16_t layer = 1; layer <= 9; layer++) {
776 uint16_t NPixBarrel = 4;
777 for (uint16_t layer = 1; layer <= NPixBarrel; layer++) {
788 uint16_t NPixForward = 3;
789 for (uint16_t layer = 1; layer <= NPixForward; layer++) {
800 for (uint16_t layer = 1; layer <= 4; layer++) {
811 for (uint16_t layer = 1; layer <= 3; layer++) {
822 for (uint16_t layer = 1; layer <= 6; layer++) {
833 for (uint16_t layer = 1; layer <= 9; layer++) {
857 stream <<
"\tcsc ring " <<
getCSCRing(pattern);
859 stream <<
"\trpc " << (
getRPCregion(pattern) ?
"endcaps" :
"barrel")
862 stream <<
"\tgem " << (
getGEMLayer(pattern) ?
"layer1" :
"layer2")
867 stream <<
"(UNKNOWN Muon SubStructure!) \tsubsubstructure "
871 stream <<
"\tlayer " <<
getLayer(pattern);
873 stream <<
"\thit type " <<
getHitType(pattern);
879 stream <<
"HitPattern" << std::endl;
883 std::ios_base::fmtflags
flags = stream.flags();
884 stream.setf(std::ios_base::hex, std::ios_base::basefield);
885 stream.setf(std::ios_base::showbase);
924 && (hitType == -1 ||
int(
getHitType(pattern)) == hitType)) {
929 return stations[0] + stations[1] + stations[2] + stations[3];
938 && (hitType == -1 ||
int(
getHitType(pattern)) == hitType)) {
940 if (ret == 0 || stat < ret) {
955 (hitType == -1 ||
int(
getHitType(pattern)) == hitType)) {
957 if (ret == 0 || stat > ret) {
976 return stations[0] + stations[1] + stations[2] + stations[3];
989 return stations[0] + stations[1] + stations[2] + stations[3];
994 int stations[4][2] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}};
1002 return stations[0][0] * stations[0][1]
1003 + stations[1][0] * stations[1][1]
1004 + stations[2][0] * stations[2][1]
1005 + stations[3][0] * stations[3][1];
1012 int pos = offset +
i;
1013 uint16_t bit = (pattern >>
i) & 0x1;
1015 hitPattern[pos >> 4] += bit << ((offset +
i) & (16 - 1));
int stripTOBLayersWithMeasurement() const
static uint16_t getCSCRing(uint16_t pattern)
CSC ring (1-4). Only valid for muon CSC patterns, of course.
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
int stripTIBLayersNull() 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 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
std::vector< Variable::Flags > flags
int pixelLayersWithMeasurement() const
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
bool insertExpectedOuterHit(const uint16_t pattern)
bool tidIsStereo(const DetId &id) const
static bool pixelEndcapHitFilter(uint16_t pattern)
bool hasValidHitInFirstPixelEndcap() const
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,2. Only valid for muon GEM patterns, of course.
int stripTOBLayersTotallyOffOrBad() const
static const unsigned short minTrackerWord
uint16_t hitPattern[ARRAY_LENGTH]
int stripTIDLayersTotallyOffOrBad() 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)
int stripTECLayersTotallyOffOrBad() const
Abs< T >::type abs(const T &t)
bool appendHit(const TrackingRecHit &hit, const TrackerTopology &ttopo)
int numberOfDTStationsWithRZView() const
int stripTIDLayersNull() const
static const unsigned short HitTypeOffset
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
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 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 trackerLayersWithoutMeasurement(HitCategory category) const
bool insertExpectedInnerHit(const uint16_t pattern)
int pixelBarrelLayersTotallyOffOrBad() const
static const unsigned short SubstrMask
static const unsigned short LayerOffset
static int position[264][3]
bool insertTrackHit(const uint16_t pattern)
int stripTECLayersWithMeasurement() const
int stripTECLayersWithoutMeasurement(HitCategory category) const
int pixelEndcapLayersTotallyOffOrBad() 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
bool hasValidHitInFirstPixelBarrel() const
DetId geographicalId() const
static uint32_t getSubSubStructure(uint16_t pattern)
uint16_t getHitPattern(HitCategory category, int position) const
int stripTIBLayersTotallyOffOrBad() const
static const unsigned short LayerMask
Detector det() const
get the detector field from this detid
static bool muonRPCHitFilter(uint16_t pattern)
static uint16_t encode(const TrackingRecHit &hit, const TrackerTopology &ttopo)
int numberOfHits(HitCategory category) const
int stripTIBLayersWithoutMeasurement(HitCategory category) const
bool appendMuonHit(const DetId &id, TrackingRecHit::Type hitType)
int pixelEndcapLayersNull() const