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" 26 do { MSG_DEBUG("Vetoing event on line " << __LINE__ << " of " << __FILE__); return; } while(0) 37 using std::stringstream;
39 using std::numeric_limits;
43 class AnalysisHandler;
116 assert(_info &&
"No AnalysisInfo object :O");
127 virtual std::string
name()
const {
128 return ( (
info().
name().empty()) ? _defaultname :
info().
name() ) + _optstring;
155 virtual std::vector<std::string>
authors()
const {
198 virtual std::string
year()
const {
232 virtual std::vector<std::string>
todos()
const {
269 virtual const std::vector<std::string> &
keywords()
const {
283 assert(_info &&
"No AnalysisInfo object :O");
294 const ParticlePair&
beams()
const;
297 const PdgIdPair
beamIds()
const;
300 double sqrtS()
const;
304 return sqrtS() <= 0.0;
320 bool isCompatible(PdgId beam1, PdgId beam2,
double e1,
double e2)
const;
323 bool isCompatible(
const PdgIdPair& beams,
const std::pair<double,double>& energies)
const;
365 double sumW2()
const;
377 const std::string
histoPath(
const std::string& hname)
const;
380 const std::string
histoPath(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
383 const std::string
mkAxisCode(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
392 const std::map<std::string, YODA::AnalysisObjectPtr>&
refData()
const {
400 template <
typename T=YODA::Scatter2D>
403 MSG_TRACE(
"Using histo bin edges for " <<
name() <<
":" << hname);
404 if (!_refdata[hname]) {
405 MSG_ERROR(
"Can't find reference histogram " << hname);
406 throw Exception(
"Reference data " + hname +
" not found.");
408 return dynamic_cast<T&
>(*_refdata[hname]);
414 template <
typename T=YODA::Scatter2D>
415 const T&
refData(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const {
416 const string hname =
mkAxisCode(datasetId, xAxisId, yAxisId);
417 return refData<T>(hname);
427 CounterPtr&
book(CounterPtr&,
const std::string&
name);
432 CounterPtr&
book(CounterPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
441 Histo1DPtr&
book(Histo1DPtr&,
const std::string& name,
size_t nbins,
double lower,
double upper);
444 Histo1DPtr&
book(Histo1DPtr&,
const std::string& name,
const std::vector<double>& binedges);
447 Histo1DPtr&
book(Histo1DPtr&,
const std::string& name,
const std::initializer_list<double>& binedges);
450 Histo1DPtr&
book(Histo1DPtr&,
const std::string& name,
const Scatter2D& refscatter);
453 Histo1DPtr&
book(Histo1DPtr&,
const std::string& name);
458 Histo1DPtr&
book(Histo1DPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
469 Histo2DPtr&
book(Histo2DPtr&,
const std::string& name,
470 size_t nxbins,
double xlower,
double xupper,
471 size_t nybins,
double ylower,
double yupper);
475 Histo2DPtr&
book(Histo2DPtr&,
const std::string& name,
476 const std::vector<double>& xbinedges,
477 const std::vector<double>& ybinedges);
481 Histo2DPtr&
book(Histo2DPtr&,
const std::string& name,
482 const std::initializer_list<double>& xbinedges,
483 const std::initializer_list<double>& ybinedges);
486 Histo2DPtr&
book(Histo2DPtr&,
const std::string& name,
487 const Scatter3D& refscatter);
490 Histo2DPtr&
book(Histo2DPtr&,
const std::string& name);
495 Histo2DPtr&
book(Histo2DPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
504 Profile1DPtr&
book(Profile1DPtr&,
const std::string& name,
size_t nbins,
double lower,
double upper);
507 Profile1DPtr&
book(Profile1DPtr&,
const std::string& name,
const std::vector<double>& binedges);
510 Profile1DPtr&
book(Profile1DPtr&,
const std::string& name,
const std::initializer_list<double>& binedges);
513 Profile1DPtr&
book(Profile1DPtr&,
const std::string& name,
const Scatter2D& refscatter);
516 Profile1DPtr&
book(Profile1DPtr&,
const std::string& name);
521 Profile1DPtr&
book(Profile1DPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
532 Profile2DPtr&
book(Profile2DPtr&,
const std::string& name,
533 size_t nxbins,
double xlower,
double xupper,
534 size_t nybins,
double ylower,
double yupper);
538 Profile2DPtr&
book(Profile2DPtr&,
const std::string& name,
539 const std::vector<double>& xbinedges,
540 const std::vector<double>& ybinedges);
544 Profile2DPtr&
book(Profile2DPtr&,
const std::string& name,
545 const std::initializer_list<double>& xbinedges,
546 const std::initializer_list<double>& ybinedges);
578 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
bool copy_pts =
false);
590 Scatter2DPtr&
book(Scatter2DPtr& s2d,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId,
bool copy_pts =
false);
595 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
size_t npts,
double lower,
double upper);
600 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
const std::vector<double>& binedges);
603 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
const Scatter2D& refscatter);
620 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
bool copy_pts=
false);
632 Scatter3DPtr&
book(Scatter3DPtr& s3d,
unsigned int datasetId,
unsigned int xAxisId,
633 unsigned int yAxisId,
unsigned int zAxisId,
bool copy_pts=
false);
638 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
639 size_t xnpts,
double xlower,
double xupper,
640 size_t ynpts,
double ylower,
double yupper);
645 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
646 const std::vector<double>& xbinedges,
647 const std::vector<double>& ybinedges);
650 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
const Scatter3D& refscatter);
659 virtual void rawHookIn(YODA::AnalysisObjectPtr yao) {
665 virtual void rawHookOut(vector<MultiweightAOPtr> raos,
size_t iW) {
674 const std::map<std::string,std::string>&
options()
const {
680 if ( _options.find(optname) != _options.end() )
681 return _options.find(optname)->second;
691 if (_options.find(optname) == _options.end())
return def;
692 std::stringstream ss;
693 ss << _options.find(optname)->second;
703 std::string
getOption(std::string optname,
const char* def) {
704 return getOption<std::string>(optname, def);
731 string calAnaName,
string calHistName,
732 const string projName,
bool increasing=
false);
745 vector<pair<float, float> > centralityBins,
746 vector<tuple<int, int, int> > ref) {
748 typedef typename ReferenceTraits<T>::RefT RefT;
749 typedef rivet_shared_ptr<Wrapper<T>> WrapT;
753 const int nCent = centralityBins.size();
754 for (
int iCent = 0; iCent < nCent; ++iCent) {
755 const string axisCode =
mkAxisCode(std::get<0>(ref[iCent]),
756 std::get<1>(ref[iCent]),
757 std::get<2>(ref[iCent]));
758 const RefT & refscatter = refData<RefT>(axisCode);
760 WrapT wtf(_weightNames(), T(refscatter,
histoPath(axisCode)));
763 CounterPtr cnt(_weightNames(), Counter(
histoPath(
"TMP/COUNTER/" + axisCode)));
766 pctl.
add(wtf, cnt, centralityBins[iCent]);
812 vector<string> _weightNames()
const;
815 YODA::AnalysisObjectPtr _getPreload(
string name)
const;
818 MultiweightAOPtr _getOtherAnalysisObject(
const std::string & ananame,
const std::string& name);
821 void _checkBookInit()
const;
824 bool _inInit()
const;
827 bool _inFinalize()
const;
833 class CounterAdapter {
836 CounterAdapter(
double x) : x_(x) {}
838 CounterAdapter(
const YODA::Counter & c) : x_(c.val()) {}
840 CounterAdapter(
const YODA::Scatter1D & s) : x_(s.points()[0].x()) {
841 assert( s.numPoints() == 1 ||
"Can only scale by a single value.");
844 operator double()
const {
return x_; }
854 double dbl(
double x) {
return x; }
855 double dbl(
const YODA::Counter & c) {
return c.val(); }
856 double dbl(
const YODA::Scatter1D & s) {
857 assert( s.numPoints() == 1 );
858 return s.points()[0].x();
870 void scale(CounterPtr cnt, CounterAdapter factor);
875 void scale(
const std::vector<CounterPtr>& cnts, CounterAdapter factor) {
876 for (
auto& c : cnts)
scale(c, factor);
881 void scale(
const std::map<T, CounterPtr>& maps, CounterAdapter factor) {
882 for (
auto& m : maps)
scale(m.second, factor);
886 template <std::
size_t array_size>
887 void scale(
const CounterPtr (&cnts)[array_size], CounterAdapter factor) {
889 for (
auto& c : cnts)
scale(c, factor);
894 void normalize(Histo1DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
899 void normalize(
const std::vector<Histo1DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
900 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
905 void normalize(
const std::map<T, Histo1DPtr>& maps, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
906 for (
auto& m : maps)
normalize(m.second, norm, includeoverflows);
910 template <std::
size_t array_size>
911 void normalize(
const Histo1DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
912 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
916 void scale(Histo1DPtr histo, CounterAdapter factor);
921 void scale(
const std::vector<Histo1DPtr>& histos, CounterAdapter factor) {
922 for (
auto& h : histos)
scale(h, factor);
927 void scale(
const std::map<T, Histo1DPtr>& maps, CounterAdapter factor) {
928 for (
auto& m : maps)
scale(m.second, factor);
932 template <std::
size_t array_size>
933 void scale(
const Histo1DPtr (&histos)[array_size], CounterAdapter factor) {
934 for (
auto& h : histos)
scale(h, factor);
939 void normalize(Histo2DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
944 void normalize(
const std::vector<Histo2DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
945 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
950 void normalize(
const std::map<T, Histo2DPtr>& maps, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
951 for (
auto& m : maps)
normalize(m.second, norm, includeoverflows);
955 template <std::
size_t array_size>
956 void normalize(
const Histo2DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
957 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
961 void scale(Histo2DPtr histo, CounterAdapter factor);
966 void scale(
const std::vector<Histo2DPtr>& histos, CounterAdapter factor) {
967 for (
auto& h : histos)
scale(h, factor);
972 void scale(
const std::map<T, Histo2DPtr>& maps, CounterAdapter factor) {
973 for (
auto& m : maps)
scale(m.second, factor);
977 template <std::
size_t array_size>
978 void scale(
const Histo2DPtr (&histos)[array_size], CounterAdapter factor) {
979 for (
auto& h : histos)
scale(h, factor);
986 void divide(CounterPtr c1, CounterPtr c2, Scatter1DPtr s)
const;
991 void divide(
const YODA::Counter& c1,
const YODA::Counter& c2, Scatter1DPtr s)
const;
997 void divide(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1002 void divide(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1008 void divide(Profile1DPtr p1, Profile1DPtr p2, Scatter2DPtr s)
const;
1013 void divide(
const YODA::Profile1D& p1,
const YODA::Profile1D& p2, Scatter2DPtr s)
const;
1019 void divide(Histo2DPtr h1, Histo2DPtr h2, Scatter3DPtr s)
const;
1024 void divide(
const YODA::Histo2D& h1,
const YODA::Histo2D& h2, Scatter3DPtr s)
const;
1030 void divide(Profile2DPtr p1, Profile2DPtr p2, Scatter3DPtr s)
const;
1035 void divide(
const YODA::Profile2D& p1,
const YODA::Profile2D& p2, Scatter3DPtr s)
const;
1041 void efficiency(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1046 void efficiency(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1052 void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1057 void asymm(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1063 void integrate(Histo1DPtr h, Scatter2DPtr s)
const;
1068 void integrate(
const Histo1D& h, Scatter2DPtr s)
const;
1077 return _analysisobjects;
1090 template <
typename YODAT>
1092 return dynamic_pointer_cast<YODAT>(_getPreload(path));
1097 template <
typename YODAT>
1098 rivet_shared_ptr< Wrapper<YODAT> >
registerAO(
const YODAT& yao) {
1099 typedef Wrapper<YODAT> WrapperT;
1100 typedef shared_ptr<YODAT> YODAPtrT;
1101 typedef rivet_shared_ptr<WrapperT> RAOT;
1103 if ( !_inInit() && !_inFinalize() ) {
1104 MSG_ERROR(
"Can't book objects outside of init() or finalize()");
1105 throw UserError(
name() +
": Can't book objects outside of init() or finalize().");
1112 if ( yao.path() == waold.get()->basePath() ) {
1113 const string msg =
"Found double-booking of " + yao.path() +
" in " +
name();
1120 return RAOT(dynamic_pointer_cast<WrapperT>(waold.get()));
1124 shared_ptr<WrapperT> wao = make_shared<WrapperT>();
1125 wao->_basePath = yao.path();
1126 YODAPtrT yaop = make_shared<YODAT>(yao);
1128 for (
const string& weightname : _weightNames()) {
1131 string finalpath = yao.path();
1132 if ( weightname !=
"" ) finalpath +=
"[" + weightname +
"]";
1133 YODAPtrT preload = getPreload<YODAT>(finalpath);
1137 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1138 << finalpath <<
" for " <<
name());
1141 MSG_TRACE(
"Using preloaded " << finalpath <<
" in " <<
name());
1142 wao->_final.push_back(make_shared<YODAT>(*preload));
1146 wao->_final.push_back(make_shared<YODAT>(yao));
1147 wao->_final.back()->setPath(finalpath);
1151 string rawpath =
"/RAW" + finalpath;
1152 preload = getPreload<YODAT>(rawpath);
1155 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1156 << rawpath <<
" for " <<
name());
1159 MSG_TRACE(
"Using preloaded " << rawpath <<
" in " <<
name());
1160 wao->_persistent.push_back(make_shared<YODAT>(*preload));
1164 wao->_persistent.push_back(make_shared<YODAT>(yao));
1165 wao->_persistent.back()->setPath(rawpath);
1168 rivet_shared_ptr<WrapperT> ret(wao);
1170 ret.get()->unsetActiveWeight();
1171 if ( _inFinalize() ) {
1174 ret.get()->pushToFinal();
1175 ret.get()->setActiveFinalWeightIdx(0);
1177 _analysisobjects.push_back(ret);
1184 template <
typename AO=MultiweightAOPtr>
1193 if (ao->path() != aonew->path())
continue;
1197 AO aoold = AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1199 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1200 << aonew->path() <<
" for " <<
name());
1201 throw LookupError(
"Found incompatible pre-existing data object with same base path during AO booking");
1205 for (
size_t weightIdx = 0; weightIdx < _weightNames().size(); ++weightIdx) {
1206 aoold.get()->setActiveWeightIdx(weightIdx);
1207 aonew.get()->setActiveWeightIdx(weightIdx);
1208 if (aoold->path() != aonew->path()) {
1209 MSG_WARNING(
"Found incompatible pre-existing data object with different weight-path " 1210 << aonew->path() <<
" for " <<
name());
1211 throw LookupError(
"Found incompatible pre-existing data object with same weight-path during AO booking");
1216 aoold.get()->unsetActiveWeight();
1217 MSG_TRACE(
"Bound pre-existing data object " << aoold->path() <<
" for " <<
name());
1222 MSG_TRACE(
"Registered " << aonew->annotation(
"Type") <<
" " << aonew->path() <<
" for " <<
name());
1223 aonew.get()->unsetActiveWeight();
1225 _analysisobjects.push_back(aonew);
1241 template <
typename AO=MultiweightAOPtr>
1247 return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1275 template <
typename AO=MultiweightAOPtr>
1277 const std::string& aoname) {
1278 MultiweightAOPtr ao = _getOtherAnalysisObject(ananame, aoname);
1280 return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1394 string _defaultname;
1397 unique_ptr<AnalysisInfo> _info;
1401 vector<MultiweightAOPtr> _analysisobjects;
1405 double _crossSection;
1406 bool _gotCrossSection;
1414 mutable std::map<std::string, YODA::AnalysisObjectPtr> _refdata;
1417 map<string, string> _options;
1429 void _cacheRefData()
const;
1447 #include "Rivet/AnalysisBuilder.hh" 1455 #define RIVET_DECLARE_PLUGIN(clsname) ::Rivet::AnalysisBuilder<clsname> plugin_ ## clsname 1459 #define RIVET_DECLARE_ALIASED_PLUGIN(clsname, alias) RIVET_DECLARE_PLUGIN(clsname)( #alias ) 1463 #define RIVET_DEFAULT_ANALYSIS_CTOR(clsname) clsname() : Analysis(# clsname) {} 1471 #define DECLARE_RIVET_PLUGIN(clsname) ::Rivet::AnalysisBuilder<clsname> plugin_ ## clsname 1478 #define DECLARE_ALIASED_RIVET_PLUGIN(clsname, alias) DECLARE_RIVET_PLUGIN(clsname)( #alias ) 1484 #define DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname) clsname() : Analysis(# clsname) {} 1490 #define DEFAULT_RIVET_ANALYSIS_CTOR(clsname) DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname) double sumOfWeights() const
Alias.
Definition: Analysis.hh:360
Definition: MC_Cent_pPb.hh:10
const AO getAnalysisObject(const std::string &aoname) const
Get a Rivet data object from the histogram system.
Definition: Analysis.hh:1242
const PdgIdPair beamIds() const
Incoming beam IDs for this run.
const vector< MultiweightAOPtr > & analysisObjects() const
List of registered analysis data objects.
Definition: Analysis.hh:1076
void divide(CounterPtr c1, CounterPtr c2, Scatter1DPtr s) const
double crossSectionErrorPerEvent() const
Used together with the percentile-based analysis objects Percentile and PercentileXaxis.
Definition: CentralityProjection.hh:26
virtual void init()
Definition: Analysis.hh:89
const std::map< std::string, YODA::AnalysisObjectPtr > & refData() const
Get all reference data objects for this analysis.
Definition: Analysis.hh:392
Holder of analysis metadata.
Definition: AnalysisInfo.hh:12
Base class for projections returning a single floating point value.
Definition: SingleValueProjection.hh:17
void scale(const std::map< T, Histo1DPtr > &maps, CounterAdapter factor)
Iteratively scale the histograms in the map, maps, by factor factor.
Definition: Analysis.hh:927
const CentralityProjection & declareCentrality(const SingleValueProjection &proj, string calAnaName, string calHistName, const string projName, bool increasing=false)
Book a CentralityProjection.
const ParticlePair & beams() const
Incoming beams for this run.
const std::map< std::string, std::string > & options() const
Return the map of all options given to this analysis.
Definition: Analysis.hh:674
CounterPtr & book(CounterPtr &, const std::string &name)
Book a counter.
Error specialisation for where the problem is between the chair and the computer. ...
Definition: Exceptions.hh:55
const std::string & status() const
Whether this analysis is trusted (in any way!)
Definition: AnalysisInfo.hh:219
bool bookingCompatible(TPtr a, TPtr b)
Definition: RivetYODA.hh:835
size_t defaultWeightIndex() const
Get the default/nominal weight index.
virtual void analyze(const Event &event)=0
void removeAnalysisObject(const std::string &path)
Unregister a data object from the histogram system (by name)
void normalize(const Histo2DPtr(&histos)[array_size], CounterAdapter norm=1.0, bool includeoverflows=true)
Definition: Analysis.hh:956
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
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:950
void normalize(Histo1DPtr histo, CounterAdapter norm=1.0, bool includeoverflows=true)
Normalize the given histogram, histo, to area = norm.
double crossSection() const
Get the process cross-section in pb. Throws if this hasn't been set.
Logging system for controlled & formatted writing to stdout.
Definition: Logging.hh:10
const std::vector< std::string > & validation() const
List a series of command lines to be used for valdation.
Definition: AnalysisInfo.hh:288
void efficiency(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const
virtual void finalize()
Definition: Analysis.hh:102
void scale(const std::vector< CounterPtr > &cnts, CounterAdapter factor)
Definition: Analysis.hh:875
std::string getOption(std::string optname) const
Get an option for this analysis instance as a string.
Definition: Analysis.hh:679
const T & refData(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const
Definition: Analysis.hh:415
This is the base class of all analysis classes in Rivet.
Definition: Analysis.hh:64
bool merging() const
Check if we are running rivet-merge.
Definition: Analysis.hh:303
Representation of a HepMC event, and enabler of Projection caching.
Definition: Event.hh:22
double sumW() const
Get the sum of event weights seen (via the analysis handler).
rivet_shared_ptr< Wrapper< YODAT > > registerAO(const YODAT &yao)
Register a new data object, optionally read in preloaded data.
Definition: Analysis.hh:1098
double sqrtS() const
Centre of mass energy for this run.
Common base class for Projection and Analysis, used for internal polymorphism.
Definition: ProjectionApplier.hh:21
void scale(const std::map< T, CounterPtr > &maps, CounterAdapter factor)
Iteratively scale the counters in the map maps, by factor factor.
Definition: Analysis.hh:881
void normalize(const Histo1DPtr(&histos)[array_size], CounterAdapter norm=1.0, bool includeoverflows=true)
Definition: Analysis.hh:911
AnalysisHandler & handler() const
Access the controlling AnalysisHandler object.
Definition: Analysis.hh:328
double crossSectionError() const
Get the process cross-section error in pb. Throws if this hasn't been set.
#define MSG_TRACE(x)
Lowest-level, most verbose messaging, using MSG_LVL.
Definition: Logging.hh:193
Error relating to looking up analysis objects in the register.
Definition: Exceptions.hh:61
void normalize(const std::vector< Histo2DPtr > &histos, CounterAdapter norm=1.0, bool includeoverflows=true)
Definition: Analysis.hh:944
const T & refData(const string &hname) const
Definition: Analysis.hh:401
Error Exception
Rivet::Exception is a synonym for Rivet::Error.
Definition: Exceptions.hh:18
size_t numEvents() const
Get the number of events seen (via the analysis handler).
void normalize(const std::vector< Histo1DPtr > &histos, CounterAdapter norm=1.0, bool includeoverflows=true)
Definition: Analysis.hh:899
The key class for coordination of Analysis objects and the event loop.
Definition: AnalysisHandler.hh:23
#define MSG_ERROR(x)
Highest level messaging for serious problems, using MSG_LVL.
Definition: Logging.hh:202
const std::string histoDir() const
Get the canonical histogram "directory" path for this analysis.
Analysis & operator=(const Analysis &)=delete
The assignment operator is private and mustdeleted, so it can never be called.
AO getAnalysisObject(const std::string &ananame, const std::string &aoname)
Definition: Analysis.hh:1276
double sumW2() const
Get the sum of squared event weights seen (via the analysis handler).
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)
void scale(CounterPtr cnt, CounterAdapter factor)
Multiplicatively scale the given counter, cnt, by factor factor.
T getOption(std::string optname, T def) const
Get an option for this analysis instance converted to a specific type.
Definition: Analysis.hh:690
void integrate(Histo1DPtr h, Scatter2DPtr s) const
bool reentrant() const
Return true if finalize() can be run multiple times for this analysis.
Definition: AnalysisInfo.hh:225
shared_ptr< YODAT > getPreload(string path) const
Get a preloaded YODA object.
Definition: Analysis.hh:1091
void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const
void scale(const CounterPtr(&cnts)[array_size], CounterAdapter factor)
Definition: Analysis.hh:887
Analysis(const std::string &name)
Constructor.
void scale(const std::vector< Histo1DPtr > &histos, CounterAdapter factor)
Definition: Analysis.hh:921
Log & getLog() const
Get a Log object based on the name() property of the calling analysis object.
#define MSG_WARNING(x)
Warning messages for non-fatal bad things, using MSG_LVL.
Definition: Logging.hh:200
const std::string histoPath(const std::string &hname) const
Get the canonical histogram path for the named histogram in this analysis.
double crossSectionPerEvent() const
virtual ~Analysis()
The destructor.
Definition: Analysis.hh:75
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:703
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:905
std::string refFile() const
Find the path to the reference-data file for this analysis.
void scale(const Histo1DPtr(&histos)[array_size], CounterAdapter factor)
Definition: Analysis.hh:933
bool isCompatible(const ParticlePair &beams) const
Check if analysis is compatible with the provided beam particle IDs and energies. ...
AO addAnalysisObject(const AO &aonew)
Register a data object in the histogram system.
Definition: Analysis.hh:1185
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:744