42 useMScat(cfg.getParameter<
bool>(
"useMultScattering")),
43 useBend(cfg.getParameter<
bool>(
"useBending")),
49 if(comparitorName !=
"none") {
58 desc.
add<
double>(
"extraHitRPhitolerance", 0.032);
59 desc.
add<
double>(
"extraHitRZtolerance", 0.037);
60 desc.
add<
bool>(
"useMultScattering",
true);
61 desc.
add<
bool>(
"useBending",
true);
62 desc.
add<
bool>(
"useFixedPreFiltering",
false);
63 desc.
add<
double>(
"phiPreFiltering", 0.3);
76 const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers)
88 const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers,
89 std::vector<int> *tripletLastLayerIndex,
93 int size = thirdLayers.size();
95 vector<const DetLayer *> thirdLayerDetLayer(size,
nullptr);
96 for (
int il=0; il<
size; ++il)
98 thirdHitMap[il] = &layerCache(thirdLayers[il], region, es);
99 thirdLayerDetLayer[il] = thirdLayers[il].detLayer();
101 hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, size, tripletLastLayerIndex);
110 const std::vector<const DetLayer *> & thirdLayerDetLayer,
111 const int nThirdLayers)
113 hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, nThirdLayers,
nullptr);
120 const std::vector<const DetLayer *> & thirdLayerDetLayer,
121 const int nThirdLayers,
122 std::vector<int> *tripletLastLayerIndex) {
133 std::vector<NodeInfo > layerTree;
134 std::vector<unsigned int> foundNodes;
135 foundNodes.reserve(100);
138 float rzError[nThirdLayers];
141 const float maxphi =
M_PI+maxDelphi, minphi = -maxphi;
142 const float safePhi =
M_PI-maxDelphi;
145 for (
int il=0; il<nThirdLayers; ++il) {
146 auto const &
hits = *thirdHitMap[il];
155 float minv=999999.0f, maxv= -minv;
157 for (
unsigned int i=0;
i!=
hits.size(); ++
i) {
162 float myerr =
hits.dv[
i];
164 layerTree.emplace_back(
i,
angle,
v);
169 KDTreeBox phiZ(minphi, maxphi, minv-0.01
f, maxv+0.01
f);
171 hitTree[il].build(layerTree, phiZ);
172 rzError[il] = maxErr;
180 for (std::size_t ip =0; ip!=doublets.
size(); ip++) {
190 auto toPos = std::signbit(zo-zi);
206 for (
int il=0; il!=nThirdLayers; ++il) {
207 const DetLayer * layer = thirdLayerDetLayer[il];
208 auto barrelLayer = layer->
isBarrel();
210 if ( (!barrelLayer) & (toPos != std::signbit(layer->
position().
z())) )
continue;
212 if (hitTree[il].
empty())
continue;
214 auto const &
hits = *thirdHitMap[il];
216 auto & correction = corrections[il];
218 correction.init(line, point2, outSeq);
220 auto & predictionRZ = preds[il];
222 predictionRZ.initPropagator(&line);
223 Range rzRange = predictionRZ();
224 correction.correctRZRange(rzRange);
234 radius = predictionRZ.detRange();
236 radius =
Range(
max(rzRange.min(), predictionRZ.detSize().min()),
237 min(rzRange.max(), predictionRZ.detSize().max()) );
239 if (radius.empty())
continue;
243 auto rPhi1 = predictionRPhitmp(radius.max());
244 bool ok1 = !rPhi1.empty();
246 correction.correctRPhiRange(rPhi1);
247 rPhi1.first /= radius.max();
248 rPhi1.second /= radius.max();
250 auto rPhi2 = predictionRPhitmp(radius.min());
251 bool ok2 = !rPhi2.empty();
253 correction.correctRPhiRange(rPhi2);
254 rPhi2.first /= radius.min();
255 rPhi2.second /= radius.min();
260 rPhi1.second =
proxim(rPhi1.second,rPhi1.first);
262 rPhi2.first =
proxim(rPhi2.first,rPhi1.first);
263 rPhi2.second =
proxim(rPhi2.second,rPhi1.first);
264 phiRange = rPhi1.sum(rPhi2);
265 }
else phiRange=rPhi1;
268 rPhi2.second =
proxim(rPhi2.second,rPhi2.first);
278 float prmin=phiRange.min(), prmax=phiRange.max();
281 if (prmax-prmin>maxDelphi) {
282 auto prm = phiRange.mean();
283 prmin = prm - 0.5f*maxDelphi;
284 prmax = prm + 0.5f*maxDelphi;
289 Range regMax = predictionRZ.detRange();
290 Range regMin = predictionRZ(regMax.min()-regOffset);
291 regMax = predictionRZ(regMax.max()+regOffset);
292 correction.correctRZRange(regMin);
293 correction.correctRZRange(regMax);
294 if (regMax.min() < regMin.min()) {
swap(regMax, regMin);}
295 KDTreeBox phiZ(prmin, prmax, regMin.min()-nSigmaRZ*rzError[il], regMax.max()+nSigmaRZ*rzError[il]);
296 hitTree[il].search(phiZ, foundNodes);
301 rzRange.min()-regOffset-nSigmaRZ*rzError[il],
302 rzRange.max()+regOffset+nSigmaRZ*rzError[il]);
303 hitTree[il].search(phiZ, foundNodes);
310 for (
auto KDdata : foundNodes) {
314 if(tripletLastLayerIndex) tripletLastLayerIndex->clear();
315 edm::LogError(
"TooManyTriplets")<<
" number of triples exceeds maximum. no triplets produced.";
319 float p3_u =
hits.u[KDdata];
320 float p3_v =
hits.v[KDdata];
321 float p3_phi =
hits.lphi[KDdata];
327 Range allowed = predictionRZ(p3_u);
328 correction.correctRZRange(allowed);
329 float vErr = nSigmaRZ *
hits.dv[KDdata];
330 Range hitRange(p3_v-vErr, p3_v+vErr);
332 if (crossingRange.empty())
continue;
334 float ir = 1.f/
hits.rv(KDdata);
337 float phiErr = nSigmaPhi *
hits.drphi[KDdata]*ir;
338 phiErr =
std::min(maxPhiErr, phiErr);
340 for (
int icharge=-1; icharge <=1; icharge+=2) {
341 Range rangeRPhi = predictionRPhi(
hits.rv(KDdata), icharge);
342 if(rangeRPhi.first>rangeRPhi.second)
continue;
343 correction.correctRPhiRange(rangeRPhi);
344 if (
checkPhiInRange(p3_phi, rangeRPhi.first*ir-phiErr, rangeRPhi.second*ir+phiErr,maxPhiErr)) {
348 result.push_back( hittriplet );
350 if(tripletLastLayerIndex) tripletLastLayerIndex->push_back(il);
352 LogDebug(
"RejectedTriplet") <<
"rejected triplet from comparitor ";
357 if (nook)
LogDebug(
"RejectedTriplet") <<
"rejected triplet from second phicheck " << p3_phi;
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
#define declareDynArray(T, n, x)
void initTolerance(float tolerance)
DetLayer const * detLayer(layer l) const
float rv(int i, layer l) const
const float extraHitRPhitolerance
T get(const Candidate &c)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)