#include #include "YODA/Reader.h" #include "YODA/Histo1D.h" #include "YODA/Histo2D.h" #include "YODA/Profile1D.h" #include "YODA/Scatter2D.h" //#include "YODA/ROOTCnv.h" #include "ROOTCnv.h" #include "TFile.h" using namespace std; using namespace YODA; int main(int argc, char** argv) { TFile out("out.root", "RECREATE"); Reader& r = mkReader("yoda"); vector aos = r.read(argv[1]); int i=0; BOOST_FOREACH (const AnalysisObject* ao, aos) { //if (ao->type() == "Histo1D") toTH1D( (const Histo1D) *ao).Clone(); //if (ao->type() == "Histo2D") toTH2D(*ao).Clone(); //if (ao->type() == "Profile1D") toTProfile(*ao).Clone(); //if (ao->type() == "Scatter2D") toTGraph(*ao).Clone(); TObject* obj; if (ao->type() == "Histo1D") { const Histo1D* h = dynamic_cast (ao); obj = toTH1D( *h).Clone(); } if (ao->type() == "Histo2D") { const Histo2D* h = dynamic_cast (ao); obj = toTH2D(*h).Clone(); } if (ao->type() == "Profile1D") { const Profile1D* h = dynamic_cast (ao); //obj = toTProfile(*h).Clone(); obj = toTH1D(*h).Clone(); } //if (ao->type() == "Scatter2D") toTGraph(*ao).Clone(); //obj->Write( Form("h%d", i++) ); obj->Write(); } out.Close(); return 0; }