CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
L1TComparison Class Reference
Inheritance diagram for L1TComparison:

Public Member Functions

 L1TComparison (const ParameterSet &)
 
 ~L1TComparison () override
 

Static Public Member Functions

static void fillDescriptions (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void analyze (Event const &, EventSetup const &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

bool algCheck_
 
int algCount_
 
int algFails_
 
edm::EDGetTokenT< GlobalAlgBlkBxCollectionalgTokenA_
 
edm::EDGetTokenT< GlobalAlgBlkBxCollectionalgTokenB_
 
bool bxZeroOnly_
 
bool egCheck_
 
int egCount_
 
int egFails_
 
edm::EDGetTokenT< EGammaBxCollectionegTokenA_
 
edm::EDGetTokenT< EGammaBxCollectionegTokenB_
 
bool jetCheck_
 
int jetCount_
 
int jetFails_
 
edm::EDGetTokenT< JetBxCollectionjetTokenA_
 
edm::EDGetTokenT< JetBxCollectionjetTokenB_
 
bool muonCheck_
 
int muonCount_
 
int muonFails_
 
edm::EDGetTokenT< MuonBxCollectionmuonTokenA_
 
edm::EDGetTokenT< MuonBxCollectionmuonTokenB_
 
bool sumCheck_
 
int sumCount_
 
int sumFails_
 
edm::EDGetTokenT< EtSumBxCollectionsumTokenA_
 
edm::EDGetTokenT< EtSumBxCollectionsumTokenB_
 
string tag_
 
bool tauCheck_
 
int tauCount_
 
int tauFails_
 
edm::EDGetTokenT< TauBxCollectiontauTokenA_
 
edm::EDGetTokenT< TauBxCollectiontauTokenB_
 

Detailed Description

Definition at line 65 of file L1TComparison.cc.

Constructor & Destructor Documentation

◆ L1TComparison()

L1TComparison::L1TComparison ( const ParameterSet iConfig)
explicit

Definition at line 120 of file L1TComparison.cc.

References gather_cfg::cout, and edm::ParameterSet::getParameter().

120  {
121  tag_ = iConfig.getParameter<string>("tag");
122  egCheck_ = iConfig.getParameter<bool>("egCheck");
123  tauCheck_ = iConfig.getParameter<bool>("tauCheck");
124  jetCheck_ = iConfig.getParameter<bool>("jetCheck");
125  sumCheck_ = iConfig.getParameter<bool>("sumCheck");
126  muonCheck_ = iConfig.getParameter<bool>("muonCheck");
127  algCheck_ = iConfig.getParameter<bool>("algCheck");
128  bxZeroOnly_ = iConfig.getParameter<bool>("bxZeroOnly");
129 
130  cout << "L1T Summary for " << tag_ << "\n";
131  cout << "DEBUG: egCheck: " << egCheck_ << "\n";
132  cout << "DEBUG: tauCheck: " << tauCheck_ << "\n";
133  cout << "DEBUG: jetCheck: " << jetCheck_ << "\n";
134  cout << "DEBUG: sumCheck: " << sumCheck_ << "\n";
135  cout << "DEBUG: muonCheck: " << muonCheck_ << "\n";
136  cout << "DEBUG: algCheck: " << algCheck_ << "\n";
137 
138  if (egCheck_) {
139  egTokenA_ = consumes<EGammaBxCollection>(iConfig.getParameter<InputTag>("egTagA"));
140  }
141  if (tauCheck_) {
142  tauTokenA_ = consumes<TauBxCollection>(iConfig.getParameter<InputTag>("tauTagA"));
143  }
144  if (jetCheck_) {
145  jetTokenA_ = consumes<JetBxCollection>(iConfig.getParameter<InputTag>("jetTagA"));
146  }
147  if (sumCheck_) {
148  sumTokenA_ = consumes<EtSumBxCollection>(iConfig.getParameter<InputTag>("sumTagA"));
149  }
150  if (muonCheck_) {
151  muonTokenA_ = consumes<MuonBxCollection>(iConfig.getParameter<InputTag>("muonTagA"));
152  }
153  if (algCheck_) {
154  algTokenA_ = consumes<GlobalAlgBlkBxCollection>(iConfig.getParameter<InputTag>("algTagA"));
155  }
156 
157  if (egCheck_) {
158  egTokenB_ = consumes<EGammaBxCollection>(iConfig.getParameter<InputTag>("egTagB"));
159  }
160  if (tauCheck_) {
161  tauTokenB_ = consumes<TauBxCollection>(iConfig.getParameter<InputTag>("tauTagB"));
162  }
163  if (jetCheck_) {
164  jetTokenB_ = consumes<JetBxCollection>(iConfig.getParameter<InputTag>("jetTagB"));
165  }
166  if (sumCheck_) {
167  sumTokenB_ = consumes<EtSumBxCollection>(iConfig.getParameter<InputTag>("sumTagB"));
168  }
169  if (muonCheck_) {
170  muonTokenB_ = consumes<MuonBxCollection>(iConfig.getParameter<InputTag>("muonTagB"));
171  }
172  if (algCheck_) {
173  algTokenB_ = consumes<GlobalAlgBlkBxCollection>(iConfig.getParameter<InputTag>("algTagB"));
174  }
175 
176  egCount_ = 0;
177  tauCount_ = 0;
178  jetCount_ = 0;
179  sumCount_ = 0;
180  muonCount_ = 0;
181  algCount_ = 0;
182 
183  egFails_ = 0;
184  tauFails_ = 0;
185  jetFails_ = 0;
186  sumFails_ = 0;
187  muonFails_ = 0;
188  algFails_ = 0;
189 }
edm::EDGetTokenT< EGammaBxCollection > egTokenB_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< MuonBxCollection > muonTokenA_
edm::EDGetTokenT< EGammaBxCollection > egTokenA_
edm::EDGetTokenT< MuonBxCollection > muonTokenB_
edm::EDGetTokenT< JetBxCollection > jetTokenA_
edm::EDGetTokenT< EtSumBxCollection > sumTokenB_
edm::EDGetTokenT< EtSumBxCollection > sumTokenA_
edm::EDGetTokenT< GlobalAlgBlkBxCollection > algTokenB_
edm::EDGetTokenT< JetBxCollection > jetTokenB_
edm::EDGetTokenT< TauBxCollection > tauTokenB_
edm::EDGetTokenT< TauBxCollection > tauTokenA_
edm::EDGetTokenT< GlobalAlgBlkBxCollection > algTokenA_

◆ ~L1TComparison()

L1TComparison::~L1TComparison ( )
override

Definition at line 191 of file L1TComparison.cc.

191 {}

Member Function Documentation

◆ analyze()

void L1TComparison::analyze ( Event const &  iEvent,
EventSetup const &  iSetup 
)
overrideprivate

Definition at line 193 of file L1TComparison.cc.

References BXVector< T >::begin(), compare_l1candidate(), gather_cfg::cout, BXVector< T >::end(), BXVector< T >::getFirstBX(), BXVector< T >::getLastBX(), iEvent, edm::HandleBase::isValid(), L1Analysis::kMinBiasHFM1, L1Analysis::kMinBiasHFP0, L1Analysis::kTotalEtEm, and BXVector< T >::size().

193  {
194  cout << "L1TComparison Module output for " << tag_ << "\n";
195 
196  if (egCheck_) {
198  iEvent.getByToken(egTokenA_, XTMPA);
200  iEvent.getByToken(egTokenB_, XTMPB);
201 
202  if (!(XTMPA.isValid() && XTMPB.isValid())) {
203  LogWarning("MissingProduct") << "L1Upgrade e-gamma's not found." << std::endl;
204  } else {
205  for (int ibx = XTMPA->getFirstBX(); ibx <= XTMPA->getLastBX(); ++ibx) {
206  if (bxZeroOnly_ && (ibx != 0))
207  continue;
208  if (ibx < XTMPB->getFirstBX())
209  continue;
210  if (ibx > XTMPB->getLastBX())
211  continue;
212  int sizeA = XTMPA->size(ibx);
213  int sizeB = XTMPB->size(ibx);
214  if (sizeA != sizeB) {
215  cout << "L1T COMPARISON FAILURE: collections have different sizes for bx = " << ibx << "\n";
216  } else {
217  auto itB = XTMPB->begin(ibx);
218  for (auto itA = XTMPA->begin(ibx); itA != XTMPA->end(ibx); ++itA) {
219  bool fail = compare_l1candidate(*itA, *itB);
220  itB++;
221  if (!fail) {
222  egCount_++;
223  } else {
224  egFails_++;
225  }
226  }
227  }
228  }
229  }
230  }
231 
232  if (tauCheck_) {
234  iEvent.getByToken(tauTokenA_, XTMPA);
236  iEvent.getByToken(tauTokenB_, XTMPB);
237 
238  if (!(XTMPA.isValid() && XTMPB.isValid())) {
239  LogWarning("MissingProduct") << "L1Upgrade tau's not found." << std::endl;
240  } else {
241  for (int ibx = XTMPA->getFirstBX(); ibx <= XTMPA->getLastBX(); ++ibx) {
242  if (bxZeroOnly_ && (ibx != 0))
243  continue;
244  if (ibx < XTMPB->getFirstBX())
245  continue;
246  if (ibx > XTMPB->getLastBX())
247  continue;
248  int sizeA = XTMPA->size(ibx);
249  int sizeB = XTMPB->size(ibx);
250  if (sizeA != sizeB) {
251  cout << "L1T COMPARISON FAILURE: collections have different sizes for bx = " << ibx << "\n";
252  } else {
253  auto itB = XTMPB->begin(ibx);
254  for (auto itA = XTMPA->begin(ibx); itA != XTMPA->end(ibx); ++itA) {
255  bool fail = compare_l1candidate(*itA, *itB);
256  itB++;
257  if (!fail) {
258  tauCount_++;
259  } else {
260  tauFails_++;
261  }
262  }
263  }
264  }
265  }
266  }
267 
268  if (jetCheck_) {
270  iEvent.getByToken(jetTokenA_, XTMPA);
272  iEvent.getByToken(jetTokenB_, XTMPB);
273 
274  if (!(XTMPA.isValid() && XTMPB.isValid())) {
275  LogWarning("MissingProduct") << "L1Upgrade jet's not found." << std::endl;
276  } else {
277  for (int ibx = XTMPA->getFirstBX(); ibx <= XTMPA->getLastBX(); ++ibx) {
278  if (bxZeroOnly_ && (ibx != 0))
279  continue;
280  if (ibx < XTMPB->getFirstBX())
281  continue;
282  if (ibx > XTMPB->getLastBX())
283  continue;
284  int sizeA = XTMPA->size(ibx);
285  int sizeB = XTMPB->size(ibx);
286  if (sizeA != sizeB) {
287  cout << "L1T COMPARISON FAILURE: collections have different sizes for bx = " << ibx << "\n";
288  } else {
289  auto itB = XTMPB->begin(ibx);
290  for (auto itA = XTMPA->begin(ibx); itA != XTMPA->end(ibx); ++itA) {
291  bool fail = compare_l1candidate(*itA, *itB);
292  itB++;
293  if (!fail) {
294  jetCount_++;
295  } else {
296  jetFails_++;
297  }
298  }
299  }
300  }
301  }
302  }
303 
304  if (sumCheck_) {
306  iEvent.getByToken(sumTokenA_, XTMPA);
308  iEvent.getByToken(sumTokenB_, XTMPB);
309 
310  if (!(XTMPA.isValid() && XTMPB.isValid())) {
311  LogWarning("MissingProduct") << "L1Upgrade sum's not found." << std::endl;
312  } else {
313  for (int ibx = XTMPA->getFirstBX(); ibx <= XTMPA->getLastBX(); ++ibx) {
314  if (bxZeroOnly_ && (ibx != 0))
315  continue;
316  if (ibx < XTMPB->getFirstBX())
317  continue;
318  if (ibx > XTMPB->getLastBX())
319  continue;
320  int sizeA = XTMPA->size(ibx);
321  int sizeB = XTMPB->size(ibx);
322 
323  if (sizeA != sizeB) {
324  cout << "L1T COMPARISON WARNING: sums collections have different sizes for bx = " << ibx << "\n";
325  cout << "L1T COMPARISON WARNING: sums collections A size = " << sizeA
326  << " sums collection B size = " << sizeB << "\n";
327  cout << "L1T COMPARISON WARNING: known issue because packer has not been udpated for Minbias\n";
328  }
329  for (auto itA = XTMPA->begin(ibx); itA != XTMPA->end(ibx); ++itA) {
330  cout << "L1T COMPARISON : EtSum type: A = " << itA->getType() << "\n";
331  }
332  for (auto itB = XTMPB->begin(ibx); itB != XTMPB->end(ibx); ++itB) {
333  cout << "L1T COMPARISON : EtSum type: B = " << itB->getType() << "\n";
334  }
335 
336  // temp workaround for sums not packed...
337  if (sizeA > sizeB)
338  sizeA = sizeB;
339  if (sizeB > sizeA)
340  sizeB = sizeA;
341 
342  if (sizeA != sizeB) {
343  cout << "L1T COMPARISON FAILURE: collections have different sizes for bx = " << ibx << "\n";
344  } else {
345  auto itB = XTMPB->begin(ibx);
346  for (auto itA = XTMPA->begin(ibx); itA != XTMPA->end(ibx); ++itA) {
347  cout << "L1T COMPARISON : EtSum type: A = " << itA->getType() << " vs B = " << itB->getType() << "\n";
348  if (itA->getType() != itB->getType()) {
349  cout << "L1T COMPARISON FAILURE: Different types .... EtSum type:" << itA->getType() << " vs "
350  << itB->getType() << "\n";
351  }
352  if (itA->getType() == EtSum::kTotalEtEm)
353  cout << "L1T COMPARISON WARNING: (known issue) sum of type " << itA->getType()
354  << " when emulated has a dummy value (pending proper emulation)"
355  << "\n";
356  if (itA->getType() < EtSum::kMinBiasHFP0 || itA->getType() > EtSum::kMinBiasHFM1) {
357  bool fail = compare_l1candidate(*itA, *itB);
358  if (fail) {
359  cout << "L1T COMPARISON FAILURE: for type " << itA->getType() << "\n";
360  }
361  if (!fail) {
362  sumCount_++;
363  } else {
364  sumFails_++;
365  }
366  } else {
367  cout << "L1T COMPARISON WARNING: (known issue) not checking sum of type " << itA->getType() << "\n";
368  }
369  itB++;
370  }
371  }
372  }
373  }
374  }
375 
376  if (muonCheck_) {
378  iEvent.getByToken(muonTokenA_, XTMPA);
380  iEvent.getByToken(muonTokenB_, XTMPB);
381 
382  if (!(XTMPA.isValid() && XTMPB.isValid())) {
383  LogWarning("MissingProduct") << "L1Upgrade muon's not found." << std::endl;
384  } else {
385  for (int ibx = XTMPA->getFirstBX(); ibx <= XTMPA->getLastBX(); ++ibx) {
386  if (bxZeroOnly_ && (ibx != 0))
387  continue;
388  if (ibx < XTMPB->getFirstBX())
389  continue;
390  if (ibx > XTMPB->getLastBX())
391  continue;
392  int sizeA = XTMPA->size(ibx);
393  int sizeB = XTMPB->size(ibx);
394  if (sizeA != sizeB) {
395  cout << "L1T COMPARISON FAILURE: collections have different sizes for bx = " << ibx << "\n";
396  } else {
397  auto itB = XTMPB->begin(ibx);
398  for (auto itA = XTMPA->begin(ibx); itA != XTMPA->end(ibx); ++itA) {
399  bool fail = compare_l1candidate(*itA, *itB);
400  itB++;
401  if (!fail) {
402  muonCount_++;
403  } else {
404  muonFails_++;
405  }
406  }
407  }
408  }
409  }
410  }
411 }
int getLastBX() const
edm::EDGetTokenT< EGammaBxCollection > egTokenB_
int getFirstBX() const
edm::EDGetTokenT< MuonBxCollection > muonTokenA_
static bool compare_l1candidate(const L1Candidate &a, const L1Candidate &b, int verbose=1)
edm::EDGetTokenT< EGammaBxCollection > egTokenA_
const_iterator begin(int bx) const
unsigned size(int bx) const
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< MuonBxCollection > muonTokenB_
edm::EDGetTokenT< JetBxCollection > jetTokenA_
edm::EDGetTokenT< EtSumBxCollection > sumTokenB_
edm::EDGetTokenT< EtSumBxCollection > sumTokenA_
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< JetBxCollection > jetTokenB_
const_iterator end(int bx) const
edm::EDGetTokenT< TauBxCollection > tauTokenB_
edm::EDGetTokenT< TauBxCollection > tauTokenA_
Log< level::Warning, false > LogWarning

◆ beginJob()

void L1TComparison::beginJob ( void  )
overrideprivate

Definition at line 413 of file L1TComparison.cc.

References gather_cfg::cout.

413 { cout << "INFO: L1TComparison module beginJob called.\n"; }

◆ endJob()

void L1TComparison::endJob ( void  )
overrideprivate

Definition at line 415 of file L1TComparison.cc.

References gather_cfg::cout.

415  {
416  cout << "INFO: L1T Comparison for " << tag_ << "\n";
417  cout << "INFO: count of successful comparison for each type follows:\n";
418  if (egCheck_)
419  cout << "eg: " << egCount_ << "\n";
420  if (tauCheck_)
421  cout << "tau: " << tauCount_ << "\n";
422  if (jetCheck_)
423  cout << "jet: " << jetCount_ << "\n";
424  if (sumCheck_)
425  cout << "sum: " << sumCount_ << "\n";
426  if (muonCheck_)
427  cout << "muon: " << muonCount_ << "\n";
428  cout << "INFO: count of failed comparison for each type follows:\n";
429  if (egCheck_)
430  cout << "eg: " << egFails_ << "\n";
431  if (tauCheck_)
432  cout << "tau: " << tauFails_ << "\n";
433  if (jetCheck_)
434  cout << "jet: " << jetFails_ << "\n";
435  if (sumCheck_)
436  cout << "sum: " << sumFails_ << "\n";
437  if (muonCheck_)
438  cout << "muon: " << muonFails_ << "\n";
439 
440  int fail = 0;
441  if (egCheck_ && ((egFails_ > 0) || (egCount_ <= 0)))
442  fail = 1;
443  if (tauCheck_ && ((tauFails_ > 0) || (tauCount_ <= 0)))
444  fail = 1;
445  if (jetCheck_ && ((jetFails_ > 0) || (jetCount_ <= 0)))
446  fail = 1;
447  if (sumCheck_ && ((sumFails_ > 0) || (sumCount_ <= 0)))
448  fail = 1;
449  if (muonCheck_ && ((muonFails_ > 0) || (muonCount_ <= 0)))
450  fail = 1;
451 
452  if (fail) {
453  cout << "SUMMARY: L1T Comparison for " << tag_ << " was FAILURE\n";
454  } else {
455  cout << "SUMMARY: L1T Comparison for " << tag_ << " was SUCCESS\n";
456  }
457 }

◆ fillDescriptions()

void L1TComparison::fillDescriptions ( ConfigurationDescriptions descriptions)
static

Definition at line 459 of file L1TComparison.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

459  {
460  //The following says we do not know what parameters are allowed so do no validation
461  // Please change this to state exactly what you do use, even if it is no parameters
463  desc.setUnknown();
464  descriptions.addDefault(desc);
465 }
void addDefault(ParameterSetDescription const &psetDescription)

Member Data Documentation

◆ algCheck_

bool L1TComparison::algCheck_
private

Definition at line 86 of file L1TComparison.cc.

◆ algCount_

int L1TComparison::algCount_
private

Definition at line 110 of file L1TComparison.cc.

◆ algFails_

int L1TComparison::algFails_
private

Definition at line 117 of file L1TComparison.cc.

◆ algTokenA_

edm::EDGetTokenT<GlobalAlgBlkBxCollection> L1TComparison::algTokenA_
private

Definition at line 95 of file L1TComparison.cc.

◆ algTokenB_

edm::EDGetTokenT<GlobalAlgBlkBxCollection> L1TComparison::algTokenB_
private

Definition at line 102 of file L1TComparison.cc.

◆ bxZeroOnly_

bool L1TComparison::bxZeroOnly_
private

Definition at line 87 of file L1TComparison.cc.

◆ egCheck_

bool L1TComparison::egCheck_
private

Definition at line 81 of file L1TComparison.cc.

◆ egCount_

int L1TComparison::egCount_
private

Definition at line 105 of file L1TComparison.cc.

◆ egFails_

int L1TComparison::egFails_
private

Definition at line 112 of file L1TComparison.cc.

◆ egTokenA_

edm::EDGetTokenT<EGammaBxCollection> L1TComparison::egTokenA_
private

Definition at line 90 of file L1TComparison.cc.

◆ egTokenB_

edm::EDGetTokenT<EGammaBxCollection> L1TComparison::egTokenB_
private

Definition at line 97 of file L1TComparison.cc.

◆ jetCheck_

bool L1TComparison::jetCheck_
private

Definition at line 83 of file L1TComparison.cc.

◆ jetCount_

int L1TComparison::jetCount_
private

Definition at line 107 of file L1TComparison.cc.

◆ jetFails_

int L1TComparison::jetFails_
private

Definition at line 114 of file L1TComparison.cc.

◆ jetTokenA_

edm::EDGetTokenT<JetBxCollection> L1TComparison::jetTokenA_
private

Definition at line 92 of file L1TComparison.cc.

◆ jetTokenB_

edm::EDGetTokenT<JetBxCollection> L1TComparison::jetTokenB_
private

Definition at line 99 of file L1TComparison.cc.

◆ muonCheck_

bool L1TComparison::muonCheck_
private

Definition at line 85 of file L1TComparison.cc.

◆ muonCount_

int L1TComparison::muonCount_
private

Definition at line 109 of file L1TComparison.cc.

◆ muonFails_

int L1TComparison::muonFails_
private

Definition at line 116 of file L1TComparison.cc.

◆ muonTokenA_

edm::EDGetTokenT<MuonBxCollection> L1TComparison::muonTokenA_
private

Definition at line 94 of file L1TComparison.cc.

◆ muonTokenB_

edm::EDGetTokenT<MuonBxCollection> L1TComparison::muonTokenB_
private

Definition at line 101 of file L1TComparison.cc.

◆ sumCheck_

bool L1TComparison::sumCheck_
private

Definition at line 84 of file L1TComparison.cc.

◆ sumCount_

int L1TComparison::sumCount_
private

Definition at line 108 of file L1TComparison.cc.

◆ sumFails_

int L1TComparison::sumFails_
private

Definition at line 115 of file L1TComparison.cc.

◆ sumTokenA_

edm::EDGetTokenT<EtSumBxCollection> L1TComparison::sumTokenA_
private

Definition at line 93 of file L1TComparison.cc.

◆ sumTokenB_

edm::EDGetTokenT<EtSumBxCollection> L1TComparison::sumTokenB_
private

Definition at line 100 of file L1TComparison.cc.

◆ tag_

string L1TComparison::tag_
private

Definition at line 78 of file L1TComparison.cc.

◆ tauCheck_

bool L1TComparison::tauCheck_
private

Definition at line 82 of file L1TComparison.cc.

◆ tauCount_

int L1TComparison::tauCount_
private

Definition at line 106 of file L1TComparison.cc.

◆ tauFails_

int L1TComparison::tauFails_
private

Definition at line 113 of file L1TComparison.cc.

◆ tauTokenA_

edm::EDGetTokenT<TauBxCollection> L1TComparison::tauTokenA_
private

Definition at line 91 of file L1TComparison.cc.

◆ tauTokenB_

edm::EDGetTokenT<TauBxCollection> L1TComparison::tauTokenB_
private

Definition at line 98 of file L1TComparison.cc.