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();
108 const std::vector<const DetLayer*>& thirdLayerDetLayer,
109 const int nThirdLayers) {
118 const std::vector<const DetLayer*>& thirdLayerDetLayer,
119 const int nThirdLayers,
120 std::vector<int>* tripletLastLayerIndex) {
123 float regOffset =
region.origin().perp();
131 std::vector<NodeInfo> layerTree;
132 std::vector<unsigned int> foundNodes;
133 foundNodes.reserve(100);
136 float rzError[nThirdLayers];
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;
189 float imppar =
region.originRBound();
190 float imppartmp =
region.originRBound() +
region.origin().perp();
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);
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);
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;
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;
T getParameter(std::string const &) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void initLayer(const DetLayer *layer)
void setAllowAnything()
allow any parameter label/value pairs
PixelRecoRange< float > Range
constexpr T normalizedPhi(T phi)
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)
edm::ESGetToken< MultipleScatteringParametrisationMaker, TrackerMultipleScatteringRecord > msmakerToken_
constexpr double nSigmaRZ
static void fillDescriptions(edm::ParameterSetDescription &desc)
static void fillDescriptions(edm::ParameterSetDescription &desc)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
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
ParameterDescriptionBase * add(U const &iLabel, T const &value)
constexpr float nSigmaPhi
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
const bool useFixedPreFiltering
std::unique_ptr< HitPairGeneratorFromLayerPair > thePairGenerator
~PixelTripletHLTGenerator() override
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
constexpr bool checkPhiInRange(T phi, T phi1, T phi2, float maxDphi=float(M_PI))
#define declareDynArray(T, n, x)
void initTolerance(float tolerance)
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > fieldToken_
const float extraHitRPhitolerance
T angle(T x1, T y1, T z1, T x2, T y2, T z2)