CMS 3D CMS Logo

GlobalTrackingRegion.cc
Go to the documentation of this file.
2 #include <cmath>
3 #include <sstream>
8 
15 
16 template <class T>
17 T sqr(T t) {
18  return t * t;
19 }
20 
21 using namespace GeomDetEnumerators;
22 
24  std::ostringstream str;
25  str << TrackingRegionBase::print() << "precise: " << thePrecise;
26  return str.str();
27 }
28 
30  const SeedingLayerSetsHits::SeedingLayer& layer) const {
31  return layer.hits();
32 }
33 
34 std::unique_ptr<HitRZCompatibility> GlobalTrackingRegion::checkRZ(const DetLayer* layer,
35  const Hit& outerHit,
36  const edm::EventSetup& iSetup,
37  const DetLayer* outerlayer,
38  float lr,
39  float gz,
40  float dr,
41  float dz) const {
42  bool isBarrel = layer->isBarrel();
43  bool isPixel = (layer->subDetector() == PixelBarrel || layer->subDetector() == PixelEndcap);
44 
45  if UNLIKELY (!outerlayer) {
46  GlobalPoint ohit = outerHit->globalPosition();
47  lr = std::sqrt(sqr(ohit.x() - origin().x()) + sqr(ohit.y() - origin().y()));
48  gz = ohit.z();
49  dr = outerHit->errorGlobalR();
50  dz = outerHit->errorGlobalZ();
51  }
52 
53  PixelRecoPointRZ outerred(lr, gz);
54 
55  PixelRecoPointRZ vtxR = (gz > origin().z() + originZBound())
56  ? PixelRecoPointRZ(-originRBound(), origin().z() + originZBound())
57  : PixelRecoPointRZ(originRBound(), origin().z() + originZBound());
58  PixelRecoPointRZ vtxL = (gz < origin().z() - originZBound())
59  ? PixelRecoPointRZ(-originRBound(), origin().z() - originZBound())
60  : PixelRecoPointRZ(originRBound(), origin().z() - originZBound());
61 
62  if UNLIKELY ((!thePrecise) && (isPixel)) {
63  auto VcotMin = PixelRecoLineRZ(vtxR, outerred).cotLine();
64  auto VcotMax = PixelRecoLineRZ(vtxL, outerred).cotLine();
65  return std::make_unique<HitEtaCheck>(isBarrel, outerred, VcotMax, VcotMin);
66  }
67 
68  constexpr float nSigmaPhi = 3.;
69 
70  dr *= nSigmaPhi;
71  dz *= nSigmaPhi;
72 
73  PixelRecoPointRZ outerL, outerR;
74  if (isBarrel) {
75  outerL = PixelRecoPointRZ(lr, gz - dz);
76  outerR = PixelRecoPointRZ(lr, gz + dz);
77  } else if (gz > 0) {
78  outerL = PixelRecoPointRZ(lr + dr, gz);
79  outerR = PixelRecoPointRZ(lr - dr, gz);
80  } else {
81  outerL = PixelRecoPointRZ(lr - dr, gz);
82  outerR = PixelRecoPointRZ(lr + dr, gz);
83  }
84 
85  auto corr = isBarrel ? dz : dr;
86 
87  SimpleLineRZ leftLine(vtxL, outerL);
88  SimpleLineRZ rightLine(vtxR, outerR);
89  HitRZConstraint rzConstraint(leftLine, rightLine);
90 
91  if UNLIKELY (theUseMS) {
92  MultipleScatteringParametrisation iSigma(layer, iSetup);
93  PixelRecoPointRZ vtxMean(0., origin().z());
94 
95  float innerScatt = 3.f * (outerlayer ? iSigma(ptMin(), vtxMean, outerred, outerlayer->seqNum())
96  : iSigma(ptMin(), vtxMean, outerred));
97 
98  float cotTheta = SimpleLineRZ(vtxMean, outerred).cotLine();
99 
100  if (isBarrel) {
101  float sinTheta = 1 / std::sqrt(1 + sqr(cotTheta));
102  corr = innerScatt / sinTheta + dz;
103  } else {
104  float cosTheta = 1 / std::sqrt(1 + sqr(1 / cotTheta));
105  corr = innerScatt / cosTheta + dr;
106  }
107  }
108 
109  if (isBarrel) {
110  return std::make_unique<HitZCheck>(rzConstraint, HitZCheck::Margin(corr, corr));
111  } else {
112  return std::make_unique<HitRCheck>(rzConstraint, HitRCheck::Margin(corr, corr));
113  }
114 }
115 
116 void GlobalTrackingRegion::checkTracks(reco::TrackCollection const& tracks, std::vector<bool>& mask) const {
117  const math::XYZPoint regOrigin(origin().x(), origin().y(), origin().z());
118 
119  assert(mask.size() == tracks.size());
120  int i = -1;
121  for (auto const& track : tracks) {
122  i++;
123  if (mask[i])
124  continue;
125 
126  if (track.pt() < ptMin()) {
127  continue;
128  }
129  if (std::abs(track.dxy(regOrigin)) > originRBound()) {
130  continue;
131  }
132  if (std::abs(track.dz(regOrigin)) > originZBound()) {
133  continue;
134  }
135 
136  mask[i] = true;
137  }
138 }
Hit
Definition: HitCollection.h:12
PixelRecoPointRZ.h
nSigmaPhi
constexpr float nSigmaPhi
Definition: PixelTripletLargeTipGenerator.cc:44
GlobalTrackingRegion::checkRZ
std::unique_ptr< HitRZCompatibility > checkRZ(const DetLayer *layer, const Hit &outerHit, const edm::EventSetup &iSetup, const DetLayer *outerlayer=nullptr, float lr=0, float gz=0, float dr=0, float dz=0) const override
Definition: GlobalTrackingRegion.cc:34
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
GlobalTrackingRegion.h
mps_fire.i
i
Definition: mps_fire.py:428
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
TrackerGeometry.h
DetLayer::subDetector
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel,...
DetLayer
Definition: DetLayer.h:21
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
SimpleLineRZ::cotLine
float cotLine() const
Definition: PixelRecoLineRZ.h:74
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
cms::cuda::assert
assert(be >=bs)
GlobalTrackingRegion::hits
TrackingRegion::Hits hits(const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayer &layer) const override
get hits from layer compatible with region constraints
Definition: GlobalTrackingRegion.cc:29
GlobalTrackingRegion::checkTracks
void checkTracks(reco::TrackCollection const &tracks, std::vector< bool > &mask) const override
Definition: GlobalTrackingRegion.cc:116
TrackingRegion::print
virtual std::string print() const
Definition: TrackingRegion.h:126
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
GeomDetEnumerators::PixelBarrel
Definition: GeomDetEnumerators.h:11
GlobalTrackingRegion::print
std::string print() const override
Definition: GlobalTrackingRegion.cc:23
TrackingRegion::Hits
SeedingLayerSetsHits::Hits Hits
Definition: TrackingRegion.h:47
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
str
#define str(s)
Definition: TestProcessor.cc:51
HitRZConstraint
Definition: HitRZConstraint.h:8
PixelRecoUtilities.h
Point3DBase< float, GlobalTag >
DetLayer::seqNum
int seqNum() const
Definition: DetLayer.h:35
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
TrackerDigiGeometryRecord.h
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
fastTrackerRecHitType::isPixel
bool isPixel(HitType hitType)
Definition: FastTrackerRecHit.h:37
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
PixelRecoLineRZ
Definition: PixelRecoLineRZ.h:12
GeomDetEnumerators::isBarrel
bool isBarrel(GeomDetEnumerators::SubDetector m)
Definition: GeomDetEnumerators.cc:57
TkTrackingRegionsMargin< float >
edm::EventSetup
Definition: EventSetup.h:57
HitRCheck.h
HitZCheck.h
SeedingLayerSetsHits::SeedingLayer
Definition: SeedingLayerSetsHits.h:37
PixelRecoPointRZ
Definition: PixelRecoPointRZ.h:6
SeedingLayerSetsHits::SeedingLayer::hits
Hits hits() const
Definition: SeedingLayerSetsHits.h:51
HitEtaCheck.h
sqr
T sqr(T t)
Definition: GlobalTrackingRegion.cc:17
MultipleScatteringParametrisation.h
SimpleLineRZ
Definition: PixelRecoLineRZ.h:63
GeomDetEnumerators
Definition: GeomDetEnumerators.h:8
PVValHelper::dz
Definition: PVValidationHelpers.h:50
PixelRecoLineRZ::cotLine
float cotLine() const
Definition: PixelRecoLineRZ.h:31
T
long double T
Definition: Basic3DVectorLD.h:48
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
DetLayer.h
PixelRecoLineRZ.h
GeomDetEnumerators::PixelEndcap
Definition: GeomDetEnumerators.h:12
MultipleScatteringParametrisation
Definition: MultipleScatteringParametrisation.h:16
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
vtxMean
static GlobalPoint vtxMean(const GlobalPoint &p1, const GlobalError &e1, const GlobalPoint &p2, const GlobalError &e2)
Definition: GhostTrackVertexFinder.cc:123
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
DetLayer::isBarrel
bool isBarrel() const
Definition: DetLayer.h:31