Fill the cluster parameters (expose to outside world for case of splitting/merging clusters)
Given a list of hits fill out the remaining parameters for this cluster and evaluate the candidate's worthiness to achieve stardom in the event display
314 std::set<const reco::ClusterHit2D*> hitSet;
318 std::vector<size_t> planeHit2DVec;
319 std::vector<size_t> planeUniqueHit2DVec;
321 planeHit2DVec.resize(3);
322 planeUniqueHit2DVec.resize(3);
328 for(
const auto& hitMapPair : hit2DToHit3DListMap)
330 size_t plane = hitMapPair.first->WireID().Plane;
332 planeHit2DVec[plane] += hitMapPair.second.size();
333 if (!(hitMapPair.first->getStatusBits() &
reco::ClusterHit2D::USED)) planeUniqueHit2DVec[plane] += hitMapPair.second.size();
338 int numUniqueHits(0);
341 std::vector<float> uniqueHitFracVec(3,0.);
342 int nPlanesWithHits(0);
343 int nPlanesWithUniqueHits(0);
345 size_t minPlaneCnt = planeUniqueHit2DVec[0];
348 for(
int idx = 0; idx < 3; idx++)
351 numTotalHits += planeHit2DVec[idx];
352 numUniqueHits += planeUniqueHit2DVec[idx];
354 if (planeHit2DVec[idx] > 0) nPlanesWithHits++;
355 if (planeUniqueHit2DVec[idx] > 0) nPlanesWithUniqueHits++;
358 uniqueHitFracVec[idx] =
float(planeUniqueHit2DVec[idx]) /
std::max(
float(planeHit2DVec[idx]),
float(1.));
361 if (planeHit2DVec[idx] < minPlaneCnt)
363 minPlaneCnt = planeHit2DVec[idx];
371 if (numUniqueHits > 0.25 * numTotalHits && nPlanesWithHits > 1 && nPlanesWithUniqueHits > 1)
374 std::sort(uniqueHitFracVec.begin(),uniqueHitFracVec.end());
376 float acceptRatio = 0.;
378 if(uniqueHitFracVec[0] * uniqueHitFracVec[1] > 0.25) acceptRatio = 1.;
380 float uniqueFraction = uniqueHitFracVec[0] * uniqueHitFracVec[1] * uniqueHitFracVec[2];
383 if (uniqueFraction > 0.6 && acceptRatio > 0.)
392 for(
auto& pair : hit2DToHit3DListMap)
395 if (pair.second.empty())
397 std::cout <<
"<<<<<< no matching 3D hits for reco hit in final hit processing >>>>>>" <<
std::endl;
402 size_t hitPlane = pair.first->WireID().Plane;
405 if (hitPlane != minPlane && pair.second.size() > 2)
411 pair.second.sort([](
const auto&
left,
const auto&
right){
return left->getHitChiSquare() <
right->getHitChiSquare();});
418 float cutDeltaTSig =
std::min(2.0,
std::max(0.5,
double(pair.second.front()->getHitChiSquare())));
426 reco::HitPairListPtr::iterator firstBadHitItr = std::find_if(pair.second.begin(),pair.second.end(),[cutDeltaTSig](
const auto& hitPtr){
return hitPtr->getHitChiSquare() > cutDeltaTSig;});
441 std::copy(firstBadHitItr,pair.second.end(),std::back_inserter(rejectCandList));
446 for(
const auto& hit3D : rejectCandList)
448 bool rejectThisHit(
true);
449 std::vector<std::pair<reco::HitPairListPtr&,reco::HitPairListPtr::iterator>> deleteVec;
451 for(
const auto& hit2D : hit3D->getHits())
454 if (!hit2D)
continue;
459 if (removeHitList.size() < 2)
462 rejectThisHit =
false;
468 if (removeItr != removeHitList.end()) deleteVec.emplace_back(removeHitList,removeItr);
474 for(
auto& rejectPair : deleteVec) rejectPair.first.erase(rejectPair.second);
476 usedHitPairList.push_back(hit3D);
481 hitSet.insert(pair.first);
485 if (!usedHitPairList.empty())
490 for(
const auto& hit3D : usedHitPairList)
492 if (hit3D == lastHit3D)
continue;
496 if (hit3DItr != hitPairVector.end())
502 hitPairVector.erase(hit3DItr);
509 edgeMap.erase(edgeMap.find(hit3D));
528 for(
const auto& hit2D : hitSet)
void PCAAnalysis_3D(const reco::HitPairListPtr &hitPairList, reco::PrincipalComponents &pca, bool skeletonOnly=false) const
PrincipalComponentsAlg m_pcaAlg
reco::PrincipalComponents & getSkeletonPCA()
reco::Hit2DToHit3DListMap & getHit2DToHit3DListMap()
Hit has been rejected for any reason.
reco::Hit3DToEdgeMap & getHit3DToEdgeMap()
reco::HitPairListPtr & getHitPairListPtr()
reco::PlaneToClusterParamsMap & getClusterParams()
reco::PrincipalComponents & getFullPCA()
std::unordered_map< const reco::ClusterHit2D *, reco::HitPairListPtr > Hit2DToHit3DListMap
std::list< const reco::ClusterHit3D * > HitPairListPtr
void UpdateParameters(const reco::ClusterHit2D *hit)
static int max(int a, int b)
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
std::unordered_map< const reco::ClusterHit3D *, reco::EdgeList > Hit3DToEdgeMap
QTextStream & endl(QTextStream &s)