Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:55

0001 //FAMOS headers
0002 #include "FastSimulation/Utilities/interface/Looses.h"
0003 
0004 #include <iomanip>
0005 #include <iostream>
0006 
0007 Looses* Looses::myself = nullptr;
0008 
0009 Looses::Looses() {}
0010 
0011 Looses* Looses::instance() {
0012   if (!myself)
0013     myself = new Looses();
0014   return myself;
0015 }
0016 
0017 Looses::~Looses() { summary(); }
0018 
0019 void Looses::count(const std::string& name, unsigned cut) {
0020   if (theLosses.find(name) == theLosses.end()) {
0021     std::vector<unsigned> myCounts;
0022     for (unsigned i = 0; i < 20; ++i)
0023       myCounts.push_back(0);
0024     theLosses[name] = myCounts;
0025   }
0026 
0027   if (cut < 20)
0028     ++theLosses[name][cut];
0029 }
0030 
0031 void Looses::summary() {
0032   std::map<std::string, std::vector<unsigned> >::const_iterator lossItr;
0033   std::cout << "***** From LOOSES ***** : Cuts effects" << std::endl << std::endl;
0034 
0035   for (lossItr = theLosses.begin(); lossItr != theLosses.end(); ++lossItr) {
0036     std::cout << lossItr->first << ":" << std::endl;
0037     for (unsigned i = 0; i < 4; ++i) {
0038       for (unsigned j = 0; j < 5; ++j) {
0039         std::cout << std::setw(8) << lossItr->second[5 * i + j] << " ";
0040       }
0041       std::cout << std::endl;
0042     }
0043     std::cout << std::endl;
0044   }
0045 }