CMS 3D CMS Logo

Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes

reco::HitPattern Class Reference

#include <HitPattern.h>

List of all members.

Public Types

enum  { MONO = 1, STEREO = 2 }
typedef bool filterType (unsigned int)

Public Member Functions

void appendHit (const TrackingRecHit &hit)
template<typename F >
void call (filterType typeFilter, F f) const
int countHits (filterType filter) const
int countTypedHits (filterType typeFilter, filterType filter) const
int cscStationsWithAnyHits () const
int cscStationsWithBadHits () const
int cscStationsWithValidHits () const
int dtStationsWithAnyHits () const
int dtStationsWithBadHits () const
int dtStationsWithValidHits () const
uint32_t getHitPattern (int position) const
uint32_t getTrackerLayerCase (uint32_t substr, uint32_t layer) const
uint32_t getTrackerMonoStereo (uint32_t substr, uint32_t layer) const
bool hasValidHitInFirstPixelBarrel () const
bool hasValidHitInFirstPixelEndcap () const
 HitPattern ()
template<typename I >
 HitPattern (const I &begin, const I &end)
template<typename C >
 HitPattern (const C &c)
int innermostMuonStationWithAnyHits () const
int innermostMuonStationWithBadHits () const
int innermostMuonStationWithHits (int hitType) const
 hitType=-1(all), 0=valid, 3=bad; 0 = no stations at all
int innermostMuonStationWithValidHits () const
int muonStations (int subdet, int hitType) const
 subdet = 0(all), 1(DT), 2(CSC), 3(RPC); hitType=-1(all), 0=valid, 3=bad
int muonStationsWithAnyHits () const
int muonStationsWithBadHits () const
int muonStationsWithValidHits () const
int numberOfBadHits () const
int numberOfBadMuonCSCHits () const
int numberOfBadMuonDTHits () const
int numberOfBadMuonHits () const
int numberOfBadMuonRPCHits () const
int numberOfDTStationsWithBothViews () const
int numberOfDTStationsWithRPhiView () const
int numberOfDTStationsWithRZView () const
int numberOfHits () const
int numberOfInactiveHits () const
int numberOfInactiveTrackerHits () const
int numberOfLostHits () const
int numberOfLostMuonCSCHits () const
int numberOfLostMuonDTHits () const
int numberOfLostMuonHits () const
int numberOfLostMuonRPCHits () const
int numberOfLostPixelBarrelHits () const
int numberOfLostPixelEndcapHits () const
int numberOfLostPixelHits () const
int numberOfLostStripHits () const
int numberOfLostStripTECHits () const
int numberOfLostStripTIBHits () const
int numberOfLostStripTIDHits () const
int numberOfLostStripTOBHits () const
int numberOfLostTrackerHits () const
int numberOfValidHits () const
int numberOfValidMuonCSCHits () const
int numberOfValidMuonDTHits () const
int numberOfValidMuonHits () const
int numberOfValidMuonRPCHits () const
int numberOfValidPixelBarrelHits () const
int numberOfValidPixelEndcapHits () const
int numberOfValidPixelHits () const
int numberOfValidStripHits () const
int numberOfValidStripLayersWithMonoAndStereo () const
int numberOfValidStripTECHits () const
int numberOfValidStripTIBHits () const
int numberOfValidStripTIDHits () const
int numberOfValidStripTOBHits () const
int numberOfValidTrackerHits () const
int outermostMuonStationWithAnyHits () const
int outermostMuonStationWithBadHits () const
int outermostMuonStationWithHits (int hitType) const
 hitType=-1(all), 0=valid, 3=bad; 0 = no stations at all
int outermostMuonStationWithValidHits () const
int pixelBarrelLayersNull () const
int pixelBarrelLayersTotallyOffOrBad () const
int pixelBarrelLayersWithMeasurement () const
int pixelBarrelLayersWithoutMeasurement () const
int pixelEndcapLayersNull () const
int pixelEndcapLayersTotallyOffOrBad () const
int pixelEndcapLayersWithMeasurement () const
int pixelEndcapLayersWithoutMeasurement () const
int pixelLayersNull () const
int pixelLayersTotallyOffOrBad () const
int pixelLayersWithMeasurement () const
int pixelLayersWithoutMeasurement () const
void print (std::ostream &stream=std::cout) const
void printHitPattern (int position, std::ostream &stream) const
int rpcStationsWithAnyHits () const
int rpcStationsWithBadHits () const
int rpcStationsWithValidHits () const
void set (const TrackingRecHit &hit, unsigned int i)
template<typename I >
void set (const I &begin, const I &end)
int stripLayersNull () const
int stripLayersTotallyOffOrBad () const
int stripLayersWithMeasurement () const
int stripLayersWithoutMeasurement () const
int stripTECLayersNull () const
int stripTECLayersTotallyOffOrBad () const
int stripTECLayersWithMeasurement () const
int stripTECLayersWithoutMeasurement () const
int stripTIBLayersNull () const
int stripTIBLayersTotallyOffOrBad () const
int stripTIBLayersWithMeasurement () const
int stripTIBLayersWithoutMeasurement () const
int stripTIDLayersNull () const
int stripTIDLayersTotallyOffOrBad () const
int stripTIDLayersWithMeasurement () const
int stripTIDLayersWithoutMeasurement () const
int stripTOBLayersNull () const
int stripTOBLayersTotallyOffOrBad () const
int stripTOBLayersWithMeasurement () const
int stripTOBLayersWithoutMeasurement () const
int trackerLayersNull () const
int trackerLayersTotallyOffOrBad () const
int trackerLayersWithMeasurement () const
int trackerLayersWithoutMeasurement () const

Static Public Member Functions

static uint32_t getCSCRing (uint32_t pattern)
 CSC ring (1-4). Only valid for muon CSC patterns, of course.
static uint32_t getDTSuperLayer (uint32_t pattern)
 DT superlayer (1-3). Where the "hit" was a DT segment, superlayer is 0. Only valid for muon DT patterns, of course.
static uint32_t getHitType (uint32_t pattern)
static uint32_t getLayer (uint32_t pattern)
static uint32_t getMuonStation (uint32_t pattern)
 Muon station (1-4). Only valid for muon patterns, of course.
static uint32_t getRPCLayer (uint32_t pattern)
 RPC layer: for station 1 and 2, layer = 1(inner) or 2(outer); for station 3, 4 layer is always 0. Only valid for muon RPC patterns, of course.
static uint32_t getRPCregion (uint32_t pattern)
 RPC region: 0 = barrel, 1 = endcap. Only valid for muon RPC patterns, of course.
static uint32_t getSide (uint32_t pattern)
static uint32_t getSubStructure (uint32_t pattern)
static uint32_t getSubSubStructure (uint32_t pattern)
static bool muonCSCHitFilter (uint32_t pattern)
static bool muonDTHitFilter (uint32_t pattern)
static bool muonHitFilter (uint32_t pattern)
static bool muonRPCHitFilter (uint32_t pattern)
static bool pixelBarrelHitFilter (uint32_t pattern)
static bool pixelEndcapHitFilter (uint32_t pattern)
static bool pixelHitFilter (uint32_t pattern)
static bool stripHitFilter (uint32_t pattern)
static bool stripTECHitFilter (uint32_t pattern)
static bool stripTIBHitFilter (uint32_t pattern)
static bool stripTIDHitFilter (uint32_t pattern)
static bool stripTOBHitFilter (uint32_t pattern)
static bool trackerHitFilter (uint32_t pattern)
static bool type_1_HitFilter (uint32_t pattern)
static bool type_2_HitFilter (uint32_t pattern)
static bool type_3_HitFilter (uint32_t pattern)
static bool validHitFilter (uint32_t pattern)

Static Public Attributes

static const unsigned short HitSize = 11
static const int MaxHits = (PatternSize * 32) / HitSize
static const unsigned short PatternSize = 25

Private Member Functions

uint32_t encode (const TrackingRecHit &, unsigned int)
void set (const TrackingRecHitRef &ref, unsigned int i)
void setHitPattern (int position, uint32_t pattern)

Static Private Member Functions

static uint32_t isStereo (DetId)

Private Attributes

uint32_t hitPattern_ [PatternSize]

Static Private Attributes

static const unsigned short HitTypeMask = 0x3
static const unsigned short HitTypeOffset = 0
static const unsigned short LayerMask = 0xF
static const unsigned short LayerOffset = 3
static const unsigned short SideMask = 0x1
static const unsigned short SideOffset = 2
static const unsigned short SubDetectorMask = 0x1
static const unsigned short SubDetectorOffset = 10
static const unsigned short SubstrMask = 0x7
static const unsigned short SubstrOffset = 7

Detailed Description

Definition at line 122 of file HitPattern.h.


Member Typedef Documentation

typedef bool reco::HitPattern::filterType(unsigned int)

Definition at line 160 of file HitPattern.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
MONO 
STEREO 

Definition at line 124 of file HitPattern.h.

{ MONO = 1, STEREO = 2 };

Constructor & Destructor Documentation

reco::HitPattern::HitPattern ( ) [inline]

Definition at line 136 of file HitPattern.h.

References hitPattern_, i, and PatternSize.

{ for (int i=0; i<PatternSize; i++) hitPattern_[i] = 0; }
template<typename I >
reco::HitPattern::HitPattern ( const I &  begin,
const I &  end 
) [inline]

Definition at line 140 of file HitPattern.h.

References begin, and end.

{ set(begin, end); }
template<typename C >
reco::HitPattern::HitPattern ( const C &  c) [inline]

Definition at line 144 of file HitPattern.h.

References trackerHits::c.

{ set(c); }

Member Function Documentation

void HitPattern::appendHit ( const TrackingRecHit hit)

Definition at line 88 of file HitPattern.cc.

References filterCSVwithJSON::copy, CSC(), cond::rpcobgas::detid, TrackingRecHit::dimension(), MuonSubdetId::DT, TrackingRecHit::geographicalId(), i, DetId::Muon, numberOfHits(), TrackingRecHit::recHits(), MuonSubdetId::RPC, and DetId::Tracker.

Referenced by reco::TrackBase::appendHitPattern().

                                                    {

  // get rec hit det id and rec hit type
  DetId id = hit.geographicalId();
  uint32_t detid = id.det();
  uint32_t subdet = id.subdetId();

  std::vector<const TrackingRecHit*> hits;


  if (detid == DetId::Tracker)
    hits.push_back(&hit);
   
  if (detid == DetId::Muon) {

    if (subdet == (uint32_t) MuonSubdetId::DT){

      // DT rechit (granularity 2)
      if(hit.dimension() == 1)
        hits.push_back(&hit);
      
      // 4D segment (granularity 0) 
      else if(hit.dimension() > 1){ // Both 2 and 4 dim cases. MB4s have 2D, but formatted in 4D segments 
        std::vector<const TrackingRecHit*> seg2D = hit.recHits(); // 4D --> 2D
        // load 1D hits (2D --> 1D)
        for(std::vector<const TrackingRecHit*>::const_iterator it = seg2D.begin(); it != seg2D.end(); ++it){
          std::vector<const TrackingRecHit*> hits1D =  (*it)->recHits();
          copy(hits1D.begin(),hits1D.end(),back_inserter(hits));
        }
      }
    }

    else if (subdet == (uint32_t) MuonSubdetId::CSC){
      
      // CSC rechit (granularity 2)
      if(hit.dimension() == 2)
        hits.push_back(&hit);

      // 4D segment (granularity 0) 
      if(hit.dimension() == 4)
        hits = hit.recHits(); // load 2D hits (4D --> 1D)
    }
   
    else if (subdet == (uint32_t) MuonSubdetId::RPC) {
      hits.push_back(&hit);
    }
  }

  unsigned int i =  numberOfHits();
  for(std::vector<const TrackingRecHit*>::const_iterator it = hits.begin(); it != hits.end(); ++it)
    set(**it,i++);


}
template<typename F >
void reco::HitPattern::call ( filterType  typeFilter,
f 
) const [inline]

Definition at line 182 of file HitPattern.h.

References f, getHitPattern(), HitSize, i, listBenchmarks::pattern, and PatternSize.

Referenced by reco::PatternSet< N >::fill().

                                                {
     for (int i=0; i<(PatternSize * 32) / HitSize; i++) {
        uint32_t pattern = getHitPattern(i);
        if (pattern == 0) break;
        // f() return false to ask to stop looping 
        if (typeFilter(pattern) && !f(pattern) ) break;
     }
    }
int reco::HitPattern::countHits ( filterType  filter) const [inline]

Definition at line 161 of file HitPattern.h.

References prof2calltree::count, alcazmumu_cfi::filter, getHitPattern(), HitSize, i, listBenchmarks::pattern, and PatternSize.

Referenced by numberOfBadHits(), numberOfInactiveHits(), numberOfLostHits(), and numberOfValidHits().

                                           {
      int count = 0;
      for (int i=0; i<(PatternSize * 32) / HitSize; i++) {
        uint32_t pattern = getHitPattern(i);
        if (pattern == 0) break;
        if (filter(pattern)) ++count;
      }
      return count;
    }
int reco::HitPattern::countTypedHits ( filterType  typeFilter,
filterType  filter 
) const [inline]
int reco::HitPattern::cscStationsWithAnyHits ( ) const [inline]

Definition at line 800 of file HitPattern.h.

References muonStations().

{ return muonStations(2,-1); }
int reco::HitPattern::cscStationsWithBadHits ( ) const [inline]

Definition at line 799 of file HitPattern.h.

References muonStations().

{ return muonStations(2, 3); }
int reco::HitPattern::cscStationsWithValidHits ( ) const [inline]

Definition at line 798 of file HitPattern.h.

References muonStations().

{ return muonStations(2, 0); }
int reco::HitPattern::dtStationsWithAnyHits ( ) const [inline]

Definition at line 797 of file HitPattern.h.

References muonStations().

{ return muonStations(1,-1); }
int reco::HitPattern::dtStationsWithBadHits ( ) const [inline]

Definition at line 796 of file HitPattern.h.

References muonStations().

{ return muonStations(1, 3); }
int reco::HitPattern::dtStationsWithValidHits ( ) const [inline]

Definition at line 795 of file HitPattern.h.

References muonStations().

{ return muonStations(1, 0); }
uint32_t HitPattern::encode ( const TrackingRecHit hit,
unsigned int  i 
) [private]

Definition at line 15 of file HitPattern.cc.

References abs, MuonSubdetId::CSC, CSCDetId, cond::rpcobgas::detid, PXFDetId::disk(), MuonSubdetId::DT, DTLayerId, TrackingRecHit::geographicalId(), TrackingRecHit::getType(), HitSize, HitTypeMask, HitTypeOffset, isStereo(), TIBDetId::layer(), TOBDetId::layer(), PXBDetId::layer(), RPCDetId::layer(), LayerMask, LayerOffset, DetId::Muon, listBenchmarks::pattern, PatternSize, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, RPCDetId::region(), dedefs::RPC, SideMask, SideOffset, RPCDetId::station(), SubDetectorMask, SubDetectorOffset, SubstrMask, SubstrOffset, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, DetId::Tracker, TIDDetId::wheel(), and TECDetId::wheel().

Referenced by set().

                                                                     {
  
  // ignore the rec hit if the number of hit is larger than the max
  if (i >= 32 * PatternSize / HitSize) return 0;

  // get rec hit det id and rec hit type
  DetId id = hit.geographicalId();
  uint32_t detid = id.det();
  uint32_t hitType = (uint32_t) hit.getType();

  // init pattern of this hit to 0
  uint32_t pattern = 0;

  // adding tracker/muon detector bit
  pattern += ((detid)&SubDetectorMask)<<SubDetectorOffset;
  
  // adding substructure (PXB,PXF,TIB,TID,TOB,TEC, or DT,CSC,RPC) bits 
  uint32_t subdet = id.subdetId();
  pattern += ((subdet)&SubstrMask)<<SubstrOffset;
  
  // adding layer/disk/wheel bits
  uint32_t layer = 0;
  if (detid == DetId::Tracker) {
    if (subdet == PixelSubdetector::PixelBarrel) 
      layer = PXBDetId(id).layer();
    else if (subdet == PixelSubdetector::PixelEndcap)
      layer = PXFDetId(id).disk();
    else if (subdet == StripSubdetector::TIB)
      layer = TIBDetId(id).layer();
    else if (subdet == StripSubdetector::TID)
      layer = TIDDetId(id).wheel();
    else if (subdet == StripSubdetector::TOB)
      layer = TOBDetId(id).layer();
    else if (subdet == StripSubdetector::TEC)
      layer = TECDetId(id).wheel();
  } else if (detid == DetId::Muon) {
    if (subdet == (uint32_t) MuonSubdetId::DT) 
      layer = ((DTLayerId(id.rawId()).station()-1)<<2) + DTLayerId(id.rawId()).superLayer();
    else if (subdet == (uint32_t) MuonSubdetId::CSC)
      layer = ((CSCDetId(id.rawId()).station()-1)<<2) +  (CSCDetId(id.rawId()).ring()-1);
    else if (subdet == (uint32_t) MuonSubdetId::RPC) {
      RPCDetId rpcid(id.rawId());
      layer = ((rpcid.station()-1)<<2) + abs(rpcid.region());
      if (rpcid.station() <= 2) layer += 2*(rpcid.layer()-1);
    }
  }
  pattern += (layer&LayerMask)<<LayerOffset;

  // adding mono/stereo bit
  uint32_t side = 0;
  if (detid == DetId::Tracker) {
       side = isStereo(id);
  } else if (detid == DetId::Muon) {
       side = 0;
  }
  pattern += (side&SideMask)<<SideOffset;

  // adding hit type bits
  pattern += (hitType&HitTypeMask)<<HitTypeOffset;

  return pattern;
}
uint32_t reco::HitPattern::getCSCRing ( uint32_t  pattern) [inline, static]

CSC ring (1-4). Only valid for muon CSC patterns, of course.

Definition at line 530 of file HitPattern.h.

References getSubSubStructure().

Referenced by printHitPattern().

                                                         {
    return (getSubSubStructure(pattern) & 3) + 1;
  }
uint32_t reco::HitPattern::getDTSuperLayer ( uint32_t  pattern) [inline, static]

DT superlayer (1-3). Where the "hit" was a DT segment, superlayer is 0. Only valid for muon DT patterns, of course.

Definition at line 526 of file HitPattern.h.

References getSubSubStructure().

Referenced by numberOfDTStationsWithBothViews(), numberOfDTStationsWithRPhiView(), numberOfDTStationsWithRZView(), and printHitPattern().

                                                              {
    return (getSubSubStructure(pattern) & 3);
  }
uint32_t HitPattern::getHitPattern ( int  position) const

Definition at line 144 of file HitPattern.cc.

References hitPattern_, and HitSize.

Referenced by PFCheckHitPattern::analyze(), CheckHitPattern::analyze(), GetTrackTrajInfo::analyze(), FixTrackHitPattern::analyze(), call(), GsfElectronAlgo::ElectronData::checkCtfTrack(), countHits(), countTypedHits(), GsfElectronCoreBaseProducer::getCtfTrackRef(), getTrackerLayerCase(), getTrackerMonoStereo(), PrimaryVertexValidation::hasFirstLayerPixelHits(), hasValidHitInFirstPixelBarrel(), hasValidHitInFirstPixelEndcap(), index_to_hitpattern(), innermostMuonStationWithHits(), SoftPFElectronTagInfoProducer::isElecClean(), PFElecTkProducer::isInnerMost(), muonStations(), numberOfDTStationsWithBothViews(), numberOfDTStationsWithRPhiView(), numberOfDTStationsWithRZView(), numberOfHits(), numberOfValidStripLayersWithMonoAndStereo(), EgAmbiguityTools::isInnerMost::operator()(), outermostMuonStationWithHits(), FWTrackResidualDetailView::prepareData(), PFCheckHitPattern::print(), reco::TrackResiduals::print(), CheckHitPattern::print(), print(), printHitPattern(), FWConvTrackHitsDetailView::setTextInfo(), EgAmbiguityTools::sharedDets(), EgAmbiguityTools::sharedHits(), and QcdUeDQM::trackSelection().

                                                     {
/* Note: you are not taking a consecutive sequence of HitSize bits starting from position*HitSize
         as the bit order in the words are reversed. 
         e.g. if position = 0 you take the lowest 10 bits of the first word.
    
         I hope this can clarify what is the memory layout of such thing

 straight 01234567890123456789012345678901 | 23456789012345678901234567890123 | 4567
 (global) 0         1         2         3  | 3       4         5         6    | 6  
 words    [--------------0---------------] | [--------------1---------------] | [---   
 word     01234567890123456789012345678901 | 01234567890123456789012345678901 | 0123
  (str)   0         1         2         3  | 0         1         2         3  | 0
          [--------------0---------------] | [--------------1---------------] | [---   
 word     10987654321098765432109876543210 | 10987654321098765432109876543210 | 1098
  (rev)   32         21        10        0 | 32         21        10        0 | 32  
 reverse  10987654321098765432109876543210 | 32109876543210987654321098765432 | 5432
          32         21        10        0 | 6  65        54        43      3   9

         ugly enough, but it's not my fault, I was not even in CMS at that time   [gpetrucc] */
  uint16_t bitEndOffset = (position+1) * HitSize;
  uint8_t secondWord   = (bitEndOffset >> 5);
  uint8_t secondWordBits = bitEndOffset & (32-1); // that is, bitEndOffset % 32
  if (secondWordBits >= HitSize) { // full block is in this word
      uint8_t lowBitsToTrash = secondWordBits - HitSize;
      uint32_t myResult = (hitPattern_[secondWord] >> lowBitsToTrash) & ((1 << HitSize)-1);
      return myResult;
  } else {
      uint8_t  firstWordBits   = HitSize - secondWordBits;
      uint32_t firstWordBlock  = hitPattern_[secondWord-1] >> (32-firstWordBits);
      uint32_t secondWordBlock = hitPattern_[secondWord] & ((1<<secondWordBits)-1);
      uint32_t myResult = firstWordBlock + (secondWordBlock << firstWordBits);
      return myResult;
  }
}
uint32_t reco::HitPattern::getHitType ( uint32_t  pattern) [inline, static]
uint32_t reco::HitPattern::getLayer ( uint32_t  pattern) [inline, static]
uint32_t reco::HitPattern::getMuonStation ( uint32_t  pattern) [inline, static]
uint32_t reco::HitPattern::getRPCLayer ( uint32_t  pattern) [inline, static]

RPC layer: for station 1 and 2, layer = 1(inner) or 2(outer); for station 3, 4 layer is always 0. Only valid for muon RPC patterns, of course.

Definition at line 534 of file HitPattern.h.

References getSubSubStructure(), and likely.

Referenced by printHitPattern().

                                                          {
    uint32_t sss = getSubSubStructure(pattern), stat = sss >> 2;
    if likely(stat <= 1) return ((sss >> 1) & 1) + 1;
    return 0;
  }
uint32_t reco::HitPattern::getRPCregion ( uint32_t  pattern) [inline, static]

RPC region: 0 = barrel, 1 = endcap. Only valid for muon RPC patterns, of course.

Definition at line 540 of file HitPattern.h.

References getSubSubStructure().

Referenced by printHitPattern().

                                                           {
    return getSubSubStructure(pattern) & 1;
  }
uint32_t reco::HitPattern::getSide ( uint32_t  pattern) [inline, static]

Definition at line 512 of file HitPattern.h.

References SideMask, SideOffset, and unlikely.

Referenced by getTrackerMonoStereo(), and numberOfValidStripLayersWithMonoAndStereo().

                                                        {
    if  unlikely(pattern == 0) return 999999;
    return (pattern >> SideOffset) & SideMask;
  }
uint32_t reco::HitPattern::getSubStructure ( uint32_t  pattern) [inline, static]
uint32_t reco::HitPattern::getSubSubStructure ( uint32_t  pattern) [inline, static]

Definition at line 506 of file HitPattern.h.

References LayerMask, LayerOffset, and unlikely.

Referenced by getCSCRing(), getDTSuperLayer(), getMuonStation(), getRPCLayer(), and getRPCregion().

                                                                 {
    if  unlikely(pattern == 0) return 999999;
    return ((pattern>>LayerOffset) & LayerMask);
  }
uint32_t HitPattern::getTrackerLayerCase ( uint32_t  substr,
uint32_t  layer 
) const

Definition at line 260 of file HitPattern.cc.

References getHitPattern(), HitSize, HitTypeMask, HitTypeOffset, i, LayerMask, LayerOffset, listBenchmarks::pattern, PatternSize, SubDetectorMask, SubDetectorOffset, SubstrMask, and SubstrOffset.

Referenced by pixelBarrelLayersNull(), pixelBarrelLayersTotallyOffOrBad(), pixelBarrelLayersWithMeasurement(), pixelBarrelLayersWithoutMeasurement(), pixelEndcapLayersNull(), pixelEndcapLayersTotallyOffOrBad(), pixelEndcapLayersWithMeasurement(), pixelEndcapLayersWithoutMeasurement(), stripTECLayersNull(), stripTECLayersTotallyOffOrBad(), stripTECLayersWithMeasurement(), stripTECLayersWithoutMeasurement(), stripTIBLayersNull(), stripTIBLayersTotallyOffOrBad(), stripTIBLayersWithMeasurement(), stripTIBLayersWithoutMeasurement(), stripTIDLayersNull(), stripTIDLayersTotallyOffOrBad(), stripTIDLayersWithMeasurement(), stripTIDLayersWithoutMeasurement(), stripTOBLayersNull(), stripTOBLayersTotallyOffOrBad(), stripTOBLayersWithMeasurement(), and stripTOBLayersWithoutMeasurement().

                                                                              {
  uint32_t tk_substr_layer = 
    (1 << SubDetectorOffset) +
    ((substr & SubstrMask) << SubstrOffset) +
    ((layer & LayerMask) << LayerOffset);
  
  uint32_t mask =
    (SubDetectorMask << SubDetectorOffset) +
    (SubstrMask << SubstrOffset) +
    (LayerMask << LayerOffset);
  
  // crossed
  //   layer case 0: valid + (missing, off, bad) ==> with measurement
  //   layer case 1: missing + (off, bad) ==> without measurement
  //   layer case 2: off, bad ==> totally off or bad, cannot say much
  // not crossed
  //   layer case 999999: track outside acceptance or in gap ==> null

  uint32_t layerCase = 999999;
  for (int i=0; i<(PatternSize * 32) / HitSize; i++)
  {
    uint32_t pattern = getHitPattern(i);
    if (pattern == 0) break;
    if ((pattern & mask) == tk_substr_layer) {
      uint32_t hitType = (pattern >> HitTypeOffset) & HitTypeMask; // 0,1,2,3
      if (hitType < layerCase) {
        layerCase = hitType;
        if (hitType == 3) layerCase = 2;
      }
    }
  }
  return layerCase;
}
uint32_t HitPattern::getTrackerMonoStereo ( uint32_t  substr,
uint32_t  layer 
) const

Definition at line 294 of file HitPattern.cc.

References getHitPattern(), getSide(), HitSize, HitTypeMask, HitTypeOffset, i, LayerMask, LayerOffset, MONO, listBenchmarks::pattern, PatternSize, STEREO, SubDetectorMask, SubDetectorOffset, SubstrMask, and SubstrOffset.

{
  uint32_t tk_substr_layer = 
    (1 << SubDetectorOffset) +
    ((substr & SubstrMask) << SubstrOffset) +
    ((layer & LayerMask) << LayerOffset);

  uint32_t mask =
    (SubDetectorMask << SubDetectorOffset) +
    (SubstrMask << SubstrOffset) +
    (LayerMask << LayerOffset);

  //    0:              neither a valid mono nor a valid stereo hit
  //    MONO:           valid mono hit
  //    STEREO:         valid stereo hit
  //    MONO | STEREO:  both
  uint32_t monoStereo = 0;
  for (int i=0; i<(PatternSize * 32) / HitSize; i++)
  {
    uint32_t pattern = getHitPattern(i);
    if (pattern == 0) break;
    if ((pattern & mask) == tk_substr_layer)
    {
      uint32_t hitType = (pattern >> HitTypeOffset) & HitTypeMask; // 0,1,2,3
      if (hitType == 0) { // valid hit
           switch (getSide(pattern)) {
           case 0: // mono
                monoStereo |= MONO;
                break;
           case 1: // stereo
                monoStereo |= STEREO;
                break;
           default:
                break;
           }
      }
    }
  }
  return monoStereo;
}
bool HitPattern::hasValidHitInFirstPixelBarrel ( ) const

Definition at line 183 of file HitPattern.cc.

References getHitPattern(), getLayer(), HitSize, i, listBenchmarks::pattern, PatternSize, pixelBarrelHitFilter(), and validHitFilter().

                                                     {
  for (int i=0; i<(PatternSize * 32) / HitSize; i++) {
    uint32_t pattern = getHitPattern(i);
    if (pattern == 0) break;
    if (pixelBarrelHitFilter(pattern)) {
      if (getLayer(pattern) == 1) {
        if (validHitFilter(pattern)) {
          return true;
        }
      }
    }
  }
  return false;
}
bool HitPattern::hasValidHitInFirstPixelEndcap ( ) const

Definition at line 198 of file HitPattern.cc.

References getHitPattern(), getLayer(), HitSize, i, listBenchmarks::pattern, PatternSize, pixelEndcapHitFilter(), and validHitFilter().

                                                     {
  for (int i=0; i<(PatternSize * 32) / HitSize; i++) {
    uint32_t pattern = getHitPattern(i);
    if (pattern == 0) break;
    if (pixelEndcapHitFilter(pattern)) {
      if (getLayer(pattern) == 1) {
        if (validHitFilter(pattern)) {
          return true;
        }
      }
    }
  }
  return false;
}
int reco::HitPattern::innermostMuonStationWithAnyHits ( ) const [inline]

Definition at line 807 of file HitPattern.h.

References innermostMuonStationWithHits().

int reco::HitPattern::innermostMuonStationWithBadHits ( ) const [inline]

Definition at line 806 of file HitPattern.h.

References innermostMuonStationWithHits().

int HitPattern::innermostMuonStationWithHits ( int  hitType) const

hitType=-1(all), 0=valid, 3=bad; 0 = no stations at all

Definition at line 658 of file HitPattern.cc.

References getHitPattern(), getHitType(), getMuonStation(), HitSize, i, muonHitFilter(), listBenchmarks::pattern, PatternSize, and run_regression::ret.

Referenced by innermostMuonStationWithAnyHits(), innermostMuonStationWithBadHits(), and innermostMuonStationWithValidHits().

                                                              {
  int ret = 0;
  for (int i=0; i<(PatternSize * 32) / HitSize; i++) {
    uint32_t pattern = getHitPattern(i);
    if (pattern == 0) break;
    if (muonHitFilter(pattern) &&
        (hitType == -1 || int(getHitType(pattern)) == hitType)) {
        int stat = getMuonStation(pattern);
        if (ret == 0 || stat < ret) ret = stat;
    }
  }
  return ret;
}
int reco::HitPattern::innermostMuonStationWithValidHits ( ) const [inline]

Definition at line 805 of file HitPattern.h.

References innermostMuonStationWithHits().

uint32_t HitPattern::isStereo ( DetId  i) [static, private]

Definition at line 606 of file HitPattern.cc.

References DetId::det(), i, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, DetId::subdetId(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, and DetId::Tracker.

Referenced by encode().

{
     switch (i.det()) {
     case DetId::Tracker:
          switch (i.subdetId()) {
          case PixelSubdetector::PixelBarrel:
          case PixelSubdetector::PixelEndcap:
               return 0;
          case StripSubdetector::TIB:
          {
               TIBDetId id = i;
               return id.isStereo();
          }
          case StripSubdetector::TID:
          {
               TIDDetId id = i;
               return id.isStereo();
          }
          case StripSubdetector::TOB:
          {
               TOBDetId id = i;
               return id.isStereo();
          }
          case StripSubdetector::TEC:
          {
               TECDetId id = i;
               return id.isStereo();
          }
          default:
               return 0;
          }
          break;
     default:
          return 0;
     }
}
bool reco::HitPattern::muonCSCHitFilter ( uint32_t  pattern) [inline, static]

Definition at line 467 of file HitPattern.h.

References MuonSubdetId::CSC, getSubStructure(), muonHitFilter(), and unlikely.

Referenced by numberOfBadMuonCSCHits(), numberOfLostMuonCSCHits(), numberOfValidMuonCSCHits(), and printHitPattern().

                                                           { 
    if  unlikely(!muonHitFilter(pattern)) return false;
    uint32_t substructure = getSubStructure(pattern);
    if (substructure == (uint32_t) MuonSubdetId::CSC) return true; 
    return false;
  }
bool reco::HitPattern::muonDTHitFilter ( uint32_t  pattern) [inline, static]
bool reco::HitPattern::muonHitFilter ( uint32_t  pattern) [inline, static]
bool reco::HitPattern::muonRPCHitFilter ( uint32_t  pattern) [inline, static]

Definition at line 474 of file HitPattern.h.

References getSubStructure(), muonHitFilter(), MuonSubdetId::RPC, and unlikely.

Referenced by numberOfBadMuonRPCHits(), numberOfLostMuonRPCHits(), numberOfValidMuonRPCHits(), and printHitPattern().

                                                           { 
    if  unlikely(!muonHitFilter(pattern)) return false;
    uint32_t substructure = getSubStructure(pattern);
    if (substructure == (uint32_t) MuonSubdetId::RPC) return true; 
    return false;
  }
int HitPattern::muonStations ( int  subdet,
int  hitType 
) const

subdet = 0(all), 1(DT), 2(CSC), 3(RPC); hitType=-1(all), 0=valid, 3=bad

Definition at line 643 of file HitPattern.cc.

References getHitPattern(), getHitType(), getMuonStation(), getSubStructure(), HitSize, i, muonHitFilter(), listBenchmarks::pattern, PatternSize, and mergeVDriftHistosByStation::stations.

Referenced by cscStationsWithAnyHits(), cscStationsWithBadHits(), cscStationsWithValidHits(), dtStationsWithAnyHits(), dtStationsWithBadHits(), dtStationsWithValidHits(), muonStationsWithAnyHits(), muonStationsWithBadHits(), muonStationsWithValidHits(), rpcStationsWithAnyHits(), rpcStationsWithBadHits(), and rpcStationsWithValidHits().

                                                           {
  int stations[4] = { 0,0,0,0 };
  for (int i=0; i<(PatternSize * 32) / HitSize; i++) {
    uint32_t pattern = getHitPattern(i);
    if (pattern == 0) break;
    if (muonHitFilter(pattern) &&
        (subdet  == 0  || int(getSubStructure(pattern)) == subdet) &&
        (hitType == -1 || int(getHitType(pattern))      == hitType)) {
        stations[getMuonStation(pattern)-1] = 1;
    }
  }
  return stations[0]+stations[1]+stations[2]+stations[3];
}
int reco::HitPattern::muonStationsWithAnyHits ( ) const [inline]

Definition at line 794 of file HitPattern.h.

References muonStations().

{ return muonStations(0,-1); }
int reco::HitPattern::muonStationsWithBadHits ( ) const [inline]

Definition at line 793 of file HitPattern.h.

References muonStations().

{ return muonStations(0, 3); }
int reco::HitPattern::muonStationsWithValidHits ( ) const [inline]

Definition at line 792 of file HitPattern.h.

References muonStations().

{ return muonStations(0, 0); }
int reco::HitPattern::numberOfBadHits ( ) const [inline]

Definition at line 685 of file HitPattern.h.

References countHits(), and type_3_HitFilter().

int reco::HitPattern::numberOfBadMuonCSCHits ( ) const [inline]
int reco::HitPattern::numberOfBadMuonDTHits ( ) const [inline]
int reco::HitPattern::numberOfBadMuonHits ( ) const [inline]
int reco::HitPattern::numberOfBadMuonRPCHits ( ) const [inline]
int HitPattern::numberOfDTStationsWithBothViews ( ) const

Definition at line 711 of file HitPattern.cc.

References getDTSuperLayer(), getHitPattern(), getMuonStation(), HitSize, i, muonDTHitFilter(), listBenchmarks::pattern, PatternSize, mergeVDriftHistosByStation::stations, and validHitFilter().

                                                      {
  int stations[4][2] = { {0,0}, {0,0}, {0,0}, {0,0} };
  for (int i=0; i<(PatternSize * 32) / HitSize; i++) {
    uint32_t pattern = getHitPattern(i);
    if (pattern == 0) break;
    if (muonDTHitFilter(pattern) && validHitFilter(pattern)) {
        stations[getMuonStation(pattern)-1][getDTSuperLayer(pattern) == 2] = 1;
    }
  }
  return stations[0][0]*stations[0][1] + stations[1][0]*stations[1][1] + stations[2][0]*stations[2][1] + stations[3][0]*stations[3][1];
}
int HitPattern::numberOfDTStationsWithRPhiView ( ) const

Definition at line 687 of file HitPattern.cc.

References getDTSuperLayer(), getHitPattern(), getMuonStation(), HitSize, i, muonDTHitFilter(), listBenchmarks::pattern, PatternSize, mergeVDriftHistosByStation::stations, and validHitFilter().

                                                     {
  int stations[4] = { 0,0,0,0 };
  for (int i=0; i<(PatternSize * 32) / HitSize; i++) {
    uint32_t pattern = getHitPattern(i);
    if (pattern == 0) break;
    if (muonDTHitFilter(pattern) && validHitFilter(pattern) && getDTSuperLayer(pattern) != 2) {
        stations[getMuonStation(pattern)-1] = 1;
    }
  }
  return stations[0]+stations[1]+stations[2]+stations[3];
}
int HitPattern::numberOfDTStationsWithRZView ( ) const

Definition at line 699 of file HitPattern.cc.

References getDTSuperLayer(), getHitPattern(), getMuonStation(), HitSize, i, muonDTHitFilter(), listBenchmarks::pattern, PatternSize, mergeVDriftHistosByStation::stations, and validHitFilter().

                                                   {
  int stations[4] = { 0,0,0,0 };
  for (int i=0; i<(PatternSize * 32) / HitSize; i++) {
    uint32_t pattern = getHitPattern(i);
    if (pattern == 0) break;
    if (muonDTHitFilter(pattern) && validHitFilter(pattern) && getDTSuperLayer(pattern) == 2) {
        stations[getMuonStation(pattern)-1] = 1;
    }
  }
  return stations[0]+stations[1]+stations[2]+stations[3];
}
int HitPattern::numberOfHits ( void  ) const
int reco::HitPattern::numberOfInactiveHits ( ) const [inline]

Definition at line 707 of file HitPattern.h.

References countHits(), and type_2_HitFilter().

int reco::HitPattern::numberOfInactiveTrackerHits ( ) const [inline]
int reco::HitPattern::numberOfLostHits ( ) const [inline]
int reco::HitPattern::numberOfLostMuonCSCHits ( ) const [inline]
int reco::HitPattern::numberOfLostMuonDTHits ( ) const [inline]
int reco::HitPattern::numberOfLostMuonHits ( ) const [inline]
int reco::HitPattern::numberOfLostMuonRPCHits ( ) const [inline]
int reco::HitPattern::numberOfLostPixelBarrelHits ( ) const [inline]
int reco::HitPattern::numberOfLostPixelEndcapHits ( ) const [inline]
int reco::HitPattern::numberOfLostPixelHits ( ) const [inline]
int reco::HitPattern::numberOfLostStripHits ( ) const [inline]
int reco::HitPattern::numberOfLostStripTECHits ( ) const [inline]
int reco::HitPattern::numberOfLostStripTIBHits ( ) const [inline]
int reco::HitPattern::numberOfLostStripTIDHits ( ) const [inline]
int reco::HitPattern::numberOfLostStripTOBHits ( ) const [inline]
int reco::HitPattern::numberOfLostTrackerHits ( ) const [inline]
int reco::HitPattern::numberOfValidHits ( ) const [inline]
int reco::HitPattern::numberOfValidMuonCSCHits ( ) const [inline]
int reco::HitPattern::numberOfValidMuonDTHits ( ) const [inline]
int reco::HitPattern::numberOfValidMuonHits ( ) const [inline]
int reco::HitPattern::numberOfValidMuonRPCHits ( ) const [inline]
int reco::HitPattern::numberOfValidPixelBarrelHits ( ) const [inline]
int reco::HitPattern::numberOfValidPixelEndcapHits ( ) const [inline]
int reco::HitPattern::numberOfValidPixelHits ( ) const [inline]
int reco::HitPattern::numberOfValidStripHits ( ) const [inline]
int HitPattern::numberOfValidStripLayersWithMonoAndStereo ( ) const

Definition at line 224 of file HitPattern.cc.

References prof2calltree::count, getHitPattern(), getLayer(), getSide(), getSubStructure(), HitSize, i, j, LayerMask, listBenchmarks::pattern, PatternSize, stripHitFilter(), SubstrMask, and validHitFilter().

Referenced by reco::modules::MultiTrackSelector::processMVA(), reco::modules::CosmicTrackSelector::select(), and ora::QueryableVector< Item >::select().

                                                                 {
  static const int nHits = (PatternSize * 32) / HitSize;
  bool hasMono[SubstrMask + 1][LayerMask + 1];
  //     printf("sizeof(hasMono) = %d\n", sizeof(hasMono));
  memset(hasMono, 0, sizeof(hasMono));
  bool hasStereo[SubstrMask + 1][LayerMask + 1];
  memset(hasStereo, 0, sizeof(hasStereo));
  // mark which layers have mono/stereo hits
  for (int i = 0; i < nHits; i++) {
    uint32_t pattern = getHitPattern(i);
    if (pattern == 0) break;
    if (validHitFilter(pattern) && stripHitFilter(pattern)) {
      switch (getSide(pattern)) {
      case 0: // mono
        hasMono[getSubStructure(pattern)][getLayer(pattern)] 
          = true;
        break;
      case 1: // stereo
        hasStereo[getSubStructure(pattern)][getLayer(pattern)]
          = true;
        break;
      default:
        break;
      }
    }
    
  }
  // count how many layers have mono and stereo hits
  int count = 0;
  for (int i = 0; i < SubstrMask + 1; ++i) 
    for (int j = 0; j < LayerMask + 1; ++j)
      if (hasMono[i][j] && hasStereo[i][j])
        count++;
  return count;
}
int reco::HitPattern::numberOfValidStripTECHits ( ) const [inline]
int reco::HitPattern::numberOfValidStripTIBHits ( ) const [inline]
int reco::HitPattern::numberOfValidStripTIDHits ( ) const [inline]
int reco::HitPattern::numberOfValidStripTOBHits ( ) const [inline]
int reco::HitPattern::numberOfValidTrackerHits ( ) const [inline]
int reco::HitPattern::outermostMuonStationWithAnyHits ( ) const [inline]

Definition at line 810 of file HitPattern.h.

References outermostMuonStationWithHits().

int reco::HitPattern::outermostMuonStationWithBadHits ( ) const [inline]

Definition at line 809 of file HitPattern.h.

References outermostMuonStationWithHits().

int HitPattern::outermostMuonStationWithHits ( int  hitType) const

hitType=-1(all), 0=valid, 3=bad; 0 = no stations at all

Definition at line 672 of file HitPattern.cc.

References getHitPattern(), getHitType(), getMuonStation(), HitSize, i, muonHitFilter(), listBenchmarks::pattern, PatternSize, and run_regression::ret.

Referenced by outermostMuonStationWithAnyHits(), outermostMuonStationWithBadHits(), and outermostMuonStationWithValidHits().

                                                              {
  int ret = 0;
  for (int i=0; i<(PatternSize * 32) / HitSize; i++) {
    uint32_t pattern = getHitPattern(i);
    if (pattern == 0) break;
    if (muonHitFilter(pattern) &&
        (hitType == -1 || int(getHitType(pattern)) == hitType)) {
        int stat = getMuonStation(pattern);
        if (ret == 0 || stat > ret) ret = stat;
    }
  }
  return ret;
}
int reco::HitPattern::outermostMuonStationWithValidHits ( ) const [inline]

Definition at line 808 of file HitPattern.h.

References outermostMuonStationWithHits().

bool reco::HitPattern::pixelBarrelHitFilter ( uint32_t  pattern) [inline, static]
int HitPattern::pixelBarrelLayersNull ( ) const

Definition at line 508 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and GeomDetEnumerators::PixelBarrel.

Referenced by pixelLayersNull().

                                            {
  int count = 0;
  uint32_t substr = PixelSubdetector::PixelBarrel;
  uint32_t NPixBarrel = 4;
  for (uint32_t layer=1; layer<=NPixBarrel; layer++) {
    if (getTrackerLayerCase(substr, layer) == 999999) count++;
  }
  return count;
}
int HitPattern::pixelBarrelLayersTotallyOffOrBad ( ) const

Definition at line 451 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and GeomDetEnumerators::PixelBarrel.

Referenced by pixelLayersTotallyOffOrBad().

                                                       {
  int count = 0;
  uint32_t substr = PixelSubdetector::PixelBarrel;
  uint32_t NPixBarrel = 4;
  for (uint32_t layer=1; layer<=NPixBarrel; layer++) {
    if (getTrackerLayerCase(substr, layer) == 2) count++;
  }
  return count;
}
int HitPattern::pixelBarrelLayersWithMeasurement ( ) const

Definition at line 337 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and GeomDetEnumerators::PixelBarrel.

Referenced by PrimaryVertexAnalyzer4PU::fillTrackHistos(), pixelLayersWithMeasurement(), IsolatedTracksNxN::printTrack(), and BeamFitter::readEvent().

                                                       {
  int count = 0;
  uint32_t substr = PixelSubdetector::PixelBarrel;
  uint32_t NPixBarrel = 4;
  for (uint32_t layer=1; layer<=NPixBarrel; layer++) {
    if (getTrackerLayerCase(substr, layer) == 0) count++;
  }
  return count;
}
int HitPattern::pixelBarrelLayersWithoutMeasurement ( ) const

Definition at line 394 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and GeomDetEnumerators::PixelBarrel.

Referenced by pixelLayersWithoutMeasurement().

                                                          {
  int count = 0;
  uint32_t substr = PixelSubdetector::PixelBarrel;
  uint32_t NPixBarrel = 4;
  for (uint32_t layer=1; layer<=NPixBarrel; layer++) {
    if (getTrackerLayerCase(substr, layer) == 1) count++;
  }
  return count;
}
bool reco::HitPattern::pixelEndcapHitFilter ( uint32_t  pattern) [inline, static]
int HitPattern::pixelEndcapLayersNull ( ) const

Definition at line 518 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and GeomDetEnumerators::PixelEndcap.

Referenced by pixelLayersNull().

                                            {
  int count = 0;
  uint32_t substr = PixelSubdetector::PixelEndcap;
  uint32_t NPixForward = 3;
  for (uint32_t layer=1; layer<=NPixForward; layer++) {
    if (getTrackerLayerCase(substr, layer) == 999999) count++;
  }
  return count;
}
int HitPattern::pixelEndcapLayersTotallyOffOrBad ( ) const

Definition at line 461 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and GeomDetEnumerators::PixelEndcap.

Referenced by pixelLayersTotallyOffOrBad().

                                                       {
  int count = 0;
  uint32_t substr = PixelSubdetector::PixelEndcap;
  uint32_t NPixForward = 3;
  for (uint32_t layer=1; layer<=NPixForward; layer++) {
    if (getTrackerLayerCase(substr, layer) == 2) count++;
  }
  return count;
}
int HitPattern::pixelEndcapLayersWithMeasurement ( ) const

Definition at line 347 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and GeomDetEnumerators::PixelEndcap.

Referenced by pixelLayersWithMeasurement(), IsolatedTracksNxN::printTrack(), and BeamFitter::readEvent().

                                                       {
  int count = 0;
  uint32_t substr = PixelSubdetector::PixelEndcap;
  uint32_t NPixForward = 3;
  for (uint32_t layer=1; layer<=NPixForward; layer++) {
    if (getTrackerLayerCase(substr, layer) == 0) count++;
  }
  return count;
}
int HitPattern::pixelEndcapLayersWithoutMeasurement ( ) const

Definition at line 404 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and GeomDetEnumerators::PixelEndcap.

Referenced by pixelLayersWithoutMeasurement().

                                                          {
  int count = 0;
  uint32_t substr = PixelSubdetector::PixelEndcap;
  uint32_t NPixForward = 3;
  for (uint32_t layer=1; layer<=NPixForward; layer++) {
    if (getTrackerLayerCase(substr, layer) == 1) count++;
  }
  return count;
}
bool reco::HitPattern::pixelHitFilter ( uint32_t  pattern) [inline, static]
int reco::HitPattern::pixelLayersNull ( ) const [inline]

Definition at line 779 of file HitPattern.h.

References pixelBarrelLayersNull(), and pixelEndcapLayersNull().

Referenced by trackerLayersNull().

int reco::HitPattern::pixelLayersTotallyOffOrBad ( ) const [inline]
int reco::HitPattern::pixelLayersWithMeasurement ( ) const [inline]
int reco::HitPattern::pixelLayersWithoutMeasurement ( ) const [inline]
void HitPattern::print ( std::ostream &  stream = std::cout) const

Definition at line 591 of file HitPattern.cc.

References flags, getHitPattern(), i, numberOfHits(), listBenchmarks::pattern, and printHitPattern().

{
     stream << "HitPattern" << std::endl;
     for (int i = 0; i < numberOfHits(); i++) 
          printHitPattern(i, stream);
     std::ios_base::fmtflags flags = stream.flags();
     stream.setf ( std::ios_base::hex, std::ios_base::basefield );  
     stream.setf ( std::ios_base::showbase );               
     for (int i = 0; i < numberOfHits(); i++) {
          uint32_t pattern = getHitPattern(i);
          stream << pattern << std::endl;
     }
     stream.flags(flags);
}
void HitPattern::printHitPattern ( int  position,
std::ostream &  stream 
) const

Definition at line 564 of file HitPattern.cc.

References getCSCRing(), getDTSuperLayer(), getHitPattern(), getHitType(), getLayer(), getMuonStation(), getRPCLayer(), getRPCregion(), getSubStructure(), muonCSCHitFilter(), muonDTHitFilter(), muonHitFilter(), muonRPCHitFilter(), listBenchmarks::pattern, and trackerHitFilter().

Referenced by spr::goodTrack(), print(), PrimaryVertexAnalyzer4PU::printRecTrks(), IsolatedTracksNxN::printTrack(), and IsolatedTracksCone::printTrack().

{
     uint32_t pattern = getHitPattern(position);
     stream << "\t";
     if (muonHitFilter(pattern))
          stream << "muon";
     if (trackerHitFilter(pattern))
          stream << "tracker";
     stream << "\tsubstructure " << getSubStructure(pattern);
     if (muonHitFilter(pattern)) {
         stream << "\tstation " << getMuonStation(pattern);
         if (muonDTHitFilter(pattern)) { 
            stream << "\tdt superlayer " << getDTSuperLayer(pattern); 
         } else if (muonCSCHitFilter(pattern)) { 
            stream << "\tcsc ring " << getCSCRing(pattern); 
         } else if (muonRPCHitFilter(pattern)) {
            stream << "\trpc " << (getRPCregion(pattern) ? "endcaps" : "barrel") << ", layer " << getRPCLayer(pattern); 
         } else {
            stream << "(UNKNOWN Muon SubStructure!) \tsubsubstructure " << getSubStructure(pattern);
         }
     } else {
         stream << "\tlayer " << getLayer(pattern);
     }
     stream << "\thit type " << getHitType(pattern);
     stream << std::endl;
}
int reco::HitPattern::rpcStationsWithAnyHits ( ) const [inline]

Definition at line 803 of file HitPattern.h.

References muonStations().

{ return muonStations(3,-1); }
int reco::HitPattern::rpcStationsWithBadHits ( ) const [inline]

Definition at line 802 of file HitPattern.h.

References muonStations().

{ return muonStations(3, 3); }
int reco::HitPattern::rpcStationsWithValidHits ( ) const [inline]

Definition at line 801 of file HitPattern.h.

References muonStations().

{ return muonStations(3, 0); }
void reco::HitPattern::set ( const TrackingRecHitRef ref,
unsigned int  i 
) [inline, private]

Definition at line 389 of file HitPattern.h.

References i.

{ set(* ref, i); }
template<typename I >
void reco::HitPattern::set ( const I &  begin,
const I &  end 
) [inline]

Definition at line 150 of file HitPattern.h.

References begin, end, hitPattern_, HitSize, Exhume::I, i, and PatternSize.

Referenced by FixTrackHitPattern::analyze(), reco::TrackBase::setHitPattern(), reco::TrackBase::setTrackerExpectedHitsInner(), and reco::TrackBase::setTrackerExpectedHitsOuter().

                                             {
      for (int i=0; i<PatternSize; i++) hitPattern_[i] = 0;
      unsigned int counter = 0;
      for (I hit=begin; hit!=end && counter<32*PatternSize/HitSize;
           hit++, counter++)
        set(*hit, counter);
    }
void reco::HitPattern::set ( const TrackingRecHit hit,
unsigned int  i 
) [inline]

Definition at line 196 of file HitPattern.h.

References encode(), i, and setHitPattern().

{setHitPattern(i, encode(hit,i));}
void HitPattern::setHitPattern ( int  position,
uint32_t  pattern 
) [private]

Definition at line 79 of file HitPattern.cc.

References hitPattern_, HitSize, i, evf::evtn::offset(), and pos.

Referenced by set().

                                                             {
  int offset = position * HitSize;
  for (int i=0; i<HitSize; i++) {
    int pos = offset + i;
    uint32_t bit = (pattern >> i) & 0x1;
    hitPattern_[pos / 32] += bit << ((offset + i) % 32); 
  }
}
bool reco::HitPattern::stripHitFilter ( uint32_t  pattern) [inline, static]
int reco::HitPattern::stripLayersNull ( ) const [inline]
int reco::HitPattern::stripLayersTotallyOffOrBad ( ) const [inline]
int reco::HitPattern::stripLayersWithMeasurement ( ) const [inline]
int reco::HitPattern::stripLayersWithoutMeasurement ( ) const [inline]
bool reco::HitPattern::stripTECHitFilter ( uint32_t  pattern) [inline, static]
int HitPattern::stripTECLayersNull ( ) const

Definition at line 555 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TEC.

Referenced by stripLayersNull().

                                         {
  int count = 0;
  uint32_t substr = StripSubdetector::TEC;
  for (uint32_t layer=1; layer<=9; layer++) {
    if (getTrackerLayerCase(substr, layer) == 999999) count++;
  }
  return count;
}
int HitPattern::stripTECLayersTotallyOffOrBad ( ) const

Definition at line 498 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TEC.

Referenced by stripLayersTotallyOffOrBad().

                                                    {
  int count = 0;
  uint32_t substr = StripSubdetector::TEC;
  for (uint32_t layer=1; layer<=9; layer++) {
    if (getTrackerLayerCase(substr, layer) == 2) count++;
  }
  return count;
}
int HitPattern::stripTECLayersWithMeasurement ( ) const

Definition at line 384 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TEC.

Referenced by IsolatedTracksNxN::analyze(), spr::goodTrack(), IsolatedTracksNxN::printTrack(), BeamFitter::readEvent(), and stripLayersWithMeasurement().

                                                    {
  int count = 0;
  uint32_t substr = StripSubdetector::TEC;
  for (uint32_t layer=1; layer<=9; layer++) {
    if (getTrackerLayerCase(substr, layer) == 0) count++;
  }
  return count;
}
int HitPattern::stripTECLayersWithoutMeasurement ( ) const

Definition at line 441 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TEC.

Referenced by IsolatedTracksNxN::analyze(), and stripLayersWithoutMeasurement().

                                                       {
  int count = 0;
  uint32_t substr = StripSubdetector::TEC;
  for (uint32_t layer=1; layer<=9; layer++) {
    if (getTrackerLayerCase(substr, layer) == 1) count++;
  }
  return count;
}
bool reco::HitPattern::stripTIBHitFilter ( uint32_t  pattern) [inline, static]
int HitPattern::stripTIBLayersNull ( ) const

Definition at line 528 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TIB.

Referenced by stripLayersNull().

                                         {
  int count = 0;
  uint32_t substr = StripSubdetector::TIB;
  for (uint32_t layer=1; layer<=4; layer++) {
    if (getTrackerLayerCase(substr, layer) == 999999) count++;
  }
  return count;
}
int HitPattern::stripTIBLayersTotallyOffOrBad ( ) const

Definition at line 471 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TIB.

Referenced by stripLayersTotallyOffOrBad().

                                                    {
  int count = 0;
  uint32_t substr = StripSubdetector::TIB;
  for (uint32_t layer=1; layer<=4; layer++) {
    if (getTrackerLayerCase(substr, layer) == 2) count++;
  }
  return count;
}
int HitPattern::stripTIBLayersWithMeasurement ( ) const

Definition at line 357 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TIB.

Referenced by IsolatedTracksNxN::analyze(), IsolatedTracksNxN::printTrack(), BeamFitter::readEvent(), and stripLayersWithMeasurement().

                                                    {
  int count = 0;
  uint32_t substr = StripSubdetector::TIB;
  for (uint32_t layer=1; layer<=4; layer++) {
    if (getTrackerLayerCase(substr, layer) == 0) count++;
  }
  return count;
}
int HitPattern::stripTIBLayersWithoutMeasurement ( ) const

Definition at line 414 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TIB.

Referenced by IsolatedTracksNxN::analyze(), and stripLayersWithoutMeasurement().

                                                       {
  int count = 0;
  uint32_t substr = StripSubdetector::TIB;
  for (uint32_t layer=1; layer<=4; layer++) {
    if (getTrackerLayerCase(substr, layer) == 1) count++;
  }
  return count;
}
bool reco::HitPattern::stripTIDHitFilter ( uint32_t  pattern) [inline, static]
int HitPattern::stripTIDLayersNull ( ) const

Definition at line 537 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TID.

Referenced by stripLayersNull().

                                         {
  int count = 0;
  uint32_t substr = StripSubdetector::TID;
  for (uint32_t layer=1; layer<=3; layer++) {
    if (getTrackerLayerCase(substr, layer) == 999999) count++;
  }
  return count;
}
int HitPattern::stripTIDLayersTotallyOffOrBad ( ) const

Definition at line 480 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TID.

Referenced by stripLayersTotallyOffOrBad().

                                                    {
  int count = 0;
  uint32_t substr = StripSubdetector::TID;
  for (uint32_t layer=1; layer<=3; layer++) {
    if (getTrackerLayerCase(substr, layer) == 2) count++;
  }
  return count;
}
int HitPattern::stripTIDLayersWithMeasurement ( ) const

Definition at line 366 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TID.

Referenced by IsolatedTracksNxN::analyze(), IsolatedTracksNxN::printTrack(), BeamFitter::readEvent(), and stripLayersWithMeasurement().

                                                    {
  int count = 0;
  uint32_t substr = StripSubdetector::TID;
  for (uint32_t layer=1; layer<=3; layer++) {
    if (getTrackerLayerCase(substr, layer) == 0) count++;
  }
  return count;
}
int HitPattern::stripTIDLayersWithoutMeasurement ( ) const

Definition at line 423 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TID.

Referenced by IsolatedTracksNxN::analyze(), and stripLayersWithoutMeasurement().

                                                       {
  int count = 0;
  uint32_t substr = StripSubdetector::TID;
  for (uint32_t layer=1; layer<=3; layer++) {
    if (getTrackerLayerCase(substr, layer) == 1) count++;
  }
  return count;
}
bool reco::HitPattern::stripTOBHitFilter ( uint32_t  pattern) [inline, static]
int HitPattern::stripTOBLayersNull ( ) const

Definition at line 546 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TOB.

Referenced by stripLayersNull().

                                         {
  int count = 0;
  uint32_t substr = StripSubdetector::TOB;
  for (uint32_t layer=1; layer<=6; layer++) {
    if (getTrackerLayerCase(substr, layer) == 999999) count++;
  }
  return count;
}
int HitPattern::stripTOBLayersTotallyOffOrBad ( ) const

Definition at line 489 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TOB.

Referenced by stripLayersTotallyOffOrBad().

                                                    {
  int count = 0;
  uint32_t substr = StripSubdetector::TOB;
  for (uint32_t layer=1; layer<=6; layer++) {
    if (getTrackerLayerCase(substr, layer) == 2) count++;
  }
  return count;
}
int HitPattern::stripTOBLayersWithMeasurement ( ) const

Definition at line 375 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TOB.

Referenced by IsolatedTracksNxN::analyze(), spr::goodTrack(), IsolatedTracksNxN::printTrack(), BeamFitter::readEvent(), and stripLayersWithMeasurement().

                                                    {
  int count = 0;
  uint32_t substr = StripSubdetector::TOB;
  for (uint32_t layer=1; layer<=6; layer++) {
    if (getTrackerLayerCase(substr, layer) == 0) count++;
  }
  return count;
}
int HitPattern::stripTOBLayersWithoutMeasurement ( ) const

Definition at line 432 of file HitPattern.cc.

References prof2calltree::count, getTrackerLayerCase(), and sistripsummary::TOB.

Referenced by IsolatedTracksNxN::analyze(), and stripLayersWithoutMeasurement().

                                                       {
  int count = 0;
  uint32_t substr = StripSubdetector::TOB;
  for (uint32_t layer=1; layer<=6; layer++) {
    if (getTrackerLayerCase(substr, layer) == 1) count++;
  }
  return count;
}
bool reco::HitPattern::trackerHitFilter ( uint32_t  pattern) [inline, static]
int reco::HitPattern::trackerLayersNull ( ) const [inline]

Definition at line 774 of file HitPattern.h.

References pixelLayersNull(), and stripLayersNull().

                                                 {
    return pixelLayersNull() + 
      stripLayersNull();
  }
int reco::HitPattern::trackerLayersTotallyOffOrBad ( ) const [inline]
int reco::HitPattern::trackerLayersWithMeasurement ( ) const [inline]
int reco::HitPattern::trackerLayersWithoutMeasurement ( ) const [inline]
bool reco::HitPattern::type_1_HitFilter ( uint32_t  pattern) [inline, static]
bool reco::HitPattern::type_2_HitFilter ( uint32_t  pattern) [inline, static]
bool reco::HitPattern::type_3_HitFilter ( uint32_t  pattern) [inline, static]

Definition at line 560 of file HitPattern.h.

References getHitType().

Referenced by numberOfBadHits().

                                                            {
    if (getHitType(pattern) == 3) return true; 
    return false;
  }
bool reco::HitPattern::validHitFilter ( uint32_t  pattern) [inline, static]

Member Data Documentation

Definition at line 383 of file HitPattern.h.

Referenced by getHitPattern(), HitPattern(), set(), and setHitPattern().

const unsigned short reco::HitPattern::HitSize = 11 [static]
const unsigned short reco::HitPattern::HitTypeMask = 0x3 [static, private]

Definition at line 380 of file HitPattern.h.

Referenced by encode(), getHitType(), getTrackerLayerCase(), and getTrackerMonoStereo().

const unsigned short reco::HitPattern::HitTypeOffset = 0 [static, private]

Definition at line 379 of file HitPattern.h.

Referenced by encode(), getHitType(), getTrackerLayerCase(), and getTrackerMonoStereo().

const unsigned short reco::HitPattern::LayerMask = 0xF [static, private]
const unsigned short reco::HitPattern::LayerOffset = 3 [static, private]
const int reco::HitPattern::MaxHits = (PatternSize * 32) / HitSize [static]

Definition at line 132 of file HitPattern.h.

const unsigned short reco::HitPattern::PatternSize = 25 [static]
const unsigned short reco::HitPattern::SideMask = 0x1 [static, private]

Definition at line 376 of file HitPattern.h.

Referenced by encode(), and getSide().

const unsigned short reco::HitPattern::SideOffset = 2 [static, private]

Definition at line 375 of file HitPattern.h.

Referenced by encode(), and getSide().

const unsigned short reco::HitPattern::SubDetectorMask = 0x1 [static, private]
const unsigned short reco::HitPattern::SubDetectorOffset = 10 [static, private]
const unsigned short reco::HitPattern::SubstrMask = 0x7 [static, private]
const unsigned short reco::HitPattern::SubstrOffset = 7 [static, private]

Definition at line 367 of file HitPattern.h.

Referenced by encode(), getSubStructure(), getTrackerLayerCase(), and getTrackerMonoStereo().