inlib  1.2.0
/Users/barrand/private/dev/softinex/old/inexlib-1.2/inlib/inlib/wroot/to
Go to the documentation of this file.
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
00002 // See the file inlib.license for terms.
00003 
00004 #ifndef inlib_wroot_to
00005 #define inlib_wroot_to
00006 
00007 #include "directory"
00008 #include "streamers"
00009 #include "bufobj"
00010 
00011 namespace inlib {
00012 namespace wroot {
00013 
00014 inline bool to(directory& a_dir,
00015                const histo::h1d& a_histo,const std::string& a_name) {
00016   bufobj* bo = new bufobj(a_dir.file().out(),a_dir.file().byte_swap(),256,
00017                           a_name,a_histo.title(),"TH1D");
00018   if(!TH1D_stream(*bo,a_histo,a_name)) {
00019     a_dir.file().out() << "inlib::wroot::to :"
00020                        << " TH1D_stream failed."
00021                        << std::endl;
00022     delete bo;
00023     return false;
00024   }
00025   a_dir.append_object(bo); //a_dir takes ownership of bo.
00026   return true;
00027 }
00028 
00029 inline bool to(directory& a_dir,
00030                const histo::h2d& a_histo,const std::string& a_name) {
00031   bufobj* bo = new bufobj(a_dir.file().out(),a_dir.file().byte_swap(),256,
00032                           a_name,a_histo.title(),"TH2D");
00033   if(!TH2D_stream(*bo,a_histo,a_name)) {
00034     a_dir.file().out() << "inlib::wroot::to :"
00035                        << " TH2D_stream failed."
00036                        << std::endl;
00037     delete bo;
00038     return false;
00039   }
00040   a_dir.append_object(bo); //a_dir takes ownership of bo.
00041   return true;
00042 }
00043 
00044 inline bool to(directory& a_dir,
00045                const histo::p1d& a_histo,const std::string& a_name) {
00046   bufobj* bo = new bufobj(a_dir.file().out(),a_dir.file().byte_swap(),256,
00047                           a_name,a_histo.title(),"TProfile");
00048   if(!TProfile_stream(*bo,a_histo,a_name)) {
00049     a_dir.file().out() << "inlib::wroot::to :"
00050                        << " TProfile_stream failed."
00051                        << std::endl;
00052     delete bo;
00053     return false;
00054   }
00055   a_dir.append_object(bo); //a_dir takes ownership of bo.
00056   return true;
00057 }
00058 
00059 }}
00060 
00061 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines