40 useMScat(cfg.getParameter<
bool>(
"useMultScattering")),
41 useBend(cfg.getParameter<
bool>(
"useBending")),
45 if (comparitorName !=
"none") {
54 desc.
add<
double>(
"extraHitRPhitolerance", 0.032);
55 desc.
add<
double>(
"extraHitRZtolerance", 0.037);
56 desc.
add<
bool>(
"useMultScattering",
true);
57 desc.
add<
bool>(
"useBending",
true);
58 desc.
add<
bool>(
"useFixedPreFiltering",
false);
59 desc.
add<
double>(
"phiPreFiltering", 0.3);
72 const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers) {
86 const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers,
87 std::vector<int>* tripletLastLayerIndex,
92 int size = thirdLayers.size();
94 vector<const DetLayer*> thirdLayerDetLayer(size,
nullptr);
95 for (
int il = 0; il <
size; ++il) {
96 thirdHitMap[il] = &layerCache(thirdLayers[il], region, es);
97 thirdLayerDetLayer[il] = thirdLayers[il].detLayer();
99 hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, size, tripletLastLayerIndex);
107 const std::vector<const DetLayer*>& thirdLayerDetLayer,
108 const int nThirdLayers) {
109 hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, nThirdLayers,
nullptr);
117 const std::vector<const DetLayer*>& thirdLayerDetLayer,
118 const int nThirdLayers,
119 std::vector<int>* tripletLastLayerIndex) {
130 std::vector<NodeInfo> layerTree;
131 std::vector<unsigned int> foundNodes;
132 foundNodes.reserve(100);
135 float rzError[nThirdLayers];
138 const float maxphi =
M_PI + maxDelphi, minphi = -maxphi;
139 const float safePhi =
M_PI - maxDelphi;
142 for (
int il = 0; il < nThirdLayers; ++il) {
143 auto const&
hits = *thirdHitMap[il];
148 corrections[il].init(es,
152 *thirdLayerDetLayer[il],
157 float minv = 999999.0f, maxv = -minv;
159 for (
unsigned int i = 0;
i !=
hits.size(); ++
i) {
165 float myerr =
hits.dv[
i];
167 layerTree.emplace_back(
i,
angle,
v);
171 else if (
angle < -safePhi)
174 KDTreeBox phiZ(minphi, maxphi, minv - 0.01
f, maxv + 0.01
f);
176 hitTree[il].build(layerTree, phiZ);
177 rzError[il] = maxErr;
185 for (std::size_t ip = 0; ip != doublets.
size(); ip++) {
195 auto toPos = std::signbit(zo - zi);
215 for (
int il = 0; il != nThirdLayers; ++il) {
216 const DetLayer* layer = thirdLayerDetLayer[il];
217 auto barrelLayer = layer->
isBarrel();
219 if ((!barrelLayer) & (toPos != std::signbit(layer->
position().
z())))
222 if (hitTree[il].
empty())
225 auto const&
hits = *thirdHitMap[il];
231 auto& predictionRZ = preds[il];
233 predictionRZ.initPropagator(&line);
234 Range rzRange = predictionRZ();
244 radius = predictionRZ.detRange();
247 Range(
max(rzRange.min(), predictionRZ.detSize().min()),
min(rzRange.max(), predictionRZ.detSize().max()));
254 auto rPhi1 = predictionRPhitmp(radius.max());
255 bool ok1 = !rPhi1.empty();
258 rPhi1.first /= radius.max();
259 rPhi1.second /= radius.max();
261 auto rPhi2 = predictionRPhitmp(radius.min());
262 bool ok2 = !rPhi2.empty();
265 rPhi2.first /= radius.min();
266 rPhi2.second /= radius.min();
271 rPhi1.second =
proxim(rPhi1.second, rPhi1.first);
273 rPhi2.first =
proxim(rPhi2.first, rPhi1.first);
274 rPhi2.second =
proxim(rPhi2.second, rPhi1.first);
275 phiRange = rPhi1.sum(rPhi2);
280 rPhi2.second =
proxim(rPhi2.second, rPhi2.first);
290 float prmin = phiRange.min(), prmax = phiRange.max();
292 if (prmax - prmin > maxDelphi) {
293 auto prm = phiRange.mean();
294 prmin = prm - 0.5f * maxDelphi;
295 prmax = prm + 0.5f * maxDelphi;
299 Range regMax = predictionRZ.detRange();
300 Range regMin = predictionRZ(regMax.min() - regOffset);
301 regMax = predictionRZ(regMax.max() + regOffset);
304 if (regMax.min() < regMin.min()) {
305 swap(regMax, regMin);
307 KDTreeBox phiZ(prmin, prmax, regMin.min() - nSigmaRZ * rzError[il], regMax.max() + nSigmaRZ * rzError[il]);
308 hitTree[il].search(phiZ, foundNodes);
312 rzRange.min() - regOffset - nSigmaRZ * rzError[il],
313 rzRange.max() + regOffset + nSigmaRZ * rzError[il]);
314 hitTree[il].search(phiZ, foundNodes);
320 for (
auto KDdata : foundNodes) {
323 if (tripletLastLayerIndex)
324 tripletLastLayerIndex->clear();
325 edm::LogError(
"TooManyTriplets") <<
" number of triples exceeds maximum. no triplets produced.";
329 float p3_u =
hits.u[KDdata];
330 float p3_v =
hits.v[KDdata];
331 float p3_phi =
hits.lphi[KDdata];
336 Range allowed = predictionRZ(p3_u);
338 float vErr = nSigmaRZ *
hits.dv[KDdata];
339 Range hitRange(p3_v - vErr, p3_v + vErr);
341 if (crossingRange.empty())
344 float ir = 1.f /
hits.rv(KDdata);
347 float phiErr = nSigmaPhi *
hits.drphi[KDdata] * ir;
348 phiErr =
std::min(maxPhiErr, phiErr);
350 for (
int icharge = -1; icharge <= 1; icharge += 2) {
351 Range rangeRPhi = predictionRPhi(
hits.rv(KDdata), icharge);
352 if (rangeRPhi.first > rangeRPhi.second)
355 if (
checkPhiInRange(p3_phi, rangeRPhi.first * ir - phiErr, rangeRPhi.second * ir + phiErr, maxPhiErr)) {
360 result.push_back(hittriplet);
362 if (tripletLastLayerIndex)
363 tripletLastLayerIndex->push_back(il);
365 LogDebug(
"RejectedTriplet") <<
"rejected triplet from comparitor ";
372 LogDebug(
"RejectedTriplet") <<
"rejected triplet from second phicheck " << p3_phi;
#define declareDynArray(T, n, x)
float originRBound() const
bounds the particle vertex in the transverse plane
T getParameter(std::string const &) const
GlobalPoint const & origin() const
void initLayer(const DetLayer *layer)
void setAllowAnything()
allow any parameter label/value pairs
PixelRecoRange< float > Range
constexpr T normalizedPhi(T phi)
float x(int i, layer l) const
const float extraHitRZtolerance
void swap(Association< C > &lhs, Association< C > &rhs)
const unsigned int theMaxElement
std::unique_ptr< SeedComparitor > theComparitor
constexpr T proxim(T b, T a)
float z(int i, layer l) const
T curvature(T InversePt, const edm::EventSetup &iSetup)
static void fillDescriptions(edm::ParameterSetDescription &desc)
static void fillDescriptions(edm::ParameterSetDescription &desc)
void hitTriplets(const TrackingRegion ®ion, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayerSet &pairLayers, const std::vector< SeedingLayerSetsHits::SeedingLayer > &thirdLayers) override
PixelTripletHLTGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
LayerCacheType * theLayerCache
float y(int i, layer l) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
unsigned int size() const override
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
const bool useFixedPreFiltering
float phi(int i, layer l) const
std::unique_ptr< HitPairGeneratorFromLayerPair > thePairGenerator
virtual const Surface::PositionType & position() const
Returns position of the surface.
~PixelTripletHLTGenerator() override
float ptMin() const
minimal pt of interest
constexpr bool checkPhiInRange(T phi, T phi1, T phi2, float maxDphi=float(M_PI))
Hit const & hit(int i, layer l) const
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
void initTolerance(float tolerance)
DetLayer const * detLayer(layer l) const
float rv(int i, layer l) const
const float extraHitRPhitolerance
T angle(T x1, T y1, T z1, T x2, T y2, T z2)