2#ifndef RIVET_Analysis_HH
3#define RIVET_Analysis_HH
5#include "Rivet/Config/RivetCommon.hh"
6#include "Rivet/AnalysisInfo.hh"
7#include "Rivet/Event.hh"
8#include "Rivet/Projection.hh"
9#include "Rivet/ProjectionApplier.hh"
10#include "Rivet/ProjectionHandler.hh"
11#include "Rivet/AnalysisLoader.hh"
12#include "Rivet/Tools/Cuts.hh"
13#include "Rivet/Tools/Logging.hh"
14#include "Rivet/Tools/ParticleUtils.hh"
15#include "Rivet/Tools/BinnedHistogram.hh"
16#include "Rivet/Tools/RivetMT2.hh"
17#include "Rivet/Tools/RivetYODA.hh"
18#include "Rivet/Tools/Percentile.hh"
19#include "Rivet/Projections/CentralityProjection.hh"
20#include "Rivet/Tools/RivetPaths.hh"
27 do { MSG_DEBUG("Vetoing event on line " << __LINE__ << " of " << __FILE__); return; } while(0)
38 using std::stringstream;
40 using std::numeric_limits;
44 class AnalysisHandler;
120 assert(_info &&
"No AnalysisInfo object :O");
131 virtual std::string
name()
const {
132 return ( (
info().
name().empty()) ? _defaultname :
info().
name() ) + _optstring;
150 string filename =
name() + (suffix.empty() ?
"" :
"-") + suffix +
"." + extn;
168 virtual std::vector<std::string>
authors()
const {
211 virtual std::string
year()
const {
250 virtual std::vector<std::string>
todos()
const {
301 virtual const std::vector<std::string> &
keywords()
const {
315 assert(_info &&
"No AnalysisInfo object :O");
336 return sqrtS() <= 0.0;
352 bool isCompatible(PdgId beam1, PdgId beam2,
double e1,
double e2)
const;
415 const std::string
histoPath(
const std::string& hname)
const;
418 const std::string
histoPath(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
421 const std::string
mkAxisCode(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
430 const std::map<std::string, YODA::AnalysisObjectPtr>&
refData()
const {
438 template <
typename T=YODA::Scatter2D>
441 MSG_TRACE(
"Using histo bin edges for " <<
name() <<
":" << hname);
442 if (!_refdata[hname]) {
443 MSG_ERROR(
"Can't find reference histogram " << hname);
444 throw Exception(
"Reference data " + hname +
" not found.");
446 return dynamic_cast<T&
>(*_refdata[hname]);
452 template <
typename T=YODA::Scatter2D>
453 const T&
refData(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const {
454 const string hname =
mkAxisCode(datasetId, xAxisId, yAxisId);
455 return refData<T>(hname);
468 CounterPtr&
book(CounterPtr&,
const std::string&
name);
473 CounterPtr&
book(CounterPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
482 Histo1DPtr&
book(Histo1DPtr&,
const std::string&
name,
size_t nbins,
double lower,
double upper);
485 Histo1DPtr&
book(Histo1DPtr&,
const std::string&
name,
const std::vector<double>& binedges);
488 Histo1DPtr&
book(Histo1DPtr&,
const std::string&
name,
const std::initializer_list<double>& binedges);
491 Histo1DPtr&
book(Histo1DPtr&,
const std::string&
name,
const Scatter2D& refscatter);
494 Histo1DPtr&
book(Histo1DPtr&,
const std::string&
name);
499 Histo1DPtr&
book(Histo1DPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
510 Histo2DPtr&
book(Histo2DPtr&,
const std::string&
name,
511 size_t nxbins,
double xlower,
double xupper,
512 size_t nybins,
double ylower,
double yupper);
516 Histo2DPtr&
book(Histo2DPtr&,
const std::string&
name,
517 const std::vector<double>& xbinedges,
518 const std::vector<double>& ybinedges);
522 Histo2DPtr&
book(Histo2DPtr&,
const std::string&
name,
523 const std::initializer_list<double>& xbinedges,
524 const std::initializer_list<double>& ybinedges);
527 Histo2DPtr&
book(Histo2DPtr&,
const std::string&
name,
528 const Scatter3D& refscatter);
531 Histo2DPtr&
book(Histo2DPtr&,
const std::string&
name);
536 Histo2DPtr&
book(Histo2DPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
545 Profile1DPtr&
book(Profile1DPtr&,
const std::string&
name,
size_t nbins,
double lower,
double upper);
548 Profile1DPtr&
book(Profile1DPtr&,
const std::string&
name,
const std::vector<double>& binedges);
551 Profile1DPtr&
book(Profile1DPtr&,
const std::string&
name,
const std::initializer_list<double>& binedges);
554 Profile1DPtr&
book(Profile1DPtr&,
const std::string&
name,
const Scatter2D& refscatter);
557 Profile1DPtr&
book(Profile1DPtr&,
const std::string&
name);
562 Profile1DPtr&
book(Profile1DPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
573 Profile2DPtr&
book(Profile2DPtr&,
const std::string&
name,
574 size_t nxbins,
double xlower,
double xupper,
575 size_t nybins,
double ylower,
double yupper);
579 Profile2DPtr&
book(Profile2DPtr&,
const std::string&
name,
580 const std::vector<double>& xbinedges,
581 const std::vector<double>& ybinedges);
585 Profile2DPtr&
book(Profile2DPtr&,
const std::string&
name,
586 const std::initializer_list<double>& xbinedges,
587 const std::initializer_list<double>& ybinedges);
615 Scatter1DPtr&
book(Scatter1DPtr& s1d,
const string& hname);
625 Scatter1DPtr&
book(Scatter1DPtr& s1d,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
628 Scatter1DPtr&
book(Scatter1DPtr& s1d,
const string& hname,
const Scatter1D& refscatter);
646 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
bool copy_pts=
false);
658 Scatter2DPtr&
book(Scatter2DPtr& s2d,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId,
bool copy_pts=
false);
663 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
size_t npts,
double lower,
double upper);
668 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
const std::vector<double>& binedges);
671 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
const Scatter2D& refscatter);
689 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
bool copy_pts=
false);
701 Scatter3DPtr&
book(Scatter3DPtr& s3d,
unsigned int datasetId,
unsigned int xAxisId,
702 unsigned int yAxisId,
unsigned int zAxisId,
bool copy_pts=
false);
707 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
708 size_t xnpts,
double xlower,
double xupper,
709 size_t ynpts,
double ylower,
double yupper);
714 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
715 const std::vector<double>& xbinedges,
716 const std::vector<double>& ybinedges);
719 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
const Scatter3D& refscatter);
729 virtual void rawHookIn(YODA::AnalysisObjectPtr yao) {
737 virtual void rawHookOut(vector<MultiweightAOPtr> raos,
size_t iW) {
746 const std::map<std::string,std::string>&
options()
const {
751 std::string
getOption(std::string optname,
string def=
"")
const {
752 if ( _options.find(optname) != _options.end() )
753 return _options.find(optname)->second;
761 std::string
getOption(std::string optname,
const char* def) {
762 return getOption<std::string>(optname, def);
774 if (_options.find(optname) == _options.end())
return def;
775 std::stringstream ss;
776 ss.exceptions(std::ios::failbit);
778 ss << _options.find(optname)->second;
782 throw ReadError(
"Could not read user-provided option into requested type");
800 if (_options.find(optname) == _options.end())
return def;
801 const std::string val =
getOption(optname);
802 const std::string lval =
toLower(val);
803 if (lval.empty())
return false;
804 if (lval ==
"true" || lval ==
"yes" || lval ==
"on")
return true;
805 if (lval ==
"false" || lval ==
"no" || lval ==
"off")
return false;
806 return bool(getOption<int>(optname, 0));
833 string calAnaName,
string calHistName,
834 const string projName,
bool increasing=
false);
847 vector<pair<float, float> > centralityBins,
848 vector<tuple<int, int, int> > ref) {
850 typedef typename ReferenceTraits<T>::RefT RefT;
851 typedef rivet_shared_ptr<Wrapper<T>> WrapT;
855 const int nCent = centralityBins.size();
856 for (
int iCent = 0; iCent < nCent; ++iCent) {
857 const string axisCode =
mkAxisCode(std::get<0>(ref[iCent]),
858 std::get<1>(ref[iCent]),
859 std::get<2>(ref[iCent]));
860 const RefT & refscatter = refData<RefT>(axisCode);
862 WrapT wtf(_weightNames(), T(refscatter,
histoPath(axisCode)));
865 CounterPtr cnt(_weightNames(), Counter(
histoPath(
"TMP/COUNTER/" + axisCode)));
868 pctl.
add(wtf, cnt, centralityBins[iCent]);
914 vector<string> _weightNames()
const;
917 YODA::AnalysisObjectPtr _getPreload(
string name)
const;
920 MultiweightAOPtr _getOtherAnalysisObject(
const std::string & ananame,
const std::string&
name);
923 void _checkBookInit()
const;
926 bool _inInit()
const;
929 bool _inFinalize()
const;
932 template <
typename YODAT>
933 void _setWriterPrecision(
const string& path, YODAT& yao);
939 class CounterAdapter {
942 CounterAdapter(
double x) : x_(x) {}
944 CounterAdapter(
const YODA::Counter & c) : x_(c.val()) {}
946 CounterAdapter(
const YODA::Scatter1D & s) : x_(s.points()[0].x()) {
947 assert( s.numPoints() == 1 ||
"Can only scale by a single value.");
950 operator double()
const {
return x_; }
960 double dbl(
double x) {
return x; }
961 double dbl(
const YODA::Counter & c) {
return c.val(); }
962 double dbl(
const YODA::Scatter1D & s) {
963 assert( s.numPoints() == 1 );
964 return s.points()[0].x();
974 void scale(CounterPtr cnt, CounterAdapter factor);
979 void scale(
const std::vector<CounterPtr>& cnts, CounterAdapter factor) {
980 for (
auto& c : cnts)
scale(c, factor);
985 void scale(
const std::map<T, CounterPtr>& maps, CounterAdapter factor) {
986 for (
auto& m : maps)
scale(m.second, factor);
990 template <std::
size_t array_size>
991 void scale(
const CounterPtr (&cnts)[array_size], CounterAdapter factor) {
993 for (
auto& c : cnts)
scale(c, factor);
998 void normalize(Histo1DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
1003 void normalize(
const std::vector<Histo1DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
1004 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
1008 template<
typename T>
1009 void normalize(
const std::map<T, Histo1DPtr>& maps, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
1010 for (
auto& m : maps)
normalize(m.second, norm, includeoverflows);
1014 template <std::
size_t array_size>
1015 void normalize(
const Histo1DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
1016 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
1020 void scale(Histo1DPtr histo, CounterAdapter factor);
1025 void scale(
const std::vector<Histo1DPtr>& histos, CounterAdapter factor) {
1026 for (
auto& h : histos)
scale(h, factor);
1030 template<
typename T>
1031 void scale(
const std::map<T, Histo1DPtr>& maps, CounterAdapter factor) {
1032 for (
auto& m : maps)
scale(m.second, factor);
1036 template <std::
size_t array_size>
1037 void scale(
const Histo1DPtr (&histos)[array_size], CounterAdapter factor) {
1038 for (
auto& h : histos)
scale(h, factor);
1043 void normalize(Histo2DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
1048 void normalize(
const std::vector<Histo2DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
1049 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
1053 template<
typename T>
1054 void normalize(
const std::map<T, Histo2DPtr>& maps, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
1055 for (
auto& m : maps)
normalize(m.second, norm, includeoverflows);
1059 template <std::
size_t array_size>
1060 void normalize(
const Histo2DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
1061 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
1065 void scale(Histo2DPtr histo, CounterAdapter factor);
1070 void scale(
const std::vector<Histo2DPtr>& histos, CounterAdapter factor) {
1071 for (
auto& h : histos)
scale(h, factor);
1075 template<
typename T>
1076 void scale(
const std::map<T, Histo2DPtr>& maps, CounterAdapter factor) {
1077 for (
auto& m : maps)
scale(m.second, factor);
1081 template <std::
size_t array_size>
1082 void scale(
const Histo2DPtr (&histos)[array_size], CounterAdapter factor) {
1083 for (
auto& h : histos)
scale(h, factor);
1093 void barchart(Histo1DPtr h, Scatter2DPtr s,
bool usefocus=
false)
const;
1098 void barchart(Histo2DPtr h, Scatter3DPtr s,
bool usefocus=
false)
const;
1104 void divide(CounterPtr c1, CounterPtr c2, Scatter1DPtr s)
const;
1109 void divide(
const YODA::Counter& c1,
const YODA::Counter& c2, Scatter1DPtr s)
const;
1115 void divide(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1120 void divide(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1126 void divide(Profile1DPtr p1, Profile1DPtr p2, Scatter2DPtr s)
const;
1131 void divide(
const YODA::Profile1D& p1,
const YODA::Profile1D& p2, Scatter2DPtr s)
const;
1137 void divide(Histo2DPtr h1, Histo2DPtr h2, Scatter3DPtr s)
const;
1142 void divide(
const YODA::Histo2D& h1,
const YODA::Histo2D& h2, Scatter3DPtr s)
const;
1148 void divide(Profile2DPtr p1, Profile2DPtr p2, Scatter3DPtr s)
const;
1153 void divide(
const YODA::Profile2D& p1,
const YODA::Profile2D& p2, Scatter3DPtr s)
const;
1159 void efficiency(CounterPtr c1, CounterPtr c2, Scatter1DPtr s)
const;
1164 void efficiency(
const YODA::Counter& c1,
const YODA::Counter& c2, Scatter1DPtr s)
const;
1170 void efficiency(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1175 void efficiency(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1181 void efficiency(Histo2DPtr h1, Histo2DPtr h2, Scatter3DPtr s)
const;
1186 void efficiency(
const YODA::Histo2D& h1,
const YODA::Histo2D& h2, Scatter3DPtr s)
const;
1192 void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1197 void asymm(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1203 void asymm(Histo2DPtr h1, Histo2DPtr h2, Scatter3DPtr s)
const;
1208 void asymm(
const YODA::Histo2D& h1,
const YODA::Histo2D& h2, Scatter3DPtr s)
const;
1228 return _analysisobjects;
1241 template <
typename YODAT>
1243 return dynamic_pointer_cast<YODAT>(_getPreload(path));
1248 template <
typename YODAT>
1249 rivet_shared_ptr< Wrapper<YODAT> >
registerAO(
const YODAT& yao) {
1250 typedef Wrapper<YODAT> WrapperT;
1251 typedef shared_ptr<YODAT> YODAPtrT;
1252 typedef rivet_shared_ptr<WrapperT> RAOT;
1254 if ( !_inInit() && !_inFinalize() ) {
1255 MSG_ERROR(
"Can't book objects outside of init() or finalize()");
1256 throw UserError(
name() +
": Can't book objects outside of init() or finalize().");
1263 if ( yao.path() == waold.get()->basePath() ) {
1264 const string msg =
"Found double-booking of " + yao.path() +
" in " +
name();
1271 return RAOT(dynamic_pointer_cast<WrapperT>(waold.get()));
1275 shared_ptr<WrapperT> wao = make_shared<WrapperT>();
1276 wao->_basePath = yao.path();
1277 YODAPtrT yaop = make_shared<YODAT>(yao);
1279 for (
const string& weightname : _weightNames()) {
1282 string finalpath = yao.path();
1283 if ( weightname !=
"" ) finalpath +=
"[" + weightname +
"]";
1284 YODAPtrT preload = getPreload<YODAT>(finalpath);
1288 MSG_WARNING(
"Found incompatible pre-existing data object with same base path "
1289 << finalpath <<
" for " <<
name());
1292 MSG_TRACE(
"Using preloaded " << finalpath <<
" in " <<
name());
1293 wao->_final.push_back(make_shared<YODAT>(*preload));
1297 wao->_final.push_back(make_shared<YODAT>(yao));
1298 wao->_final.back()->setPath(finalpath);
1302 string rawpath =
"/RAW" + finalpath;
1303 preload = getPreload<YODAT>(rawpath);
1306 MSG_WARNING(
"Found incompatible pre-existing data object with same base path "
1307 << rawpath <<
" for " <<
name());
1310 MSG_TRACE(
"Using preloaded " << rawpath <<
" in " <<
name());
1311 wao->_persistent.push_back(make_shared<YODAT>(*preload));
1315 wao->_persistent.push_back(make_shared<YODAT>(yao));
1316 wao->_persistent.back()->setPath(rawpath);
1319 rivet_shared_ptr<WrapperT> ret(wao);
1321 ret.get()->unsetActiveWeight();
1322 if ( _inFinalize() ) {
1325 ret.get()->pushToFinal();
1326 ret.get()->setActiveFinalWeightIdx(0);
1328 _analysisobjects.push_back(ret);
1335 template <
typename AO=MultiweightAOPtr>
1344 if (ao->path() != aonew->path())
continue;
1348 AO aoold = AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1350 MSG_WARNING(
"Found incompatible pre-existing data object with same base path "
1351 << aonew->path() <<
" for " <<
name());
1352 throw LookupError(
"Found incompatible pre-existing data object with same base path during AO booking");
1356 for (
size_t weightIdx = 0; weightIdx < _weightNames().size(); ++weightIdx) {
1357 aoold.get()->setActiveWeightIdx(weightIdx);
1358 aonew.get()->setActiveWeightIdx(weightIdx);
1359 if (aoold->path() != aonew->path()) {
1360 MSG_WARNING(
"Found incompatible pre-existing data object with different weight-path "
1361 << aonew->path() <<
" for " <<
name());
1362 throw LookupError(
"Found incompatible pre-existing data object with same weight-path during AO booking");
1367 aoold.get()->unsetActiveWeight();
1368 MSG_TRACE(
"Bound pre-existing data object " << aoold->path() <<
" for " <<
name());
1373 MSG_TRACE(
"Registered " << aonew->annotation(
"Type") <<
" " << aonew->path() <<
" for " <<
name());
1374 aonew.get()->unsetActiveWeight();
1376 _analysisobjects.push_back(aonew);
1392 template <
typename AO=MultiweightAOPtr>
1398 return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1426 template <
typename AO=MultiweightAOPtr>
1428 const std::string& aoname) {
1429 MultiweightAOPtr ao = _getOtherAnalysisObject(ananame, aoname);
1431 return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1545 string _defaultname;
1548 unique_ptr<AnalysisInfo> _info;
1552 vector<MultiweightAOPtr> _analysisobjects;
1556 double _crossSection;
1557 bool _gotCrossSection;
1565 mutable std::map<std::string, YODA::AnalysisObjectPtr> _refdata;
1568 map<string, string> _options;
1580 void _cacheRefData()
const;
1598#include "Rivet/AnalysisBuilder.hh"
1606#define RIVET_DECLARE_PLUGIN(clsname) ::Rivet::AnalysisBuilder<clsname> plugin_ ## clsname
1610#define RIVET_DECLARE_ALIASED_PLUGIN(clsname, alias) RIVET_DECLARE_PLUGIN(clsname)( #alias )
1614#define RIVET_DEFAULT_ANALYSIS_CTOR(clsname) clsname() : Analysis(# clsname) {}
1622#define DECLARE_RIVET_PLUGIN(clsname) ::Rivet::AnalysisBuilder<clsname> plugin_ ## clsname
1629#define DECLARE_ALIASED_RIVET_PLUGIN(clsname, alias) DECLARE_RIVET_PLUGIN(clsname)( #alias )
1635#define DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname) clsname() : Analysis(# clsname) {}
1641#define DEFAULT_RIVET_ANALYSIS_CTOR(clsname) DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname)
The key class for coordination of Analysis objects and the event loop.
Definition AnalysisHandler.hh:23
Holder of analysis metadata.
Definition AnalysisInfo.hh:12
std::string refFile() const
Find the path to the reference-data file for this analysis.
const std::vector< std::string > & validation() const
List a series of command lines to be used for valdation.
Definition AnalysisInfo.hh:276
This is the base class of all analysis classes in Rivet.
Definition Analysis.hh:65
std::string getOption(std::string optname, const char *def)
Sane overload for literal character strings (which don't play well with stringstream)
Definition Analysis.hh:761
virtual ~Analysis()
The destructor.
Definition Analysis.hh:76
T getOption(std::string optname, T def) const
Get an option for this analysis instance converted to a specific type.
Definition Analysis.hh:773
double crossSection() const
Get the process cross-section in pb. Throws if this hasn't been set.
double crossSectionPerEvent() const
double crossSectionErrorPerEvent() const
std::string getOption(std::string optname, string def="") const
Get an option for this analysis instance as a string.
Definition Analysis.hh:751
double sumW2() const
Get the sum of squared event weights seen (via the analysis handler).
const std::map< std::string, std::string > & options() const
Return the map of all options given to this analysis.
Definition Analysis.hh:746
bool getOption(std::string optname, bool def) const
Get an option for this analysis instance converted to a bool.
Definition Analysis.hh:799
const vector< MultiweightAOPtr > & analysisObjects() const
List of registered analysis data objects.
Definition Analysis.hh:1227
double sumW() const
Get the sum of event weights seen (via the analysis handler).
AnalysisHandler & handler() const
Access the controlling AnalysisHandler object.
Definition Analysis.hh:363
double sumOfWeights() const
Alias.
Definition Analysis.hh:395
size_t numEvents() const
Get the number of events seen (via the analysis handler).
Analysis(const std::string &name)
Constructor.
Analysis & operator=(const Analysis &)=delete
The assignment operator is private and mustdeleted, so it can never be called.
Log & getLog() const
Get a Log object based on the name() property of the calling analysis object.
double crossSectionError() const
Get the process cross-section error in pb. Throws if this hasn't been set.
void efficiency(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const
void asymm(Histo2DPtr h1, Histo2DPtr h2, Scatter3DPtr s) const
void scale(const Histo1DPtr(&histos)[array_size], CounterAdapter factor)
Definition Analysis.hh:1037
void scale(const std::vector< Histo1DPtr > &histos, CounterAdapter factor)
Definition Analysis.hh:1025
void scale(Histo1DPtr histo, CounterAdapter factor)
Multiplicatively scale the given histogram, histo, by factor factor.
void divide(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const
void normalize(const std::map< T, Histo2DPtr > &maps, CounterAdapter norm=1.0, bool includeoverflows=true)
Normalize the histograms in map, maps, to area = norm.
Definition Analysis.hh:1054
void normalize(Histo2DPtr histo, CounterAdapter norm=1.0, bool includeoverflows=true)
Normalize the given histogram, histo, to area = norm.
void barchart(Histo2DPtr h, Scatter3DPtr s, bool usefocus=false) const
void normalize(const std::vector< Histo2DPtr > &histos, CounterAdapter norm=1.0, bool includeoverflows=true)
Definition Analysis.hh:1048
void normalize(const Histo2DPtr(&histos)[array_size], CounterAdapter norm=1.0, bool includeoverflows=true)
Definition Analysis.hh:1060
void scale(const std::map< T, Histo1DPtr > &maps, CounterAdapter factor)
Iteratively scale the histograms in the map, maps, by factor factor.
Definition Analysis.hh:1031
Used together with the percentile-based analysis objects Percentile and PercentileXaxis.
Definition CentralityProjection.hh:27
Representation of a HepMC event, and enabler of Projection caching.
Definition Event.hh:22
Logging system for controlled & formatted writing to stdout.
Definition Logging.hh:10
void add(TPtr ao, CounterPtr cnt, pair< float, float > cent={0.0, 100.0})
Add a new percentile bin.
Definition Percentile.hh:122
The Percentile class for centrality binning.
Definition Percentile.hh:203
Common base class for Projection and Analysis, used for internal polymorphism.
Definition ProjectionApplier.hh:21
Base class for projections returning a single floating point value.
Definition SingleValueProjection.hh:17
const std::string & status() const
Whether this analysis is trusted (in any way!)
Definition AnalysisInfo.hh:210
bool reentrant() const
Return true if finalize() can be run multiple times for this analysis.
Definition AnalysisInfo.hh:215
void removeAnalysisObject(const std::string &path)
Unregister a data object from the histogram system (by name)
AO getAnalysisObject(const std::string &ananame, const std::string &aoname)
Definition Analysis.hh:1427
rivet_shared_ptr< Wrapper< YODAT > > registerAO(const YODAT &yao)
Register a new data object, optionally read in preloaded data.
Definition Analysis.hh:1249
size_t defaultWeightIndex() const
Get the default/nominal weight index.
shared_ptr< YODAT > getPreload(string path) const
Get a preloaded YODA object.
Definition Analysis.hh:1242
const AO getAnalysisObject(const std::string &aoname) const
Get a Rivet data object from the histogram system.
Definition Analysis.hh:1393
void removeAnalysisObject(const MultiweightAOPtr &ao)
Unregister a data object from the histogram system (by pointer)
AO addAnalysisObject(const AO &aonew)
Register a data object in the histogram system.
Definition Analysis.hh:1336
bool isCompatible(PdgId beam1, PdgId beam2, double e1, double e2) const
Check if analysis is compatible with the provided beam particle IDs and energies.
bool isCompatible(const ParticlePair &beams) const
Check if analysis is compatible with the provided beam particle IDs and energies.
bool isCompatibleWithSqrtS(const float energy, float tolerance=1E-5) const
Check if sqrtS is compatible with provided value.
bool isCompatible(const PdgIdPair &beams, const std::pair< double, double > &energies) const
Check if analysis is compatible with the provided beam particle IDs and energies.
Percentile< T > bookPercentile(string projName, vector< pair< float, float > > centralityBins, vector< tuple< int, int, int > > ref)
Book a Percentile wrapper around AnalysisObjects.
Definition Analysis.hh:846
const CentralityProjection & declareCentrality(const SingleValueProjection &proj, string calAnaName, string calHistName, const string projName, bool increasing=false)
Book a CentralityProjection.
CounterPtr & book(CounterPtr &, unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId)
CounterPtr & book(CounterPtr &, const std::string &name)
Book a counter.
Histo1DPtr & book(Histo1DPtr &, const std::string &name)
Book a 1D histogram, using the binnings in the reference data histogram.
Histo1DPtr & book(Histo1DPtr &, const std::string &name, const std::vector< double > &binedges)
Book a 1D histogram with non-uniform bins defined by the vector of bin edges binedges .
Histo1DPtr & book(Histo1DPtr &, const std::string &name, size_t nbins, double lower, double upper)
Book a 1D histogram with nbins uniformly distributed across the range lower - upper .
Histo1DPtr & book(Histo1DPtr &, const std::string &name, const Scatter2D &refscatter)
Book a 1D histogram with binning from a reference scatter.
Histo1DPtr & book(Histo1DPtr &, const std::string &name, const std::initializer_list< double > &binedges)
Book a 1D histogram with non-uniform bins defined by the vector of bin edges binedges .
Histo1DPtr & book(Histo1DPtr &, unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId)
Histo2DPtr & book(Histo2DPtr &, const std::string &name)
Book a 2D histogram, using the binnings in the reference data histogram.
Histo2DPtr & book(Histo2DPtr &, const std::string &name, const std::vector< double > &xbinedges, const std::vector< double > &ybinedges)
Histo2DPtr & book(Histo2DPtr &, const std::string &name, const Scatter3D &refscatter)
Book a 2D histogram with binning from a reference scatter.
Histo2DPtr & book(Histo2DPtr &, const std::string &name, const std::initializer_list< double > &xbinedges, const std::initializer_list< double > &ybinedges)
Histo2DPtr & book(Histo2DPtr &, unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId)
Histo2DPtr & book(Histo2DPtr &, const std::string &name, size_t nxbins, double xlower, double xupper, size_t nybins, double ylower, double yupper)
const std::string mkAxisCode(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const
Get the internal histogram name for given d, x and y (cf. HepData)
const std::string histoDir() const
Get the canonical histogram "directory" path for this analysis.
const std::string histoPath(const std::string &hname) const
Get the canonical histogram path for the named histogram in this analysis.
const std::string histoPath(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const
Get the canonical histogram path for the numbered histogram in this analysis.
virtual void finalize()
Definition Analysis.hh:103
virtual void analyze(const Event &event)=0
virtual void init()
Definition Analysis.hh:90
void integrate(Histo1DPtr h, Scatter2DPtr s) const
void efficiency(CounterPtr c1, CounterPtr c2, Scatter1DPtr s) const
void efficiency(const YODA::Counter &c1, const YODA::Counter &c2, Scatter1DPtr s) const
void divide(const YODA::Histo2D &h1, const YODA::Histo2D &h2, Scatter3DPtr s) const
void asymm(const YODA::Histo1D &h1, const YODA::Histo1D &h2, Scatter2DPtr s) const
void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const
void asymm(const YODA::Histo2D &h1, const YODA::Histo2D &h2, Scatter3DPtr s) const
void scale(const CounterPtr(&cnts)[array_size], CounterAdapter factor)
Definition Analysis.hh:991
void scale(const std::vector< CounterPtr > &cnts, CounterAdapter factor)
Definition Analysis.hh:979
void scale(CounterPtr cnt, CounterAdapter factor)
Multiplicatively scale the given counter, cnt, by factor factor.
void divide(CounterPtr c1, CounterPtr c2, Scatter1DPtr s) const
void normalize(const std::map< T, Histo1DPtr > &maps, CounterAdapter norm=1.0, bool includeoverflows=true)
Normalize the histograms in map, maps, to area = norm.
Definition Analysis.hh:1009
void divide(const YODA::Histo1D &h1, const YODA::Histo1D &h2, Scatter2DPtr s) const
void normalize(Histo1DPtr histo, CounterAdapter norm=1.0, bool includeoverflows=true)
Normalize the given histogram, histo, to area = norm.
void barchart(Histo1DPtr h, Scatter2DPtr s, bool usefocus=false) const
void integrate(const Histo1D &h, Scatter2DPtr s) const
void normalize(const std::vector< Histo1DPtr > &histos, CounterAdapter norm=1.0, bool includeoverflows=true)
Definition Analysis.hh:1003
void efficiency(const YODA::Histo2D &h1, const YODA::Histo2D &h2, Scatter3DPtr s) const
void divide(const YODA::Profile1D &p1, const YODA::Profile1D &p2, Scatter2DPtr s) const
void normalize(const Histo1DPtr(&histos)[array_size], CounterAdapter norm=1.0, bool includeoverflows=true)
Definition Analysis.hh:1015
void divide(const YODA::Profile2D &p1, const YODA::Profile2D &p2, Scatter3DPtr s) const
void efficiency(const YODA::Histo1D &h1, const YODA::Histo1D &h2, Scatter2DPtr s) const
void scale(const std::map< T, CounterPtr > &maps, CounterAdapter factor)
Iteratively scale the counters in the map maps, by factor factor.
Definition Analysis.hh:985
void divide(const YODA::Counter &c1, const YODA::Counter &c2, Scatter1DPtr s) const
Profile1DPtr & book(Profile1DPtr &, const std::string &name)
Book a 1D profile histogram, using the binnings in the reference data histogram.
Profile1DPtr & book(Profile1DPtr &, unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId)
Profile1DPtr & book(Profile1DPtr &, const std::string &name, const std::vector< double > &binedges)
Book a 1D profile histogram with non-uniform bins defined by the vector of bin edges binedges .
Profile1DPtr & book(Profile1DPtr &, const std::string &name, const std::initializer_list< double > &binedges)
Book a 1D profile histogram with non-uniform bins defined by the vector of bin edges binedges .
Profile1DPtr & book(Profile1DPtr &, const std::string &name, const Scatter2D &refscatter)
Book a 1D profile histogram with binning from a reference scatter.
Profile1DPtr & book(Profile1DPtr &, const std::string &name, size_t nbins, double lower, double upper)
Book a 1D profile histogram with nbins uniformly distributed across the range lower - upper .
Profile2DPtr & book(Profile2DPtr &, const std::string &name, const std::vector< double > &xbinedges, const std::vector< double > &ybinedges)
Profile2DPtr & book(Profile2DPtr &, const std::string &name, const std::initializer_list< double > &xbinedges, const std::initializer_list< double > &ybinedges)
Profile2DPtr & book(Profile2DPtr &, const std::string &name, size_t nxbins, double xlower, double xupper, size_t nybins, double ylower, double yupper)
const T & refData(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const
Definition Analysis.hh:453
const std::map< std::string, YODA::AnalysisObjectPtr > & refData() const
Get all reference data objects for this analysis.
Definition Analysis.hh:430
const T & refData(const string &hname) const
Definition Analysis.hh:439
const PdgIdPair beamIds() const
Incoming beam IDs for this run.
bool merging() const
Check if we are running rivet-merge.
Definition Analysis.hh:335
double sqrtS() const
Centre of mass energy for this run.
const ParticlePair & beams() const
Incoming beams for this run.
Scatter2DPtr & book(Scatter2DPtr &s2d, const string &hname, bool copy_pts=false)
Book a 2-dimensional data point set with the given name.
Scatter1DPtr & book(Scatter1DPtr &s1d, const string &hname, const Scatter1D &refscatter)
Book a 1-dimensional data point set from an existing scatter and a new path.
Scatter1DPtr & book(Scatter1DPtr &s1d, unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId)
Book a 1-dimensional data point set, using the reference-data histogram indices.
Scatter2DPtr & book(Scatter2DPtr &s2d, const string &hname, const Scatter2D &refscatter)
Book a 2-dimensional data point set with x-points from an existing scatter and a new path.
Scatter2DPtr & book(Scatter2DPtr &s2d, unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId, bool copy_pts=false)
Book a 2-dimensional data point set, using the binnings in the reference data histogram.
Scatter2DPtr & book(Scatter2DPtr &s2d, const string &hname, size_t npts, double lower, double upper)
Book a 2-dimensional data point set with equally spaced x-points in a range.
Scatter2DPtr & book(Scatter2DPtr &s2d, const string &hname, const std::vector< double > &binedges)
Book a 2-dimensional data point set based on provided contiguous "bin edges".
Scatter1DPtr & book(Scatter1DPtr &s1d, const string &hname)
Book a 1-dimensional data point set with the given name.
Scatter3DPtr & book(Scatter3DPtr &s3d, const std::string &hname, size_t xnpts, double xlower, double xupper, size_t ynpts, double ylower, double yupper)
Book a 3-dimensional data point set with equally spaced x-points in a range.
Scatter3DPtr & book(Scatter3DPtr &s3d, unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId, unsigned int zAxisId, bool copy_pts=false)
Book a 3-dimensional data point set, using the binnings in the reference data histogram.
Scatter3DPtr & book(Scatter3DPtr &s3d, const std::string &hname, const Scatter3D &refscatter)
Book a 3-dimensional data point set with x-points from an existing scatter and a new path.
Scatter3DPtr & book(Scatter3DPtr &s3d, const std::string &hname, const std::vector< double > &xbinedges, const std::vector< double > &ybinedges)
Book a 3-dimensional data point set based on provided contiguous "bin edges".
Scatter3DPtr & book(Scatter3DPtr &s3d, const std::string &hname, bool copy_pts=false)
Book a 3-dimensional data point set with the given name.
bool bookingCompatible(TPtr a, TPtr b)
Definition RivetYODA.hh:877
#define MSG_TRACE(x)
Lowest-level, most verbose messaging, using MSG_LVL.
Definition Logging.hh:193
#define MSG_WARNING(x)
Warning messages for non-fatal bad things, using MSG_LVL.
Definition Logging.hh:200
#define MSG_ERROR(x)
Highest level messaging for serious problems, using MSG_LVL.
Definition Logging.hh:202
std::string findAnalysisDataFile(const std::string &filename, const std::vector< std::string > &pathprepend=std::vector< std::string >(), const std::vector< std::string > &pathappend=std::vector< std::string >())
Find the first file of the given name in the general data file search dirs.
string toLower(const string &s)
Convert a string to lower-case.
Definition Utils.hh:128
Definition MC_Cent_pPb.hh:10
std::pair< Particle, Particle > ParticlePair
Typedef for a pair of Particle objects.
Definition Particle.hh:42
Error Exception
Rivet::Exception is a synonym for Rivet::Error.
Definition Exceptions.hh:18
Error relating to looking up analysis objects in the register.
Definition Exceptions.hh:61
Error for read failures.
Definition Exceptions.hh:72
Error specialisation for where the problem is between the chair and the computer.
Definition Exceptions.hh:55