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;
380 const std::string
histoPath(
const std::string& hname)
const;
383 const std::string
histoPath(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
386 const std::string
mkAxisCode(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
395 const std::map<std::string, YODA::AnalysisObjectPtr>&
refData()
const {
403 template <
typename T=YODA::Scatter2D>
406 MSG_TRACE(
"Using histo bin edges for " <<
name() <<
":" << hname);
407 if (!_refdata[hname]) {
408 MSG_ERROR(
"Can't find reference histogram " << hname);
409 throw Exception(
"Reference data " + hname +
" not found.");
411 return dynamic_cast<T&
>(*_refdata[hname]);
417 template <
typename T=YODA::Scatter2D>
418 const T&
refData(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const {
419 const string hname =
mkAxisCode(datasetId, xAxisId, yAxisId);
420 return refData<T>(hname);
433 CounterPtr&
book(CounterPtr&,
const std::string&
name);
438 CounterPtr&
book(CounterPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
447 Histo1DPtr&
book(Histo1DPtr&,
const std::string& name,
size_t nbins,
double lower,
double upper);
450 Histo1DPtr&
book(Histo1DPtr&,
const std::string& name,
const std::vector<double>& binedges);
453 Histo1DPtr&
book(Histo1DPtr&,
const std::string& name,
const std::initializer_list<double>& binedges);
456 Histo1DPtr&
book(Histo1DPtr&,
const std::string& name,
const Scatter2D& refscatter);
459 Histo1DPtr&
book(Histo1DPtr&,
const std::string& name);
464 Histo1DPtr&
book(Histo1DPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
475 Histo2DPtr&
book(Histo2DPtr&,
const std::string& name,
476 size_t nxbins,
double xlower,
double xupper,
477 size_t nybins,
double ylower,
double yupper);
481 Histo2DPtr&
book(Histo2DPtr&,
const std::string& name,
482 const std::vector<double>& xbinedges,
483 const std::vector<double>& ybinedges);
487 Histo2DPtr&
book(Histo2DPtr&,
const std::string& name,
488 const std::initializer_list<double>& xbinedges,
489 const std::initializer_list<double>& ybinedges);
492 Histo2DPtr&
book(Histo2DPtr&,
const std::string& name,
493 const Scatter3D& refscatter);
496 Histo2DPtr&
book(Histo2DPtr&,
const std::string& name);
501 Histo2DPtr&
book(Histo2DPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
510 Profile1DPtr&
book(Profile1DPtr&,
const std::string& name,
size_t nbins,
double lower,
double upper);
513 Profile1DPtr&
book(Profile1DPtr&,
const std::string& name,
const std::vector<double>& binedges);
516 Profile1DPtr&
book(Profile1DPtr&,
const std::string& name,
const std::initializer_list<double>& binedges);
519 Profile1DPtr&
book(Profile1DPtr&,
const std::string& name,
const Scatter2D& refscatter);
522 Profile1DPtr&
book(Profile1DPtr&,
const std::string& name);
527 Profile1DPtr&
book(Profile1DPtr&,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
538 Profile2DPtr&
book(Profile2DPtr&,
const std::string& name,
539 size_t nxbins,
double xlower,
double xupper,
540 size_t nybins,
double ylower,
double yupper);
544 Profile2DPtr&
book(Profile2DPtr&,
const std::string& name,
545 const std::vector<double>& xbinedges,
546 const std::vector<double>& ybinedges);
550 Profile2DPtr&
book(Profile2DPtr&,
const std::string& name,
551 const std::initializer_list<double>& xbinedges,
552 const std::initializer_list<double>& ybinedges);
584 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
bool copy_pts =
false);
596 Scatter2DPtr&
book(Scatter2DPtr& s2d,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId,
bool copy_pts =
false);
601 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
size_t npts,
double lower,
double upper);
606 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
const std::vector<double>& binedges);
609 Scatter2DPtr&
book(Scatter2DPtr& s2d,
const string& hname,
const Scatter2D& refscatter);
626 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
bool copy_pts=
false);
638 Scatter3DPtr&
book(Scatter3DPtr& s3d,
unsigned int datasetId,
unsigned int xAxisId,
639 unsigned int yAxisId,
unsigned int zAxisId,
bool copy_pts=
false);
644 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
645 size_t xnpts,
double xlower,
double xupper,
646 size_t ynpts,
double ylower,
double yupper);
651 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
652 const std::vector<double>& xbinedges,
653 const std::vector<double>& ybinedges);
656 Scatter3DPtr&
book(Scatter3DPtr& s3d,
const std::string& hname,
const Scatter3D& refscatter);
666 virtual void rawHookIn(YODA::AnalysisObjectPtr yao) {
674 virtual void rawHookOut(vector<MultiweightAOPtr> raos,
size_t iW) {
683 const std::map<std::string,std::string>&
options()
const {
689 if ( _options.find(optname) != _options.end() )
690 return _options.find(optname)->second;
700 if (_options.find(optname) == _options.end())
return def;
701 std::stringstream ss;
702 ss << _options.find(optname)->second;
712 std::string
getOption(std::string optname,
const char* def) {
713 return getOption<std::string>(optname, def);
740 string calAnaName,
string calHistName,
741 const string projName,
bool increasing=
false);
754 vector<pair<float, float> > centralityBins,
755 vector<tuple<int, int, int> > ref) {
757 typedef typename ReferenceTraits<T>::RefT RefT;
758 typedef rivet_shared_ptr<Wrapper<T>> WrapT;
762 const int nCent = centralityBins.size();
763 for (
int iCent = 0; iCent < nCent; ++iCent) {
764 const string axisCode =
mkAxisCode(std::get<0>(ref[iCent]),
765 std::get<1>(ref[iCent]),
766 std::get<2>(ref[iCent]));
767 const RefT & refscatter = refData<RefT>(axisCode);
769 WrapT wtf(_weightNames(), T(refscatter,
histoPath(axisCode)));
772 CounterPtr cnt(_weightNames(), Counter(
histoPath(
"TMP/COUNTER/" + axisCode)));
775 pctl.
add(wtf, cnt, centralityBins[iCent]);
821 vector<string> _weightNames()
const;
824 YODA::AnalysisObjectPtr _getPreload(
string name)
const;
827 MultiweightAOPtr _getOtherAnalysisObject(
const std::string & ananame,
const std::string& name);
830 void _checkBookInit()
const;
833 bool _inInit()
const;
836 bool _inFinalize()
const;
842 class CounterAdapter {
845 CounterAdapter(
double x) : x_(x) {}
847 CounterAdapter(
const YODA::Counter & c) : x_(c.val()) {}
849 CounterAdapter(
const YODA::Scatter1D & s) : x_(s.points()[0].x()) {
850 assert( s.numPoints() == 1 ||
"Can only scale by a single value.");
853 operator double()
const {
return x_; }
863 double dbl(
double x) {
return x; }
864 double dbl(
const YODA::Counter & c) {
return c.val(); }
865 double dbl(
const YODA::Scatter1D & s) {
866 assert( s.numPoints() == 1 );
867 return s.points()[0].x();
879 void scale(CounterPtr cnt, CounterAdapter factor);
884 void scale(
const std::vector<CounterPtr>& cnts, CounterAdapter factor) {
885 for (
auto& c : cnts)
scale(c, factor);
890 void scale(
const std::map<T, CounterPtr>& maps, CounterAdapter factor) {
891 for (
auto& m : maps)
scale(m.second, factor);
895 template <std::
size_t array_size>
896 void scale(
const CounterPtr (&cnts)[array_size], CounterAdapter factor) {
898 for (
auto& c : cnts)
scale(c, factor);
903 void normalize(Histo1DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
908 void normalize(
const std::vector<Histo1DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
909 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
914 void normalize(
const std::map<T, Histo1DPtr>& maps, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
915 for (
auto& m : maps)
normalize(m.second, norm, includeoverflows);
919 template <std::
size_t array_size>
920 void normalize(
const Histo1DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
921 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
925 void scale(Histo1DPtr histo, CounterAdapter factor);
930 void scale(
const std::vector<Histo1DPtr>& histos, CounterAdapter factor) {
931 for (
auto& h : histos)
scale(h, factor);
936 void scale(
const std::map<T, Histo1DPtr>& maps, CounterAdapter factor) {
937 for (
auto& m : maps)
scale(m.second, factor);
941 template <std::
size_t array_size>
942 void scale(
const Histo1DPtr (&histos)[array_size], CounterAdapter factor) {
943 for (
auto& h : histos)
scale(h, factor);
948 void normalize(Histo2DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
953 void normalize(
const std::vector<Histo2DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
954 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
959 void normalize(
const std::map<T, Histo2DPtr>& maps, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
960 for (
auto& m : maps)
normalize(m.second, norm, includeoverflows);
964 template <std::
size_t array_size>
965 void normalize(
const Histo2DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
966 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
970 void scale(Histo2DPtr histo, CounterAdapter factor);
975 void scale(
const std::vector<Histo2DPtr>& histos, CounterAdapter factor) {
976 for (
auto& h : histos)
scale(h, factor);
981 void scale(
const std::map<T, Histo2DPtr>& maps, CounterAdapter factor) {
982 for (
auto& m : maps)
scale(m.second, factor);
986 template <std::
size_t array_size>
987 void scale(
const Histo2DPtr (&histos)[array_size], CounterAdapter factor) {
988 for (
auto& h : histos)
scale(h, factor);
995 void divide(CounterPtr c1, CounterPtr c2, Scatter1DPtr s)
const;
1000 void divide(
const YODA::Counter& c1,
const YODA::Counter& c2, Scatter1DPtr s)
const;
1006 void divide(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1011 void divide(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1017 void divide(Profile1DPtr p1, Profile1DPtr p2, Scatter2DPtr s)
const;
1022 void divide(
const YODA::Profile1D& p1,
const YODA::Profile1D& p2, Scatter2DPtr s)
const;
1028 void divide(Histo2DPtr h1, Histo2DPtr h2, Scatter3DPtr s)
const;
1033 void divide(
const YODA::Histo2D& h1,
const YODA::Histo2D& h2, Scatter3DPtr s)
const;
1039 void divide(Profile2DPtr p1, Profile2DPtr p2, Scatter3DPtr s)
const;
1044 void divide(
const YODA::Profile2D& p1,
const YODA::Profile2D& p2, Scatter3DPtr s)
const;
1050 void efficiency(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1055 void efficiency(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1061 void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1066 void asymm(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1072 void integrate(Histo1DPtr h, Scatter2DPtr s)
const;
1077 void integrate(
const Histo1D& h, Scatter2DPtr s)
const;
1086 return _analysisobjects;
1099 template <
typename YODAT>
1101 return dynamic_pointer_cast<YODAT>(_getPreload(path));
1106 template <
typename YODAT>
1107 rivet_shared_ptr< Wrapper<YODAT> >
registerAO(
const YODAT& yao) {
1108 typedef Wrapper<YODAT> WrapperT;
1109 typedef shared_ptr<YODAT> YODAPtrT;
1110 typedef rivet_shared_ptr<WrapperT> RAOT;
1112 if ( !_inInit() && !_inFinalize() ) {
1113 MSG_ERROR(
"Can't book objects outside of init() or finalize()");
1114 throw UserError(
name() +
": Can't book objects outside of init() or finalize().");
1121 if ( yao.path() == waold.get()->basePath() ) {
1122 const string msg =
"Found double-booking of " + yao.path() +
" in " +
name();
1129 return RAOT(dynamic_pointer_cast<WrapperT>(waold.get()));
1133 shared_ptr<WrapperT> wao = make_shared<WrapperT>();
1134 wao->_basePath = yao.path();
1135 YODAPtrT yaop = make_shared<YODAT>(yao);
1137 for (
const string& weightname : _weightNames()) {
1140 string finalpath = yao.path();
1141 if ( weightname !=
"" ) finalpath +=
"[" + weightname +
"]";
1142 YODAPtrT preload = getPreload<YODAT>(finalpath);
1146 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1147 << finalpath <<
" for " <<
name());
1150 MSG_TRACE(
"Using preloaded " << finalpath <<
" in " <<
name());
1151 wao->_final.push_back(make_shared<YODAT>(*preload));
1155 wao->_final.push_back(make_shared<YODAT>(yao));
1156 wao->_final.back()->setPath(finalpath);
1160 string rawpath =
"/RAW" + finalpath;
1161 preload = getPreload<YODAT>(rawpath);
1164 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1165 << rawpath <<
" for " <<
name());
1168 MSG_TRACE(
"Using preloaded " << rawpath <<
" in " <<
name());
1169 wao->_persistent.push_back(make_shared<YODAT>(*preload));
1173 wao->_persistent.push_back(make_shared<YODAT>(yao));
1174 wao->_persistent.back()->setPath(rawpath);
1177 rivet_shared_ptr<WrapperT> ret(wao);
1179 ret.get()->unsetActiveWeight();
1180 if ( _inFinalize() ) {
1183 ret.get()->pushToFinal();
1184 ret.get()->setActiveFinalWeightIdx(0);
1186 _analysisobjects.push_back(ret);
1193 template <
typename AO=MultiweightAOPtr>
1202 if (ao->path() != aonew->path())
continue;
1206 AO aoold = AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1208 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1209 << aonew->path() <<
" for " <<
name());
1210 throw LookupError(
"Found incompatible pre-existing data object with same base path during AO booking");
1214 for (
size_t weightIdx = 0; weightIdx < _weightNames().size(); ++weightIdx) {
1215 aoold.get()->setActiveWeightIdx(weightIdx);
1216 aonew.get()->setActiveWeightIdx(weightIdx);
1217 if (aoold->path() != aonew->path()) {
1218 MSG_WARNING(
"Found incompatible pre-existing data object with different weight-path " 1219 << aonew->path() <<
" for " <<
name());
1220 throw LookupError(
"Found incompatible pre-existing data object with same weight-path during AO booking");
1225 aoold.get()->unsetActiveWeight();
1226 MSG_TRACE(
"Bound pre-existing data object " << aoold->path() <<
" for " <<
name());
1231 MSG_TRACE(
"Registered " << aonew->annotation(
"Type") <<
" " << aonew->path() <<
" for " <<
name());
1232 aonew.get()->unsetActiveWeight();
1234 _analysisobjects.push_back(aonew);
1250 template <
typename AO=MultiweightAOPtr>
1256 return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1284 template <
typename AO=MultiweightAOPtr>
1286 const std::string& aoname) {
1287 MultiweightAOPtr ao = _getOtherAnalysisObject(ananame, aoname);
1289 return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1403 string _defaultname;
1406 unique_ptr<AnalysisInfo> _info;
1410 vector<MultiweightAOPtr> _analysisobjects;
1414 double _crossSection;
1415 bool _gotCrossSection;
1423 mutable std::map<std::string, YODA::AnalysisObjectPtr> _refdata;
1426 map<string, string> _options;
1438 void _cacheRefData()
const;
1456 #include "Rivet/AnalysisBuilder.hh" 1464 #define RIVET_DECLARE_PLUGIN(clsname) ::Rivet::AnalysisBuilder<clsname> plugin_ ## clsname 1468 #define RIVET_DECLARE_ALIASED_PLUGIN(clsname, alias) RIVET_DECLARE_PLUGIN(clsname)( #alias ) 1472 #define RIVET_DEFAULT_ANALYSIS_CTOR(clsname) clsname() : Analysis(# clsname) {} 1480 #define DECLARE_RIVET_PLUGIN(clsname) ::Rivet::AnalysisBuilder<clsname> plugin_ ## clsname 1487 #define DECLARE_ALIASED_RIVET_PLUGIN(clsname, alias) DECLARE_RIVET_PLUGIN(clsname)( #alias ) 1493 #define DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname) clsname() : Analysis(# clsname) {} 1499 #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:1251
const PdgIdPair beamIds() const
Incoming beam IDs for this run.
const vector< MultiweightAOPtr > & analysisObjects() const
List of registered analysis data objects.
Definition: Analysis.hh:1085
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:395
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:936
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:683
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:849
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:965
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:959
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:884
std::string getOption(std::string optname) const
Get an option for this analysis instance as a string.
Definition: Analysis.hh:688
const T & refData(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const
Definition: Analysis.hh:418
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:1107
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:890
void normalize(const Histo1DPtr(&histos)[array_size], CounterAdapter norm=1.0, bool includeoverflows=true)
Definition: Analysis.hh:920
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:953
const T & refData(const string &hname) const
Definition: Analysis.hh:404
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:908
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:1285
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:699
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:1100
void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const
void scale(const CounterPtr(&cnts)[array_size], CounterAdapter factor)
Definition: Analysis.hh:896
Analysis(const std::string &name)
Constructor.
void scale(const std::vector< Histo1DPtr > &histos, CounterAdapter factor)
Definition: Analysis.hh:930
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:712
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:914
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:942
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:1194
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:753