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;
356 double sumW2()
const;
368 const std::string
histoPath(
const std::string& hname)
const;
371 const std::string
histoPath(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
374 const std::string
mkAxisCode(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
383 const std::map<std::string, YODA::AnalysisObjectPtr>&
refData()
const {
391 template <
typename T=YODA::Scatter2D>
394 MSG_TRACE(
"Using histo bin edges for " <<
name() <<
":" << hname);
395 if (!_refdata[hname]) {
396 MSG_ERROR(
"Can't find reference histogram " << hname);
397 throw Exception(
"Reference data " + hname +
" not found.");
399 return dynamic_cast<T&
>(*_refdata[hname]);
405 template <
typename T=YODA::Scatter2D>
406 const T&
refData(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const {
407 const string hname =
mkAxisCode(datasetId, xAxisId, yAxisId);
418 CounterPtr &
book(CounterPtr &,
const std::string&
name);
423 CounterPtr &
book(CounterPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
432 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
size_t nbins,
double lower,
double upper);
435 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
const std::vector<double>& binedges);
438 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
const std::initializer_list<double>& binedges);
441 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
const Scatter2D& refscatter);
444 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name);
449 Histo1DPtr &
book(Histo1DPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
460 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
461 size_t nxbins,
double xlower,
double xupper,
462 size_t nybins,
double ylower,
double yupper);
466 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
467 const std::vector<double>& xbinedges,
468 const std::vector<double>& ybinedges);
472 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
473 const std::initializer_list<double>& xbinedges,
474 const std::initializer_list<double>& ybinedges);
477 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
478 const Scatter3D& refscatter);
481 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name);
486 Histo2DPtr &
book(Histo2DPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
495 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
size_t nbins,
double lower,
double upper);
498 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
const std::vector<double>& binedges);
501 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
const std::initializer_list<double>& binedges);
504 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
const Scatter2D& refscatter);
507 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name);
512 Profile1DPtr &
book(Profile1DPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
523 Profile2DPtr &
book(Profile2DPtr &,
const std::string& name,
524 size_t nxbins,
double xlower,
double xupper,
525 size_t nybins,
double ylower,
double yupper);
529 Profile2DPtr &
book(Profile2DPtr &,
const std::string& name,
530 const std::vector<double>& xbinedges,
531 const std::vector<double>& ybinedges);
535 Profile2DPtr &
book(Profile2DPtr &,
const std::string& name,
536 const std::initializer_list<double>& xbinedges,
537 const std::initializer_list<double>& ybinedges);
569 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
bool copy_pts =
false);
581 Scatter2DPtr &
book(Scatter2DPtr & s2d,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId,
bool copy_pts =
false);
586 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
size_t npts,
double lower,
double upper);
591 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
const std::vector<double>& binedges);
594 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
const Scatter2D& refscatter);
611 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
bool copy_pts=
false);
623 Scatter3DPtr &
book(Scatter3DPtr & s3d,
unsigned int datasetId,
unsigned int xAxisId,
624 unsigned int yAxisId,
unsigned int zAxisId,
bool copy_pts=
false);
629 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
630 size_t xnpts,
double xlower,
double xupper,
631 size_t ynpts,
double ylower,
double yupper);
636 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
637 const std::vector<double>& xbinedges,
638 const std::vector<double>& ybinedges);
641 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
const Scatter3D& refscatter);
649 virtual void rawHookIn(YODA::AnalysisObjectPtr yao) {
654 virtual void rawHookOut(vector<MultiweightAOPtr> raos,
size_t iW) {
660 size_t _globalDefaultWeightIndex()
const;
667 const std::map<std::string,std::string> &
options() {
673 if ( _options.find(optname) != _options.end() )
674 return _options.find(optname)->second;
684 if (_options.find(optname) == _options.end())
return def;
685 std::stringstream ss;
686 ss << _options.find(optname)->second;
716 string calAnaName,
string calHistName,
717 const string projName,
bool increasing=
false);
730 vector<pair<float, float> > centralityBins,
731 vector<tuple<int, int, int> > ref) {
733 typedef typename ReferenceTraits<T>::RefT RefT;
734 typedef rivet_shared_ptr<Wrapper<T>> WrapT;
738 const int nCent = centralityBins.size();
739 for (
int iCent = 0; iCent < nCent; ++iCent) {
740 const string axisCode =
mkAxisCode(std::get<0>(ref[iCent]),
741 std::get<1>(ref[iCent]),
742 std::get<2>(ref[iCent]));
743 const RefT & refscatter = refData<RefT>(axisCode);
745 WrapT wtf(_weightNames(), T(refscatter,
histoPath(axisCode)));
748 CounterPtr cnt(_weightNames(), Counter(
histoPath(
"TMP/COUNTER/" + axisCode)));
751 pctl.
add(wtf, cnt, centralityBins[iCent]);
797 vector<string> _weightNames()
const;
800 YODA::AnalysisObjectPtr _getPreload(
string name)
const;
803 size_t _defaultWeightIndex()
const;
806 MultiweightAOPtr _getOtherAnalysisObject(
const std::string & ananame,
const std::string& name);
809 void _checkBookInit()
const;
815 bool inFinalize()
const;
820 class CounterAdapter {
822 CounterAdapter(
double x) : x_(x ) {}
824 CounterAdapter(
const YODA::Counter & c) : x_(c.val() ) {}
828 CounterAdapter(
const YODA::Scatter1D & s) : x_(s.points()[0].x()) {
829 assert( s.numPoints() == 1 ||
"Can only scale by a single value.");
836 operator double()
const {
return x_; }
846 double dbl(
double x) {
return x; }
847 double dbl(
const YODA::Counter & c) {
return c.val(); }
848 double dbl(
const YODA::Scatter1D & s) {
849 assert( s.numPoints() == 1 );
850 return s.points()[0].x();
859 void scale(CounterPtr cnt, CounterAdapter factor);
864 void scale(
const std::vector<CounterPtr>& cnts, CounterAdapter factor) {
865 for (
auto& c : cnts)
scale(c, factor);
870 void scale(
const std::map<T, CounterPtr>& maps, CounterAdapter factor) {
871 for (
auto& m : maps)
scale(m.second, factor);
875 template <std::
size_t array_size>
876 void scale(
const CounterPtr (&cnts)[array_size], CounterAdapter factor) {
878 for (
auto& c : cnts)
scale(c, factor);
883 void normalize(Histo1DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
888 void normalize(
const std::vector<Histo1DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
889 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
894 void normalize(
const std::map<T, Histo1DPtr>& maps, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
895 for (
auto& m : maps)
normalize(m.second, norm, includeoverflows);
899 template <std::
size_t array_size>
900 void normalize(
const Histo1DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
901 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
905 void scale(Histo1DPtr histo, CounterAdapter factor);
910 void scale(
const std::vector<Histo1DPtr>& histos, CounterAdapter factor) {
911 for (
auto& h : histos)
scale(h, factor);
916 void scale(
const std::map<T, Histo1DPtr>& maps, CounterAdapter factor) {
917 for (
auto& m : maps)
scale(m.second, factor);
921 template <std::
size_t array_size>
922 void scale(
const Histo1DPtr (&histos)[array_size], CounterAdapter factor) {
923 for (
auto& h : histos)
scale(h, factor);
928 void normalize(Histo2DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
933 void normalize(
const std::vector<Histo2DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
934 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
939 void normalize(
const std::map<T, Histo2DPtr>& maps, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
940 for (
auto& m : maps)
normalize(m.second, norm, includeoverflows);
944 template <std::
size_t array_size>
945 void normalize(
const Histo2DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
946 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
950 void scale(Histo2DPtr histo, CounterAdapter factor);
955 void scale(
const std::vector<Histo2DPtr>& histos, CounterAdapter factor) {
956 for (
auto& h : histos)
scale(h, factor);
961 void scale(
const std::map<T, Histo2DPtr>& maps, CounterAdapter factor) {
962 for (
auto& m : maps)
scale(m.second, factor);
966 template <std::
size_t array_size>
967 void scale(
const Histo2DPtr (&histos)[array_size], CounterAdapter factor) {
968 for (
auto& h : histos)
scale(h, factor);
975 void divide(CounterPtr c1, CounterPtr c2, Scatter1DPtr s)
const;
980 void divide(
const YODA::Counter& c1,
const YODA::Counter& c2, Scatter1DPtr s)
const;
986 void divide(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
991 void divide(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
997 void divide(Profile1DPtr p1, Profile1DPtr p2, Scatter2DPtr s)
const;
1002 void divide(
const YODA::Profile1D& p1,
const YODA::Profile1D& p2, Scatter2DPtr s)
const;
1008 void divide(Histo2DPtr h1, Histo2DPtr h2, Scatter3DPtr s)
const;
1013 void divide(
const YODA::Histo2D& h1,
const YODA::Histo2D& h2, Scatter3DPtr s)
const;
1019 void divide(Profile2DPtr p1, Profile2DPtr p2, Scatter3DPtr s)
const;
1024 void divide(
const YODA::Profile2D& p1,
const YODA::Profile2D& p2, Scatter3DPtr s)
const;
1030 void efficiency(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1035 void efficiency(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1041 void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
1046 void asymm(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
1052 void integrate(Histo1DPtr h, Scatter2DPtr s)
const;
1057 void integrate(
const Histo1D& h, Scatter2DPtr s)
const;
1066 return _analysisobjects;
1076 template <
typename YODAT>
1078 return dynamic_pointer_cast<YODAT>(_getPreload(path));
1083 template <
typename YODAT>
1084 rivet_shared_ptr< Wrapper<YODAT> >
registerAO(
const YODAT & yao) {
1085 typedef Wrapper<YODAT> WrapperT;
1086 typedef shared_ptr<YODAT> YODAPtrT;
1087 typedef rivet_shared_ptr<WrapperT> RAOT;
1089 if ( !inInit() && !inFinalize() ) {
1090 MSG_ERROR(
"Can't book objects outside of init()");
1091 throw UserError(
name() +
": Can't book objects outside of init() or finalize().");
1098 if ( yao.path() == waold.get()->basePath() ) {
1099 const string msg =
"Found double-booking of " + yao.path() +
" in " +
name();
1104 MSG_WARNING(msg +
". Keeping previous booking");
1106 return RAOT(dynamic_pointer_cast<WrapperT>(waold.get()));
1110 shared_ptr<WrapperT> wao = make_shared<WrapperT>();
1111 wao->_basePath = yao.path();
1112 YODAPtrT yaop = make_shared<YODAT>(yao);
1114 for (
const string& weightname : _weightNames()) {
1117 string finalpath = yao.path();
1118 if ( weightname !=
"" ) finalpath +=
"[" + weightname +
"]";
1119 YODAPtrT preload = getPreload<YODAT>(finalpath);
1122 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1123 << finalpath <<
" for " <<
name());
1126 MSG_TRACE(
"Using preloaded " << finalpath <<
" in " <<
name());
1127 wao->_final.push_back(make_shared<YODAT>(*preload));
1131 wao->_final.push_back(make_shared<YODAT>(yao));
1132 wao->_final.back()->setPath(finalpath);
1136 string rawpath =
"/RAW" + finalpath;
1137 preload = getPreload<YODAT>(rawpath);
1140 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1141 << rawpath <<
" for " <<
name());
1144 MSG_TRACE(
"Using preloaded " << rawpath <<
" in " <<
name());
1145 wao->_persistent.push_back(make_shared<YODAT>(*preload));
1149 wao->_persistent.push_back(make_shared<YODAT>(yao));
1150 wao->_persistent.back()->setPath(rawpath);
1153 rivet_shared_ptr<WrapperT> ret(wao);
1155 ret.get()->unsetActiveWeight();
1156 if ( inFinalize() ) {
1159 ret.get()->pushToFinal();
1160 ret.get()->setActiveFinalWeightIdx(0);
1162 _analysisobjects.push_back(ret);
1169 template <
typename AO=MultiweightAOPtr>
1176 ao.get()->setActiveWeightIdx(_defaultWeightIndex());
1177 aonew.get()->setActiveWeightIdx(_defaultWeightIndex());
1178 if (ao->path() != aonew->path())
continue;
1182 AO aoold = AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1184 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1185 << aonew->path() <<
" for " <<
name());
1186 throw LookupError(
"Found incompatible pre-existing data object with same base path during AO booking");
1190 for (
size_t weightIdx = 0; weightIdx < _weightNames().size(); ++weightIdx) {
1191 aoold.get()->setActiveWeightIdx(weightIdx);
1192 aonew.get()->setActiveWeightIdx(weightIdx);
1193 if (aoold->path() != aonew->path()) {
1194 MSG_WARNING(
"Found incompatible pre-existing data object with different weight-path " 1195 << aonew->path() <<
" for " <<
name());
1196 throw LookupError(
"Found incompatible pre-existing data object with same weight-path during AO booking");
1201 aoold.get()->unsetActiveWeight();
1202 MSG_TRACE(
"Bound pre-existing data object " << aoold->path() <<
" for " <<
name());
1207 MSG_TRACE(
"Registered " << aonew->annotation(
"Type") <<
" " << aonew->path() <<
" for " <<
name());
1208 aonew.get()->unsetActiveWeight();
1210 _analysisobjects.push_back(aonew);
1226 template <
typename AO=MultiweightAOPtr>
1229 ao.get()->setActiveWeightIdx(_defaultWeightIndex());
1232 return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1260 template <
typename AO=MultiweightAOPtr>
1262 const std::string& aoname) {
1263 MultiweightAOPtr ao = _getOtherAnalysisObject(ananame, aoname);
1265 return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1379 string _defaultname;
1382 unique_ptr<AnalysisInfo> _info;
1386 vector<MultiweightAOPtr> _analysisobjects;
1390 double _crossSection;
1391 bool _gotCrossSection;
1399 mutable std::map<std::string, YODA::AnalysisObjectPtr> _refdata;
1402 map<string, string> _options;
1413 void _cacheRefData()
const;
1428 return getOption<std::string>(optname, def).c_str();
1436 #include "Rivet/AnalysisBuilder.hh" 1440 #define DECLARE_RIVET_PLUGIN(clsname) ::Rivet::AnalysisBuilder<clsname> plugin_ ## clsname 1445 #define DECLARE_ALIASED_RIVET_PLUGIN(clsname, alias) DECLARE_RIVET_PLUGIN(clsname)( #alias ) 1449 #define DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname) clsname() : Analysis(# clsname) {} 1453 #define DEFAULT_RIVET_ANALYSIS_CTOR(clsname) DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname) double sumOfWeights() const
Alias.
Definition: Analysis.hh:351
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:1227
const PdgIdPair beamIds() const
Incoming beam IDs for this run.
const vector< MultiweightAOPtr > & analysisObjects() const
List of registered analysis data objects.
Definition: Analysis.hh:1065
void divide(CounterPtr c1, CounterPtr c2, Scatter1DPtr s) 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:383
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:916
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.
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:945
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:939
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:864
const T & refData(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const
Definition: Analysis.hh:406
std::string getOption(std::string optname)
Get an option for this analysis instance as a string.
Definition: Analysis.hh:672
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:1084
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:870
void normalize(const Histo1DPtr(&histos)[array_size], CounterAdapter norm=1.0, bool includeoverflows=true)
Definition: Analysis.hh:900
AnalysisHandler & handler() const
Access the controlling AnalysisHandler object.
Definition: Analysis.hh:326
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:933
const T & refData(const string &hname) const
Definition: Analysis.hh:392
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:888
The key class for coordination of Analysis objects and the event loop.
Definition: AnalysisHandler.hh:23
const std::map< std::string, std::string > & options()
Return the map of all options given to this analysis.
Definition: Analysis.hh:667
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:1261
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.
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:1077
void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const
void scale(const CounterPtr(&cnts)[array_size], CounterAdapter factor)
Definition: Analysis.hh:876
Analysis(const std::string &name)
Constructor.
void scale(const std::vector< Histo1DPtr > &histos, CounterAdapter factor)
Definition: Analysis.hh:910
Log & getLog() const
Get a Log object based on the name() property of the calling analysis object.
T getOption(std::string optname, T def)
Get an option for this analysis instance converted to a specific type.
Definition: Analysis.hh:683
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
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:894
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:922
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:1170
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:729