4 using namespace dedefs;
11 std::cout <<
"\nL1COMPARATOR constructor...\n" << std::flush;
13 std::vector<unsigned int> dosys(0,
DEnsys);
17 if((
int)dosys.size()!=
DEnsys)
19 <<
"wrong selection of systems to be compared\n"
20 <<
"\t the size of the mask COMPARE_COLLS (" << dosys.size()
21 <<
") is not " <<
DEnsys << std::endl;
22 assert((
int)dosys.size()==
DEnsys);
24 for(
int isys=0; isys<
DEnsys; isys++)
25 if( dosys[isys]!=0 && dosys[isys]!=1 )
27 <<
"L1Comparator: comparison flag for system " << isys
28 <<
" is non boolean: " << dosys[isys] <<
". Exiting.\n";
31 m_doSys[
i] = dosys[
i];
39 std::cout <<
"[L1Comparator] list of systems to process: ";
47 assert(
ETP==0); assert(
HTP==1); assert(
RCT== 2); assert(
GCT== 3);
48 assert(
DTP==4); assert(
DTF==5); assert(
CTP== 6); assert(
CTF== 7);
49 assert(
RPC==8); assert(
LTC==9); assert(
GMT==10); assert(
GLT==11);
52 std::cout <<
"[L1Comparator] debug print collection labels\n";
72 for(
int sys=0; sys<
DEnsys; sys++) {
85 <<
"\n\tdt:" << data_label <<
" : " <<m_DEsource[sys][0]
86 <<
"\n\tem:" << emul_label <<
" : " <<m_DEsource[sys][1]
89 std::cout <<
"\tdt:" << data_label <<
" : " <<m_DEsource[sys][2]
90 <<
"\n\tem:" << emul_label <<
" : " <<m_DEsource[sys][3]
102 if(!m_dumpFile.good())
104 <<
" L1Comparator::L1Comparator() : "
105 <<
" couldn't open dump file " << m_dumpFileName.c_str() << std::endl;
113 for(
int j=0;
j<2;
j++)
115 DEmatchEvt[
i] =
true;
120 produces<L1DataEmulRecord>().setBranchAlias(
"L1DataEmulRecord");
123 std::cout <<
"\nL1Comparator constructor...done.\n" << std::flush;
134 std::cout <<
"\nL1COMPARATOR beginRun...\n" << std::flush;
153 std::cout <<
"RCT key is empty. Sub-systems is disabled ("<<m_doSys[
RCT]<<
")\n";
155 std::cout <<
"GCT key is empty. Sub-systems is disabled ("<<m_doSys[
GCT]<<
")\n";
157 std::cout <<
"DTTF key is empty. Sub-systems is disabled ("<<m_doSys[
DTF]<<
")\n";
159 std::cout <<
"CSCTF key is empty. Sub-systems is disabled ("<<m_doSys[
CTF]<<
")\n";
161 std::cout <<
"RPC key is empty. Sub-systems is disabled ("<<m_doSys[
RPC]<<
")\n";
163 std::cout <<
"GMT key is empty. Sub-systems is disabled ("<<m_doSys[
GMT]<<
")\n";
165 std::cout <<
"GT key is empty. Sub-systems is disabled ("<<m_doSys[
GLT]<<
")\n";
166 std::cout <<
"TSC key = " << pKey->tscKey() << std::endl;
175 <<
"No L1TriggerKey found."
180 std::cout <<
"L1COMPARATOR beginRun... done\n" << std::flush;
186 m_dumpFile <<
"\n\n-------\n"
187 <<
"Global data|emulator agreement: "
188 << m_match << std::endl;
197 runNum_ = iEvent.
id().
run();
200 std::cout <<
"\nL1COMPARATOR entry:" << nevt_ <<
" | evt:" << evtNum_
201 <<
" | run:" << runNum_ <<
"\n" << std::flush;
208 for(
int j=0;
j<2;
j++)
210 DEmatchEvt[
i] =
true;
223 iEvent.
getByLabel(m_DEsource[RCT][0], rct_em_data);
224 iEvent.
getByLabel(m_DEsource[RCT][1], rct_em_emul);
225 iEvent.
getByLabel(m_DEsource[RCT][0], rct_rgn_data);
226 iEvent.
getByLabel(m_DEsource[RCT][1], rct_rgn_emul);
257 iEvent.
getByLabel(m_DEsource[GCT][0].
label(),
"isoEm", gct_isolaem_data);
258 iEvent.
getByLabel(m_DEsource[GCT][1].
label(),
"isoEm", gct_isolaem_emul);
259 iEvent.
getByLabel(m_DEsource[GCT][0].
label(),
"nonIsoEm",gct_noisoem_data);
260 iEvent.
getByLabel(m_DEsource[GCT][1].
label(),
"nonIsoEm",gct_noisoem_emul);
261 iEvent.
getByLabel(m_DEsource[GCT][0].
label(),
"cenJets", gct_cenjets_data);
262 iEvent.
getByLabel(m_DEsource[GCT][1].
label(),
"cenJets", gct_cenjets_emul);
263 iEvent.
getByLabel(m_DEsource[GCT][0].
label(),
"forJets", gct_forjets_data);
264 iEvent.
getByLabel(m_DEsource[GCT][1].
label(),
"forJets", gct_forjets_emul);
265 iEvent.
getByLabel(m_DEsource[GCT][0].
label(),
"tauJets", gct_taujets_data);
266 iEvent.
getByLabel(m_DEsource[GCT][1].
label(),
"tauJets", gct_taujets_emul);
268 iEvent.
getByLabel(m_DEsource[GCT][0],gct_ht_data);
269 iEvent.
getByLabel(m_DEsource[GCT][1],gct_ht_emul);
270 iEvent.
getByLabel(m_DEsource[GCT][0],gct_etmiss_data);
271 iEvent.
getByLabel(m_DEsource[GCT][1],gct_etmiss_emul);
272 iEvent.
getByLabel(m_DEsource[GCT][0],gct_ettota_data);
273 iEvent.
getByLabel(m_DEsource[GCT][1],gct_ettota_emul);
274 iEvent.
getByLabel(m_DEsource[GCT][0],gct_htmiss_data);
275 iEvent.
getByLabel(m_DEsource[GCT][1],gct_htmiss_emul);
276 iEvent.
getByLabel(m_DEsource[GCT][0],gct_hfring_data);
277 iEvent.
getByLabel(m_DEsource[GCT][1],gct_hfring_emul);
278 iEvent.
getByLabel(m_DEsource[GCT][0],gct_hfbcnt_data);
279 iEvent.
getByLabel(m_DEsource[GCT][1],gct_hfbcnt_emul);
280 iEvent.
getByLabel(m_DEsource[GCT][0],gct_jetcnt_data);
281 iEvent.
getByLabel(m_DEsource[GCT][1],gct_jetcnt_emul);
290 iEvent.
getByLabel(m_DEsource[DTP][0],dtp_ph_data_);
291 iEvent.
getByLabel(m_DEsource[DTP][1],dtp_ph_emul_);
292 iEvent.
getByLabel(m_DEsource[DTP][0],dtp_th_data_);
293 iEvent.
getByLabel(m_DEsource[DTP][1],dtp_th_emul_);
300 if(dtp_ph_data_.
isValid()) dtp_ph_data = dtp_ph_data_->getContainer();
301 if(dtp_ph_emul_.
isValid()) dtp_ph_emul = dtp_ph_emul_->getContainer();
302 if(dtp_th_data_.
isValid()) dtp_th_data = dtp_th_data_->getContainer();
303 if(dtp_th_emul_.
isValid()) dtp_th_emul = dtp_th_emul_->getContainer();
315 typedef std::vector<L1MuDTTrackCand> L1MuDTTrackCandCollection;
317 dtf_trk_data_v.clear(); dtf_trk_emul_v.clear();
319 L1MuDTTrackCandCollection *dttc = dtf_trk_data_->getContainer();
320 for(L1MuDTTrackCandCollection::const_iterator it=dttc->begin();
321 it!=dttc->end(); it++)
325 L1MuDTTrackCandCollection *dttc = dtf_trk_emul_->getContainer();
326 for(L1MuDTTrackCandCollection::const_iterator it=dttc->begin();
327 it!=dttc->end(); it++)
330 dtf_trk_data =&dtf_trk_data_v;
331 dtf_trk_emul =&dtf_trk_emul_v;
350 iEvent.
getByLabel(m_DEsource[LTC][0],ltc_data);
351 iEvent.
getByLabel(m_DEsource[LTC][1],ltc_emul);
365 iEvent.
getByLabel(m_DEsource[GMT][0], gmt_data);
366 iEvent.
getByLabel(m_DEsource[GMT][1], gmt_emul);
367 iEvent.
getByLabel(m_DEsource[GMT][0], gmt_rdt_data_);
368 iEvent.
getByLabel(m_DEsource[GMT][1], gmt_rdt_emul_);
372 gmt_can_data_vec.clear(); gmt_can_emul_vec.clear();
373 gmt_rdt_data_vec.clear(); gmt_rdt_emul_vec.clear();
375 typedef std::vector<L1MuGMTReadoutRecord>::const_iterator GmtRrIt;
377 std::vector<L1MuGMTReadoutRecord> gmt_rdt_data_bx = gmt_rdt_data_->getRecords();
378 for(GmtRrIt igmtrr=gmt_rdt_data_bx.begin(); igmtrr!=gmt_rdt_data_bx.end(); igmtrr++) {
380 typedef std::vector<L1MuGMTExtendedCand>::const_iterator GmtECIt;
381 std::vector<L1MuGMTExtendedCand> gmc;
382 gmc = igmtrr->getGMTCands();
383 for(GmtECIt iter1=gmc.begin(); iter1!=gmc.end(); iter1++) {
384 L1MuGMTCand cand(iter1->getDataWord(),iter1->bx());
386 cand.setEtaValue(iter1->etaValue());
387 cand.setPtValue (iter1->ptValue ());
388 gmt_can_data_vec.push_back(cand);
391 typedef L1MuRegionalCandCollection::const_iterator GmtRCIt;
394 rmc = igmtrr->getDTBXCands();
395 gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(),rmc.begin(),rmc.end());
397 rmc = igmtrr->getCSCCands();
398 gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(),rmc.begin(),rmc.end());
400 rmc = igmtrr->getBrlRPCCands();
401 gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(),rmc.begin(),rmc.end());
403 rmc = igmtrr->getFwdRPCCands();
404 gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(),rmc.begin(),rmc.end());
407 std::vector<L1MuGMTReadoutRecord> gmt_rdt_emul_bx = gmt_rdt_emul_->getRecords();
408 for(GmtRrIt igmtrr=gmt_rdt_emul_bx.begin(); igmtrr!=gmt_rdt_emul_bx.end(); igmtrr++) {
410 typedef std::vector<L1MuGMTExtendedCand>::const_iterator GmtECIt;
411 std::vector<L1MuGMTExtendedCand> gmc;
412 gmc = igmtrr->getGMTCands();
413 for(GmtECIt iter1=gmc.begin(); iter1!=gmc.end(); iter1++) {
414 gmt_can_emul_vec.push_back(
L1MuGMTCand(iter1->getDataWord(),iter1->bx()));
417 typedef L1MuRegionalCandCollection::const_iterator GmtRCIt;
420 rmc = igmtrr->getDTBXCands();
421 gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(),rmc.begin(),rmc.end());
423 rmc = igmtrr->getCSCCands();
424 gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(),rmc.begin(),rmc.end());
426 rmc = igmtrr->getBrlRPCCands();
427 gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(),rmc.begin(),rmc.end());
429 rmc = igmtrr->getFwdRPCCands();
430 gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(),rmc.begin(),rmc.end());
433 gmt_rdt_data = &gmt_rdt_data_vec;
434 gmt_rdt_emul = &gmt_rdt_emul_vec;
435 gmt_can_data = &gmt_can_data_vec;
436 gmt_can_emul = &gmt_can_emul_vec;
441 bool isValidDE[
DEnsys][2];
442 for(
int i=0;
i<
DEnsys;
i++)
for(
int j=0;
j<2;
j++) isValidDE[
i][
j]=
false;
447 isValidDE[
GCT][0] = gct_isolaem_data .
isValid(); isValidDE[
GCT][1] =gct_isolaem_emul .
isValid();
448 isValidDE[
GCT][0]&= gct_noisoem_data .
isValid(); isValidDE[
GCT][1]&=gct_noisoem_emul .
isValid();
449 isValidDE[
GCT][0]&= gct_cenjets_data .
isValid(); isValidDE[
GCT][1]&=gct_cenjets_emul .
isValid();
450 isValidDE[
GCT][0]&= gct_forjets_data .
isValid(); isValidDE[
GCT][1]&=gct_forjets_emul .
isValid();
451 isValidDE[
GCT][0]&= gct_taujets_data .
isValid(); isValidDE[
GCT][1]&=gct_taujets_emul .
isValid();
476 for(
int j=0;
j<2;
j++) {
477 isValid[
i] &= isValidDE[
i][
j];
482 std::cout <<
"L1Comparator sys isValid? (evt:" << nevt_ <<
") ";
499 std::cout <<
"L1Comparator start processing the collections.\n" << std::flush;
502 if(m_doSys[RCT]&&isValid[RCT]) process<L1CaloEmCollection> ( rct_em_data, rct_em_emul,
RCT,
RCTem);
503 if(m_doSys[RCT]&&isValid[RCT]) process<L1CaloRegionCollection> ( rct_rgn_data, rct_rgn_emul,
RCT,
RCTrgn);
505 if(m_doSys[GCT]&&isValid[GCT]) process<L1GctEmCandCollection> (gct_isolaem_data, gct_isolaem_emul,
GCT,
GCTisolaem);
506 if(m_doSys[GCT]&&isValid[GCT]) process<L1GctEmCandCollection> (gct_noisoem_data, gct_noisoem_emul,
GCT,
GCTnoisoem);
507 if(m_doSys[GCT]&&isValid[GCT]) process<L1GctJetCandCollection> (gct_cenjets_data, gct_cenjets_emul,
GCT,
GCTcenjets);
508 if(m_doSys[GCT]&&isValid[GCT]) process<L1GctJetCandCollection> (gct_forjets_data, gct_forjets_emul,
GCT,
GCTforjets);
509 if(m_doSys[GCT]&&isValid[GCT]) process<L1GctJetCandCollection> (gct_taujets_data, gct_taujets_emul,
GCT,
GCTtaujets);
510 if(m_doSys[GCT]&&isValid[GCT]) process<L1GctEtHadCollection> ( gct_ht_data, gct_ht_emul,
GCT,
GCTethad);
511 if(m_doSys[GCT]&&isValid[GCT]) process<L1GctEtMissCollection> ( gct_etmiss_data, gct_etmiss_emul,
GCT,
GCTetmiss);
512 if(m_doSys[GCT]&&isValid[GCT]) process<L1GctEtTotalCollection> ( gct_ettota_data , gct_ettota_emul,
GCT,
GCTettot);
513 if(m_doSys[GCT]&&isValid[GCT]) process<L1GctHtMissCollection> ( gct_htmiss_data, gct_htmiss_emul,
GCT,
GCThtmiss);
514 if(m_doSys[GCT]&&isValid[GCT]) process<L1GctHFRingEtSumsCollection> ( gct_hfring_data, gct_hfring_emul,
GCT,
GCThfring);
515 if(m_doSys[GCT]&&isValid[GCT]) process<L1GctHFBitCountsCollection> ( gct_hfbcnt_data, gct_hfbcnt_emul,
GCT,
GCThfbit);
518 if(m_doSys[DTP]&&isValid[DTP]) process<L1MuDTChambPhDigiCollection> ( dtp_ph_data, dtp_ph_emul,
DTP,
DTtpPh);
519 if(m_doSys[DTP]&&isValid[DTP]) process<L1MuDTChambThDigiCollection> ( dtp_th_data, dtp_th_emul,
DTP,
DTtpTh);
521 if(m_doSys[DTF]&&isValid[DTF]) process<L1MuRegionalCandCollection> ( dtf_trk_data, dtf_trk_emul,
DTF,
DTtftrk);
523 if(m_doSys[RPC]&&isValid[RPC]) process<L1MuRegionalCandCollection> ( rpc_cen_data, rpc_cen_emul,
RPC,
RPCcen);
524 if(m_doSys[RPC]&&isValid[RPC]) process<L1MuRegionalCandCollection> ( rpc_for_data, rpc_for_emul,
RPC,
RPCfor);
526 if(m_doSys[GMT]&&isValid[GMT]) process<L1MuGMTCandCollection> ( gmt_data, gmt_emul,
GMT,
GMTmain);
527 if(m_doSys[GMT]&&isValid[GMT]) process<L1MuRegionalCandCollection> ( gmt_rdt_data, gmt_rdt_emul,
GMT,
GMTrdt);
528 if(m_doSys[GMT]&&isValid[GMT]) process<L1MuGMTCandCollection> ( gmt_can_data, gmt_can_emul,
GMT,
GMTcnd);
535 std::cout <<
"L1Comparator done processing all collections.\n" << std::flush;
538 std::cout <<
"[L1Comparator] sys match? << evt." << nevt_ <<
": ";
547 bool evt_match =
true;
549 evt_match &= DEmatchEvt[
i];
561 m_match &= evt_match;
562 m_dumpFile << std::flush;
565 if(m_dedigis.size()==0) {
567 std::cout <<
"\n [L1Comparator] adding empty collection to DErecord\n";
572 std::auto_ptr<L1DataEmulRecord>
record
573 (
new L1DataEmulRecord(evt_match,m_doSys,DEmatchEvt,DEncand,m_dedigis, gltdigimon));
575 std::cout <<
"\n [L1Comparator] printing DErecord"
577 <<
"|evt:" << evtNum_
578 <<
"|run:" << runNum_
579 <<
"):\n" << std::flush;
581 <<
"\n" << std::flush;
587 std::cout <<
"L1comparator::analize() end. " << nevt_ << std::endl;
596 std::cout <<
"L1Comparator::process -ing system:" << sys
597 <<
" (" <<
SystLabel[sys] <<
"), data type " << cid
598 <<
"...\n" << std::flush;
600 std::cout <<
"L1Comparator::process debug "
601 <<
" (size " << data->size() <<
"," <<emul->size() <<
")"
602 <<
".\n" << std::flush;
608 else if(m_dumpMode==-1)
610 else if(m_dumpMode>0) {
626 <<
" system:" <<
SystLabel[sys] <<
"(id " << sys <<
")"
628 <<
" ndata:" << ndata
629 <<
" nemul:" << nemul
630 <<
" (size " << data->size() <<
"," <<emul->size() <<
")"
631 <<
".\n" << std::flush;
633 if(ndata==0&&nemul==0) {
636 <<
"empty collections -- exiting!\n" << std::flush;
640 m_dumpFile << std::setiosflags(std::ios::showpoint | std::ios::fixed
641 | std::ios::right | std::ios::adjustfield);
642 std::cout << std::setiosflags(std::ios::showpoint | std::ios::fixed
643 | std::ios::right | std::ios::adjustfield);
645 if(dumpEvent_ && prt ) {
646 m_dumpFile <<
"\nEntry: " << nevt_
647 <<
" (event:" << evtNum_
648 <<
" | run:" << runNum_
649 <<
")\n" << std::flush;
654 m_dumpFile <<
"\n sys:" <<
SystLabel[sys]
655 <<
" (" << sys <<
"), type:" << cid
659 std::cout <<
"L1Comparator::process print:\n" << std::flush
664 DEmatchEvt[sys] &= cmp.
do_compare(m_dumpFile,m_dumpMode);
670 for(L1DEDigiCollection::iterator it=dg.begin(); it!=dg.end();it++)
674 for(L1DEDigiCollection::iterator it=dg.begin(); it!=dg.end();it++)
677 for(L1DEDigiCollection::iterator it=dg.begin(); it!=dg.end();it++)
681 m_dedigis.insert(m_dedigis.end(), dg.begin(), dg.end());
682 for(
int i=0;
i<2;
i++)
689 <<
" ndata:" << DEncand[sys][0]
690 <<
" nemul:" << DEncand[sys][1]
691 <<
" (size " << data->size() <<
"," <<emul->size() <<
")"
692 <<
" ndigis:" << dg.size()
693 <<
" agree? " << DEmatchEvt[sys]
697 std::cout <<
"L1Comparator::process -ing system:"
698 << sys <<
" (" <<
SystLabel[sys] <<
")...done.\n"
702 template <
class myCol>
706 typedef typename myCol::iterator col_it;
707 col_sz ndata = data->size();
708 col_sz nemul = emul->size();
711 m_dumpFile <<
" #cand mismatch!"
712 <<
"\tdata: " << ndata
713 <<
"\temul: " << nemul
716 col_it itd = data ->
begin();
717 col_it itm = emul ->
begin();
718 for (col_sz
i=0;
i<ndata;
i++) {
719 match &= dumpCandidate(*itd++,*itm++, m_dumpFile);
729 s<<em<<std::endl<<std::endl;
T getParameter(std::string const &) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
L1Comparator(const edm::ParameterSet &)
std::string print(col_cit it) const
virtual void beginJob(void)
int get_ncand(typeT) const
std::vector< L1DataEmulDigi > L1DEDigiCollection
virtual void produce(edm::Event &, const edm::EventSetup &)
L1DEDigiCollection getDEDigis() const
void setPhiValue(float phiVal)
Setters for physical values.
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::string GetName(int i=0) const
std::vector< L1MuDTChambThDigi > L1MuDTChambThDigiCollection
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::vector< L1MuRegionalCand > L1MuRegionalCandCollection
bool do_compare(std::ofstream &, int dump=0)
std::vector< L1MuDTChambPhDigi > L1MuDTChambPhDigiCollection
const std::string SystLabel[DEnsys]
std::vector< std::vector< double > > tmp
bool dumpCandidate(const T &dt, const T &em, std::ostream &s)
char data[epos_bytes_allocation]
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
bool CompareCollections(edm::Handle< T > data, edm::Handle< T > emul)
virtual void beginRun(edm::Run const &, const edm::EventSetup &) overridefinal
std::vector< L1MuGMTCand > L1MuGMTCandCollection
void process(T const *, T const *, const int, const int)