CMS 3D CMS Logo

L1Comparator.cc
Go to the documentation of this file.
3 
4 using namespace dedefs;
5 
6 namespace {
7  std::array<bool, dedefs::DEnsys> fillDoSys(edm::ParameterSet const& iConfig) {
8  std::vector<unsigned int> dosys = iConfig.getUntrackedParameter<std::vector<unsigned int> >(
9  "COMPARE_COLLS", std::vector<unsigned int>(0, DEnsys));
10 
11  if ((int)dosys.size() != DEnsys)
12  edm::LogError("L1Comparator") << "wrong selection of systems to be compared\n"
13  << "\t the size of the mask COPARE_COLLS (" << dosys.size() << ") is not " << DEnsys
14  << std::endl;
15  assert((int)dosys.size() == DEnsys);
16 
17  for (int isys = 0; isys < DEnsys; isys++)
18  if (dosys[isys] != 0 && dosys[isys] != 1)
19  throw cms::Exception("Invalid configuration") << "L1Comparator: comparison flag for system " << isys
20  << " is non boolean: " << dosys[isys] << ". Exiting.\n";
21 
22  std::array<bool, dedefs::DEnsys> ret;
23  for (int i = 0; i < DEnsys; i++)
24  ret[i] = dosys[i];
25  return ret;
26  }
27 } // namespace
28 
30  : m_stage1_layer2_{iConfig.getParameter<bool>("stage1_layer2_")},
31  verbose_{iConfig.getUntrackedParameter<int>("VerboseFlag", 0)},
32  tokenTriggerKey_{esConsumes<edm::Transition::BeginRun>()},
33  m_doSys{fillDoSys(iConfig)},
34  m_dumpFileName{iConfig.getUntrackedParameter<std::string>("DumpFile", "")},
35  m_dumpMode{iConfig.getUntrackedParameter<int>("DumpMode", 0)},
36  m_fileGuard{} {
37  if (verbose())
38  std::cout << "\nL1COMPARATOR constructor...\n" << std::flush;
39 
40  if (verbose()) {
41  std::cout << "[L1Comparator] do sys? ";
42  for (int i = 0; i < DEnsys; i++)
43  std::cout << m_doSys[i] << " ";
44  std::cout << std::endl;
45 
46  std::cout << "[L1Comparator] list of systems to process: ";
47  for (int i = 0; i < DEnsys; i++)
48  if (m_doSys[i])
49  std::cout << SystLabel[i] << " ";
50  std::cout << std::endl;
51  }
52 
54  assert(ETP == 0);
55  assert(HTP == 1);
56  assert(RCT == 2);
57  assert(GCT == 3);
58  assert(DTP == 4);
59  assert(DTF == 5);
60  assert(CTP == 6);
61  assert(CTF == 7);
62  assert(RPC == 8);
63  assert(LTC == 9);
64  assert(GMT == 10);
65  assert(GLT == 11);
66 
68  if (m_dumpMode) {
69  m_dumpFile.open(m_dumpFileName.c_str(), std::ios::out);
70  if (!m_dumpFile.good())
71  edm::LogInfo("L1ComparatorDumpFileOpenError")
72  << " L1Comparator::L1Comparator() : "
73  << " couldn't open dump file " << m_dumpFileName.c_str() << std::endl;
74  }
75 
76  m_match = true;
77  nevt_ = -1;
78 
80  produces<L1DataEmulRecord>().setBranchAlias("L1DataEmulRecord");
81 
82  // -- RCT [regional calorimeter trigger]
83  if (m_doSys[RCT]) {
84  edm::InputTag tag0 = iConfig.getParameter<edm::InputTag>("RCTsourceData");
85  edm::InputTag tag1 = iConfig.getParameter<edm::InputTag>("RCTsourceEmul");
86 
87  tokenCaloEm_[0] = consumes<L1CaloEmCollection>(tag0);
88  tokenCaloEm_[1] = consumes<L1CaloEmCollection>(tag1);
89  tokenCaloRegion_[0] = consumes<L1CaloRegionCollection>(tag0);
90  tokenCaloRegion_[1] = consumes<L1CaloRegionCollection>(tag1);
91  }
92 
93  // -- GCT [global calorimeter trigger]
94  if (m_doSys[GCT]) {
96  tags[0] = iConfig.getParameter<edm::InputTag>("GCTsourceData");
97  tags[1] = iConfig.getParameter<edm::InputTag>("GCTsourceEmul");
98 
99  if (m_stage1_layer2_ == false) {
100  for (int i = 0; i < 2; ++i) {
101  edm::InputTag const& tag = tags[i];
102  std::string const& label = tag.label();
103  tokenGctEmCand_isoEm_[i] = consumes<L1GctEmCandCollection>(edm::InputTag(label, "isoEm"));
104  tokenGctEmCand_nonIsoEm_[i] = consumes<L1GctEmCandCollection>(edm::InputTag(label, "nonIsoEm"));
105  tokenGctJetCand_cenJets_[i] = consumes<L1GctJetCandCollection>(edm::InputTag(label, "cenJets"));
106  tokenGctJetCand_forJets_[i] = consumes<L1GctJetCandCollection>(edm::InputTag(label, "forJets"));
107  tokenGctJetCand_tauJets_[i] = consumes<L1GctJetCandCollection>(edm::InputTag(label, "tauJets"));
108  tokenGctEtTotal_[i] = consumes<L1GctEtTotalCollection>(tag);
109  tokenGctEtHad_[i] = consumes<L1GctEtHadCollection>(tag);
110  tokenGctEtMiss_[i] = consumes<L1GctEtMissCollection>(tag);
111  tokenGctHFRingEtSums_[i] = consumes<L1GctHFRingEtSumsCollection>(tag);
112  tokenGctHFBitCounts_[i] = consumes<L1GctHFBitCountsCollection>(tag);
113  tokenGctHtMiss_[i] = consumes<L1GctHtMissCollection>(tag);
114  tokenGctJetCounts_[i] = consumes<L1GctJetCountsCollection>(tag);
115  }
116  }
117  if (m_stage1_layer2_ == true) {
118  for (int i = 0; i < 2; ++i) {
119  edm::InputTag const& tag = tags[i];
120  std::string const& label = tag.label();
121  tokenGctEmCand_isoEm_[i] = consumes<L1GctEmCandCollection>(edm::InputTag(label, "isoEm"));
122  tokenGctEmCand_nonIsoEm_[i] = consumes<L1GctEmCandCollection>(edm::InputTag(label, "nonIsoEm"));
123  tokenGctJetCand_cenJets_[i] = consumes<L1GctJetCandCollection>(edm::InputTag(label, "cenJets"));
124  tokenGctJetCand_forJets_[i] = consumes<L1GctJetCandCollection>(edm::InputTag(label, "forJets"));
125  tokenGctJetCand_tauJets_[i] = consumes<L1GctJetCandCollection>(edm::InputTag(label, "tauJets"));
126  tokenGctJetCand_isoTauJets_[i] = consumes<L1GctJetCandCollection>(edm::InputTag(label, "isoTauJets"));
127  tokenGctEtTotal_[i] = consumes<L1GctEtTotalCollection>(tag);
128  tokenGctEtHad_[i] = consumes<L1GctEtHadCollection>(tag);
129  tokenGctEtMiss_[i] = consumes<L1GctEtMissCollection>(tag);
130  tokenGctHFRingEtSums_[i] = consumes<L1GctHFRingEtSumsCollection>(tag);
131  tokenGctHFBitCounts_[i] = consumes<L1GctHFBitCountsCollection>(tag);
132  tokenGctHtMiss_[i] = consumes<L1GctHtMissCollection>(tag);
133  tokenGctJetCounts_[i] = consumes<L1GctJetCountsCollection>(tag);
134  }
135  }
136  }
137 
138  // -- DTP [drift tube trigger primitive]
139  if (m_doSys[DTP]) {
140  edm::InputTag tag0 = iConfig.getParameter<edm::InputTag>("DTPsourceData");
141  edm::InputTag tag1 = iConfig.getParameter<edm::InputTag>("DTPsourceEmul");
142 
143  tokenMuDTChambPh_[0] = consumes<L1MuDTChambPhContainer>(tag0);
144  tokenMuDTChambPh_[1] = consumes<L1MuDTChambPhContainer>(tag1);
145  tokenMuDTChambTh_[0] = consumes<L1MuDTChambThContainer>(tag0);
146  tokenMuDTChambTh_[1] = consumes<L1MuDTChambThContainer>(tag1);
147  }
148 
149  // -- DTF [drift tube track finder]
150  if (m_doSys[DTF]) {
151  edm::InputTag tag0 = iConfig.getParameter<edm::InputTag>("DTFsourceData");
152  edm::InputTag tag1 = iConfig.getParameter<edm::InputTag>("DTFsourceEmul");
153 
154  tokenMuDTTrack_[0] = consumes<L1MuDTTrackContainer>(edm::InputTag(tag0.label(), "DATA"));
155  tokenMuDTTrack_[1] = consumes<L1MuDTTrackContainer>(edm::InputTag(tag1.label(), "DTTF"));
156  }
157 
158  // -- RPC [resistive plate chambers regional trigger]
159  if (m_doSys[RPC]) {
160  edm::InputTag tag0 = iConfig.getParameter<edm::InputTag>("RPCsourceData");
161  edm::InputTag tag1 = iConfig.getParameter<edm::InputTag>("RPCsourceEmul");
162 
163  tokenMuRegionalCandRPCb_[0] = consumes<L1MuRegionalCandCollection>(edm::InputTag(tag0.label(), "RPCb"));
164  tokenMuRegionalCandRPCb_[1] = consumes<L1MuRegionalCandCollection>(edm::InputTag(tag1.label(), "RPCb"));
165  tokenMuRegionalCandRPCf_[0] = consumes<L1MuRegionalCandCollection>(edm::InputTag(tag0.label(), "RPCf"));
166  tokenMuRegionalCandRPCf_[1] = consumes<L1MuRegionalCandCollection>(edm::InputTag(tag1.label(), "RPCf"));
167  }
168 
169  // -- LTC [local trigger controller]
170  if (m_doSys[LTC]) {
171  // FIXME
172  // There should be a real input tag here, but there was none in the original code.
173  edm::InputTag dummyTag;
174  tokenLTCDigi_[0] = consumes<LTCDigiCollection>(dummyTag);
175  tokenLTCDigi_[1] = consumes<LTCDigiCollection>(dummyTag);
176  }
177 
178  // -- GMT [global muon trigger]
179  if (m_doSys[GMT]) {
180  edm::InputTag tag0 = iConfig.getParameter<edm::InputTag>("GMTsourceData");
181  edm::InputTag tag1 = iConfig.getParameter<edm::InputTag>("GMTsourceEmul");
182 
183  tokenMuGMTCand_[0] = consumes<L1MuGMTCandCollection>(tag0);
184  tokenMuGMTCand_[1] = consumes<L1MuGMTCandCollection>(tag1);
185  tokenMuReadoutCand_[0] = consumes<L1MuGMTReadoutCollection>(tag0);
186  tokenMuReadoutCand_[1] = consumes<L1MuGMTReadoutCollection>(tag1);
187  }
188 
189  if (verbose())
190  std::cout << "\nL1Comparator constructor...done.\n" << std::flush;
191 }
192 
193 std::shared_ptr<L1Comparator::RunCache> L1Comparator::globalBeginRun(edm::Run const& iRun,
194  const edm::EventSetup& iSetup) const {
195  if (verbose())
196  std::cout << "\nL1COMPARATOR beginRun...\n" << std::flush;
197 
198  auto runDoSys = std::make_shared<RunCache>();
199  // disable subsystem if not included in current run configuration
200  try {
201  auto const& pKey = iSetup.getData(tokenTriggerKey_);
202  *runDoSys = m_doSys;
203 
204  (*runDoSys)[RCT] &= (!(pKey.subsystemKey(L1TriggerKey::kRCT).empty()));
205  (*runDoSys)[GCT] &= (!(pKey.subsystemKey(L1TriggerKey::kGCT).empty()));
206  (*runDoSys)[DTF] &= (!(pKey.subsystemKey(L1TriggerKey::kDTTF).empty()));
207  (*runDoSys)[CTF] &= (!(pKey.subsystemKey(L1TriggerKey::kCSCTF).empty()));
208  (*runDoSys)[RPC] &= (!(pKey.subsystemKey(L1TriggerKey::kRPC).empty()));
209  (*runDoSys)[GMT] &= (!(pKey.subsystemKey(L1TriggerKey::kGMT).empty()));
210  (*runDoSys)[GLT] &= (!(pKey.subsystemKey(L1TriggerKey::kGT).empty()));
211 
212  if (verbose()) {
213  if (pKey.subsystemKey(L1TriggerKey::kRCT).empty())
214  std::cout << "RCT key is empty. Sub-systems is disabled (" << (*runDoSys)[RCT] << ")\n";
215  if (pKey.subsystemKey(L1TriggerKey::kGCT).empty())
216  std::cout << "GCT key is empty. Sub-systems is disabled (" << (*runDoSys)[GCT] << ")\n";
217  if (pKey.subsystemKey(L1TriggerKey::kDTTF).empty())
218  std::cout << "DTTF key is empty. Sub-systems is disabled (" << (*runDoSys)[DTF] << ")\n";
219  if (pKey.subsystemKey(L1TriggerKey::kCSCTF).empty())
220  std::cout << "CSCTF key is empty. Sub-systems is disabled (" << (*runDoSys)[CTF] << ")\n";
221  if (pKey.subsystemKey(L1TriggerKey::kRPC).empty())
222  std::cout << "RPC key is empty. Sub-systems is disabled (" << (*runDoSys)[RPC] << ")\n";
223  if (pKey.subsystemKey(L1TriggerKey::kGMT).empty())
224  std::cout << "GMT key is empty. Sub-systems is disabled (" << (*runDoSys)[GMT] << ")\n";
225  if (pKey.subsystemKey(L1TriggerKey::kGT).empty())
226  std::cout << "GT key is empty. Sub-systems is disabled (" << (*runDoSys)[GLT] << ")\n";
227  std::cout << "TSC key = " << pKey.tscKey() << std::endl;
228  }
229 
230  //access subsystem key if needed, eg:
231  //std::cout << "RCT key:" << pKey->subsystemKey( L1TriggerKey::kRCT ) << std::endl;
232  } catch (cms::Exception& ex) {
233  edm::LogWarning("L1Comparator") << "No L1TriggerKey found." << std::endl;
234  }
235 
236  if (verbose())
237  std::cout << "L1COMPARATOR beginRun... done\n" << std::flush;
238  return runDoSys;
239 }
240 
242  if (m_dumpMode)
243  m_dumpFile << "\n\n-------\n"
244  << "Global data|emulator agreement: " << m_match << std::endl;
245  m_dumpFile.close();
246 }
247 
250  eventInfo.nevt_ = ++nevt_;
251  eventInfo.evtNum_ = iEvent.id().event();
252  eventInfo.runNum_ = iEvent.id().run();
253 
254  if (verbose())
255  std::cout << "\nL1COMPARATOR entry:" << eventInfo.nevt_ << " | evt:" << eventInfo.evtNum_
256  << " | run:" << eventInfo.runNum_ << "\n"
257  << std::flush;
258 
260 
261  // -- RCT [regional calorimeter trigger]
266  auto const runIndex = iEvent.getRun().index();
267  auto& runDoSys = *runCache(runIndex);
268 
269  if (runDoSys[RCT]) {
270  iEvent.getByToken(tokenCaloEm_[0], rct_em_data);
271  iEvent.getByToken(tokenCaloEm_[1], rct_em_emul);
272  iEvent.getByToken(tokenCaloRegion_[0], rct_rgn_data);
273  iEvent.getByToken(tokenCaloRegion_[1], rct_rgn_emul);
274  }
275 
276  // -- GCT [global calorimeter trigger]
277  edm::Handle<L1GctEmCandCollection> gct_isolaem_data;
278  edm::Handle<L1GctEmCandCollection> gct_isolaem_emul;
279  edm::Handle<L1GctEmCandCollection> gct_noisoem_data;
280  edm::Handle<L1GctEmCandCollection> gct_noisoem_emul;
281  edm::Handle<L1GctJetCandCollection> gct_cenjets_data;
282  edm::Handle<L1GctJetCandCollection> gct_cenjets_emul;
283  edm::Handle<L1GctJetCandCollection> gct_forjets_data;
284  edm::Handle<L1GctJetCandCollection> gct_forjets_emul;
285  edm::Handle<L1GctJetCandCollection> gct_taujets_data;
286  edm::Handle<L1GctJetCandCollection> gct_taujets_emul;
287  edm::Handle<L1GctJetCandCollection> gct_isotaujets_data;
288  edm::Handle<L1GctJetCandCollection> gct_isotaujets_emul;
289 
292  edm::Handle<L1GctEtMissCollection> gct_etmiss_data;
293  edm::Handle<L1GctEtMissCollection> gct_etmiss_emul;
294  edm::Handle<L1GctEtTotalCollection> gct_ettota_data;
295  edm::Handle<L1GctEtTotalCollection> gct_ettota_emul;
296  edm::Handle<L1GctHtMissCollection> gct_htmiss_data;
297  edm::Handle<L1GctHtMissCollection> gct_htmiss_emul;
304 
305  if (runDoSys[GCT]) {
306  if (m_stage1_layer2_ == false) {
307  iEvent.getByToken(tokenGctEmCand_isoEm_[0], gct_isolaem_data);
308  iEvent.getByToken(tokenGctEmCand_isoEm_[1], gct_isolaem_emul);
309  iEvent.getByToken(tokenGctEmCand_nonIsoEm_[0], gct_noisoem_data);
310  iEvent.getByToken(tokenGctEmCand_nonIsoEm_[1], gct_noisoem_emul);
311  iEvent.getByToken(tokenGctJetCand_cenJets_[0], gct_cenjets_data);
312  iEvent.getByToken(tokenGctJetCand_cenJets_[1], gct_cenjets_emul);
313  iEvent.getByToken(tokenGctJetCand_forJets_[0], gct_forjets_data);
314  iEvent.getByToken(tokenGctJetCand_forJets_[1], gct_forjets_emul);
315  iEvent.getByToken(tokenGctJetCand_tauJets_[0], gct_taujets_data);
316  iEvent.getByToken(tokenGctJetCand_tauJets_[1], gct_taujets_emul);
317  iEvent.getByToken(tokenGctEtHad_[0], gct_ht_data);
318  iEvent.getByToken(tokenGctEtHad_[1], gct_ht_emul);
319  iEvent.getByToken(tokenGctEtMiss_[0], gct_etmiss_data);
320  iEvent.getByToken(tokenGctEtMiss_[1], gct_etmiss_emul);
321  iEvent.getByToken(tokenGctEtTotal_[0], gct_ettota_data);
322  iEvent.getByToken(tokenGctEtTotal_[1], gct_ettota_emul);
323  iEvent.getByToken(tokenGctHtMiss_[0], gct_htmiss_data);
324  iEvent.getByToken(tokenGctHtMiss_[1], gct_htmiss_emul);
325  iEvent.getByToken(tokenGctHFRingEtSums_[0], gct_hfring_data);
326  iEvent.getByToken(tokenGctHFRingEtSums_[1], gct_hfring_emul);
327  iEvent.getByToken(tokenGctHFBitCounts_[0], gct_hfbcnt_data);
328  iEvent.getByToken(tokenGctHFBitCounts_[1], gct_hfbcnt_emul);
329  iEvent.getByToken(tokenGctJetCounts_[0], gct_jetcnt_data);
330  iEvent.getByToken(tokenGctJetCounts_[1], gct_jetcnt_emul);
331  }
332  if (m_stage1_layer2_ == true) {
333  iEvent.getByToken(tokenGctEmCand_isoEm_[0], gct_isolaem_data);
334  iEvent.getByToken(tokenGctEmCand_isoEm_[1], gct_isolaem_emul);
335  iEvent.getByToken(tokenGctEmCand_nonIsoEm_[0], gct_noisoem_data);
336  iEvent.getByToken(tokenGctEmCand_nonIsoEm_[1], gct_noisoem_emul);
337  iEvent.getByToken(tokenGctJetCand_cenJets_[0], gct_cenjets_data);
338  iEvent.getByToken(tokenGctJetCand_cenJets_[1], gct_cenjets_emul);
339  iEvent.getByToken(tokenGctJetCand_forJets_[0], gct_forjets_data);
340  iEvent.getByToken(tokenGctJetCand_forJets_[1], gct_forjets_emul);
341  iEvent.getByToken(tokenGctJetCand_tauJets_[0], gct_taujets_data);
342  iEvent.getByToken(tokenGctJetCand_tauJets_[1], gct_taujets_emul);
343  iEvent.getByToken(tokenGctJetCand_isoTauJets_[0], gct_isotaujets_data);
344  iEvent.getByToken(tokenGctJetCand_isoTauJets_[1], gct_isotaujets_emul);
345  iEvent.getByToken(tokenGctEtHad_[0], gct_ht_data);
346  iEvent.getByToken(tokenGctEtHad_[1], gct_ht_emul);
347  iEvent.getByToken(tokenGctEtMiss_[0], gct_etmiss_data);
348  iEvent.getByToken(tokenGctEtMiss_[1], gct_etmiss_emul);
349  iEvent.getByToken(tokenGctEtTotal_[0], gct_ettota_data);
350  iEvent.getByToken(tokenGctEtTotal_[1], gct_ettota_emul);
351  iEvent.getByToken(tokenGctHtMiss_[0], gct_htmiss_data);
352  iEvent.getByToken(tokenGctHtMiss_[1], gct_htmiss_emul);
353  iEvent.getByToken(tokenGctHFRingEtSums_[0], gct_hfring_data);
354  iEvent.getByToken(tokenGctHFRingEtSums_[1], gct_hfring_emul);
355  iEvent.getByToken(tokenGctHFBitCounts_[0], gct_hfbcnt_data);
356  iEvent.getByToken(tokenGctHFBitCounts_[1], gct_hfbcnt_emul);
357  iEvent.getByToken(tokenGctJetCounts_[0], gct_jetcnt_data);
358  iEvent.getByToken(tokenGctJetCounts_[1], gct_jetcnt_emul);
359  }
360  }
361 
362  // -- DTP [drift tube trigger primitive]
367  if (runDoSys[DTP]) {
368  iEvent.getByToken(tokenMuDTChambPh_[0], dtp_ph_data_);
369  iEvent.getByToken(tokenMuDTChambPh_[1], dtp_ph_emul_);
370  iEvent.getByToken(tokenMuDTChambTh_[0], dtp_th_data_);
371  iEvent.getByToken(tokenMuDTChambTh_[1], dtp_th_emul_);
372  }
373  L1MuDTChambPhDigiCollection const* dtp_ph_data = nullptr;
374  L1MuDTChambPhDigiCollection const* dtp_ph_emul = nullptr;
375  L1MuDTChambThDigiCollection const* dtp_th_data = nullptr;
376  L1MuDTChambThDigiCollection const* dtp_th_emul = nullptr;
377 
378  if (dtp_ph_data_.isValid())
379  dtp_ph_data = dtp_ph_data_->getContainer();
380  if (dtp_ph_emul_.isValid())
381  dtp_ph_emul = dtp_ph_emul_->getContainer();
382  if (dtp_th_data_.isValid())
383  dtp_th_data = dtp_th_data_->getContainer();
384  if (dtp_th_emul_.isValid())
385  dtp_th_emul = dtp_th_emul_->getContainer();
386 
387  // -- DTF [drift tube track finder]
388  edm::Handle<L1MuDTTrackContainer> dtf_trk_data_;
389  edm::Handle<L1MuDTTrackContainer> dtf_trk_emul_;
390  L1MuRegionalCandCollection const* dtf_trk_data = nullptr;
391  L1MuRegionalCandCollection const* dtf_trk_emul = nullptr;
392  if (runDoSys[DTF]) {
393  iEvent.getByToken(tokenMuDTTrack_[0], dtf_trk_data_);
394  iEvent.getByToken(tokenMuDTTrack_[1], dtf_trk_emul_);
395  }
396  //extract the regional cands
397  typedef std::vector<L1MuDTTrackCand> L1MuDTTrackCandCollection;
398  L1MuRegionalCandCollection dtf_trk_data_v, dtf_trk_emul_v;
399  dtf_trk_data_v.clear();
400  dtf_trk_emul_v.clear();
401  if (dtf_trk_data_.isValid()) {
402  L1MuDTTrackCandCollection const* dttc = dtf_trk_data_->getContainer();
403  for (L1MuDTTrackCandCollection::const_iterator it = dttc->begin(); it != dttc->end(); it++)
404  dtf_trk_data_v.push_back(L1MuRegionalCand(*it));
405  }
406  if (dtf_trk_emul_.isValid()) {
407  L1MuDTTrackCandCollection const* dttc = dtf_trk_emul_->getContainer();
408  for (L1MuDTTrackCandCollection::const_iterator it = dttc->begin(); it != dttc->end(); it++)
409  dtf_trk_emul_v.push_back(L1MuRegionalCand(*it));
410  }
411  dtf_trk_data = &dtf_trk_data_v;
412  dtf_trk_emul = &dtf_trk_emul_v;
413 
414  // -- RPC [resistive plate chambers regional trigger]
419  if (runDoSys[RPC]) {
420  iEvent.getByToken(tokenMuRegionalCandRPCb_[0], rpc_cen_data);
421  iEvent.getByToken(tokenMuRegionalCandRPCb_[1], rpc_cen_emul);
422  iEvent.getByToken(tokenMuRegionalCandRPCf_[0], rpc_for_data);
423  iEvent.getByToken(tokenMuRegionalCandRPCf_[1], rpc_for_emul);
424  }
425 
426  // -- LTC [local trigger controller]
429  if (runDoSys[LTC]) {
430  iEvent.getByToken(tokenLTCDigi_[0], ltc_data);
431  iEvent.getByToken(tokenLTCDigi_[1], ltc_emul);
432  }
433 
434  // -- GMT [global muon trigger]
441  //tbd: may compare extended candidates
442  L1MuGMTCandCollection const* gmt_can_data(new L1MuGMTCandCollection);
443  L1MuGMTCandCollection const* gmt_can_emul(new L1MuGMTCandCollection);
444  if (runDoSys[GMT]) {
445  iEvent.getByToken(tokenMuGMTCand_[0], gmt_data);
446  iEvent.getByToken(tokenMuGMTCand_[1], gmt_emul);
447  iEvent.getByToken(tokenMuReadoutCand_[0], gmt_rdt_data_);
448  iEvent.getByToken(tokenMuReadoutCand_[1], gmt_rdt_emul_);
449  }
450  L1MuGMTCandCollection gmt_can_data_vec, gmt_can_emul_vec;
451  L1MuRegionalCandCollection gmt_rdt_data_vec, gmt_rdt_emul_vec;
452  gmt_can_data_vec.clear();
453  gmt_can_emul_vec.clear();
454  gmt_rdt_data_vec.clear();
455  gmt_rdt_emul_vec.clear();
456  if (gmt_rdt_data_.isValid() && gmt_rdt_emul_.isValid()) {
457  typedef std::vector<L1MuGMTReadoutRecord>::const_iterator GmtRrIt;
458  //get record vector for data
459  std::vector<L1MuGMTReadoutRecord> gmt_rdt_data_bx = gmt_rdt_data_->getRecords();
460  for (GmtRrIt igmtrr = gmt_rdt_data_bx.begin(); igmtrr != gmt_rdt_data_bx.end(); igmtrr++) {
461  //get gmt cands
462  typedef std::vector<L1MuGMTExtendedCand>::const_iterator GmtECIt;
463  std::vector<L1MuGMTExtendedCand> gmc;
464  gmc = igmtrr->getGMTCands();
465  for (GmtECIt iter1 = gmc.begin(); iter1 != gmc.end(); iter1++) {
466  L1MuGMTCand cand(iter1->getDataWord(), iter1->bx());
467  cand.setPhiValue(iter1->phiValue());
468  cand.setEtaValue(iter1->etaValue());
469  cand.setPtValue(iter1->ptValue());
470  gmt_can_data_vec.push_back(cand);
471  }
472  //get reg cands
473  typedef L1MuRegionalCandCollection::const_iterator GmtRCIt;
475  rmc.clear();
476  rmc = igmtrr->getDTBXCands();
477  gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(), rmc.begin(), rmc.end());
478  rmc.clear();
479  rmc = igmtrr->getCSCCands();
480  gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(), rmc.begin(), rmc.end());
481  rmc.clear();
482  rmc = igmtrr->getBrlRPCCands();
483  gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(), rmc.begin(), rmc.end());
484  rmc.clear();
485  rmc = igmtrr->getFwdRPCCands();
486  gmt_rdt_data_vec.insert(gmt_rdt_data_vec.end(), rmc.begin(), rmc.end());
487  }
488  //get record vector for emul
489  std::vector<L1MuGMTReadoutRecord> gmt_rdt_emul_bx = gmt_rdt_emul_->getRecords();
490  for (GmtRrIt igmtrr = gmt_rdt_emul_bx.begin(); igmtrr != gmt_rdt_emul_bx.end(); igmtrr++) {
491  //get gmt cands
492  typedef std::vector<L1MuGMTExtendedCand>::const_iterator GmtECIt;
493  std::vector<L1MuGMTExtendedCand> gmc;
494  gmc = igmtrr->getGMTCands();
495  for (GmtECIt iter1 = gmc.begin(); iter1 != gmc.end(); iter1++) {
496  gmt_can_emul_vec.push_back(L1MuGMTCand(iter1->getDataWord(), iter1->bx()));
497  }
498  //get reg cands
499  typedef L1MuRegionalCandCollection::const_iterator GmtRCIt;
501  rmc.clear();
502  rmc = igmtrr->getDTBXCands();
503  gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(), rmc.begin(), rmc.end());
504  rmc.clear();
505  rmc = igmtrr->getCSCCands();
506  gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(), rmc.begin(), rmc.end());
507  rmc.clear();
508  rmc = igmtrr->getBrlRPCCands();
509  gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(), rmc.begin(), rmc.end());
510  rmc.clear();
511  rmc = igmtrr->getFwdRPCCands();
512  gmt_rdt_emul_vec.insert(gmt_rdt_emul_vec.end(), rmc.begin(), rmc.end());
513  }
514  }
515  gmt_rdt_data = &gmt_rdt_data_vec;
516  gmt_rdt_emul = &gmt_rdt_emul_vec;
517  gmt_can_data = &gmt_can_data_vec;
518  gmt_can_emul = &gmt_can_emul_vec;
519 
521 
522  //check collections validity
523  bool isValidDE[DEnsys][2]; // = {false};
524  for (int i = 0; i < DEnsys; i++)
525  for (int j = 0; j < 2; j++)
526  isValidDE[i][j] = false;
527 
528  isValidDE[RCT][0] = rct_em_data.isValid();
529  isValidDE[RCT][1] = rct_em_emul.isValid();
530  isValidDE[RCT][0] &= rct_rgn_data.isValid();
531  isValidDE[RCT][1] = rct_rgn_emul.isValid();
532 
533  if (m_stage1_layer2_ == false) {
534  isValidDE[GCT][0] = gct_isolaem_data.isValid();
535  isValidDE[GCT][1] = gct_isolaem_emul.isValid();
536  isValidDE[GCT][0] &= gct_noisoem_data.isValid();
537  isValidDE[GCT][1] &= gct_noisoem_emul.isValid();
538  isValidDE[GCT][0] &= gct_cenjets_data.isValid();
539  isValidDE[GCT][1] &= gct_cenjets_emul.isValid();
540  isValidDE[GCT][0] &= gct_forjets_data.isValid();
541  isValidDE[GCT][1] &= gct_forjets_emul.isValid();
542  isValidDE[GCT][0] &= gct_taujets_data.isValid();
543  isValidDE[GCT][1] &= gct_taujets_emul.isValid();
544  isValidDE[GCT][0] &= gct_etmiss_data.isValid();
545  isValidDE[GCT][1] &= gct_etmiss_emul.isValid();
546  isValidDE[GCT][0] &= gct_ettota_data.isValid();
547  isValidDE[GCT][1] &= gct_ettota_emul.isValid();
548  isValidDE[GCT][0] &= gct_htmiss_data.isValid();
549  isValidDE[GCT][1] &= gct_htmiss_emul.isValid();
550  isValidDE[GCT][0] &= gct_hfring_data.isValid();
551  isValidDE[GCT][1] &= gct_hfring_emul.isValid();
552  isValidDE[GCT][0] &= gct_hfbcnt_data.isValid();
553  isValidDE[GCT][1] &= gct_hfbcnt_emul.isValid();
554  //isValidDE[GCT][0]&= gct_jetcnt_data .isValid(); isValidDE[GCT][1]&= gct_jetcnt_emul .isValid(); #temporary
555  }
556  if (m_stage1_layer2_ == true) {
557  isValidDE[GCT][0] = gct_isolaem_data.isValid();
558  isValidDE[GCT][1] = gct_isolaem_emul.isValid();
559  isValidDE[GCT][0] &= gct_noisoem_data.isValid();
560  isValidDE[GCT][1] &= gct_noisoem_emul.isValid();
561  isValidDE[GCT][0] &= gct_cenjets_data.isValid();
562  isValidDE[GCT][1] &= gct_cenjets_emul.isValid();
563  isValidDE[GCT][0] &= gct_forjets_data.isValid();
564  isValidDE[GCT][1] &= gct_forjets_emul.isValid();
565  isValidDE[GCT][0] &= gct_taujets_data.isValid();
566  isValidDE[GCT][1] &= gct_taujets_emul.isValid();
567  isValidDE[GCT][0] &= gct_isotaujets_data.isValid();
568  isValidDE[GCT][1] &= gct_isotaujets_emul.isValid();
569  isValidDE[GCT][0] &= gct_etmiss_data.isValid();
570  isValidDE[GCT][1] &= gct_etmiss_emul.isValid();
571  isValidDE[GCT][0] &= gct_ettota_data.isValid();
572  isValidDE[GCT][1] &= gct_ettota_emul.isValid();
573  isValidDE[GCT][0] &= gct_htmiss_data.isValid();
574  isValidDE[GCT][1] &= gct_htmiss_emul.isValid();
575  isValidDE[GCT][0] &= gct_hfring_data.isValid();
576  isValidDE[GCT][1] &= gct_hfring_emul.isValid();
577  isValidDE[GCT][0] &= gct_hfbcnt_data.isValid();
578  isValidDE[GCT][1] &= gct_hfbcnt_emul.isValid();
579  }
580  isValidDE[DTP][0] = dtp_ph_data_.isValid();
581  isValidDE[DTP][1] = dtp_ph_emul_.isValid();
582  isValidDE[DTP][0] &= dtp_th_data_.isValid();
583  isValidDE[DTP][1] &= dtp_th_emul_.isValid();
584 
585  isValidDE[DTF][0] = dtf_trk_data_.isValid();
586  isValidDE[DTF][1] = dtf_trk_emul_.isValid();
587 
588  isValidDE[RPC][0] = rpc_cen_data.isValid();
589  isValidDE[RPC][1] = rpc_cen_emul.isValid();
590  isValidDE[RPC][0] &= rpc_for_data.isValid();
591  isValidDE[RPC][1] &= rpc_for_emul.isValid();
592 
593  isValidDE[LTC][0] = ltc_data.isValid();
594  isValidDE[LTC][1] = ltc_emul.isValid();
595 
596  isValidDE[GMT][0] = gmt_data.isValid();
597  isValidDE[GMT][1] = gmt_emul.isValid();
598  //isValidDE[GMT][0]&= gmt_rdt_data_.isValid(); isValidDE[GMT][1]&= gmt_rdt_emul_.isValid();
599 
600  bool isValid[DEnsys];
601  for (int i = 0; i < DEnsys; i++) {
602  isValid[i] = true;
603  for (int j = 0; j < 2; j++) {
604  isValid[i] &= isValidDE[i][j];
605  }
606  }
607 
608  if (verbose()) {
609  std::cout << "L1Comparator sys isValid? (evt:" << eventInfo.nevt_ << ") ";
610  std::cout << "\n\t&: ";
611  for (int i = 0; i < DEnsys; i++)
612  std::cout << isValid[i] << " ";
613  std::cout << "\n\td: ";
614  for (int i = 0; i < DEnsys; i++)
615  std::cout << isValidDE[i][0] << " ";
616  std::cout << "\n\te: ";
617  for (int i = 0; i < DEnsys; i++)
618  std::cout << isValidDE[i][1] << " ";
619  std::cout << std::endl;
620  }
621 
622  //reset flags...
623  //for(int i=0; i<DEnsys; i++) isValid[i]=true;
624 
625  if (verbose())
626  std::cout << "L1Comparator start processing the collections.\n" << std::flush;
627 
629  if (runDoSys[RCT] && isValid[RCT])
630  process<L1CaloEmCollection>(rct_em_data, rct_em_emul, RCT, RCTem, eventInfo);
631  if (runDoSys[RCT] && isValid[RCT])
632  process<L1CaloRegionCollection>(rct_rgn_data, rct_rgn_emul, RCT, RCTrgn, eventInfo);
633 
634  if (m_stage1_layer2_ == false) {
635  if (runDoSys[GCT] && isValid[GCT])
636  process<L1GctEmCandCollection>(gct_isolaem_data, gct_isolaem_emul, GCT, GCTisolaem, eventInfo);
637  if (runDoSys[GCT] && isValid[GCT])
638  process<L1GctEmCandCollection>(gct_noisoem_data, gct_noisoem_emul, GCT, GCTnoisoem, eventInfo);
639  if (runDoSys[GCT] && isValid[GCT])
640  process<L1GctJetCandCollection>(gct_cenjets_data, gct_cenjets_emul, GCT, GCTcenjets, eventInfo);
641  if (runDoSys[GCT] && isValid[GCT])
642  process<L1GctJetCandCollection>(gct_forjets_data, gct_forjets_emul, GCT, GCTforjets, eventInfo);
643  if (runDoSys[GCT] && isValid[GCT])
644  process<L1GctJetCandCollection>(gct_taujets_data, gct_taujets_emul, GCT, GCTtaujets, eventInfo);
645  if (runDoSys[GCT] && isValid[GCT])
646  process<L1GctEtHadCollection>(gct_ht_data, gct_ht_emul, GCT, GCTethad, eventInfo);
647  if (runDoSys[GCT] && isValid[GCT])
648  process<L1GctEtMissCollection>(gct_etmiss_data, gct_etmiss_emul, GCT, GCTetmiss, eventInfo);
649  if (runDoSys[GCT] && isValid[GCT])
650  process<L1GctEtTotalCollection>(gct_ettota_data, gct_ettota_emul, GCT, GCTettot, eventInfo);
651  if (runDoSys[GCT] && isValid[GCT])
652  process<L1GctHtMissCollection>(gct_htmiss_data, gct_htmiss_emul, GCT, GCThtmiss, eventInfo);
653  if (runDoSys[GCT] && isValid[GCT])
654  process<L1GctHFRingEtSumsCollection>(gct_hfring_data, gct_hfring_emul, GCT, GCThfring, eventInfo);
655  if (runDoSys[GCT] && isValid[GCT])
656  process<L1GctHFBitCountsCollection>(gct_hfbcnt_data, gct_hfbcnt_emul, GCT, GCThfbit, eventInfo);
657  //if(runDoSys[GCT]&&isValid[GCT]) process<L1GctJetCountsCollection> ( gct_jetcnt_data, gct_jetcnt_emul, GCT,GCTjetcnt);#missing in emulator
658  }
659  if (m_stage1_layer2_ == true) {
660  if (runDoSys[GCT] && isValid[GCT])
661  process<L1GctEmCandCollection>(gct_isolaem_data, gct_isolaem_emul, GCT, GCTisolaem, eventInfo);
662  if (runDoSys[GCT] && isValid[GCT])
663  process<L1GctEmCandCollection>(gct_noisoem_data, gct_noisoem_emul, GCT, GCTnoisoem, eventInfo);
664  if (runDoSys[GCT] && isValid[GCT])
665  process<L1GctJetCandCollection>(gct_cenjets_data, gct_cenjets_emul, GCT, GCTcenjets, eventInfo);
666  if (runDoSys[GCT] && isValid[GCT])
667  process<L1GctJetCandCollection>(gct_forjets_data, gct_forjets_emul, GCT, GCTforjets, eventInfo);
668  if (runDoSys[GCT] && isValid[GCT])
669  process<L1GctJetCandCollection>(gct_taujets_data, gct_taujets_emul, GCT, GCTtaujets, eventInfo);
670  if (runDoSys[GCT] && isValid[GCT])
671  process<L1GctJetCandCollection>(gct_isotaujets_data, gct_isotaujets_emul, GCT, GCTisotaujets, eventInfo);
672  if (runDoSys[GCT] && isValid[GCT])
673  process<L1GctEtHadCollection>(gct_ht_data, gct_ht_emul, GCT, GCTethad, eventInfo);
674  if (runDoSys[GCT] && isValid[GCT])
675  process<L1GctEtMissCollection>(gct_etmiss_data, gct_etmiss_emul, GCT, GCTetmiss, eventInfo);
676  if (runDoSys[GCT] && isValid[GCT])
677  process<L1GctEtTotalCollection>(gct_ettota_data, gct_ettota_emul, GCT, GCTettot, eventInfo);
678  if (runDoSys[GCT] && isValid[GCT])
679  process<L1GctHtMissCollection>(gct_htmiss_data, gct_htmiss_emul, GCT, GCThtmiss, eventInfo);
680  if (runDoSys[GCT] && isValid[GCT])
681  process<L1GctHFRingEtSumsCollection>(gct_hfring_data, gct_hfring_emul, GCT, GCThfring, eventInfo);
682  if (runDoSys[GCT] && isValid[GCT])
683  process<L1GctHFBitCountsCollection>(gct_hfbcnt_data, gct_hfbcnt_emul, GCT, GCThfbit, eventInfo);
684  //if(runDoSys[GCT]&&isValid[GCT]) process<L1GctJetCountsCollection> ( gct_jetcnt_data, gct_jetcnt_emul, GCT,GCTjetcnt);#missing in emulator
685  }
686 
687  if (runDoSys[DTP] && isValid[DTP])
688  process<L1MuDTChambPhDigiCollection>(dtp_ph_data, dtp_ph_emul, DTP, DTtpPh, eventInfo);
689  if (runDoSys[DTP] && isValid[DTP])
690  process<L1MuDTChambThDigiCollection>(dtp_th_data, dtp_th_emul, DTP, DTtpTh, eventInfo);
691 
692  if (runDoSys[DTF] && isValid[DTF])
693  process<L1MuRegionalCandCollection>(dtf_trk_data, dtf_trk_emul, DTF, DTtftrk, eventInfo);
694 
695  if (runDoSys[RPC] && isValid[RPC])
696  process<L1MuRegionalCandCollection>(rpc_cen_data, rpc_cen_emul, RPC, RPCcen, eventInfo);
697  if (runDoSys[RPC] && isValid[RPC])
698  process<L1MuRegionalCandCollection>(rpc_for_data, rpc_for_emul, RPC, RPCfor, eventInfo);
699 
700  if (runDoSys[GMT] && isValid[GMT])
701  process<L1MuGMTCandCollection>(gmt_data, gmt_emul, GMT, GMTmain, eventInfo);
702  if (runDoSys[GMT] && isValid[GMT])
703  process<L1MuRegionalCandCollection>(gmt_rdt_data, gmt_rdt_emul, GMT, GMTrdt, eventInfo);
704  if (runDoSys[GMT] && isValid[GMT])
705  process<L1MuGMTCandCollection>(gmt_can_data, gmt_can_emul, GMT, GMTcnd, eventInfo);
706 
707  // >>---- GLT ---- <<
708  GltDEDigi gltdigimon;
709 
710  if (verbose())
711  std::cout << "L1Comparator done processing all collections.\n" << std::flush;
712 
713  if (verbose()) {
714  std::cout << "[L1Comparator] sys match? << evt." << eventInfo.nevt_ << ": ";
715  for (int i = 0; i < DEnsys; i++)
716  std::cout << eventInfo.DEmatchEvt[i] << " ";
717  std::cout << std::endl;
718  }
719 
720  // >>---- Event match? ---- <<
721 
722  bool evt_match = true;
723  for (int i = 0; i < DEnsys; i++)
724  evt_match &= eventInfo.DEmatchEvt[i];
725 
726  /* char ok[10];
727  if(evt_match) sprintf(ok,"GOOD :]");
728  else sprintf(ok,"BAD !!!");
729  char dumptofile[1000];
730  sprintf(dumptofile,"\n -> event data and emulator match... %s\n", ok);
731  m_dumpFile<<dumptofile;
732  */
733 
734  // >>---- Global match? ---- <<
735  if (not evt_match) {
736  m_match = false;
737  }
738  {
739  if (m_dumpMode) {
740  std::lock_guard<std::mutex> guard(m_fileGuard);
741  m_dumpFile << eventInfo.dumpToFile_.rdbuf() << std::flush;
742  }
743  }
744  //if collection is empty, add empty digi
745  if (eventInfo.m_dedigis.empty()) {
746  if (verbose())
747  std::cout << "\n [L1Comparator] adding empty collection to DErecord\n";
748  eventInfo.m_dedigis.push_back(L1DataEmulDigi());
749  }
750 
751  // >>---- d|e record ---- <<
752  std::unique_ptr<L1DataEmulRecord> record(new L1DataEmulRecord(
753  evt_match, runDoSys, eventInfo.DEmatchEvt, eventInfo.DEncand, eventInfo.m_dedigis, gltdigimon));
754  if (verbose()) {
755  std::cout << "\n [L1Comparator] printing DErecord"
756  << "(entry:" << eventInfo.nevt_ << "|evt:" << eventInfo.evtNum_ << "|run:" << eventInfo.runNum_ << "):\n"
757  << std::flush;
758  std::cout << *record << "\n" << std::flush;
759  }
760 
761  iEvent.put(std::move(record));
762 
763  if (verbose())
764  std::cout << "L1comparator::analize() end. " << eventInfo.nevt_ << std::endl;
765 }
766 
767 template <class T>
768 void L1Comparator::process(T const* data, T const* emul, const int sys, const int cid, EventInfo& eventInfo) const {
769  if (verbose())
770  std::cout << "L1Comparator::process -ing system:" << sys << " (" << SystLabel[sys] << "), data type " << cid
771  << "...\n"
772  << std::flush;
773  if (verbose())
774  std::cout << "L1Comparator::process debug "
775  << " (size " << data->size() << "," << emul->size() << ")"
776  << ".\n"
777  << std::flush;
778 
780  bool prt = false;
781  if (!m_dumpMode)
782  prt = false;
783  else if (m_dumpMode == -1)
784  prt = true;
785  else if (m_dumpMode > 0) {
787  if (tmp.get_ncand(0) == 0 && tmp.get_ncand(1) == 0)
788  prt = false;
789  else
790  prt = !tmp.do_compare(eventInfo.dumpToFile_, 0);
791  }
792 
793  //declare de compare object
795 
796  int ndata = cmp.get_ncand(0);
797  int nemul = cmp.get_ncand(1);
798 
799  if (verbose())
800  std::cout << "L1Comparator::process "
801  << " system:" << SystLabel[sys] << "(id " << sys << ")"
802  << " type:" << cmp.GetName(0) << "(" << cmp.de_type() << ")"
803  << " ndata:" << ndata << " nemul:" << nemul << " (size " << data->size() << "," << emul->size() << ")"
804  << ".\n"
805  << std::flush;
806 
807  if (ndata == 0 && nemul == 0) {
808  if (verbose())
809  std::cout << "L1Comparator::process "
810  << "empty collections -- exiting!\n"
811  << std::flush;
812  return;
813  }
814 
815  eventInfo.dumpToFile_ << std::setiosflags(std::ios::showpoint | std::ios::fixed | std::ios::right |
816  std::ios::adjustfield);
817  std::cout << std::setiosflags(std::ios::showpoint | std::ios::fixed | std::ios::right | std::ios::adjustfield);
818 
819  if (eventInfo.dumpEvent_ && prt) {
820  eventInfo.dumpToFile_ << "\nEntry: " << eventInfo.nevt_ << " (event:" << eventInfo.evtNum_
821  << " | run:" << eventInfo.runNum_ << ")\n"
822  << std::flush;
823  eventInfo.dumpEvent_ = false;
824  }
825 
826  if (prt)
827  eventInfo.dumpToFile_ << "\n sys:" << SystLabel[sys] << " (" << sys << "), type:" << cid //cmp.GetName()
828  << " ...\n";
829 
830  if (verbose())
831  std::cout << "L1Comparator::process print:\n" << std::flush << cmp.print() << std::flush;
832 
834  eventInfo.DEmatchEvt[sys] &= cmp.do_compare(eventInfo.dumpToFile_, m_dumpMode);
835 
837  L1DEDigiCollection dg = cmp.getDEDigis();
838 
839  if (verbose())
840  for (L1DEDigiCollection::iterator it = dg.begin(); it != dg.end(); it++)
841  std::cout << *it << "\n";
842 
844  for (L1DEDigiCollection::iterator it = dg.begin(); it != dg.end(); it++)
845  it->setSid(sys);
847  for (L1DEDigiCollection::iterator it = dg.begin(); it != dg.end(); it++)
848  it->setCid(cid);
849 
851  eventInfo.m_dedigis.insert(eventInfo.m_dedigis.end(), dg.begin(), dg.end());
852  for (int i = 0; i < 2; i++)
853  eventInfo.DEncand[sys][i] += cmp.get_ncand(i);
854 
855  if (verbose())
856  std::cout << "L1Comparator::process "
857  << " system:" << SystLabel[sys] << " type:" << cmp.GetName(0) << " ndata:" << eventInfo.DEncand[sys][0]
858  << " nemul:" << eventInfo.DEncand[sys][1] << " (size " << data->size() << "," << emul->size() << ")"
859  << " ndigis:" << dg.size() << " agree? " << eventInfo.DEmatchEvt[sys] << std::endl;
860 
861  if (verbose())
862  std::cout << "L1Comparator::process -ing system:" << sys << " (" << SystLabel[sys] << ")...done.\n" << std::flush;
863 }
864 
865 template <class myCol>
868  std::ostream& dumpStream) const {
869  bool match = true;
870  typedef typename myCol::size_type col_sz;
871  typedef typename myCol::iterator col_it;
872  col_sz ndata = data->size();
873  col_sz nemul = emul->size();
874  if (ndata != nemul) {
875  match &= false;
876  dumpStream << " #cand mismatch!"
877  << "\tdata: " << ndata << "\temul: " << nemul << std::endl;
878  }
879  col_it itd = data->begin();
880  col_it itm = emul->begin();
881  for (col_sz i = 0; i < ndata; i++) {
882  match &= dumpCandidate(*itd++, *itm++, dumpStream);
883  }
884  return match;
885 }
886 
887 template <class T>
888 bool L1Comparator::dumpCandidate(const T& dt, const T& em, std::ostream& s) const {
889  if (dt == em)
890  return true;
891  s << dt << std::endl;
892  s << em << std::endl << std::endl;
893  return false;
894 }
std::shared_ptr< RunCache > globalBeginRun(edm::Run const &, const edm::EventSetup &) const final
const edm::ESGetToken< L1TriggerKey, L1TriggerKeyRcd > tokenTriggerKey_
Definition: L1Comparator.h:112
edm::EDGetTokenT< L1GctEmCandCollection > tokenGctEmCand_nonIsoEm_[2]
Definition: L1Comparator.h:91
float dt
Definition: AMPTWrapper.h:136
edm::EDGetTokenT< LTCDigiCollection > tokenLTCDigi_[2]
Definition: L1Comparator.h:105
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const int DEnsys
Definition: DEtrait.h:38
edm::EDGetTokenT< L1GctEtHadCollection > tokenGctEtHad_[2]
Definition: L1Comparator.h:97
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
edm::EDGetTokenT< L1MuRegionalCandCollection > tokenMuRegionalCandRPCb_[2]
Definition: L1Comparator.h:107
L1Comparator(const edm::ParameterSet &)
Definition: L1Comparator.cc:29
bool verbose
ret
prodAgent to be discontinued
edm::EDGetTokenT< L1GctJetCountsCollection > tokenGctJetCounts_[2]
Definition: L1Comparator.h:102
std::mutex m_fileGuard
Definition: L1Comparator.h:118
edm::EDGetTokenT< L1GctEtMissCollection > tokenGctEtMiss_[2]
Definition: L1Comparator.h:98
edm::EDGetTokenT< L1GctHFBitCountsCollection > tokenGctHFBitCounts_[2]
Definition: L1Comparator.h:100
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< L1MuDTChambThContainer > tokenMuDTChambTh_[2]
Definition: L1Comparator.h:104
edm::EDGetTokenT< L1GctJetCandCollection > tokenGctJetCand_tauJets_[2]
Definition: L1Comparator.h:94
std::vector< L1DataEmulDigi > L1DEDigiCollection
Definition: DEtrait.h:101
assert(be >=bs)
uint16_t size_type
The_Container const * getContainer() const
T getUntrackedParameter(std::string const &, T const &) const
char const * label
std::atomic< int > nevt_
Definition: L1Comparator.h:85
int iEvent
Definition: GenABIO.cc:224
bool CompareCollections(edm::Handle< T > data, edm::Handle< T > emul, std::ostream &) const
bool dumpCandidate(const T &dt, const T &em, std::ostream &s) const
edm::EDGetTokenT< L1MuGMTReadoutCollection > tokenMuReadoutCand_[2]
Definition: L1Comparator.h:110
edm::EDGetTokenT< L1GctJetCandCollection > tokenGctJetCand_isoTauJets_[2]
Definition: L1Comparator.h:95
edm::EDGetTokenT< L1MuRegionalCandCollection > tokenMuRegionalCandRPCf_[2]
Definition: L1Comparator.h:108
bool getData(T &iHolder) const
Definition: EventSetup.h:122
edm::EDGetTokenT< L1GctEtTotalCollection > tokenGctEtTotal_[2]
Definition: L1Comparator.h:96
TrackContainer const * getContainer() const
edm::EDGetTokenT< L1CaloEmCollection > tokenCaloEm_[2]
Definition: L1Comparator.h:88
std::vector< L1MuDTChambThDigi > L1MuDTChambThDigiCollection
Definition: DEtrait.h:93
std::vector< L1MuRegionalCand > L1MuRegionalCandCollection
edm::EDGetTokenT< L1MuDTChambPhContainer > tokenMuDTChambPh_[2]
Definition: L1Comparator.h:103
int verbose() const
Definition: L1Comparator.h:81
std::atomic< bool > m_match
Definition: L1Comparator.h:119
edm::EDGetTokenT< L1GctJetCandCollection > tokenGctJetCand_cenJets_[2]
Definition: L1Comparator.h:92
const std::array< bool, dedefs::DEnsys > m_doSys
Definition: L1Comparator.h:114
Phi_Container const * getContainer() const
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
std::vector< L1MuDTChambPhDigi > L1MuDTChambPhDigiCollection
Definition: DEtrait.h:92
edm::EDGetTokenT< L1GctHFRingEtSumsCollection > tokenGctHFRingEtSums_[2]
Definition: L1Comparator.h:99
edm::EDGetTokenT< L1GctJetCandCollection > tokenGctJetCand_forJets_[2]
Definition: L1Comparator.h:93
edm::EDGetTokenT< L1GctHtMissCollection > tokenGctHtMiss_[2]
Definition: L1Comparator.h:101
edm::EDGetTokenT< L1CaloRegionCollection > tokenCaloRegion_[2]
Definition: L1Comparator.h:89
bool isValid() const
Definition: HandleBase.h:70
const std::string SystLabel[DEnsys]
Definition: DEtrait.h:42
void process(T const *, T const *, const int, const int, EventInfo &eventInfo) const
void endJob() override
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
Definition: DEtrait.h:36
std::ofstream m_dumpFile
Definition: L1Comparator.h:116
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
eventInfo
add run, event number and lumi section
edm::EDGetTokenT< L1MuDTTrackContainer > tokenMuDTTrack_[2]
Definition: L1Comparator.h:106
Log< level::Warning, false > LogWarning
tmp
align.sh
Definition: createJobs.py:716
long double T
edm::EDGetTokenT< L1GctEmCandCollection > tokenGctEmCand_isoEm_[2]
Definition: L1Comparator.h:90
def move(src, dest)
Definition: eostools.py:511
std::vector< L1MuGMTCand > L1MuGMTCandCollection
Definition: DEtrait.h:99
Definition: Run.h:45
const int m_dumpMode
Definition: L1Comparator.h:117
edm::EDGetTokenT< L1MuGMTCandCollection > tokenMuGMTCand_[2]
Definition: L1Comparator.h:109
const bool m_stage1_layer2_
Definition: L1Comparator.h:82