38 useMScat(cfg.getParameter<bool>(
"useMultScattering")),
39 useBend(cfg.getParameter<bool>(
"useBending")),
43 if (comparitorName !=
"none") {
55 desc.
add<
double>(
"extraHitRPhitolerance", 0.032);
56 desc.
add<
double>(
"extraHitRZtolerance", 0.037);
57 desc.
add<
bool>(
"useMultScattering",
true);
58 desc.
add<
bool>(
"useBending",
true);
59 desc.
add<
bool>(
"useFixedPreFiltering",
false);
60 desc.
add<
double>(
"phiPreFiltering", 0.3);
73 const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers) {
87 const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers,
88 std::vector<int>* tripletLastLayerIndex,
93 int size = thirdLayers.size();
95 vector<const DetLayer*> thirdLayerDetLayer(size,
nullptr);
96 for (
int il = 0; il <
size; ++il) {
97 thirdHitMap[il] = &layerCache(thirdLayers[il], region);
98 thirdLayerDetLayer[il] = thirdLayers[il].detLayer();
100 hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, size, tripletLastLayerIndex);
108 const std::vector<const DetLayer*>& thirdLayerDetLayer,
109 const int nThirdLayers) {
110 hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, nThirdLayers,
nullptr);
118 const std::vector<const DetLayer*>& thirdLayerDetLayer,
119 const int nThirdLayers,
120 std::vector<int>* tripletLastLayerIndex) {
131 std::vector<NodeInfo> layerTree;
132 std::vector<unsigned int> foundNodes;
133 foundNodes.reserve(100);
136 float rzError[nThirdLayers];
138 const float maxDelphi = region.
ptMin() < 0.3f ? float(
M_PI) / 4.f : float(
M_PI) / 8.f;
139 const float maxphi =
M_PI + maxDelphi, minphi = -maxphi;
140 const float safePhi =
M_PI - maxDelphi;
149 for (
int il = 0; il < nThirdLayers; ++il) {
150 auto const& hits = *thirdHitMap[il];
155 corrections[il].init(region.
ptMin(),
158 *thirdLayerDetLayer[il],
165 float minv = 999999.0f, maxv = -minv;
167 for (
unsigned int i = 0;
i != hits.size(); ++
i) {
173 float myerr = hits.dv[
i];
175 layerTree.emplace_back(
i,
angle,
v);
179 else if (
angle < -safePhi)
182 KDTreeBox phiZ(minphi, maxphi, minv - 0.01
f, maxv + 0.01
f);
184 hitTree[il].build(layerTree, phiZ);
185 rzError[il] = maxErr;
193 for (std::size_t ip = 0; ip != doublets.
size(); ip++) {
203 auto toPos = std::signbit(zo - zi);
223 for (
int il = 0; il != nThirdLayers; ++il) {
225 auto barrelLayer = layer->
isBarrel();
227 if ((!barrelLayer) & (toPos != std::signbit(layer->
position().
z())))
230 if (hitTree[il].
empty())
233 auto const& hits = *thirdHitMap[il];
239 auto& predictionRZ =
preds[il];
241 predictionRZ.initPropagator(&line);
242 Range rzRange = predictionRZ();
252 radius = predictionRZ.detRange();
255 Range(
max(rzRange.min(), predictionRZ.detSize().min()),
min(rzRange.max(), predictionRZ.detSize().max()));
262 auto rPhi1 = predictionRPhitmp(radius.max());
263 bool ok1 = !rPhi1.empty();
266 rPhi1.first /= radius.max();
267 rPhi1.second /= radius.max();
269 auto rPhi2 = predictionRPhitmp(radius.min());
270 bool ok2 = !rPhi2.empty();
273 rPhi2.first /= radius.min();
274 rPhi2.second /= radius.min();
279 rPhi1.second =
proxim(rPhi1.second, rPhi1.first);
281 rPhi2.first =
proxim(rPhi2.first, rPhi1.first);
282 rPhi2.second =
proxim(rPhi2.second, rPhi1.first);
283 phiRange = rPhi1.sum(rPhi2);
288 rPhi2.second =
proxim(rPhi2.second, rPhi2.first);
294 constexpr
float nSigmaRZ = 3.46410161514f;
298 float prmin = phiRange.min(), prmax = phiRange.max();
300 if (prmax - prmin > maxDelphi) {
301 auto prm = phiRange.mean();
302 prmin = prm - 0.5f * maxDelphi;
303 prmax = prm + 0.5f * maxDelphi;
307 Range regMax = predictionRZ.detRange();
308 Range regMin = predictionRZ(regMax.min() - regOffset);
309 regMax = predictionRZ(regMax.max() + regOffset);
312 if (regMax.min() < regMin.min()) {
313 swap(regMax, regMin);
315 KDTreeBox phiZ(prmin, prmax, regMin.min() - nSigmaRZ * rzError[il], regMax.max() + nSigmaRZ * rzError[il]);
316 hitTree[il].search(phiZ, foundNodes);
320 rzRange.min() - regOffset - nSigmaRZ * rzError[il],
321 rzRange.max() + regOffset + nSigmaRZ * rzError[il]);
322 hitTree[il].search(phiZ, foundNodes);
328 for (
auto KDdata : foundNodes) {
331 if (tripletLastLayerIndex)
332 tripletLastLayerIndex->clear();
333 edm::LogError(
"TooManyTriplets") <<
" number of triples exceeds maximum. no triplets produced.";
337 float p3_u = hits.u[KDdata];
338 float p3_v = hits.v[KDdata];
339 float p3_phi = hits.lphi[KDdata];
344 Range allowed = predictionRZ(p3_u);
346 float vErr = nSigmaRZ * hits.dv[KDdata];
347 Range hitRange(p3_v - vErr, p3_v + vErr);
349 if (crossingRange.empty())
352 float ir = 1.f / hits.rv(KDdata);
354 constexpr
float maxPhiErr = 0.5 *
M_PI;
355 float phiErr = nSigmaPhi * hits.drphi[KDdata] * ir;
356 phiErr =
std::min(maxPhiErr, phiErr);
358 for (
int icharge = -1; icharge <= 1; icharge += 2) {
359 Range rangeRPhi = predictionRPhi(hits.rv(KDdata), icharge);
360 if (rangeRPhi.first > rangeRPhi.second)
363 if (
checkPhiInRange(p3_phi, rangeRPhi.first * ir - phiErr, rangeRPhi.second * ir + phiErr, maxPhiErr)) {
368 result.push_back(hittriplet);
370 if (tripletLastLayerIndex)
371 tripletLastLayerIndex->push_back(il);
373 LogDebug(
"RejectedTriplet") <<
"rejected triplet from comparitor ";
380 LogDebug(
"RejectedTriplet") <<
"rejected triplet from second phicheck " << p3_phi;
float originRBound() const
bounds the particle vertex in the transverse plane
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
Log< level::Error, false > LogError
void swap(Association< C > &lhs, Association< C > &rhs)
T curvature(T InversePt, const MagneticField &field)
const unsigned int theMaxElement
std::unique_ptr< SeedComparitor > theComparitor
constexpr T proxim(T b, T a)
constexpr std::array< uint8_t, layerIndexSize > layer
tuple extraHitRZtolerance
float z(int i, layer l) const
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > msmakerToken_
bool getData(T &iHolder) const
constexpr double nSigmaRZ
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
tuple extraHitRPhitolerance
float y(int i, layer l) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
constexpr float nSigmaPhi
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
T getParameter(std::string const &) const
float ptMin() const
minimal pt of interest
constexpr float correction(int sizeM1, int q_f, int q_l, uint16_t upper_edge_first_pix, uint16_t lower_edge_last_pix, float lorentz_shift, float theThickness, float cot_angle, float pitch, bool first_is_big, bool last_is_big)
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
#define declareDynArray(T, n, x)
void initTolerance(float tolerance)
DetLayer const * detLayer(layer l) const
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > fieldToken_
unsigned int size() const override
float rv(int i, layer l) const
tuple size
Write out results.
const float extraHitRPhitolerance
tuple useFixedPreFiltering
T angle(T x1, T y1, T z1, T x2, T y2, T z2)