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;
95 std::vector<NodeInfo > layerTree;
96 std::vector<unsigned int> foundNodes;
97 foundNodes.reserve(100);
104 for (
int il=0; il!=
size; ++il) {
105 thirdHitMap[il] = &(*theLayerCache)(
theLayers[il], region,
ev, es);
106 auto const & hits = *thirdHitMap[il];
108 pred.
initLayer(theLayers[il].detLayer());
112 float minv=999999.0, maxv= -999999.0;
114 for (
unsigned int i=0;
i!=hits.size(); ++
i) {
119 float myerr = hits.dv[
i];
121 layerTree.emplace_back(
i,
angle,
v);
127 KDTreeBox phiZ(minphi, maxphi, minv-0.01
f, maxv+0.01
f);
129 hitTree[il].
build(layerTree, phiZ);
130 rzError[il] = maxErr;
138 for (std::size_t ip =0; ip!=doublets.size(); ip++) {
162 for (
int il=0; il!=
size; ++il) {
163 if (hitTree[il].
empty())
continue;
165 auto const & hits = *thirdHitMap[il];
168 auto barrelLayer = layer->
isBarrel();
175 Range rzRange = predictionRZ();
176 correction.correctRZRange(rzRange);
186 radius = predictionRZ.detRange();
188 radius =
Range(
max(rzRange.min(), predictionRZ.detSize().min()),
189 min(rzRange.max(), predictionRZ.detSize().max()) );
191 if (radius.empty())
continue;
216 auto rPhi1 = predictionRPhitmp(radius.max());
217 auto rPhi2 = predictionRPhitmp(radius.min());
220 correction.correctRPhiRange(rPhi1);
221 correction.correctRPhiRange(rPhi2);
222 rPhi1.first /= radius.max();
223 rPhi1.second /= radius.max();
224 rPhi2.first /= radius.min();
225 rPhi2.second /= radius.min();
233 float prmin=phiRange.min(), prmax=phiRange.max();
243 Range regMax = predictionRZ.detRange();
244 Range regMin = predictionRZ(regMax.min()-regOffset);
245 regMax = predictionRZ(regMax.max()+regOffset);
246 correction.correctRZRange(regMin);
247 correction.correctRZRange(regMax);
248 if (regMax.min() < regMin.min()) {
swap(regMax, regMin);}
249 KDTreeBox phiZ(prmin, prmax, regMin.min()-nSigmaRZ*rzError[il], regMax.max()+nSigmaRZ*rzError[il]);
250 hitTree[il].
search(phiZ, foundNodes);
255 rzRange.min()-regOffset-nSigmaRZ*rzError[il],
256 rzRange.max()+regOffset+nSigmaRZ*rzError[il]);
257 hitTree[il].
search(phiZ, foundNodes);
264 for (
auto KDdata : foundNodes) {
268 edm::LogError(
"TooManyTriplets")<<
" number of triples exceeds maximum. no triplets produced.";
272 float p3_u = hits.u[KDdata];
273 float p3_v = hits.v[KDdata];
274 float p3_phi = hits.lphi[KDdata];
280 Range allowed = predictionRZ(p3_u);
281 correction.correctRZRange(allowed);
282 float vErr = nSigmaRZ *hits.dv[KDdata];
283 Range hitRange(p3_v-vErr, p3_v+vErr);
285 if (crossingRange.empty())
continue;
287 float ir = 1.f/hits.rv(KDdata);
288 float phiErr = nSigmaPhi * hits.drphi[KDdata]*ir;
289 for (
int icharge=-1; icharge <=1; icharge+=2) {
290 Range rangeRPhi = predictionRPhi(hits.rv(KDdata), icharge);
291 correction.correctRPhiRange(rangeRPhi);
292 if (
checkPhiInRange(p3_phi, rangeRPhi.first*ir-phiErr, rangeRPhi.second*ir+phiErr)) {
296 result.push_back( hittriplet );
298 LogDebug(
"RejectedTriplet") <<
"rejected triplet from comparitor ";
313 return ( (phi1 <= phi) && (phi <= phi2) );
317 const std::pair<float,float>&
r2)
const
318 {
float r2_min=r2.first;
319 float r2_max=r2.second;
323 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
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
bool checkPhiInRange(float phi, float phi1, float phi2) const
LayerCacheType * theLayerCache
void initTolerance(float tolerance)
list pairs
sort tag files by run number
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)