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;
122 assert(_info &&
"No AnalysisInfo object :O");
133 virtual std::string
name()
const {
134 return ( (
info().
name().empty()) ? _defaultname :
info().
name() ) + _optstring;
161 virtual std::vector<std::string>
authors()
const {
204 virtual std::string
year()
const {
238 virtual std::vector<std::string>
todos()
const {
269 virtual const std::vector<std::string> &
keywords()
const {
287 assert(_info &&
"No AnalysisInfo object :O");
298 const ParticlePair&
beams()
const;
301 const PdgIdPair
beamIds()
const;
304 double sqrtS()
const;
308 return sqrtS() <= 0.0;
323 bool isCompatible(PdgId beam1, PdgId beam2,
double e1,
double e2)
const;
326 bool isCompatible(
const PdgIdPair& beams,
const std::pair<double,double>& energies)
const;
361 double sumW2()
const;
373 const std::string
histoPath(
const std::string& hname)
const;
376 const std::string
histoPath(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
379 const std::string
mkAxisCode(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const;
389 template <
typename T=YODA::Scatter2D>
392 MSG_TRACE(
"Using histo bin edges for " <<
name() <<
":" << hname);
393 if (!_refdata[hname]) {
394 MSG_ERROR(
"Can't find reference histogram " << hname);
395 throw Exception(
"Reference data " + hname +
" not found.");
397 return dynamic_cast<T&
>(*_refdata[hname]);
402 template <
typename T=YODA::Scatter2D>
403 const T&
refData(
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId)
const {
404 const string hname =
mkAxisCode(datasetId, xAxisId, yAxisId);
415 CounterPtr &
book(CounterPtr &,
const std::string&
name);
420 CounterPtr &
book(CounterPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
429 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
size_t nbins,
double lower,
double upper);
432 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
const std::vector<double>& binedges);
435 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
const std::initializer_list<double>& binedges);
438 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name,
const Scatter2D& refscatter);
441 Histo1DPtr &
book(Histo1DPtr &,
const std::string& name);
446 Histo1DPtr &
book(Histo1DPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
457 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
458 size_t nxbins,
double xlower,
double xupper,
459 size_t nybins,
double ylower,
double yupper);
463 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
464 const std::vector<double>& xbinedges,
465 const std::vector<double>& ybinedges);
469 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
470 const std::initializer_list<double>& xbinedges,
471 const std::initializer_list<double>& ybinedges);
474 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name,
475 const Scatter3D& refscatter);
478 Histo2DPtr &
book(Histo2DPtr &,
const std::string& name);
483 Histo2DPtr &
book(Histo2DPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
492 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
size_t nbins,
double lower,
double upper);
495 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
const std::vector<double>& binedges);
498 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
const std::initializer_list<double>& binedges);
501 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name,
const Scatter2D& refscatter);
504 Profile1DPtr &
book(Profile1DPtr &,
const std::string& name);
509 Profile1DPtr &
book(Profile1DPtr &,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId);
520 Profile2DPtr &
book(Profile2DPtr &,
const std::string& name,
521 size_t nxbins,
double xlower,
double xupper,
522 size_t nybins,
double ylower,
double yupper);
526 Profile2DPtr &
book(Profile2DPtr &,
const std::string& name,
527 const std::vector<double>& xbinedges,
528 const std::vector<double>& ybinedges);
532 Profile2DPtr &
book(Profile2DPtr &,
const std::string& name,
533 const std::initializer_list<double>& xbinedges,
534 const std::initializer_list<double>& ybinedges);
566 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
bool copy_pts =
false);
578 Scatter2DPtr &
book(Scatter2DPtr & s2d,
unsigned int datasetId,
unsigned int xAxisId,
unsigned int yAxisId,
bool copy_pts =
false);
583 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
size_t npts,
double lower,
double upper);
588 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
const std::vector<double>& binedges);
591 Scatter2DPtr &
book(Scatter2DPtr & s2d,
const string& hname,
const Scatter2D& refscatter);
608 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
bool copy_pts=
false);
620 Scatter3DPtr &
book(Scatter3DPtr & s3d,
unsigned int datasetId,
unsigned int xAxisId,
621 unsigned int yAxisId,
unsigned int zAxisId,
bool copy_pts=
false);
626 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
627 size_t xnpts,
double xlower,
double xupper,
628 size_t ynpts,
double ylower,
double yupper);
633 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
634 const std::vector<double>& xbinedges,
635 const std::vector<double>& ybinedges);
638 Scatter3DPtr &
book(Scatter3DPtr & s3d,
const std::string& hname,
const Scatter3D& refscatter);
649 const std::map<std::string,std::string> &
options() {
655 if ( _options.find(optname) != _options.end() )
656 return _options.find(optname)->second;
664 if (_options.find(optname) == _options.end())
return def;
665 std::stringstream ss;
666 ss << _options.find(optname)->second;
691 string calAnaName,
string calHistName,
692 const string projName,
bool increasing =
false);
704 vector<pair<float, float> > centralityBins,
705 vector<tuple<int, int, int> > ref) {
707 typedef typename ReferenceTraits<T>::RefT RefT;
708 typedef rivet_shared_ptr<Wrapper<T>> WrapT;
712 const int nCent = centralityBins.size();
713 for (
int iCent = 0; iCent < nCent; ++iCent) {
714 const string axisCode =
mkAxisCode(std::get<0>(ref[iCent]),
715 std::get<1>(ref[iCent]),
716 std::get<2>(ref[iCent]));
717 const RefT & refscatter = refData<RefT>(axisCode);
719 WrapT wtf(_weightNames(), T(refscatter,
histoPath(axisCode)));
722 CounterPtr cnt(_weightNames(), Counter(
histoPath(
"TMP/COUNTER/" + axisCode)));
725 pctl.
add(wtf, cnt, centralityBins[iCent]);
768 vector<string> _weightNames()
const;
771 YODA::AnalysisObjectPtr _getPreload(
string name)
const;
774 size_t _defaultWeightIndex()
const;
777 MultiweightAOPtr _getOtherAnalysisObject(
const std::string & ananame,
const std::string& name);
780 void _checkBookInit()
const;
786 bool inFinalize()
const;
791 class CounterAdapter {
793 CounterAdapter(
double x) : x_(x ) {}
795 CounterAdapter(
const YODA::Counter & c) : x_(c.val() ) {}
799 CounterAdapter(
const YODA::Scatter1D & s) : x_(s.points()[0].x()) {
800 assert( s.numPoints() == 1 ||
"Can only scale by a single value.");
807 operator double()
const {
return x_; }
817 double dbl(
double x) {
return x; }
818 double dbl(
const YODA::Counter & c) {
return c.val(); }
819 double dbl(
const YODA::Scatter1D & s) {
820 assert( s.numPoints() == 1 );
821 return s.points()[0].x();
829 void scale(CounterPtr cnt, CounterAdapter factor);
834 void scale(
const std::vector<CounterPtr>& cnts, CounterAdapter factor) {
835 for (
auto& c : cnts)
scale(c, factor);
838 template <std::
size_t array_size>
839 void scale(
const CounterPtr (&cnts)[array_size], CounterAdapter factor) {
841 for (
auto& c : cnts)
scale(c, factor);
846 void normalize(Histo1DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
851 void normalize(
const std::vector<Histo1DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
852 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
855 template <std::
size_t array_size>
856 void normalize(
const Histo1DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
857 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
861 void scale(Histo1DPtr histo, CounterAdapter factor);
866 void scale(
const std::vector<Histo1DPtr>& histos, CounterAdapter factor) {
867 for (
auto& h : histos)
scale(h, factor);
870 template <std::
size_t array_size>
871 void scale(
const Histo1DPtr (&histos)[array_size], CounterAdapter factor) {
872 for (
auto& h : histos)
scale(h, factor);
877 void normalize(Histo2DPtr histo, CounterAdapter norm=1.0,
bool includeoverflows=
true);
882 void normalize(
const std::vector<Histo2DPtr>& histos, CounterAdapter norm=1.0,
bool includeoverflows=
true) {
883 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
886 template <std::
size_t array_size>
887 void normalize(
const Histo2DPtr (&histos)[array_size], CounterAdapter norm=1.0,
bool includeoverflows=
true) {
888 for (
auto& h : histos)
normalize(h, norm, includeoverflows);
892 void scale(Histo2DPtr histo, CounterAdapter factor);
897 void scale(
const std::vector<Histo2DPtr>& histos, CounterAdapter factor) {
898 for (
auto& h : histos)
scale(h, factor);
901 template <std::
size_t array_size>
902 void scale(
const Histo2DPtr (&histos)[array_size], CounterAdapter factor) {
903 for (
auto& h : histos)
scale(h, factor);
910 void divide(CounterPtr c1, CounterPtr c2, Scatter1DPtr s)
const;
915 void divide(
const YODA::Counter& c1,
const YODA::Counter& c2, Scatter1DPtr s)
const;
921 void divide(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
926 void divide(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
932 void divide(Profile1DPtr p1, Profile1DPtr p2, Scatter2DPtr s)
const;
937 void divide(
const YODA::Profile1D& p1,
const YODA::Profile1D& p2, Scatter2DPtr s)
const;
943 void divide(Histo2DPtr h1, Histo2DPtr h2, Scatter3DPtr s)
const;
948 void divide(
const YODA::Histo2D& h1,
const YODA::Histo2D& h2, Scatter3DPtr s)
const;
954 void divide(Profile2DPtr p1, Profile2DPtr p2, Scatter3DPtr s)
const;
959 void divide(
const YODA::Profile2D& p1,
const YODA::Profile2D& p2, Scatter3DPtr s)
const;
965 void efficiency(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
970 void efficiency(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
976 void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s)
const;
981 void asymm(
const YODA::Histo1D& h1,
const YODA::Histo1D& h2, Scatter2DPtr s)
const;
987 void integrate(Histo1DPtr h, Scatter2DPtr s)
const;
992 void integrate(
const Histo1D& h, Scatter2DPtr s)
const;
1001 return _analysisobjects;
1011 template <
typename YODAT>
1013 return dynamic_pointer_cast<YODAT>(_getPreload(path));
1017 template <
typename YODAT>
1018 rivet_shared_ptr< Wrapper<YODAT> >
registerAO(
const YODAT & yao) {
1019 typedef Wrapper<YODAT> WrapperT;
1020 typedef shared_ptr<YODAT> YODAPtrT;
1021 typedef rivet_shared_ptr<WrapperT> RAOT;
1023 if ( !inInit() && !inFinalize() ) {
1024 MSG_ERROR(
"Can't book objects outside of init()");
1025 throw UserError(
name() +
": Can't book objects outside of init() or finalize().");
1031 if ( yao.path() == waold.get()->basePath() ) {
1033 MSG_WARNING(
"Found double-booking of " << yao.path() <<
" in " 1034 <<
name() <<
". Keeping previous booking");
1035 return RAOT(dynamic_pointer_cast<WrapperT>(waold.get()));
1040 shared_ptr<WrapperT> wao = make_shared<WrapperT>();
1041 wao->_basePath = yao.path();
1042 YODAPtrT yaop = make_shared<YODAT>(yao);
1044 for (
const string& weightname : _weightNames()) {
1047 string finalpath = yao.path();
1048 if ( weightname !=
"" ) finalpath +=
"[" + weightname +
"]";
1049 YODAPtrT preload = getPreload<YODAT>(finalpath);
1052 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1053 << finalpath <<
" for " <<
name());
1056 MSG_TRACE(
"Using preloaded " << finalpath <<
" in " <<
name());
1057 wao->_final.push_back(make_shared<YODAT>(*preload));
1061 wao->_final.push_back(make_shared<YODAT>(yao));
1062 wao->_final.back()->setPath(finalpath);
1066 string rawpath =
"/RAW" + finalpath;
1067 preload = getPreload<YODAT>(rawpath);
1070 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1071 << rawpath <<
" for " <<
name());
1074 MSG_TRACE(
"Using preloaded " << rawpath <<
" in " <<
name());
1075 wao->_persistent.push_back(make_shared<YODAT>(*preload));
1079 wao->_persistent.push_back(make_shared<YODAT>(yao));
1080 wao->_persistent.back()->setPath(rawpath);
1083 rivet_shared_ptr<WrapperT> ret(wao);
1085 ret.get()->unsetActiveWeight();
1086 if ( inFinalize() ) {
1089 ret.get()->pushToFinal();
1090 ret.get()->setActiveFinalWeightIdx(0);
1092 _analysisobjects.push_back(ret);
1099 template <
typename AO=MultiweightAOPtr>
1106 ao.get()->setActiveWeightIdx(_defaultWeightIndex());
1107 aonew.get()->setActiveWeightIdx(_defaultWeightIndex());
1108 if (ao->path() != aonew->path())
continue;
1112 AO aoold = AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1114 MSG_WARNING(
"Found incompatible pre-existing data object with same base path " 1115 << aonew->path() <<
" for " <<
name());
1116 throw LookupError(
"Found incompatible pre-existing data object with same base path during AO booking");
1120 for (
size_t weightIdx = 0; weightIdx < _weightNames().size(); ++weightIdx) {
1121 aoold.get()->setActiveWeightIdx(weightIdx);
1122 aonew.get()->setActiveWeightIdx(weightIdx);
1123 if (aoold->path() != aonew->path()) {
1124 MSG_WARNING(
"Found incompatible pre-existing data object with different weight-path " 1125 << aonew->path() <<
" for " <<
name());
1126 throw LookupError(
"Found incompatible pre-existing data object with same weight-path during AO booking");
1131 aoold.get()->unsetActiveWeight();
1132 MSG_TRACE(
"Bound pre-existing data object " << aoold->path() <<
" for " <<
name());
1137 MSG_TRACE(
"Registered " << aonew->annotation(
"Type") <<
" " << aonew->path() <<
" for " <<
name());
1138 aonew.get()->unsetActiveWeight();
1140 _analysisobjects.push_back(aonew);
1156 template <
typename AO=MultiweightAOPtr>
1159 ao.get()->setActiveWeightIdx(_defaultWeightIndex());
1162 return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1190 template <
typename AO=MultiweightAOPtr>
1192 const std::string& aoname) {
1193 MultiweightAOPtr ao = _getOtherAnalysisObject(ananame, aoname);
1195 return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1309 string _defaultname;
1312 unique_ptr<AnalysisInfo> _info;
1316 vector<MultiweightAOPtr> _analysisobjects;
1320 double _crossSection;
1321 bool _gotCrossSection;
1329 mutable std::map<std::string, YODA::AnalysisObjectPtr> _refdata;
1332 map<string, string> _options;
1343 void _cacheRefData()
const;
1359 #include "Rivet/AnalysisBuilder.hh" 1363 #define DECLARE_RIVET_PLUGIN(clsname) ::Rivet::AnalysisBuilder<clsname> plugin_ ## clsname 1368 #define DECLARE_ALIASED_RIVET_PLUGIN(clsname, alias) DECLARE_RIVET_PLUGIN(clsname)( #alias ) 1372 #define DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname) clsname() : Analysis(# clsname) {} 1376 #define DEFAULT_RIVET_ANALYSIS_CTOR(clsname) DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname) double sumOfWeights() const
Alias.
Definition: Analysis.hh:356
Definition: MC_Cent_pPb.hh:10
virtual std::string inspireId() const
Get the Inspire ID code for this analysis.
Definition: Analysis.hh:148
const std::string & summary() const
Get a short description of the analysis. Short (one sentence) description used as an index entry...
Definition: AnalysisInfo.hh:90
const vector< MultiweightAOPtr > & analysisObjects() const
List of registered analysis data objects.
Definition: Analysis.hh:1000
virtual std::string summary() const
Get a short description of the analysis.
Definition: Analysis.hh:170
rivet_shared_ptr< Wrapper< YODAT > > registerAO(const YODAT &yao)
Register a new data object, optionally read in preloaded data.
Definition: Analysis.hh:1018
void scale(const std::vector< CounterPtr > &cnts, CounterAdapter factor)
Definition: Analysis.hh:834
Used together with the percentile-based analysis objects Percentile and PercentileXaxis.
Definition: CentralityProjection.hh:26
void scale(const CounterPtr(&cnts)[array_size], CounterAdapter factor)
Definition: Analysis.hh:839
Holder of analysis metadata.
Definition: AnalysisInfo.hh:12
Base class for projections returning a single floating point value.
Definition: SingleValueProjection.hh:17
const std::string & status() const
Whether this analysis is trusted (in any way!)
Definition: AnalysisInfo.hh:185
virtual const std::vector< std::pair< double, double > > & requiredEnergies() const
Sets of valid beam energy pairs, in GeV.
Definition: Analysis.hh:264
const AO getAnalysisObject(const std::string &aoname) const
Get a Rivet data object from the histogram system.
Definition: Analysis.hh:1157
virtual std::string year() const
When the original experimental analysis was published.
Definition: Analysis.hh:204
Error specialisation for where the problem is between the chair and the computer. ...
Definition: Exceptions.hh:55
bool isCompatible(const ParticlePair &beams) const
Check if analysis is compatible with the provided beam particle IDs and energies. ...
virtual std::string spiresId() const
Get the SPIRES ID code for this analysis (~deprecated).
Definition: Analysis.hh:153
void scale(const std::vector< Histo1DPtr > &histos, CounterAdapter factor)
Definition: Analysis.hh:866
void setRefDataName(const std::string &name)
Set the reference data name of the analysis (if different from plugin name).
Definition: AnalysisInfo.hh:61
const std::string & bibTeX() const
BibTeX citation entry for this article.
Definition: AnalysisInfo.hh:178
virtual std::vector< std::string > todos() const
Any work to be done on this analysis.
Definition: Analysis.hh:238
virtual void finalize()
Definition: Analysis.hh:108
const double luminosityfb() const
The integrated data luminosity of the data set in 1/fb.
Definition: AnalysisInfo.hh:154
AO addAnalysisObject(const AO &aonew)
Register a data object in the histogram system.
Definition: Analysis.hh:1100
bool bookingCompatible(TPtr a, TPtr b)
Definition: RivetYODA.hh:595
virtual std::string experiment() const
Experiment which performed and published this analysis.
Definition: Analysis.hh:194
void add(TPtr ao, CounterPtr cnt, pair< float, float > cent={0.0, 100.0})
Add a new percentile bin.
Definition: Percentile.hh:122
virtual void analyze(const Event &event)=0
const std::string & bibKey() const
BibTeX citation key for this article.
Definition: AnalysisInfo.hh:171
AnalysisInfo & info()
Get the actual AnalysisInfo object in which all this metadata is stored (non-const).
Definition: Analysis.hh:286
virtual std::string status() const
Whether this analysis is trusted (in any way!)
Definition: Analysis.hh:233
virtual void init()
Definition: Analysis.hh:95
The Percentile class for centrality binning.
Definition: Percentile.hh:203
virtual std::vector< std::string > validation() const
make-style commands for validating this analysis.
Definition: Analysis.hh:243
const std::vector< std::string > & todos() const
Any work to be done on this analysis.
Definition: AnalysisInfo.hh:192
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
virtual std::vector< std::string > references() const
Journal, and preprint references.
Definition: Analysis.hh:218
const std::vector< std::string > & validation() const
List a series of command lines to be used for valdation.
Definition: AnalysisInfo.hh:214
const std::vector< std::string > & authors() const
Names & emails of paper/analysis authors. Names and email of authors in 'NAME <EMAIL>' format...
Definition: AnalysisInfo.hh:80
const std::vector< PdgIdPair > & beams() const
Beam particle types.
Definition: AnalysisInfo.hh:118
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:703
const ParticlePair & beams() const
Incoming beams for this run.
const std::string & experiment() const
Experiment which performed and published this analysis.
Definition: AnalysisInfo.hh:132
std::string getOption(std::string optname)
Get an option for this analysis instance as a string.
Definition: Analysis.hh:654
const std::string & spiresId() const
Get the SPIRES ID code for this analysis.
Definition: AnalysisInfo.hh:71
const std::vector< std::string > & keywords() const
Analysis Keywords for grouping etc.
Definition: AnalysisInfo.hh:168
This is the base class of all analysis classes in Rivet.
Definition: Analysis.hh:64
void efficiency(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const
Representation of a HepMC event, and enabler of Projection caching.
Definition: Event.hh:22
const T & refData(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const
Definition: Analysis.hh:403
double sumW() const
Get the sum of event weights seen (via the analysis handler).
virtual void setRefDataName(const std::string &ref_data="")
Set name of reference data file, which could be different from plugin name.
Definition: Analysis.hh:143
Common base class for Projection and Analysis, used for internal polymorphism.
Definition: ProjectionApplier.hh:21
virtual double luminosityfb() const
The integrated luminosity in inverse femtobarn.
Definition: Analysis.hh:209
virtual std::vector< std::string > authors() const
Names & emails of paper/analysis authors.
Definition: Analysis.hh:161
AnalysisHandler & handler() const
Access the controlling AnalysisHandler object.
Definition: Analysis.hh:331
virtual std::string name() const
Get the name of the analysis.
Definition: Analysis.hh:133
void scale(const Histo2DPtr(&histos)[array_size], CounterAdapter factor)
Definition: Analysis.hh:902
bool merging() const
Check if we are running rivet-merge.
Definition: Analysis.hh:307
Error relating to looking up analysis objects in the register.
Definition: Exceptions.hh:61
void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const
virtual const std::vector< std::string > & keywords() const
Get vector of analysis keywords.
Definition: Analysis.hh:269
bool reentrant() const
Return true if finalize() can be run multiple times for this analysis.
Definition: AnalysisInfo.hh:223
AO getAnalysisObject(const std::string &ananame, const std::string &aoname)
Definition: Analysis.hh:1191
Error Exception
Rivet::Exception is a synonym for Rivet::Error.
Definition: Exceptions.hh:18
const std::string histoPath(const std::string &hname) const
Get the canonical histogram path for the named histogram in this analysis.
size_t numEvents() const
Get the number of events seen (via the analysis handler).
void removeAnalysisObject(const std::string &path)
Unregister a data object from the histogram system (by name)
double sqrtS() const
Centre of mass energy for this run.
The key class for coordination of Analysis objects and the event loop.
Definition: AnalysisHandler.hh:23
virtual double luminosity() const
The integrated luminosity in inverse picobarn.
Definition: Analysis.hh:213
void scale(const Histo1DPtr(&histos)[array_size], CounterAdapter factor)
Definition: Analysis.hh:871
virtual std::string bibKey() const
BibTeX citation key for this article.
Definition: Analysis.hh:223
const std::map< std::string, std::string > & options()
Return the map of all options given to this analysis.
Definition: Analysis.hh:649
void normalize(const std::vector< Histo1DPtr > &histos, CounterAdapter norm=1.0, bool includeoverflows=true)
Definition: Analysis.hh:851
virtual Analysis & setRequiredEnergies(const std::vector< std::pair< double, double > > &requiredEnergies)
Declare the list of valid beam energy pairs, in GeV.
Definition: Analysis.hh:274
void normalize(const Histo2DPtr(&histos)[array_size], CounterAdapter norm=1.0, bool includeoverflows=true)
Definition: Analysis.hh:887
void scale(const std::vector< Histo2DPtr > &histos, CounterAdapter factor)
Definition: Analysis.hh:897
double sumW2() const
Get the sum of squared event weights seen (via the analysis handler).
virtual Analysis & setRequiredBeams(const std::vector< PdgIdPair > &requiredBeams)
Declare the allowed pairs of incoming beams required by this analysis.
Definition: Analysis.hh:257
const CentralityProjection & declareCentrality(const SingleValueProjection &proj, string calAnaName, string calHistName, const string projName, bool increasing=false)
Book a CentralityProjection.
const std::vector< std::string > & references() const
Journal and preprint references.
Definition: AnalysisInfo.hh:162
CounterPtr & book(CounterPtr &, const std::string &name)
Book a counter.
const T & refData(const string &hname) const
Definition: Analysis.hh:390
std::string getRefDataName() const
Get the reference data name of the analysis (if different from plugin name).
Definition: AnalysisInfo.hh:55
virtual std::string runInfo() const
Information about the events needed as input for this analysis.
Definition: Analysis.hh:189
virtual std::string getRefDataName() const
Get name of reference data file, which could be different from plugin name.
Definition: Analysis.hh:138
virtual std::string description() const
Get a full description of the analysis.
Definition: Analysis.hh:180
void integrate(Histo1DPtr h, Scatter2DPtr s) const
Analysis(const std::string &name)
Constructor.
const std::string & year() const
When the original experimental analysis was published. When the refereed paper on which this is based...
Definition: AnalysisInfo.hh:148
const std::string histoDir() const
Get the canonical histogram "directory" path for this analysis.
virtual std::string bibTeX() const
BibTeX citation entry for this article.
Definition: Analysis.hh:228
Log & getLog() const
Get a Log object based on the name() property of the calling analysis object.
void normalize(const Histo1DPtr(&histos)[array_size], CounterAdapter norm=1.0, bool includeoverflows=true)
Definition: Analysis.hh:856
const std::string & description() const
Get a full description of the analysis. Full textual description of this analysis, what it is useful for, what experimental techniques are applied, etc. Should be treated as a chunk of restructuredText (http://docutils.sourceforge.net/rst.html), with equations to be rendered as LaTeX with amsmath operators.
Definition: AnalysisInfo.hh:101
T getOption(std::string optname, T def)
Definition: Analysis.hh:663
virtual std::string collider() const
Collider on which the experiment ran.
Definition: Analysis.hh:199
void scale(CounterPtr cnt, CounterAdapter factor)
Multiplicatively scale the given counter, cnt, by factor factor.
double crossSectionPerEvent() const
virtual ~Analysis()
The destructor.
Definition: Analysis.hh:82
const double luminosity() const
The integrated data luminosity of the data set in 1/pb.
Definition: AnalysisInfo.hh:156
const std::string & runInfo() const
Information about the events needed as input for this analysis. Event types, energies, kinematic cuts, particles to be considered stable, etc. etc. Should be treated as a restructuredText bullet list (http://docutils.sourceforge.net/rst.html)
Definition: AnalysisInfo.hh:111
void setBeams(const std::vector< PdgIdPair > &beams)
Set beam particle types.
Definition: AnalysisInfo.hh:121
const std::string & inspireId() const
Get the Inspire (SPIRES replacement) ID code for this analysis.
Definition: AnalysisInfo.hh:64
void normalize(Histo1DPtr histo, CounterAdapter norm=1.0, bool includeoverflows=true)
Normalize the given histogram, histo, to area = norm.
const std::string & collider() const
Collider on which the experiment ran.
Definition: AnalysisInfo.hh:139
void divide(CounterPtr c1, CounterPtr c2, Scatter1DPtr s) const
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)
virtual bool reentrant() const
Does this analysis have a reentrant finalize()?
Definition: Analysis.hh:248
void normalize(const std::vector< Histo2DPtr > &histos, CounterAdapter norm=1.0, bool includeoverflows=true)
Definition: Analysis.hh:882
shared_ptr< YODAT > getPreload(string path) const
Get a preloaded YODA object.
Definition: Analysis.hh:1012
virtual const std::vector< PdgIdPair > & requiredBeams() const
Return the allowed pairs of incoming beams required by this analysis.
Definition: Analysis.hh:253
const PdgIdPair beamIds() const
Incoming beam IDs for this run.
const AnalysisInfo & info() const
Get the actual AnalysisInfo object in which all this metadata is stored.
Definition: Analysis.hh:121
void setEnergies(const std::vector< std::pair< double, double > > &energies)
Set the valid beam energies.
Definition: AnalysisInfo.hh:128
const std::vector< std::pair< double, double > > & energies() const
Sets of valid beam energies.
Definition: AnalysisInfo.hh:125