32 struct LayerRZPredictions {
44 : thePairGenerator(0),
46 useFixedPreFiltering(cfg.getParameter<bool>(
"useFixedPreFiltering")),
47 extraHitRZtolerance(cfg.getParameter<double>(
"extraHitRZtolerance")),
48 extraHitRPhitolerance(cfg.getParameter<double>(
"extraHitRPhitolerance")),
49 useMScat(cfg.getParameter<bool>(
"useMultScattering")),
50 useBend(cfg.getParameter<bool>(
"useBending"))
64 std::vector<SeedingLayerSetsHits::SeedingLayer> thirdLayers) {
73 if (range.first > second.max() || range.second < second.min())
75 if (range.first < second.min())
76 range.first = second.min();
77 if (range.second > second.max())
78 range.second = second.max();
79 return range.first < range.second;
98 if (doublets.empty())
return;
107 std::vector<NodeInfo > layerTree;
108 std::vector<unsigned int> foundNodes;
109 foundNodes.reserve(100);
115 LayerRZPredictions mapPred[
size];
119 for(
int il = 0; il <
size; il++) {
120 thirdHitMap[il] = &(*theLayerCache)(
theLayers[il], region, ev, es);
121 auto const & hits = *thirdHitMap[il];
123 const DetLayer *layer = theLayers[il].detLayer();
124 LayerRZPredictions &predRZ = mapPred[il];
125 predRZ.line.initLayer(layer);
126 predRZ.helix1.initLayer(layer);
127 predRZ.helix2.initLayer(layer);
134 float minv=999999.0;
float maxv = -999999.0;
136 for (
unsigned int i=0;
i!=hits.size(); ++
i) {
141 float myerr = hits.dv[
i];
143 layerTree.emplace_back(
i,
angle,
v);
149 KDTreeBox phiZ(minphi, maxphi, minv-0.01
f, maxv+0.01
f);
151 hitTree[il].
build(layerTree, phiZ);
152 rzError[il] = maxErr;
157 for (std::size_t ip =0; ip!=doublets.size(); ip++) {
174 if (!intersect(generalCurvature,
Range(-curv, curv)))
continue;
176 for(
int il = 0; il <
size; il++) {
177 if (hitTree[il].
empty())
continue;
179 bool barrelLayer = layer->
isBarrel();
184 LayerRZPredictions &predRZ = mapPred[il];
185 predRZ.line.initPropagator(&line);
208 Range z3s = predRZ.line.detRange();
209 double z3 = z3s.first < 0 ?
std::max(z3s.first, z3s.second)
212 gp1.
z(), gp2.
z(), z3);
213 if (!intersect(curvature,
Range(-maxCurvature, maxCurvature)))
217 HelixRZ helix1(&predictionRPhi, gp1.
z(), gp2.
z(), curvature.first);
218 HelixRZ helix2(&predictionRPhi, gp1.
z(), gp2.
z(), curvature.second);
220 predRZ.helix1.initPropagator(&helix1);
221 predRZ.helix2.initPropagator(&helix2);
223 Range rzRanges[2] = { predRZ.helix1(), predRZ.helix2() };
224 predRZ.helix1.initPropagator(
nullptr);
225 predRZ.helix2.initPropagator(
nullptr);
227 rzRange.first =
std::min(rzRanges[0].
first, rzRanges[1].first);
228 rzRange.second =
std::max(rzRanges[0].second, rzRanges[1].second);
232 if (curvature.first * curvature.second < 0.0) {
233 Range rzLineRange = predRZ.line();
234 rzRange.first =
std::min(rzRange.first, rzLineRange.first);
235 rzRange.second =
std::max(rzRange.second, rzLineRange.second);
238 rzRange = predRZ.line();
241 if (rzRange.first >= rzRange.second)
244 correction.correctRZRange(rzRange);
254 radius = predRZ.line.detRange();
255 if (!intersect(rzRange, predRZ.line.detSize()))
259 if (!intersect(radius, predRZ.line.detSize()))
263 Range rPhi1 = predictionRPhi(curvature, radius.first);
264 Range rPhi2 = predictionRPhi(curvature, radius.second);
265 correction.correctRPhiRange(rPhi1);
266 correction.correctRPhiRange(rPhi2);
267 rPhi1.first /= radius.first;
268 rPhi1.second /= radius.first;
269 rPhi2.first /= radius.second;
270 rPhi2.second /= radius.second;
275 float prmin=phiRange.min(), prmax=phiRange.max();
284 Range regMax = predRZ.line.detRange();
285 Range regMin = predRZ.line(regMax.min());
286 regMax = predRZ.line(regMax.max());
287 correction.correctRZRange(regMin);
288 correction.correctRZRange(regMax);
289 if (regMax.min() < regMin.min()) {
swap(regMax, regMin);}
293 hitTree[il].
search(phiZ, foundNodes);
299 hitTree[il].
search(phiZ, foundNodes);
305 thirdHitMap[il] = &(*theLayerCache)(
theLayers[il], region, ev, es);
306 auto const & hits = *thirdHitMap[il];
307 for (
auto KDdata : foundNodes) {
309 double p3_r = p3.
perp();
310 double p3_z = p3.
z();
311 float p3_phi = hits.phi(KDdata);
313 Range rangeRPhi = predictionRPhi(curvature, p3_r);
314 correction.correctRPhiRange(rangeRPhi);
317 float phiErr =
nSigmaPhi * hits.drphi[KDdata]*ir;
318 if (!
checkPhiInRange(p3_phi, rangeRPhi.first*ir-phiErr, rangeRPhi.second*ir+phiErr))
323 auto curv_ = predictionRPhi.curvature(thc);
324 double p2_r = point2.
r();
double p2_z = point2.z();
326 l2rzFixup(predictionRPhi, curv_, *doublets.hit(ip,
HitDoublets::outer), p2_r, p2_z, tTopo);
327 l3rzFixup(predictionRPhi, curv_, *hits.theHits[KDdata].hit(), p3_r, p3_z, tTopo);
331 HelixRZ updatedHelix(&predictionRPhi, gp1.
z(), p2_z, curv_);
332 rangeRZ = predRZ.helix1(barrelLayer ? p3_r : p3_z, updatedHelix);
334 float tIP = predictionRPhi.transverseIP(thc);
337 rangeRZ = predRZ.line(barrelLayer ? p3_r : p3_z, line);
339 correction.correctRZRange(rangeRZ);
341 double err =
nSigmaRZ * hits.dv[KDdata];
343 rangeRZ.first -= err, rangeRZ.second += err;
345 if (!rangeRZ.inside(barrelLayer ? p3_z : p3_r))
continue;
349 edm::LogError(
"TooManyTriplets")<<
" number of triples exceed maximum. no triplets produced.";
360 {
while (phi > phi2) phi -= 2. *
M_PI;
361 while (phi < phi1) phi += 2. *
M_PI;
365 std::pair<float, float>
367 const std::pair<float, float> &
r2)
const
368 {
float r2Min = r2.first;
369 float r2Max = r2.second;
370 while (r1.first - r2Min > +
M_PI) r2Min += 2. *
M_PI, r2Max += 2. *
M_PI;
371 while (r1.first - r2Min < -
M_PI) r2Min -= 2. *
M_PI, r2Max -= 2. *
M_PI;
372 return std::make_pair(
min(r1.first, r2Min),
max(r1.second, r2Max));
float originRBound() const
bounds the particle vertex in the transverse plane
void swap(ora::Record &rh, ora::Record &lh)
T getParameter(std::string const &) const
virtual HitPairGenerator * clone() const =0
void build(std::vector< KDTreeNodeInfo > &eltList, const KDTreeBox ®ion)
ThirdHitPredictionFromCircle::HelixRZ HelixRZ
T r() const
Radius, same as mag()
void setSeedingLayers(SeedingLayerSetsHits::SeedingLayerSet pairLayers, std::vector< SeedingLayerSetsHits::SeedingLayer > thirdLayers) override
bool useFixedPreFiltering
void search(const KDTreeBox &searchBox, std::vector< KDTreeNodeInfo > &resRecHitList)
LayerCacheType * theLayerCache
float extraHitRPhitolerance
U second(std::pair< T, U > const &p)
bool checkPhiInRange(float phi, float phi1, float phi2) const
T curvature(T InversePt, const edm::EventSetup &iSetup)
std::vector< SeedingLayerSetsHits::SeedingLayer > theLayers
const T & max(const T &a, const T &b)
constexpr double nSigmaRZ
PixelTripletLargeTipGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
unsigned int theMaxElement
void init(const HitPairGenerator &pairs, LayerCacheType *layerCache) override
virtual HitDoublets doublets(const TrackingRegion ®, const edm::Event &ev, const edm::EventSetup &es)
virtual void hitTriplets(const TrackingRegion ®ion, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es)
constexpr double nSigmaPhi
std::pair< float, float > mergePhiRanges(const std::pair< float, float > &r1, const std::pair< float, float > &r2) const
float extraHitRZtolerance
HitPairGenerator * thePairGenerator
PixelRecoRange< float > Range
static double maxCurvature(const ThirdHitPredictionFromCircle *circle, double z1, double z2, double z3)
T const * product() const
float ptMin() const
minimal pt of interest
list pairs
sort tag files by run number
virtual unsigned int size() const
DetLayer const * detLayer(layer l) const
tuple size
Write out results.
virtual void setSeedingLayers(SeedingLayerSetsHits::SeedingLayerSet layers)=0
T angle(T x1, T y1, T z1, T x2, T y2, T z2)