CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
PFCheckHitPattern Class Reference

PFCheckHitPatter. More...

#include <PFCheckHitPattern.h>

Public Types

typedef std::pair< PFTrackHitInfo, PFTrackHitInfoPFTrackHitFullInfo
 
typedef std::pair< unsigned int, unsigned int > PFTrackHitInfo
 

Public Member Functions

PFTrackHitFullInfo analyze (const TrackerTopology *tkerTopo, const TrackerGeometry *tkerGeom, const reco::TrackBaseRef track, const TransientVertex &vert)
 
 PFCheckHitPattern ()
 
void print (const reco::TrackBaseRef track) const
 Print hit pattern on track. More...
 
 ~PFCheckHitPattern ()
 

Private Types

typedef std::pair< uint32_t, uint32_t > DetInfo
 
typedef std::map< DetInfo, std::pair< double, double > > RZrangeMap
 

Private Member Functions

void init (const TrackerTopology *, const TrackerGeometry *)
 Create map indicating r/z values of all layers/disks. More...
 
void print (const reco::HitPattern::HitCategory, const reco::HitPattern &hp) const
 

Static Private Member Functions

static bool barrel (uint32_t subDet)
 Return a bool indicating if a given subdetector is in the barrel. More...
 

Private Attributes

bool geomInitDone_
 Note if geometry info is already initialized. More...
 
RZrangeMap rangeRorZ_
 

Detailed Description

PFCheckHitPatter.

Author
Ian Tomalin, modified by Maxime Gouzevitch
Date
October 2009

Definition at line 34 of file PFCheckHitPattern.h.

Member Typedef Documentation

typedef std::pair<uint32_t, uint32_t> PFCheckHitPattern::DetInfo
private

a pair<uint32, uint32> consisting of the numbers used by HitPattern to identify subdetector and layer number respectively.

Definition at line 65 of file PFCheckHitPattern.h.

Definition at line 43 of file PFCheckHitPattern.h.

typedef std::pair<unsigned int, unsigned int> PFCheckHitPattern::PFTrackHitInfo

Definition at line 42 of file PFCheckHitPattern.h.

typedef std::map< DetInfo, std::pair< double, double> > PFCheckHitPattern::RZrangeMap
private

For a given subdetector & layer number, this stores the minimum and maximum r (or z) values if it is barrel (or endcap) respectively.

Definition at line 78 of file PFCheckHitPattern.h.

Constructor & Destructor Documentation

PFCheckHitPattern::PFCheckHitPattern ( )
inline

Definition at line 38 of file PFCheckHitPattern.h.

38 : geomInitDone_(false) {}
bool geomInitDone_
Note if geometry info is already initialized.
PFCheckHitPattern::~PFCheckHitPattern ( )
inline

Definition at line 40 of file PFCheckHitPattern.h.

40 {}

Member Function Documentation

pair< PFCheckHitPattern::PFTrackHitInfo, PFCheckHitPattern::PFTrackHitInfo > PFCheckHitPattern::analyze ( const TrackerTopology tkerTopo,
const TrackerGeometry tkerGeom,
const reco::TrackBaseRef  track,
const TransientVertex vert 
)

PFCheck if hit pattern of this track is consistent with it being produced at given vertex. Pair.first gives number of hits on track in front of vertex. Pair.second gives number of missing hits between vertex and innermost hit on track.

Definition at line 79 of file PFCheckHitPattern.cc.

References Reference_intrackfit_cff::barrel, edm::RefToBase< T >::get(), reco::HitPattern::getHitPattern(), reco::HitPattern::getLayer(), reco::HitPattern::getSubStructure(), reco::TrackBase::hitPattern(), AnalysisDataFormats_SUSYBSMObjects::hp, mps_fire::i, init, reco::HitPattern::MISSING_INNER_HITS, reco::HitPattern::missingHitFilter(), reco::HitPattern::numberOfAllHits(), PV3DBase< T, PVType, FrameType >::perp(), TransientVertex::position(), reco::HitPattern::TRACK_HITS, reco::HitPattern::trackerHitFilter(), reco::HitPattern::validHitFilter(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by PFDisplacedVertexFinder::fitVertexFromSeed().

81 {
82 
83  // PFCheck if hit pattern of this track is consistent with it being produced
84  // at given vertex. Pair.first gives number of hits on track in front of vertex.
85  // Pair.second gives number of missing hits between vertex and innermost hit
86  // on track.
87 
88  // Initialise geometry info if not yet done.
89  if (!geomInitDone_) this->init(tkerTopo, tkerGeom);
90 
91  // Get hit patterns of this track
92  const reco::HitPattern& hp = track.get()->hitPattern();
93 
94  // Count number of valid hits on track definately in front of the vertex,
95  // taking into account finite depth of each layer.
96  unsigned int nHitBefore = 0;
97  unsigned int nHitAfter = 0;
98 
99  for (int i = 0; i < hp.numberOfAllHits(HitPattern::TRACK_HITS); i++) {
100  uint32_t hit = hp.getHitPattern(HitPattern::TRACK_HITS, i);
101  if (hp.trackerHitFilter(hit) && hp.validHitFilter(hit)) {
102  uint32_t subDet = hp.getSubStructure(hit);
103  uint32_t layer = hp.getLayer(hit);
104  DetInfo detInfo(subDet, layer);
105  double maxRZ = rangeRorZ_[detInfo].second;
106 
107  if (this->barrel(subDet)) {
108  if (vert.position().perp() > maxRZ) nHitBefore++;
109  else nHitAfter++;
110  } else {
111  if (fabs(vert.position().z()) > maxRZ) nHitBefore++;
112  else nHitAfter++;
113  }
114  }
115  }
116 
117  // Count number of missing hits before the innermost hit on the track,
118  // taking into account finite depth of each layer.
119  unsigned int nMissHitAfter = 0;
120  unsigned int nMissHitBefore = 0;
121 
122  for (int i = 0; i < hp.numberOfAllHits(HitPattern::MISSING_INNER_HITS); i++) {
123  uint32_t hit = hp.getHitPattern(HitPattern::MISSING_INNER_HITS, i);
125  uint32_t subDet = reco::HitPattern::getSubStructure(hit);
126  uint32_t layer = reco::HitPattern::getLayer(hit);
127  DetInfo detInfo(subDet, layer);
128  double minRZ = rangeRorZ_[detInfo].first;
129 
130  // cout << "subDet = " << subDet << " layer = " << layer << " minRZ = " << minRZ << endl;
131 
132  if (this->barrel(subDet)) {
133  if (vert.position().perp() < minRZ) nMissHitAfter++;
134  else nMissHitBefore++;
135  } else {
136  if (fabs(vert.position().z()) < minRZ) nMissHitAfter++;
137  else nMissHitBefore++;
138  }
139  }
140  }
141 
142 
143  PFTrackHitInfo trackToVertex(nHitBefore, nMissHitBefore);
144  PFTrackHitInfo trackFromVertex(nHitAfter, nMissHitAfter);
145 
146 
147  return pair< PFTrackHitInfo, PFTrackHitInfo>(trackToVertex, trackFromVertex);
148 }
value_type const * get() const
Definition: RefToBase.h:234
bool geomInitDone_
Note if geometry info is already initialized.
static uint32_t getLayer(uint16_t pattern)
Definition: HitPattern.h:700
T perp() const
Definition: PV3DBase.h:72
static bool missingHitFilter(uint16_t pattern)
Definition: HitPattern.h:792
static bool validHitFilter(uint16_t pattern)
Definition: HitPattern.h:787
std::pair< unsigned int, unsigned int > PFTrackHitInfo
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
GlobalPoint position() const
T z() const
Definition: PV3DBase.h:64
int numberOfAllHits(HitCategory category) const
Definition: HitPattern.h:807
void init(const TrackerTopology *, const TrackerGeometry *)
Create map indicating r/z values of all layers/disks.
static uint32_t getSubStructure(uint16_t pattern)
Definition: HitPattern.h:691
static bool trackerHitFilter(uint16_t pattern)
Definition: HitPattern.h:677
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:446
std::pair< uint32_t, uint32_t > DetInfo
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:515
static bool barrel(uint32_t subDet)
Return a bool indicating if a given subdetector is in the barrel.
bool PFCheckHitPattern::barrel ( uint32_t  subDet)
staticprivate

Return a bool indicating if a given subdetector is in the barrel.

Definition at line 71 of file PFCheckHitPattern.cc.

References PixelSubdetector::PixelBarrel, StripSubdetector::TIB, and StripSubdetector::TOB.

71  {
72  // Determines if given sub-detector is in the barrel.
73  return (subDet == StripSubdetector::TIB || subDet == StripSubdetector::TOB ||
75 }
void PFCheckHitPattern::init ( const TrackerTopology tkerTopo,
const TrackerGeometry tkerGeom 
)
private

Create map indicating r/z values of all layers/disks.

Definition at line 20 of file PFCheckHitPattern.cc.

References Reference_intrackfit_cff::barrel, edmIntegrityCheck::d, TrackerGeometry::dets(), mps_fire::i, TrackerTopology::layer(), and position.

20  {
21 
22  //
23  // Note min/max radius (z) of each barrel layer (endcap disk).
24  //
25 
26  geomInitDone_ = true;
27 
28  // Get Tracker geometry
29  const TrackingGeometry::DetContainer& dets = tkerGeom->dets();
30 
31  // Loop over all modules in the Tracker.
32  for (unsigned int i = 0; i < dets.size(); i++) {
33 
34  // Get subdet and layer of this module
35  auto detId = dets[i]->geographicalId();
36  auto detInfo = DetInfo(detId.subdetId(), tkerTopo->layer(detId));
37  uint32_t subDet = detInfo.first;
38 
39  // Note r (or z) of module if barrel (or endcap).
40  double r_or_z;
41  if (this->barrel(subDet)) {
42  r_or_z = dets[i]->position().perp();
43  } else {
44  r_or_z = fabs(dets[i]->position().z());
45  }
46 
47  // Recover min/max r/z value of this layer/disk found so far.
48  double minRZ = 999.;
49  double maxRZ = 0.;
50  if (rangeRorZ_.find(detInfo) != rangeRorZ_.end()) {
51  minRZ = rangeRorZ_[detInfo].first;
52  maxRZ = rangeRorZ_[detInfo].second;
53  }
54 
55  // Update with those of this module if it exceeds them.
56  if (minRZ > r_or_z) minRZ = r_or_z;
57  if (maxRZ < r_or_z) maxRZ = r_or_z;
58  rangeRorZ_[detInfo] = pair<double, double>(minRZ, maxRZ);
59  }
60 
61 #if 0
62  //def DEBUG_CHECKHITPATTERN
63  RZrangeMap::const_iterator d;
64  for (d = rangeRorZ_.begin(); d != rangeRorZ_.end(); d++) {
65  DetInfo detInfo = d->first;
66  pair<double, double> rangeRZ = d->second;
67  }
68 #endif
69 }
bool geomInitDone_
Note if geometry info is already initialized.
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
unsigned int layer(const DetId &id) const
std::vector< const GeomDet * > DetContainer
std::pair< uint32_t, uint32_t > DetInfo
static int position[264][3]
Definition: ReadPGInfo.cc:509
static bool barrel(uint32_t subDet)
Return a bool indicating if a given subdetector is in the barrel.
void PFCheckHitPattern::print ( const reco::TrackBaseRef  track) const

Print hit pattern on track.

Definition at line 150 of file PFCheckHitPattern.cc.

References gather_cfg::cout, edm::RefToBase< T >::get(), reco::TrackBase::hitPattern(), AnalysisDataFormats_SUSYBSMObjects::hp, reco::HitPattern::MISSING_INNER_HITS, edm::print(), and reco::HitPattern::TRACK_HITS.

150  {
151  // Get hit patterns of this track
152  const reco::HitPattern &hp = track.get()->hitPattern();
153 
154  cout<<"=== Hits on Track ==="<<endl;
156  cout<<"=== Hits before track ==="<<endl;
158 }
value_type const * get() const
Definition: RefToBase.h:234
void print(const reco::TrackBaseRef track) const
Print hit pattern on track.
susybsm::HSCParticleRefProd hp
Definition: classes.h:27
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:446
void PFCheckHitPattern::print ( const reco::HitPattern::HitCategory  category,
const reco::HitPattern hp 
) const
private

Definition at line 160 of file PFCheckHitPattern.cc.

References gather_cfg::cout, reco::HitPattern::getHitPattern(), reco::HitPattern::getHitType(), reco::HitPattern::getLayer(), reco::HitPattern::getSubStructure(), mps_fire::i, reco::HitPattern::numberOfAllHits(), and reco::HitPattern::trackerHitFilter().

160  {
161  for (int i = 0; i < hp.numberOfAllHits(category); i++) {
162  uint32_t hit = hp.getHitPattern(category, i);
163  if (hp.trackerHitFilter(hit)) {
164  uint32_t subdet = hp.getSubStructure(hit);
165  uint32_t layer = hp.getLayer(hit);
166  cout<<"hit "<<i<<" subdet="<<subdet<<" layer="<<layer<<" type "<<hp.getHitType(hit)<<endl;
167  }
168  }
169 }
static uint32_t getLayer(uint16_t pattern)
Definition: HitPattern.h:700
static uint32_t getHitType(uint16_t pattern)
Definition: HitPattern.h:733
int numberOfAllHits(HitCategory category) const
Definition: HitPattern.h:807
static uint32_t getSubStructure(uint16_t pattern)
Definition: HitPattern.h:691
static bool trackerHitFilter(uint16_t pattern)
Definition: HitPattern.h:677
uint16_t getHitPattern(HitCategory category, int position) const
Definition: HitPattern.h:515

Member Data Documentation

bool PFCheckHitPattern::geomInitDone_
private

Note if geometry info is already initialized.

Definition at line 74 of file PFCheckHitPattern.h.

RZrangeMap PFCheckHitPattern::rangeRorZ_
private

Definition at line 79 of file PFCheckHitPattern.h.