30 using namespace ctfseeding;
33 : thePairGenerator(0),
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"))
47 if(comparitorName !=
"none") {
64 std::vector<SeedingLayerSetsHits::SeedingLayer> thirdLayers) {
79 if (doublets.empty())
return;
90 std::vector<ThirdHitRZPrediction<PixelRecoLineRZ>> preds(size);
99 std::vector<NodeInfo > layerTree;
100 std::vector<unsigned int> foundNodes;
101 foundNodes.reserve(100);
104 std::vector<KDTreeLinkerAlgo<unsigned int>> hitTree(size);
112 for (
int il=0; il!=
size; ++il) {
114 auto const & hits = *thirdHitMap[il];
116 pred.
initLayer(theLayers[il].detLayer());
120 float minv=999999.0, maxv= -999999.0;
122 for (
unsigned int i=0;
i!=hits.size(); ++
i) {
127 float myerr = hits.dv[
i];
129 layerTree.emplace_back(
i,
angle,
v);
135 KDTreeBox phiZ(minphi, maxphi, minv-0.01
f, maxv+0.01
f);
137 hitTree[il].
build(layerTree, phiZ);
138 rzError[il] = maxErr;
146 for (std::size_t ip =0; ip!=doublets.size(); ip++) {
170 for (
int il=0; il!=
size; ++il) {
171 if (hitTree[il].
empty())
continue;
173 auto const & hits = *thirdHitMap[il];
176 auto barrelLayer = layer->
isBarrel();
183 Range rzRange = predictionRZ();
184 correction.correctRZRange(rzRange);
194 radius = predictionRZ.detRange();
196 radius =
Range(
max(rzRange.min(), predictionRZ.detSize().min()),
197 min(rzRange.max(), predictionRZ.detSize().max()) );
199 if (radius.empty())
continue;
224 auto rPhi1 = predictionRPhitmp(radius.max());
225 auto rPhi2 = predictionRPhitmp(radius.min());
228 correction.correctRPhiRange(rPhi1);
229 correction.correctRPhiRange(rPhi2);
230 rPhi1.first /= radius.max();
231 rPhi1.second /= radius.max();
232 rPhi2.first /= radius.min();
233 rPhi2.second /= radius.min();
241 float prmin=phiRange.min(), prmax=phiRange.max();
251 Range regMax = predictionRZ.detRange();
252 Range regMin = predictionRZ(regMax.min()-regOffset);
253 regMax = predictionRZ(regMax.max()+regOffset);
254 correction.correctRZRange(regMin);
255 correction.correctRZRange(regMax);
256 if (regMax.min() < regMin.min()) {
swap(regMax, regMin);}
257 KDTreeBox phiZ(prmin, prmax, regMin.min()-nSigmaRZ*rzError[il], regMax.max()+nSigmaRZ*rzError[il]);
258 hitTree[il].
search(phiZ, foundNodes);
263 rzRange.min()-regOffset-nSigmaRZ*rzError[il],
264 rzRange.max()+regOffset+nSigmaRZ*rzError[il]);
265 hitTree[il].
search(phiZ, foundNodes);
272 for (
auto KDdata : foundNodes) {
276 edm::LogError(
"TooManyTriplets")<<
" number of triples exceeds maximum. no triplets produced.";
280 float p3_u = hits.u[KDdata];
281 float p3_v = hits.v[KDdata];
282 float p3_phi = hits.lphi[KDdata];
288 Range allowed = predictionRZ(p3_u);
289 correction.correctRZRange(allowed);
290 float vErr = nSigmaRZ *hits.dv[KDdata];
291 Range hitRange(p3_v-vErr, p3_v+vErr);
293 if (crossingRange.empty())
continue;
295 float ir = 1.f/hits.rv(KDdata);
296 float phiErr = nSigmaPhi * hits.drphi[KDdata]*ir;
297 for (
int icharge=-1; icharge <=1; icharge+=2) {
298 Range rangeRPhi = predictionRPhi(hits.rv(KDdata), icharge);
299 correction.correctRPhiRange(rangeRPhi);
300 if (
checkPhiInRange(p3_phi, rangeRPhi.first*ir-phiErr, rangeRPhi.second*ir+phiErr)) {
304 result.push_back( hittriplet );
306 LogDebug(
"RejectedTriplet") <<
"rejected triplet from comparitor ";
321 return ( (phi1 <= phi) && (phi <= phi2) );
325 const std::pair<float,float>&
r2)
const
326 {
float r2_min=r2.first;
327 float r2_max=r2.second;
331 return std::make_pair(
min(r1.first,r2_min),
max(r1.second,r2_max));
std::vector< SeedingLayerSetsHits::SeedingLayer > theLayers
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)
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
std::unique_ptr< SeedComparitor > theComparitor
PixelTripletHLTGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
bool useFixedPreFiltering
T curvature(T InversePt, const edm::EventSetup &iSetup)
HitPairGenerator * thePairGenerator
unsigned int theMaxElement
virtual HitDoublets doublets(const TrackingRegion ®, const edm::Event &ev, const edm::EventSetup &es)
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
PixelRecoRange< float > Range
void setSeedingLayers(SeedingLayerSetsHits::SeedingLayerSet pairLayers, std::vector< SeedingLayerSetsHits::SeedingLayer > thirdLayers) override
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
LayerCacheType * theLayerCache
void initTolerance(float tolerance)
void init(const HitPairGenerator &pairs, LayerCacheType *layerCache) override
virtual unsigned int size() const
virtual void hitTriplets(const TrackingRegion ®ion, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es)
DetLayer const * detLayer(layer l) const
float extraHitRZtolerance
tuple size
Write out results.
virtual void setSeedingLayers(SeedingLayerSetsHits::SeedingLayerSet layers)=0
virtual ~PixelTripletHLTGenerator()
T get(const Candidate &c)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)