43 useMScat(cfg.getParameter<bool>(
"useMultScattering")),
44 useBend(cfg.getParameter<bool>(
"useBending")),
50 if(comparitorName !=
"none") {
59 desc.
add<
double>(
"extraHitRPhitolerance", 0.032);
60 desc.
add<
double>(
"extraHitRZtolerance", 0.037);
61 desc.
add<
bool>(
"useMultScattering",
true);
62 desc.
add<
bool>(
"useBending",
true);
63 desc.
add<
bool>(
"useFixedPreFiltering",
false);
64 desc.
add<
double>(
"phiPreFiltering", 0.3);
77 const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers)
89 const std::vector<SeedingLayerSetsHits::SeedingLayer>& thirdLayers,
90 std::vector<int> *tripletLastLayerIndex,
94 int size = thirdLayers.size();
96 vector<const DetLayer *> thirdLayerDetLayer(size,0);
97 for (
int il=0; il<
size; ++il)
99 thirdHitMap[il] = &layerCache(thirdLayers[il], region, es);
100 thirdLayerDetLayer[il] = thirdLayers[il].detLayer();
102 hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, size, tripletLastLayerIndex);
111 const std::vector<const DetLayer *> & thirdLayerDetLayer,
112 const int nThirdLayers)
114 hitTriplets(region, result, es, doublets, thirdHitMap, thirdLayerDetLayer, nThirdLayers,
nullptr);
121 const std::vector<const DetLayer *> & thirdLayerDetLayer,
122 const int nThirdLayers,
123 std::vector<int> *tripletLastLayerIndex) {
134 std::vector<NodeInfo > layerTree;
135 std::vector<unsigned int> foundNodes;
136 foundNodes.reserve(100);
139 float rzError[nThirdLayers];
142 const float maxphi =
M_PI+maxDelphi, minphi = -maxphi;
143 const float safePhi =
M_PI-maxDelphi;
146 for (
int il=0; il<nThirdLayers; ++il) {
147 auto const &
hits = *thirdHitMap[il];
156 float minv=999999.0f, maxv= -minv;
158 for (
unsigned int i=0;
i!=
hits.size(); ++
i) {
163 float myerr =
hits.dv[
i];
165 layerTree.emplace_back(
i,
angle,
v);
170 KDTreeBox phiZ(minphi, maxphi, minv-0.01
f, maxv+0.01
f);
172 hitTree[il].build(layerTree, phiZ);
173 rzError[il] = maxErr;
181 for (std::size_t ip =0; ip!=doublets.
size(); ip++) {
191 auto toPos = std::signbit(zo-zi);
207 for (
int il=0; il!=nThirdLayers; ++il) {
208 const DetLayer * layer = thirdLayerDetLayer[il];
209 auto barrelLayer = layer->
isBarrel();
211 if ( (!barrelLayer) & (toPos != std::signbit(layer->
position().
z())) )
continue;
213 if (hitTree[il].
empty())
continue;
215 auto const &
hits = *thirdHitMap[il];
217 auto & correction = corrections[il];
219 correction.init(line, point2, outSeq);
221 auto & predictionRZ = preds[il];
223 predictionRZ.initPropagator(&line);
224 Range rzRange = predictionRZ();
225 correction.correctRZRange(rzRange);
235 radius = predictionRZ.detRange();
237 radius =
Range(
max(rzRange.min(), predictionRZ.detSize().min()),
238 min(rzRange.max(), predictionRZ.detSize().max()) );
240 if (radius.empty())
continue;
244 auto rPhi1 = predictionRPhitmp(radius.max());
245 bool ok1 = !rPhi1.empty();
247 correction.correctRPhiRange(rPhi1);
248 rPhi1.first /= radius.max();
249 rPhi1.second /= radius.max();
251 auto rPhi2 = predictionRPhitmp(radius.min());
252 bool ok2 = !rPhi2.empty();
254 correction.correctRPhiRange(rPhi2);
255 rPhi2.first /= radius.min();
256 rPhi2.second /= radius.min();
261 rPhi1.second =
proxim(rPhi1.second,rPhi1.first);
263 rPhi2.first =
proxim(rPhi2.first,rPhi1.first);
264 rPhi2.second =
proxim(rPhi2.second,rPhi1.first);
265 phiRange = rPhi1.sum(rPhi2);
266 }
else phiRange=rPhi1;
269 rPhi2.second =
proxim(rPhi2.second,rPhi2.first);
279 float prmin=phiRange.min(), prmax=phiRange.max();
282 if (prmax-prmin>maxDelphi) {
283 auto prm = phiRange.mean();
284 prmin = prm - 0.5f*maxDelphi;
285 prmax = prm + 0.5f*maxDelphi;
290 Range regMax = predictionRZ.detRange();
291 Range regMin = predictionRZ(regMax.min()-regOffset);
292 regMax = predictionRZ(regMax.max()+regOffset);
293 correction.correctRZRange(regMin);
294 correction.correctRZRange(regMax);
295 if (regMax.min() < regMin.min()) {
swap(regMax, regMin);}
296 KDTreeBox phiZ(prmin, prmax, regMin.min()-nSigmaRZ*rzError[il], regMax.max()+nSigmaRZ*rzError[il]);
297 hitTree[il].search(phiZ, foundNodes);
302 rzRange.min()-regOffset-nSigmaRZ*rzError[il],
303 rzRange.max()+regOffset+nSigmaRZ*rzError[il]);
304 hitTree[il].search(phiZ, foundNodes);
311 for (
auto KDdata : foundNodes) {
315 if(tripletLastLayerIndex) tripletLastLayerIndex->clear();
316 edm::LogError(
"TooManyTriplets")<<
" number of triples exceeds maximum. no triplets produced.";
320 float p3_u =
hits.u[KDdata];
321 float p3_v =
hits.v[KDdata];
322 float p3_phi =
hits.lphi[KDdata];
328 Range allowed = predictionRZ(p3_u);
329 correction.correctRZRange(allowed);
330 float vErr = nSigmaRZ *
hits.dv[KDdata];
331 Range hitRange(p3_v-vErr, p3_v+vErr);
333 if (crossingRange.empty())
continue;
335 float ir = 1.f/
hits.rv(KDdata);
338 float phiErr = nSigmaPhi *
hits.drphi[KDdata]*ir;
339 phiErr =
std::min(maxPhiErr, phiErr);
341 for (
int icharge=-1; icharge <=1; icharge+=2) {
342 Range rangeRPhi = predictionRPhi(
hits.rv(KDdata), icharge);
343 if(rangeRPhi.first>rangeRPhi.second)
continue;
344 correction.correctRPhiRange(rangeRPhi);
345 if (
checkPhiInRange(p3_phi, rangeRPhi.first*ir-phiErr, rangeRPhi.second*ir+phiErr,maxPhiErr)) {
349 result.push_back( hittriplet );
351 if(tripletLastLayerIndex) tripletLastLayerIndex->push_back(il);
353 LogDebug(
"RejectedTriplet") <<
"rejected triplet from comparitor ";
358 if (nook)
LogDebug(
"RejectedTriplet") <<
"rejected triplet from second phicheck " << p3_phi;
float originRBound() const
bounds the particle vertex in the transverse plane
T getParameter(std::string const &) const
GlobalPoint const & origin() const
void initLayer(const DetLayer *layer)
def create(alignables, pedeDump, additionalData, outputFile, config)
void setAllowAnything()
allow any parameter label/value pairs
PixelRecoRange< float > Range
float x(int i, layer l) const
const float extraHitRZtolerance
void swap(Association< C > &lhs, Association< C > &rhs)
const unsigned int theMaxElement
std::unique_ptr< SeedComparitor > theComparitor
float z(int i, layer l) const
T curvature(T InversePt, const edm::EventSetup &iSetup)
static void fillDescriptions(edm::ParameterSetDescription &desc)
bool checkPhiInRange(T phi, T phi1, T phi2, float maxDphi=float(M_PI))
static void fillDescriptions(edm::ParameterSetDescription &desc)
virtual void hitTriplets(const TrackingRegion ®ion, OrderedHitTriplets &trs, const edm::Event &ev, const edm::EventSetup &es, const SeedingLayerSetsHits::SeedingLayerSet &pairLayers, const std::vector< SeedingLayerSetsHits::SeedingLayer > &thirdLayers) override
PixelTripletHLTGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC)
LayerCacheType * theLayerCache
float y(int i, layer l) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
SeedingHitSet::ConstRecHitPointer Hit
BaseTrackerRecHit const * Hit
const bool useFixedPreFiltering
float phi(int i, layer l) const
std::unique_ptr< HitPairGeneratorFromLayerPair > thePairGenerator
virtual const Surface::PositionType & position() const
Returns position of the surface.
float ptMin() const
minimal pt of interest
Hit const & hit(int i, layer l) const
PixelRecoRange< T > intersection(const PixelRecoRange< T > &r) const
#define declareDynArray(T, n, x)
void initTolerance(float tolerance)
virtual unsigned int size() const
DetLayer const * detLayer(layer l) const
float rv(int i, layer l) const
const float extraHitRPhitolerance
virtual ~PixelTripletHLTGenerator()
T get(const Candidate &c)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)