|
[Rivet] a few issues/problems with Rivet and its toolsroman lysak lysak at fzu.czThu Feb 5 21:37:34 GMT 2015
Hi Andy, unfortunately 'toTProfile(Profile1D p)' function is still missing something, I get these errors when trying to draw the TProfile object which was created by the program below : root [2] Warning in <TCanvas::ResizePad>: Inf/NaN propagated to the pad. Check drawn objects. Warning in <TCanvas::ResizePad>: Canvas_1 height changed from 0 to 10 Error in <TGaxis::PaintAxis>: wmin (0.000000) == wmax (0.000000) It is not clear to me what else should be filled in, maybe the best would be to ask the question to ROOT authors. However, 'toTH1D(Profile1D p)' function works fine, after some fixies (I attach the code I used for this). Cheers, Roman On 27/01/15 12:50, Andy Buckley wrote: > 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 >>> > -------------- next part -------------- A non-text attachment was scrubbed... Name: ConvertProfile1D.cc Type: text/x-c++src Size: 1360 bytes Desc: not available URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150205/a74bb3c0/attachment.cc> -------------- next part -------------- A non-text attachment was scrubbed... Name: ROOTCnv.h Type: text/x-chdr Size: 13102 bytes Desc: not available URL: <https://www.hepforge.org/lists-archive/rivet/attachments/20150205/a74bb3c0/attachment.h>
More information about the Rivet mailing list |