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;
114 assert(_info &&
"No AnalysisInfo object :O");
125 virtual std::string
name()
const {
126 return ( (
info().
name().empty()) ? _defaultname :
info().
name() ) + _optstring;
153 virtual std::vector<std::string>
authors()
const {
196 virtual std::string
year()
const {
230 virtual std::vector<std::string>
todos()
const {
267 virtual const std::vector<std::string> &
keywords()
const {
281 assert(_info &&
"No AnalysisInfo object :O");
292 const ParticlePair&
beams()
const;
295 const PdgIdPair
beamIds()
const;
298 double sqrtS()
const;
302 return sqrtS() <= 0.0;
318 bool isCompatible(PdgId beam1, PdgId beam2,
double e1,
double e2)
const;
321 bool isCompatible(
const PdgIdPair& beams,
const std::pair<double,double>& energies)
const;
363 double sumW2()
const;
375 const std::string
histoPath(
const std::string& hname)
const;
378 const std::string
histoPath(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
381 const std::string
mkAxisCode(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
390 const std::map<std::string, YODA::AnalysisObjectPtr>&
refData()
const {
398 template <
typename T=YODA::Scatter2D>
401 MSG_TRACE(
"Using histo bin edges for " <<
name() <<
":" << hname);
402 if (!_refdata[hname]) {
403 MSG_ERROR(
"Can't find reference histogram " << hname);
404 throw Exception(
"Reference data " + hname +
" not found.");
406 return dynamic_cast<T&
>(*_refdata[hname]);
412 template <
typename T=YODA::Scatter2D>
413 const T&
refData(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const {
414 const string hname =
mkAxisCode(datasetId, xAxisId, yAxisId);
425 CounterPtr &
book(CounterPtr &,
const std::string&
name);
430 CounterPtr &
book(CounterPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
439 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
size_t nbins,
double lower,
double upper);
442 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
const std::vector<double>& binedges);
445 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
const std::initializer_list<double>& binedges);
448 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
const Scatter2D& refscatter);
451 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name);
456 Histo1DPtr &
book(Histo1DPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
467 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
468 size_t nxbins,
double xlower,
double xupper,
469 size_t nybins,
double ylower,
double yupper);
473 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
474 const std::vector<double>& xbinedges,
475 const std::vector<double>& ybinedges);
479 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
480 const std::initializer_list<double>& xbinedges,
481 const std::initializer_list<double>& ybinedges);
484 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
485 const Scatter3D& refscatter);
488 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name);
493 Histo2DPtr &
book(Histo2DPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
502 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
size_t nbins,
double lower,
double upper);
505 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
const std::vector<double>& binedges);
508 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
const std::initializer_list<double>& binedges);
511 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
const Scatter2D& refscatter);
514 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name);
519 Profile1DPtr &
book(Profile1DPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
530 Profile2DPtr &
book(Profile2DPtr &,
const std::string& name,
531 size_t nxbins,
double xlower,
double xupper,
532 size_t nybins,
double ylower,
double yupper);
536 Profile2DPtr &
book(Profile2DPtr &,
const std::string& name,
537 const std::vector<double>& xbinedges,
538 const std::vector<double>& ybinedges);
542 Profile2DPtr &
book(Profile2DPtr &,
const std::string& name,
543 const std::initializer_list<double>& xbinedges,
544 const std::initializer_list<double>& ybinedges);
576 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
bool copy_pts =
false);
588 Scatter2DPtr &
book(Scatter2DPtr & s2d,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId,
bool copy_pts =
false);
593 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
size_t npts,
double lower,
double upper);
598 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
const std::vector<double>& binedges);
601 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
const Scatter2D& refscatter);
618 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
bool copy_pts=
false);
630 Scatter3DPtr &
book(Scatter3DPtr & s3d,
unsigned int datasetId,
unsigned int xAxisId,
631 unsigned int yAxisId,
unsigned int zAxisId,
bool copy_pts=
false);
636 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
637 size_t xnpts,
double xlower,
double xupper,
638 size_t ynpts,
double ylower,
double yupper);
643 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
644 const std::vector<double>& xbinedges,
645 const std::vector<double>& ybinedges);
648 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
const Scatter3D& refscatter);
656 virtual void rawHookIn(YODA::AnalysisObjectPtr yao) {
661 virtual void rawHookOut(vector<MultiweightAOPtr> raos,
size_t iW) {
667 size_t _globalDefaultWeightIndex()
const;
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 size_t _defaultWeightIndex()
const;
821 MultiweightAOPtr _getOtherAnalysisObject(
const std::string & ananame,
const std::string& name);
824 void _checkBookInit()
const;
830 bool inFinalize()
const;
835 class CounterAdapter {
837 CounterAdapter(
double x) : x_(x ) {}
839 CounterAdapter(
const YODA::Counter & c) : x_(c.val() ) {}
843 CounterAdapter(
const YODA::Scatter1D & s) : x_(s.points()[0].x()) {
844 assert( s.numPoints() == 1 ||
"Can only scale by a single value.");
851 operator double()
const {
return x_; }
861 double dbl(
double x) {
return x; }
862 double dbl(
const YODA::Counter & c) {
return c.val(); }
863 double dbl(
const YODA::Scatter1D & s) {
864 assert( s.numPoints() == 1 );
865 return s.points()[0].x();
874 void scale(CounterPtr cnt, CounterAdapter factor);
879 void scale(
const std::vector<CounterPtr>& cnts, CounterAdapter factor) {
880 for (
auto& c : cnts)
scale(c, factor);
885 void scale(
const std::map<T, CounterPtr>& maps, CounterAdapter factor) {
886 for (
auto& m : maps)
scale(m.second, factor);
890 template <std::
size_t array_size>
891 void scale(
const CounterPtr (&cnts)[array_size], CounterAdapter factor) {
893 for (
auto& c : cnts)
scale(c, factor);
898 void normalize(Histo1DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
903 void normalize(
const std::vector<Histo1DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
904 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
909 void normalize(
const std::map<T, Histo1DPtr>& maps, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
910 for (
auto& m : maps)
normalize(m.second, norm, includeoverflows);
914 template <std::
size_t array_size>
915 void normalize(
const Histo1DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
916 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
920 void scale(Histo1DPtr histo, CounterAdapter factor);
925 void scale(
const std::vector<Histo1DPtr>& histos, CounterAdapter factor) {
926 for (
auto& h : histos)
scale(h, factor);
931 void scale(
const std::map<T, Histo1DPtr>& maps, CounterAdapter factor) {
932 for (
auto& m : maps)
scale(m.second, factor);
936 template <std::
size_t array_size>
937 void scale(
const Histo1DPtr (&histos)[array_size], CounterAdapter factor) {
938 for (
auto& h : histos)
scale(h, factor);
943 void normalize(Histo2DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
948 void normalize(
const std::vector<Histo2DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
949 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
954 void normalize(
const std::map<T, Histo2DPtr>& maps, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
955 for (
auto& m : maps)
normalize(m.second, norm, includeoverflows);
959 template <std::
size_t array_size>
960 void normalize(
const Histo2DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
961 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
965 void scale(Histo2DPtr histo, CounterAdapter factor);
970 void scale(
const std::vector<Histo2DPtr>& histos, CounterAdapter factor) {
971 for (
auto& h : histos)
scale(h, factor);
976 void scale(
const std::map<T, Histo2DPtr>& maps, CounterAdapter factor) {
977 for (
auto& m : maps)
scale(m.second, factor);
981 template <std::
size_t array_size>
982 void scale(
const Histo2DPtr (&histos)[array_size], CounterAdapter factor) {
983 for (
auto& h : histos)
scale(h, factor);
990 void divide(CounterPtr c1, CounterPtr c2, Scatter1DPtr s)
const;
995 void divide(
const YODA::Counter& c1,
const YODA::Counter& c2, Scatter1DPtr s)
const;
1001 void divide(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1006 void divide(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1012 void divide(Profile1DPtr p1, Profile1DPtr p2, Scatter2DPtr s)
const;
1017 void divide(
const YODA::Profile1D& p1,
const YODA::Profile1D& p2, Scatter2DPtr s)
const;
1023 void divide(Histo2DPtr h1, Histo2DPtr h2, Scatter3DPtr s)
const;
1028 void divide(
const YODA::Histo2D& h1,
const YODA::Histo2D& h2, Scatter3DPtr s)
const;
1034 void divide(Profile2DPtr p1, Profile2DPtr p2, Scatter3DPtr s)
const;
1039 void divide(
const YODA::Profile2D& p1,
const YODA::Profile2D& p2, Scatter3DPtr s)
const;
1045 void efficiency(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1050 void efficiency(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1056 void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1061 void asymm(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1067 void integrate(Histo1DPtr h, Scatter2DPtr s)
const;
1072 void integrate(
const Histo1D& h, Scatter2DPtr s)
const;
1081 return _analysisobjects;
1091 template <
typename YODAT>
1093 return dynamic_pointer_cast<YODAT>(_getPreload(path));
1098 template <
typename YODAT>
1099 rivet_shared_ptr< Wrapper<YODAT> >
registerAO(
const YODAT & yao) {
1100 typedef Wrapper<YODAT> WrapperT;
1101 typedef shared_ptr<YODAT> YODAPtrT;
1102 typedef rivet_shared_ptr<WrapperT> RAOT;
1104 if ( !inInit() && !inFinalize() ) {
1105 MSG_ERROR(
"Can't book objects outside of init()");
1106 throw UserError(
name() +
": Can't book objects outside of init() or finalize().");
1113 if ( yao.path() == waold.get()->basePath() ) {
1114 const string msg =
"Found double-booking of " + yao.path() +
" in " +
name();
1121 return RAOT(dynamic_pointer_cast<WrapperT>(waold.get()));
1125 shared_ptr<WrapperT> wao = make_shared<WrapperT>();
1126 wao->_basePath = yao.path();
1127 YODAPtrT yaop = make_shared<YODAT>(yao);
1129 for (
const string& weightname : _weightNames()) {
1132 string finalpath = yao.path();
1133 if ( weightname !=
"" ) finalpath +=
"[" + weightname +
"]";
1134 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>
1191 ao.get()->setActiveWeightIdx(_defaultWeightIndex());
1192 aonew.get()->setActiveWeightIdx(_defaultWeightIndex());
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>
1244 ao.get()->setActiveWeightIdx(_defaultWeightIndex());
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;
1428 void _cacheRefData()
const;
1451 #include "Rivet/AnalysisBuilder.hh" 1459 #define DECLARE_RIVET_PLUGIN(clsname) ::Rivet::AnalysisBuilder<clsname> plugin_ ## clsname 1464 #define DECLARE_ALIASED_RIVET_PLUGIN(clsname, alias) DECLARE_RIVET_PLUGIN(clsname)( #alias ) 1468 #define DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname) clsname() : Analysis(# clsname) {} 1472 #define DEFAULT_RIVET_ANALYSIS_CTOR(clsname) DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname) double sumOfWeights() const
Alias.
Definition: Analysis.hh:358
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:1080
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:87
const std::map< std::string, YODA::AnalysisObjectPtr > & refData() const
Get all reference data objects for this analysis.
Definition: Analysis.hh:390
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:931
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
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:960
bool bookingCompatible(TPtr a, TPtr b)
Definition: RivetYODA.hh:607
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:954
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:100
void scale(const std::vector< CounterPtr > &cnts, CounterAdapter factor)
Definition: Analysis.hh:879
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:413
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:301
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:1099
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:885
void normalize(const Histo1DPtr(&histos)[array_size], CounterAdapter norm=1.0, bool includeoverflows=true)
Definition: Analysis.hh:915
AnalysisHandler & handler() const
Access the controlling AnalysisHandler object.
Definition: Analysis.hh:326
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:948
const T & refData(const string &hname) const
Definition: Analysis.hh:399
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:903
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.
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:1092
void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const
void scale(const CounterPtr(&cnts)[array_size], CounterAdapter factor)
Definition: Analysis.hh:891
Analysis(const std::string &name)
Constructor.
void scale(const std::vector< Histo1DPtr > &histos, CounterAdapter factor)
Definition: Analysis.hh:925
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:76
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:909
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:937
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