PamCut: Collections/VerboseCollection/VerboseCollection.cpp Source File

- Main Page
- Classes
- Files

- File List
- File Members

# Collections/VerboseCollection/VerboseCollection.cpp

Go to the documentation of this file.

    00001 /*
    00002  * VerboseCollection.cpp
    00003  *
    00004  *  Created on: 16-mag-2009
    00005  *      Author: Nicola Mori
    00006  */
    00007
    00010 #include "VerboseCollection.h"
    00011 #include <cmath>
    00012
    00013 void VerboseCollection::Finalize() {
    00014
    00015   // Prepare the output format
    00016   streamsize oldPrec = cout.precision();
    00017   streamsize newPrec = 4;
    00018   cout.precision(newPrec);
    00019   cout.setf(ios::fixed, ios::floatfield);
    00020   unsigned int nDigitsEvents = 0;
    00021   double nEvents = (double) GetNEv();
    00022   while (nEvents >= 1.) {
    00023     nEvents /= 10.;
    00024     nDigitsEvents++;
    00025   }
    00026   unsigned int nameWidth = 0;
    00027
    00028   for (unsigned int i = 0; i < _cuts.size(); i++) {
    00029     if (strlen(GetCut(i)->GetName()) > nameWidth)
    00030       nameWidth = strlen(GetCut(i)->GetName());
    00031   }
    00032
    00033   cout << "\n- Collection: " << GetName() << "\n";
    00034   cout << "  Selected/Analized events (eff.): " << GetNGood() << "/" << GetNEv() << "  (" << (float) GetNGood()
    00035       / (float) GetNEv() << ")\n";
    00036   cout << "     " << setw(nameWidth + 1) << "--Single cuts--";
    00037   cout << "     " << setw(nDigitsEvents) << "sel.";
    00038   cout << "     " << setw(nDigitsEvents) << "tot.";
    00039   cout << "     " << setw(newPrec + 2) << "eff.";
    00040   cout << "     " << setw(newPrec + 2) << "prog. eff.\n";
    00041   for (unsigned int i = 0; i < GetSize(); i++) {
    00042     cout << "     " << setw(nameWidth) << GetCut(i)->GetName() << ":";
    00043     cout << "     " << setw(nDigitsEvents) << GetCut(i)->GetNGood();
    00044     cout << "     " << setw(nDigitsEvents) << GetCut(i)->GetNEv();
    00045     cout << "     " << (float) GetCut(i)->GetNGood() / (float) GetCut(i)->GetNEv();
    00046     cout << "     " << (float) GetCut(i)->GetNGood() / (float) GetNEv();
    00047     cout << "\n";
    00048
    00049   }
    00050   cout << endl;
    00051
    00052   // Reset the output format
    00053   cout.precision(oldPrec);
    00054   cout << resetiosflags(ios::floatfield);
    00055
    00056   SmartCollection::Finalize();
    00057
    00058 }