25 typedef typename T::const_iterator
col_cit;
30 typedef typename std::vector<cand_type>
cand_vec;
31 typedef typename std::pair<cand_type,cand_type>
cand_pair;
32 typedef typename de_trait::coll_type
const*
typeT;
47 <<
": creating instance of type: " <<
GetName(0)
48 <<
", data size:" <<
data_->size() <<
" ncand:" <<
ncand_[0]
49 <<
", emul size:" <<
emul_->size() <<
" ncand:" <<
ncand_[1]
50 <<
".\n" << std::flush;
65 bool SortCollections(cand_vec& dg, cand_vec& eg, cand_vec& db, cand_vec& eb);
69 if(
debug_ && (i<0 || i>2) )
71 <<
"DEcompare illegal number of candidates request flag:"<<i<<
"\n";
78 inline int de_type()
const {
return de_trait::de_type();}
84 std::stringstream ss(
"");
85 for(col_cit itd=
data_->begin();itd!=
data_->end();itd++)
87 for(col_cit itm=
emul_->begin();itm!=
emul_->end();itm++)
107 template <
typename T>
110 std::cout <<
" DEcompare::do_compare... " 111 <<
GetName() <<
"\n" << std::flush;
116 if(dump==-1 || (dump==1 && !
t_match))
118 <<
" data and emulator comparison: " << ok.c_str() << std::endl;
122 template <
typename T>
125 for (
col_cit it = col->begin(); it!=col->end(); it++) {
133 template <
typename T>
137 std::cout <<
" DEcompare::CompareCollections...\n"<< std::flush;
141 assert (ndata || nemul);
143 cand_vec data_good, emul_good, data_bad, emul_bad;
144 data_good.reserve(
data_->size());
145 emul_good.reserve(
emul_->size());
146 data_bad .reserve(
data_->size());
147 emul_bad .reserve(
emul_->size());
154 <<
" data_bad:" << data_bad .size()
155 <<
" emul_bad:" << emul_bad .size()
156 <<
" data_good:" << data_good.size()
157 <<
" emul_good:" << emul_good.size()
158 <<
" data_:" <<
data_->size()
159 <<
" emul_:" <<
emul_->size()
160 <<
".\n" <<std::flush;
162 if(dump==-1 || (dump==1 && !match)) {
163 os <<
" number of candidates: " << ndata;
166 os <<
" (data) " << nemul <<
" (emul) disagree";
174 col_sz ndt=0, nem=0, nde=0;
179 ndt = data_bad.size();
180 nem = emul_bad.size();
181 nde = (ndt>nem)?ndt:nem;
183 itd = data_bad.begin();
184 itm = emul_bad.begin();
187 os <<
" un-matched (" << nde <<
")\n";
191 if (
i< ndt &&
i< nem) prtmode=0;
192 else if(i< ndt && i>=nem) prtmode=1;
193 else if(
i>=ndt &&
i< nem) prtmode=2;
198 else if(prtmode==0) {
199 if( (dump==2 && !
de_utils.de_equal_loc(*itd,*itm)) ||
200 (dump==3 &&
de_utils.de_equal_loc(*itd,*itm)) )
206 if(
de_utils.de_equal_loc(*itd,*itm)) {
211 }
else if (prtmode==1) {
213 }
else if (prtmode==2) {
222 itd = data_good.begin();
223 itm = emul_good.begin();
225 assert(data_good.size()==emul_good.size());
227 os <<
" matched (" << data_good.size() <<
")\n";
229 for(
col_sz i=0;
i<data_good.size();
i++) {
230 assert(
de_utils.de_equal(*itd,*itm));
238 std::cout <<
"DEcompare<T>::CompareCollections end.\n"<< std::flush;
244 template <
typename T>
248 std::cout <<
" DEcompare::SortCollections...\n"<< std::flush;
262 emul_tmp.push_back(*ite);
268 col_it ite = emul_tmp.end();
269 ite =
de_utils.de_find(emul_tmp.begin(),emul_tmp.end(),*itd);
270 if(ite!=emul_tmp.end()) {
271 data_good.push_back(*itd);
272 emul_good.push_back(*ite);
273 ite=emul_tmp.erase(ite);
275 data_tmp.push_back(*itd);
280 for(
col_it itd = data_tmp.begin(); itd != data_tmp.end(); itd++) {
281 for(
col_it ite = emul_tmp.begin(); ite != emul_tmp.end(); ite++) {
282 if(
de_utils.de_equal_loc(*itd,*ite)) {
283 data_bad.push_back(*itd);
284 emul_bad.push_back(*ite);
285 itd = data_tmp.erase(itd)-1;
286 ite = emul_tmp.erase(ite)-1;
295 data_bad.insert(data_bad.end(),data_tmp.begin(),data_tmp.end());
296 emul_bad.insert(emul_bad.end(),emul_tmp.begin(),emul_tmp.end());
300 <<
" data_bad:" << data_bad .size()
301 <<
" emul_bad:" << emul_bad .size()
302 <<
" data_good:" << data_good.size()
303 <<
" emul_good:" << emul_good.size()
306 <<
"\n" << std::flush;
308 std::cout <<
"DEcompare<T>::SortCollections end.\n"<< std::flush;
312 template <
typename T>
315 os <<
" data: " <<
print(itd);
317 os <<
" emul: " <<
print(itm) << std::endl;
bool CompareCollections(std::ofstream &, int dump=0)
std::string print(col_cit it) const
de_trait::coll_type const * typeT
int get_ncand(typeT) const
de_trait::cand_type cand_type
bool SortCollections(cand_vec &dg, cand_vec &eg, cand_vec &db, cand_vec &eb)
std::vector< L1DataEmulDigi > L1DEDigiCollection
L1DEDigiCollection getDEDigis() const
int get_ncand(int i) const
std::pair< cand_type, cand_type > cand_pair
Abs< T >::type abs(const T &t)
std::string print() const
std::vector< cand_type > cand_vec
std::string GetName(int i=0) const
bool do_compare(std::ofstream &, int dump=0)
bool DumpCandidate(col_cit itd, col_cit itm, std::ofstream &, int mode=0)
bool is_empty(col_cit it) const
T::const_iterator col_cit
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
de_trait::coll_type coll_type
DEcompare(typeT dt, typeT em)
L1DEDigiCollection deDigiColl_