rarToyList.cc

Go to the documentation of this file.
00001 /*****************************************************************************
00002 * Project: BaBar detector at the SLAC PEP-II B-factory
00003 * Package: RooRarFit
00004  *    File: $Id: rarToyList.cc,v 1.2 2011/08/26 17:54:18 fwilson Exp $
00005  * Authors: Fergus Wilson
00006  * History:
00007  * 
00008  * Copyright (C) 2005-2012, RAL
00009  *****************************************************************************/
00010 //
00011 // BEGIN_HTML
00012 // This is a helper class for displaying Toy events numbers
00013 // END_HTML
00014 //
00015 
00016 #include "Riostream.h"
00017 #include <map>
00018 #include "RooRarFit/rarVersion.hh"
00019 #include "RooRarFit/rarToyList.hh"
00020 
00021 using namespace std;
00022 
00023 ClassImp(rarToyList);
00024 
00025 //--------------------------------------------
00026 void rarToyList::print() const {
00027   
00028   if (mapInitial.empty()) {
00029     cout << "No observables defined in Toy so nothing to print" <<endl;
00030     return;
00031   }
00032 
00033   typedef map<TString, Double_t> MapType;
00034   typedef map<TString, TString>  MapType2;
00035   
00036   Double_t nInit_tot(0), nReq_tot(0), nFound_tot(0), nUsed_tot(0);
00037   Int_t index(0);
00038 
00039   cout << endl;
00040   cout << "Summary of Toy. Dataset : " << datasetName << " with " << datasetEvts << " events " << endl;
00041   cout << " Ind     Observable  Initial  Request      Used Adj      Method" << endl;
00042   cout << " ---     ----------  -------  -------      ---- ---      ------" << endl;
00043 
00044   MapType::const_iterator it;
00045   for (it = mapInitial.begin(); it != mapInitial.end(); ++it) {
00046     TString obs = it->first;
00047     Double_t nInit = it->second;
00048     nInit_tot += nInit;
00049 
00050     // now look for other entries
00051     MapType::const_iterator iter1 = mapRequested.find(obs);
00052     Double_t nReq(0);
00053     if (iter1 != mapRequested.end()) {nReq = iter1->second;}
00054     nReq_tot += nReq;
00055 
00056     //
00057     MapType::const_iterator iter2 = mapFound.find(obs);
00058     Double_t nFound(0);
00059     if (iter2 != mapFound.end()) {nFound = iter2->second;}
00060     nFound_tot += nFound;
00061 
00062     //
00063     MapType::const_iterator iter3 = mapUsed.find(obs);
00064     Double_t nUsed(0);
00065     if (iter3 != mapUsed.end()) {nUsed = iter3->second;}
00066     nUsed_tot += nUsed;
00067 
00068     //
00069     MapType2::const_iterator iter4 = mapMethod.find(obs);
00070     TString method("unk");
00071     if (iter4 != mapMethod.end()) {method = iter4->second;}
00072 
00073     //
00074     TString adj("");
00075     if (nUsed != nReq) {adj = "*";}
00076 
00077     index++;
00078     TString line(Form("%4d %14s %8d %8d  %8d   %1s %11s", 
00079                       index, obs.Data(), 
00080                       (Int_t) nInit, (Int_t) nReq, (Int_t) nUsed, 
00081                       adj.Data(), method.Data()));
00082 
00083     cout << line << endl;
00084   }
00085 
00086   TString totals(Form("Totals: %20d %8d  %8d", (Int_t) nInit_tot, (Int_t) nReq_tot, (Int_t) nUsed_tot));
00087   cout << " ---     ----------  -------  -------      ---- ---      ------" << endl;
00088   cout << totals << endl;
00089   cout << endl;
00090   return;
00091 }

Generated on 30 Oct 2013 for RooRarFit by  doxygen 1.4.7