31 using namespace ctfseeding;
35 useFixedPreFiltering(cfg.getParameter<bool>(
"useFixedPreFiltering")),
36 extraHitRZtolerance(cfg.getParameter<double>(
"extraHitRZtolerance")),
37 extraHitRPhitolerance(cfg.getParameter<double>(
"extraHitRPhitolerance")),
38 useMScat(cfg.getParameter<bool>(
"useMultScattering")),
39 useBend(cfg.getParameter<bool>(
"useBending"))
46 if(comparitorName !=
"none") {
58 const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers)
63 auto const & doublets =
thePairGenerator->doublets(region,ev,es, pairLayers);
65 if (doublets.empty())
return;
73 int size = thirdLayers.size();
76 std::vector<ThirdHitRZPrediction<PixelRecoLineRZ>> preds(size);
85 std::vector<NodeInfo > layerTree;
86 std::vector<unsigned int> foundNodes;
87 foundNodes.reserve(100);
90 std::vector<KDTreeLinkerAlgo<unsigned int>> hitTree(size);
98 for (
int il=0; il!=
size; ++il) {
99 thirdHitMap[il] = &(*theLayerCache)(thirdLayers[il],
region,
ev, es);
100 auto const & hits = *thirdHitMap[il];
102 pred.
initLayer(thirdLayers[il].detLayer());
106 float minv=999999.0, maxv= -999999.0;
108 for (
unsigned int i=0;
i!=hits.size(); ++
i) {
113 float myerr = hits.dv[
i];
115 layerTree.emplace_back(
i,
angle,
v);
121 KDTreeBox phiZ(minphi, maxphi, minv-0.01
f, maxv+0.01
f);
123 hitTree[il].
build(layerTree, phiZ);
124 rzError[il] = maxErr;
132 for (std::size_t ip =0; ip!=doublets.size(); ip++) {
156 for (
int il=0; il!=
size; ++il) {
157 if (hitTree[il].
empty())
continue;
159 auto const & hits = *thirdHitMap[il];
161 const DetLayer * layer = thirdLayers[il].detLayer();
162 auto barrelLayer = layer->
isBarrel();
169 Range rzRange = predictionRZ();
170 correction.correctRZRange(rzRange);
180 radius = predictionRZ.detRange();
182 radius =
Range(
max(rzRange.min(), predictionRZ.detSize().min()),
183 min(rzRange.max(), predictionRZ.detSize().max()) );
185 if (radius.empty())
continue;
210 auto rPhi1 = predictionRPhitmp(radius.max());
211 auto rPhi2 = predictionRPhitmp(radius.min());
214 correction.correctRPhiRange(rPhi1);
215 correction.correctRPhiRange(rPhi2);
216 rPhi1.first /= radius.max();
217 rPhi1.second /= radius.max();
218 rPhi2.first /= radius.min();
219 rPhi2.second /= radius.min();
227 float prmin=phiRange.min(), prmax=phiRange.max();
237 Range regMax = predictionRZ.detRange();
238 Range regMin = predictionRZ(regMax.min()-regOffset);
239 regMax = predictionRZ(regMax.max()+regOffset);
240 correction.correctRZRange(regMin);
241 correction.correctRZRange(regMax);
242 if (regMax.min() < regMin.min()) {
swap(regMax, regMin);}
243 KDTreeBox phiZ(prmin, prmax, regMin.min()-nSigmaRZ*rzError[il], regMax.max()+nSigmaRZ*rzError[il]);
244 hitTree[il].
search(phiZ, foundNodes);
249 rzRange.min()-regOffset-nSigmaRZ*rzError[il],
250 rzRange.max()+regOffset+nSigmaRZ*rzError[il]);
251 hitTree[il].
search(phiZ, foundNodes);
258 for (
auto KDdata : foundNodes) {
262 edm::LogError(
"TooManyTriplets")<<
" number of triples exceeds maximum. no triplets produced.";
266 float p3_u = hits.u[KDdata];
267 float p3_v = hits.v[KDdata];
268 float p3_phi = hits.lphi[KDdata];
274 Range allowed = predictionRZ(p3_u);
275 correction.correctRZRange(allowed);
276 float vErr = nSigmaRZ *hits.dv[KDdata];
277 Range hitRange(p3_v-vErr, p3_v+vErr);
279 if (crossingRange.empty())
continue;
281 float ir = 1.f/hits.rv(KDdata);
282 float phiErr = nSigmaPhi * hits.drphi[KDdata]*ir;
283 for (
int icharge=-1; icharge <=1; icharge+=2) {
284 Range rangeRPhi = predictionRPhi(hits.rv(KDdata), icharge);
285 correction.correctRPhiRange(rangeRPhi);
286 if (
checkPhiInRange(p3_phi, rangeRPhi.first*ir-phiErr, rangeRPhi.second*ir+phiErr)) {
290 result.push_back( hittriplet );
292 LogDebug(
"RejectedTriplet") <<
"rejected triplet from comparitor ";
307 return ( (phi1 <= phi) && (phi <= phi2) );
311 const std::pair<float,float>&
r2)
const
312 {
float r2_min=r2.first;
313 float r2_max=r2.second;
317 return std::make_pair(
min(r1.first,r2_min),
max(r1.second,r2_max));
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
void build(std::vector< KDTreeNodeInfo > &eltList, const KDTreeBox ®ion)
void initPropagator(const Propagator *propagator)
GlobalPoint const & origin() const
void initLayer(const DetLayer *layer)
float extraHitRPhitolerance
void search(const KDTreeBox &searchBox, std::vector< KDTreeNodeInfo > &resRecHitList)
std::pair< float, float > mergePhiRanges(const std::pair< float, float > &r1, const std::pair< float, float > &r2) const
const unsigned int theMaxElement
std::unique_ptr< SeedComparitor > theComparitor
PixelTripletHLTGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
bool useFixedPreFiltering
T curvature(T InversePt, const edm::EventSetup &iSetup)
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
PixelRecoRange< float > Range
virtual void hitTriplets(const TrackingRegion ®ion, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es, SeedingLayerSetsHits::SeedingLayerSet pairLayers, const std::vector< SeedingLayerSetsHits::SeedingLayer > &thirdLayers) override
std::unique_ptr< HitPairGeneratorFromLayerPair > thePairGenerator
float ptMin() const
minimal pt of interest
Geom::Phi< T > phi() const
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
bool checkPhiInRange(float phi, float phi1, float phi2) const
void initTolerance(float tolerance)
virtual unsigned int size() const
float extraHitRZtolerance
tuple size
Write out results.
virtual ~PixelTripletHLTGenerator()
T get(const Candidate &c)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)