27 typedef typename T::const_iterator
col_cit;
32 typedef typename std::vector<cand_type>
cand_vec;
33 typedef typename std::pair<cand_type, cand_type>
cand_pair;
34 typedef typename de_trait::coll_type
const*
typeT;
46 <<
": creating instance of type: " <<
GetName(0) <<
", data size:" <<
data_->size()
47 <<
" ncand:" <<
ncand_[0] <<
", emul size:" <<
emul_->size() <<
" ncand:" <<
ncand_[1]
68 if (
debug_ && (i < 0 || i > 2))
69 LogDebug(
"DEcompare") <<
"DEcompare illegal number of candidates request flag:" <<
i <<
"\n";
76 inline int de_type()
const {
return de_trait::de_type(); }
82 std::stringstream
ss(
"");
104 template <
typename T>
107 std::cout <<
" DEcompare::do_compare... " << GetName() <<
"\n" << std::flush;
108 t_match = CompareCollections(os,
dump);
114 if (
dump == -1 || (
dump == 1 && !t_match))
115 os <<
" ..." << GetName() <<
" data and emulator comparison: " <<
ok.c_str() << std::endl;
119 template <
typename T>
130 template <
typename T>
133 std::cout <<
" DEcompare::CompareCollections...\n" << std::flush;
135 int ndata = get_ncand(0);
136 int nemul = get_ncand(1);
139 cand_vec data_good, emul_good, data_bad, emul_bad;
140 data_good.reserve(data_->size());
141 emul_good.reserve(emul_->size());
142 data_bad.reserve(data_->size());
143 emul_bad.reserve(emul_->size());
146 match &= SortCollections(data_good, emul_good, data_bad, emul_bad);
150 <<
" data_bad:" << data_bad.size() <<
" emul_bad:" << emul_bad.size() <<
" data_good:" << data_good.size()
151 <<
" emul_good:" << emul_good.size() <<
" data_:" << data_->size() <<
" emul_:" << emul_->size() <<
".\n"
155 os <<
" number of candidates: " << ndata;
156 if (ndata != nemul) {
158 os <<
" (data) " << nemul <<
" (emul) disagree";
165 col_sz ndt = 0, nem = 0, nde = 0;
170 ndt = data_bad.size();
171 nem = emul_bad.size();
172 nde = (ndt > nem) ? ndt : nem;
174 itd = data_bad.begin();
175 itm = emul_bad.begin();
178 os <<
" un-matched (" << nde <<
")\n";
181 if (
i < ndt &&
i < nem)
183 else if (i < ndt && i >= nem)
185 else if (
i >= ndt &&
i < nem)
191 DumpCandidate(itd, itm, os, prtmode);
192 else if (prtmode == 0) {
193 if ((
dump == 2 && !de_utils.de_equal_loc(*itd, *itm)) || (
dump == 3 && de_utils.de_equal_loc(*itd, *itm)))
194 DumpCandidate(itd, itm, os, prtmode);
199 if (de_utils.de_equal_loc(*itd, *itm)) {
200 deDigiColl_.push_back(de_utils.DEDigi(itd, itm, 1));
202 deDigiColl_.push_back(de_utils.DEDigi(itd, itm, 2));
204 }
else if (prtmode == 1) {
205 deDigiColl_.push_back(de_utils.DEDigi(itd, itd, 3));
206 }
else if (prtmode == 2) {
207 deDigiColl_.push_back(de_utils.DEDigi(itm, itm, 4));
216 itd = data_good.begin();
217 itm = emul_good.begin();
219 assert(data_good.size() == emul_good.size());
221 os <<
" matched (" << data_good.size() <<
")\n";
223 for (
col_sz i = 0;
i < data_good.size();
i++) {
224 assert(de_utils.de_equal(*itd, *itm));
226 DumpCandidate(itd, itm, os, prtmode);
227 deDigiColl_.push_back(de_utils.DEDigi(itd, itm, 0));
233 std::cout <<
"DEcompare<T>::CompareCollections end.\n" << std::flush;
238 template <
typename T>
241 std::cout <<
" DEcompare::SortCollections...\n" << std::flush;
253 for (
col_cit ite = emul_->begin(); ite != emul_->end(); ite++) {
255 emul_tmp.push_back(*ite);
259 for (
col_cit itd = data_->begin(); itd != data_->end(); itd++) {
262 col_it ite = emul_tmp.end();
263 ite = de_utils.de_find(emul_tmp.begin(), emul_tmp.end(), *itd);
264 if (ite != emul_tmp.end()) {
265 data_good.push_back(*itd);
266 emul_good.push_back(*ite);
267 ite = emul_tmp.erase(ite);
269 data_tmp.push_back(*itd);
274 for (
col_it itd = data_tmp.begin(); itd != data_tmp.end(); itd++) {
275 for (
col_it ite = emul_tmp.begin(); ite != emul_tmp.end(); ite++) {
276 if (de_utils.de_equal_loc(*itd, *ite)) {
277 data_bad.push_back(*itd);
278 emul_bad.push_back(*ite);
279 itd = data_tmp.erase(itd) - 1;
280 ite = emul_tmp.erase(ite) - 1;
289 data_bad.insert(data_bad.end(), data_tmp.begin(), data_tmp.end());
290 emul_bad.insert(emul_bad.end(), emul_tmp.begin(), emul_tmp.end());
294 <<
" data_bad:" << data_bad.size() <<
" emul_bad:" << emul_bad.size() <<
" data_good:" << data_good.size()
295 <<
" emul_good:" << emul_good.size() <<
" data: " << get_ncand(data_) <<
" emul: " << get_ncand(emul_)
299 std::cout <<
"DEcompare<T>::SortCollections end.\n" << std::flush;
303 template <
typename T>
306 os <<
" data: " <<
print(itd);
308 os <<
" emul: " <<
print(itm) << std::endl;
310 if (!de_utils.de_equal(*itd, *itm))