|
[Rivet] a few issues/problems with Rivet and its toolsAndy Buckley andy.buckley at cern.chTue Jan 27 11:50:16 GMT 2015
Hi again Roman, I've updated the toTProfile routine here: https://yoda.hepforge.org/hg/yoda/file/tip/include/YODA/ROOTCnv.h Does this look correct to you? There is also now a toTH2D routine, which I'll map into Python for use in a future version of yoda2root. Note that you can use these to write a very simple C++ format converter program without needing a new version of YODA, since the ROOTCnv.h functions are not used anywhere in Rivet other than in the ROOT conversion Python module. For example, something like this should work: #include "YODA/Reader.h" #include "YODA/ROOTCnv.h" #include "TFile.h" int main(int argc, char** argv) { TFile out("out.root", "RECREATE"); YODA::Reader& r = YODA::mkReader("yoda"); vector<YODA::AnalysisObject*> aos = r.read(argv[1]); BOOST_FOREACH (const YODA::AnalysisObject* ao, aos) { if (ao->type() == "Histo1D") toTH1D(*ao).Clone(); if (ao->type() == "Histo2D") toTH2D(*ao).Clone(); if (ao->type() == "Profile1D") toTProfile(*ao).Clone(); if (ao->type() == "Scatter2D") toTGraph(*ao).Clone(); } out.Close(); return 0; } I'm sure there are errors in that, particularly in the ROOT file and object handling, but it's a start -- let us know if you need help with this (and also if it works!) Andy On 26/01/15 21:42, roman lysak wrote: > >> Yes, 2D histograms are not fully implemented at present. The next >> version of YODA should add overflows for 2D histos and fix 2D I/O, at >> which point we can start supporting them properly. I'll make sure that >> we provide an Analysis::scale() function for them at the same time. > Do you have time estimate for this? If it's more than 1-2 months, we > will probably have to find another solution. > > >> >> If just calling SetBinContent + SetBinError would be sufficient (and >> would work), please let me know... it's an easy change to make! > my understanding is that this would not work. > However, according > https://root.cern.ch/root/html/TProfile.html#TProfile:Fill@4 and > references therein it seems to me that this is minimally needed to set > for each bin: > > - for sum(y*y): TProfile::GetSumw2() //right now you set here sum(w*w), > if I understand correctly > - for sum(y): TProfile::GetArray() > - for sum(w): TProfile::SetBinEntries(bin, w) > > Clearly, the names of accessors/methods are confusing... > > Cheers and thanks, > Roman > > > >> >> Cheers, >> Andy >> > -- Dr Andy Buckley, Royal Society University Research Fellow Particle Physics Expt Group, University of Glasgow / PH Dept, CERN
More information about the Rivet mailing list |