25 double lenght(
const std::vector<int>&);
50 #include <Math/VectorUtil.h>
56 using namespace ROOT::Math::VectorUtil;
62 algoMethod_(
cfg.getParameter<
string>(
"algoMethod")) {
63 produces<CandViewMatchMap>(
"src2mtc");
64 produces<CandViewMatchMap>(
"mtc2src");
75 edm::LogVerbatim(
"CandOneToOneDeltaRMatcher") <<
"======== Source Collection =======";
78 <<
" pt source " <<
c->pt() <<
" " <<
c->eta() <<
" " <<
c->phi() << endl;
80 edm::LogVerbatim(
"CandOneToOneDeltaRMatcher") <<
"======== Matched Collection =======";
83 <<
" pt source " <<
c->pt() <<
" " <<
c->eta() <<
" " <<
c->phi() << endl;
86 const int nSrc =
source->size();
87 const int nMtc =
matched->size();
96 vector<float> tempAllDist;
98 tempAllDist.push_back(
DeltaR(iSr->p4(), iMt->p4()));
100 AllDist.push_back(tempAllDist);
105 vector<float> tempAllDist;
107 tempAllDist.push_back(
DeltaR(iSr->p4(), iMt->p4()));
109 AllDist.push_back(tempAllDist);
125 int nLoopToDo = (
int)(TMath::Factorial(
nMax) / TMath::Factorial(
nMax -
nMin));
126 edm::LogVerbatim(
"CandOneToOneDeltaRMatcher") <<
"nLoop:" << nLoopToDo << endl;
140 if (nLoopToDo < 10000) {
147 throw cms::Exception(
"OneToOne Constructor") <<
"wrong matching method in ParameterSet";
152 <<
"min: " <<
i1 <<
" " << bestCB[
i1] <<
" " <<
AllDist[
i1][bestCB[
i1]];
161 auto matchMapSrMt = std::make_unique<CandViewMatchMap>();
162 auto matchMapMtSr = std::make_unique<CandViewMatchMap>();
164 for (
int c = 0;
c !=
nMin;
c++) {
194 for (vector<int>::const_iterator it = best.begin(); it != best.end(); it++) {
214 float totalDeltaR = 0;
215 float BestTotalDeltaR = 1000;
226 for (
int cnt = 0; cnt < TMath::Factorial(
nMin); cnt++) {
228 if (totalDeltaR < BestTotalDeltaR) {
229 BestTotalDeltaR = totalDeltaR;
232 next_permutation(cb.begin(), cb.end());
257 bestCB.push_back(minInd);
265 if (bestCB[
i1] == bestCB[
i2]) {