Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

MarSysBinningFun.C

Go to the documentation of this file.
00001 #include "SFHMarana/MarSysBinningFun.h"
00002 #include "TFile.h"
00003 #include <iostream>
00004 #include <string.h>
00005     
00006 using namespace::std;    
00007     
00008 MarSysBinningFun::MarSysBinningFun (const TMarSyst &marsyst_, TFile *outfile_) 
00009 : marsyst(marsyst_), outfile(outfile_) {
00010    
00011   nbins = 0; 
00012   for(list<string>::const_iterator i = marsyst.ScalesToBeDone.begin(); 
00013       i!=marsyst.ScalesToBeDone.end(); 
00014       i++){
00015     string dir=(*i);  
00016     sysstringmap[dir]=nbins;
00017     sysintmap[nbins]=dir;
00018     cout << "MarSysBinningFun::MarSysBinningFun: added number, dir: " << nbins << ", " << dir << " to maps" << endl; 
00019     nbins++;
00020   }
00021     cout << "MarSysBinningFun::MarSysBinningFun: nbins total: " << nbins << endl; 
00022 
00023 }
00024 
00025 int MarSysBinningFun::operator() () const {
00026   SysStringMap::const_iterator it = sysstringmap.find(marsyst.Name);
00027   int result = (it == sysstringmap.end()) ? -1 : it->second;
00028 //   cout << "MarSysBinningFun::operator(): name=" << marsyst.Name
00029 //        << ", result=" << result << endl;
00030   return result;
00031 }
00032 
00033 const char *MarSysBinningFun::getBinName(int i) const {
00034   SysIntMap::const_iterator it = sysintmap.find(i);
00035   const char *dir = (it == sysintmap.end()) ? "/" : it->second.c_str();
00036   if (outfile) outfile->cd(dir);
00037   cout << "MarSysBinningFun::getBinName: changing to " << dir << endl;
00038   char *result = new char[1];
00039   result[0]='\0';
00040   return result;
00041 }
00042 
00043 const char *MarSysBinningFun::getBinTitle(int i) const {
00044   SysIntMap::const_iterator it = sysintmap.find(i);
00045   const char *name = (it == sysintmap.end()) ? "--invalid--" : it->second.c_str();
00046   size_t len = strlen(name) + 1;
00047   char *result = new char[len];
00048   strncpy (result, name, len);
00049   return result;
00050 }

Generated on Thu Jul 28 11:48:52 2005 for SFHMarana by doxygen 1.3.2