|
[Rivet-svn] r4321 - in trunk: . pyext/rivet src/Analyses src/Core testblackhole at projects.hepforge.org blackhole at projects.hepforge.orgWed May 29 00:07:48 BST 2013
Author: buckley Date: Wed May 29 00:07:48 2013 New Revision: 4321 Log: Minor bugfixes and improvements in Scatter2D booking and MC_JetAnalysis. Modified: trunk/ChangeLog trunk/pyext/rivet/rivetwrap.i trunk/src/Analyses/MC_JetAnalysis.cc trunk/src/Core/Analysis.cc trunk/test/testApi.cc Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Tue May 28 20:23:51 2013 (r4320) +++ trunk/ChangeLog Wed May 29 00:07:48 2013 (r4321) @@ -1,3 +1,7 @@ +2013-05-29 Andy Buckley <andy.buckley at cern.ch> + + * Minor bugfixes and improvements in Scatter2D booking and MC_JetAnalysis. + 2013-05-28 Andy Buckley <andy.buckley at cern.ch> * Removing defunct HistoFormat.hh and HistoHandler.{hh,cc} Modified: trunk/pyext/rivet/rivetwrap.i ============================================================================== --- trunk/pyext/rivet/rivetwrap.i Tue May 28 20:23:51 2013 (r4320) +++ trunk/pyext/rivet/rivetwrap.i Wed May 29 00:07:48 2013 (r4321) @@ -31,7 +31,6 @@ // Logging interface // Not mapping whole log interface, since we only want to be able to set log levels. -//%template(LogLevelMap) std::map<std::string, int>; %ignore operator<<; namespace Rivet { %rename(setLogLevel) Log::setLevel(const std::string&, int); @@ -46,9 +45,6 @@ Log(const std::string& name, int level); }; } -//%include "Rivet/Tools/Logging.hh" - -//%include "Rivet/Tools/Logging.hh" // Rivet search paths %include "Rivet/Tools/RivetPaths.hh" Modified: trunk/src/Analyses/MC_JetAnalysis.cc ============================================================================== --- trunk/src/Analyses/MC_JetAnalysis.cc Tue May 28 20:23:51 2013 (r4320) +++ trunk/src/Analyses/MC_JetAnalysis.cc Wed May 29 00:07:48 2013 (r4321) @@ -143,8 +143,11 @@ scale(_h_rap_jet[i], crossSection()/sumOfWeights()); // Create eta/rapidity ratio plots - divide(*_h_eta_jet_plus[i], *_h_eta_jet_minus[i], bookScatter2D("jet_eta_pmratio_" + lexical_cast<string>(i+1))); - divide(*_h_rap_jet_plus[i], *_h_rap_jet_minus[i], bookScatter2D("jet_y_pmratio_" + lexical_cast<string>(i+1))); + /// @todo This should be neater: there should be a way to book an empty scatter by name. + Scatter2DPtr jet_eta_pmratio( new Scatter2D(histoPath("jet_eta_pmratio_" + to_str(i+1))) ); addPlot(jet_eta_pmratio); + Scatter2DPtr jet_rap_pmratio( new Scatter2D(histoPath("jet_y_pmratio_" + to_str(i+1))) ); addPlot(jet_rap_pmratio); + divide(*_h_eta_jet_plus[i], *_h_eta_jet_minus[i], jet_eta_pmratio); + divide(*_h_rap_jet_plus[i], *_h_rap_jet_minus[i], jet_rap_pmratio); } // Scale the d{eta,R} histograms Modified: trunk/src/Core/Analysis.cc ============================================================================== --- trunk/src/Core/Analysis.cc Tue May 28 20:23:51 2013 (r4320) +++ trunk/src/Core/Analysis.cc Wed May 29 00:07:48 2013 (r4321) @@ -377,13 +377,19 @@ const string& title, const string& xtitle, const string& ytitle) { - Scatter2DPtr dps = bookScatter2D(hname, title, xtitle, ytitle); + const string path = histoPath(hname); + Scatter2DPtr s( new Scatter2D(path) ); const double binwidth = (upper-lower)/npts; for (size_t pt = 0; pt < npts; ++pt) { const double bincentre = lower + (pt + 0.5) * binwidth; - dps->addPoint(bincentre, 0, binwidth/2.0, 0); + s->addPoint(bincentre, 0, binwidth/2.0, 0); } - return dps; + addPlot(s); + MSG_TRACE("Made scatter " << hname << " for " << name()); + s->setTitle(title); + s->setAnnotation("XLabel", xtitle); + s->setAnnotation("YLabel", ytitle); + return s; } @@ -392,13 +398,19 @@ const string& title, const string& xtitle, const string& ytitle) { - Scatter2DPtr dps = bookScatter2D(hname, title, xtitle, ytitle); + const string path = histoPath(hname); + Scatter2DPtr s( new Scatter2D(path) ); for (size_t pt = 0; pt < binedges.size()-1; ++pt) { const double bincentre = (binedges[pt] + binedges[pt+1]) / 2.0; const double binwidth = binedges[pt+1] - binedges[pt]; - dps->addPoint(bincentre, 0, binwidth/2.0, 0); + s->addPoint(bincentre, 0, binwidth/2.0, 0); } - return dps; + addPlot(s); + MSG_TRACE("Made scatter " << hname << " for " << name()); + s->setTitle(title); + s->setAnnotation("XLabel", xtitle); + s->setAnnotation("YLabel", ytitle); + return s; } @@ -457,11 +469,11 @@ MSG_ERROR("Failed to scale histo=NULL in analysis " << name() << " (scale=" << scale << ")"); return; } - MSG_TRACE("Scaling histo " << histo->path() << "by factor " << scale); + MSG_TRACE("Scaling histo " << histo->path() << " by factor " << scale); try { histo->scaleW(scale); } catch (YODA::WeightError& we) { - MSG_WARNING("Could not normalize histo " << histo->path()); + MSG_WARNING("Could not scale histo " << histo->path()); return; } // // Transforming the histo into a scatter after scaling @@ -478,7 +490,7 @@ } - /// @todo 2D versions of scale and normalize... or ditch these completely? + /// @todo 2D versions of scale and normalize... void Analysis::addPlot(AnalysisObjectPtr ao) { Modified: trunk/test/testApi.cc ============================================================================== --- trunk/test/testApi.cc Tue May 28 20:23:51 2013 (r4320) +++ trunk/test/testApi.cc Wed May 29 00:07:48 2013 (r4321) @@ -6,6 +6,7 @@ int main() { Rivet::AnalysisHandler ah; + Rivet::Log::setLevel("Rivet", Rivet::Log::TRACE); // Specify the analyses to be used ah.addAnalysis("EXAMPLE");
More information about the Rivet-svn mailing list |