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"))
57 const std::vector<SeedingLayer> & layers,
75 if (doublets.empty())
return;
91 std::vector<NodeInfo > layerTree;
98 for (
int il=0; il!=
size; ++il) {
99 thirdHitMap[il] = &(*theLayerCache)(&
theLayers[il], region, ev, es);
100 auto const & hits = *thirdHitMap[il];
102 pred.
initLayer(theLayers[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++) {
155 for (
int il=0; il!=
size; ++il) {
156 if (hitTree[il].
empty())
continue;
158 auto const & hits = *thirdHitMap[il];
161 auto barrelLayer = layer->
isBarrel();
168 Range rzRange = predictionRZ();
169 correction.correctRZRange(rzRange);
179 radius = predictionRZ.detRange();
181 radius =
Range(
max(rzRange.min(), predictionRZ.detSize().min()),
182 min(rzRange.max(), predictionRZ.detSize().max()) );
184 if (radius.empty())
continue;
188 Range rPhi1m = predictionRPhitmp(radius.max(), -1);
189 Range rPhi1p = predictionRPhitmp(radius.max(), 1);
190 Range rPhi2m = predictionRPhitmp(radius.min(), -1);
191 Range rPhi2p = predictionRPhitmp(radius.min(), 1);
194 correction.correctRPhiRange(rPhi1);
195 correction.correctRPhiRange(rPhi2);
196 rPhi1.first /= radius.
max();
197 rPhi1.second /= radius.max();
198 rPhi2.first /= radius.min();
199 rPhi2.second /= radius.min();
207 float prmin=phiRange.min(), prmax=phiRange.max();
217 Range regMax = predictionRZ.detRange();
218 Range regMin = predictionRZ(regMax.min()-regOffset);
219 regMax = predictionRZ(regMax.max()+regOffset);
220 correction.correctRZRange(regMin);
221 correction.correctRZRange(regMax);
222 if (regMax.min() < regMin.min()) {
swap(regMax, regMin);}
223 KDTreeBox phiZ(prmin, prmax, regMin.min()-nSigmaRZ*rzError[il], regMax.max()+nSigmaRZ*rzError[il]);
224 hitTree[il].
search(phiZ, layerTree);
229 rzRange.min()-regOffset-nSigmaRZ*rzError[il],
230 rzRange.max()+regOffset+nSigmaRZ*rzError[il]);
231 hitTree[il].
search(phiZ, layerTree);
238 for (
auto const & ih : layerTree) {
242 edm::LogError(
"TooManyTriplets")<<
" number of triples exceeds maximum. no triplets produced.";
246 auto KDdata = ih.data;
247 float p3_u = hits.u[KDdata];
248 float p3_v = hits.v[KDdata];
249 float p3_phi = hits.lphi[KDdata];
255 Range allowed = predictionRZ(p3_u);
256 correction.correctRZRange(allowed);
257 float vErr = nSigmaRZ *hits.dv[KDdata];
258 Range hitRange(p3_v-vErr, p3_v+vErr);
260 if (crossingRange.empty())
continue;
262 float ir = 1.f/hits.rv(KDdata);
263 float phiErr = nSigmaPhi * hits.drphi[KDdata]*ir;
264 for (
int icharge=-1; icharge <=1; icharge+=2) {
265 Range rangeRPhi = predictionRPhi(hits.rv(KDdata), icharge);
266 correction.correctRPhiRange(rangeRPhi);
267 if (
checkPhiInRange(p3_phi, rangeRPhi.first*ir-phiErr, rangeRPhi.second*ir+phiErr)) {
271 result.push_back( hittriplet );
273 LogDebug(
"RejectedTriplet") <<
"rejected triplet from comparitor ";
288 return ( (phi1 <= phi) && (phi <= phi2) );
292 const std::pair<float,float>&
r2)
const
293 {
float r2_min=r2.first;
294 float r2_max=r2.second;
298 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
std::vector< ctfseeding::SeedingLayer > theLayers
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
PixelRecoRange< T > sum(const PixelRecoRange< T > &r) const
virtual bool compatible(const SeedingHitSet &hits, const TrackingRegion ®ion) const =0
virtual void init(const edm::EventSetup &es)=0
virtual void init(const HitPairGenerator &pairs, const std::vector< ctfseeding::SeedingLayer > &layers, LayerCacheType *layerCache)
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
bool useFixedPreFiltering
T curvature(T InversePt, const edm::EventSetup &iSetup)
const T & max(const T &a, const T &b)
SeedComparitor * theComparitor
constexpr double nSigmaRZ
HitPairGenerator * thePairGenerator
unsigned int theMaxElement
virtual HitDoublets doublets(const TrackingRegion ®, const edm::Event &ev, const edm::EventSetup &es)
constexpr double nSigmaPhi
PixelRecoRange< float > Range
PixelTripletHLTGenerator(const edm::ParameterSet &cfg)
float ptMin() const
minimal pt of interest
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
bool checkPhiInRange(float phi, float phi1, float phi2) const
TransientTrackingRecHit::ConstRecHitPointer Hit
LayerCacheType * theLayerCache
void initTolerance(float tolerance)
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 ~PixelTripletHLTGenerator()
T get(const Candidate &c)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)