CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/FastSimulation/Utilities/src/Looses.cc

Go to the documentation of this file.
00001 //FAMOS headers
00002 #include "FastSimulation/Utilities/interface/Looses.h"
00003 
00004 #include <iomanip>
00005 #include <iostream>
00006 
00007 Looses* Looses::myself = 0;
00008 
00009 Looses::Looses() {}
00010 
00011 Looses* Looses::instance() {
00012   if (!myself) myself = new Looses();
00013   return myself;
00014 }
00015 
00016 Looses::~Looses() { summary(); }
00017 
00018 void 
00019 Looses::count(const std::string& name, unsigned cut) { 
00020   
00021   if ( theLosses.find(name) == theLosses.end() ) { 
00022 
00023     std::vector<unsigned> myCounts;
00024     for ( unsigned i=0; i<20; ++i ) myCounts.push_back(0);
00025     theLosses[name] = myCounts;
00026 
00027   } 
00028 
00029   if ( cut < 20 ) ++theLosses[name][cut];
00030 
00031 }
00032 
00033 void 
00034 Looses::summary() { 
00035 
00036   std::map< std::string, std::vector<unsigned> >::const_iterator lossItr;
00037   std::cout << "***** From LOOSES ***** : Cuts effects" << std::endl << std::endl;
00038 
00039   for ( lossItr=theLosses.begin(); lossItr != theLosses.end(); ++lossItr ) {
00040     std::cout << lossItr->first << ":" << std::endl;
00041     for ( unsigned i=0; i<4; ++i ) {
00042       for ( unsigned j=0; j<5; ++j ) {
00043         std::cout << std::setw(8) << lossItr->second[5*i+j] << " ";
00044       }
00045       std::cout << std::endl;
00046     }
00047     std::cout << std::endl;
00048   }
00049      
00050 }
00051