00001 // -*- C++ -*- 00002 #ifndef RIVET_HistoFormat_HH 00003 #define RIVET_HistoFormat_HH 00004 00005 #include "Rivet/Rivet.hh" 00006 00007 namespace Rivet { 00008 00009 00010 /// Enumeration of available histogram output formats. 00011 enum HistoFormat { AIDAML, FLAT, ROOT }; 00012 00013 /// Typedef for a map of histogram format enums to strings. 00014 typedef std::map<HistoFormat, std::string> HistoFormatMap; 00015 00016 00017 /// Typedef for a map of histogram format name strings to enums. 00018 typedef std::map<std::string, HistoFormat> HistoFormatMapR; 00019 00020 00021 /// Function which returns a map from histogram format enums to the corresponding name strings. 00022 inline HistoFormatMap getKnownHistoFormats() { 00023 HistoFormatMap hfmap; 00024 hfmap[AIDAML] = "AIDA"; 00025 hfmap[FLAT] = "FLAT"; 00026 #ifdef HAVE_ROOT 00027 hfmap[ROOT] = "ROOT"; 00028 #endif 00029 return hfmap; 00030 } 00031 00032 /// Function which returns a map from histogram format name strings to the corresponding enums. 00033 inline HistoFormatMapR getKnownHistoFormatsR() { 00034 HistoFormatMap hfmap = getKnownHistoFormats(); 00035 HistoFormatMapR hfmapr; 00036 for (HistoFormatMap::const_iterator hf = hfmap.begin(); hf != hfmap.end(); ++hf) { 00037 hfmapr[hf->second] = hf->first; 00038 } 00039 return hfmapr; 00040 } 00041 00042 00043 /// Typedef for a collection of histogram format name enums. 00044 typedef std::vector<HistoFormat> HistoFormatList; 00045 00046 00047 /// Function which returns a vector of all the histogram format 00048 /// values in the HistoFormat enum. 00049 inline HistoFormatList getKnownHistoFormatEnums() { 00050 HistoFormatList names; 00051 HistoFormatMap hfmap = getKnownHistoFormats(); 00052 for (HistoFormatMap::const_iterator hf = hfmap.begin(); hf != hfmap.end(); ++hf) { 00053 names.push_back(hf->first); 00054 } 00055 return names; 00056 } 00057 00058 00059 /// Function which returns a vector of all the histogram format name strings. 00060 inline std::vector<std::string> getKnownHistoFormatNames() { 00061 vector<string> names; 00062 HistoFormatMap hfmap = getKnownHistoFormats(); 00063 for (HistoFormatMap::const_iterator hf = hfmap.begin(); hf != hfmap.end(); ++hf) { 00064 names.push_back(hf->second); 00065 } 00066 return names; 00067 } 00068 00069 00070 } 00071 00072 #endif