Rivet  3.1.0
Analysis.hh
1 // -*- C++ -*-
2 #ifndef RIVET_Analysis_HH
3 #define RIVET_Analysis_HH
4 
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"
20 #include <tuple>
21 
22 
25 #define vetoEvent \
26  do { MSG_DEBUG("Vetoing event on line " << __LINE__ << " of " << __FILE__); return; } while(0)
27 
28 
29 namespace Rivet {
30 
31 
32  // Convenience for analysis writers
33  using std::cout;
34  using std::cerr;
35  using std::endl;
36  using std::tuple;
37  using std::stringstream;
38  using std::swap;
39  using std::numeric_limits;
40 
41 
42  // Forward declaration
43  class AnalysisHandler;
44 
45 
64  class Analysis : public ProjectionApplier {
65 
67  friend class AnalysisHandler;
68 
69 
70  public:
71 
73 
74 
75  // /// The default constructor.
76  // Analysis();
77 
79  Analysis(const std::string& name);
80 
82  virtual ~Analysis() {}
83 
85 
86 
87  public:
88 
90 
91 
95  virtual void init() { }
96 
101  virtual void analyze(const Event& event) = 0;
102 
108  virtual void finalize() { }
109 
111 
112 
113  public:
114 
118 
119 
121  const AnalysisInfo& info() const {
122  assert(_info && "No AnalysisInfo object :O");
123  return *_info;
124  }
125 
133  virtual std::string name() const {
134  return ( (info().name().empty()) ? _defaultname : info().name() ) + _optstring;
135  }
136 
138  virtual std::string getRefDataName() const {
139  return (info().getRefDataName().empty()) ? _defaultname : info().getRefDataName();
140  }
141 
143  virtual void setRefDataName(const std::string& ref_data="") {
144  info().setRefDataName(!ref_data.empty() ? ref_data : name());
145  }
146 
148  virtual std::string inspireId() const {
149  return info().inspireId();
150  }
151 
153  virtual std::string spiresId() const {
154  return info().spiresId();
155  }
156 
161  virtual std::vector<std::string> authors() const {
162  return info().authors();
163  }
164 
170  virtual std::string summary() const {
171  return info().summary();
172  }
173 
180  virtual std::string description() const {
181  return info().description();
182  }
183 
189  virtual std::string runInfo() const {
190  return info().runInfo();
191  }
192 
194  virtual std::string experiment() const {
195  return info().experiment();
196  }
197 
199  virtual std::string collider() const {
200  return info().collider();
201  }
202 
204  virtual std::string year() const {
205  return info().year();
206  }
207 
209  virtual double luminosityfb() const {
210  return info().luminosityfb();
211  }
213  virtual double luminosity() const {
214  return info().luminosity();
215  }
216 
218  virtual std::vector<std::string> references() const {
219  return info().references();
220  }
221 
223  virtual std::string bibKey() const {
224  return info().bibKey();
225  }
226 
228  virtual std::string bibTeX() const {
229  return info().bibTeX();
230  }
231 
233  virtual std::string status() const {
234  return (info().status().empty()) ? "UNVALIDATED" : info().status();
235  }
236 
238  virtual std::vector<std::string> todos() const {
239  return info().todos();
240  }
241 
243  virtual std::vector<std::string> validation() const {
244  return info().validation();
245  }
246 
248  virtual bool reentrant() const {
249  return info().reentrant();
250  }
251 
253  virtual const std::vector<PdgIdPair>& requiredBeams() const {
254  return info().beams();
255  }
257  virtual Analysis& setRequiredBeams(const std::vector<PdgIdPair>& requiredBeams) {
258  info().setBeams(requiredBeams);
259  return *this;
260  }
261 
262 
264  virtual const std::vector<std::pair<double, double> >& requiredEnergies() const {
265  return info().energies();
266  }
267 
269  virtual const std::vector<std::string> & keywords() const {
270  return info().keywords();
271  }
272 
274  virtual Analysis& setRequiredEnergies(const std::vector<std::pair<double, double> >& requiredEnergies) {
276  return *this;
277  }
278 
280 
281 
283 
284 
287  assert(_info && "No AnalysisInfo object :O");
288  return *_info;
289  }
290 
292 
293 
295 
296 
298  const ParticlePair& beams() const;
299 
301  const PdgIdPair beamIds() const;
302 
304  double sqrtS() const;
305 
307  bool merging() const {
308  return sqrtS() <= 0.0;
309  }
310 
312 
313 
317 
318 
320  bool isCompatible(const ParticlePair& beams) const;
321 
323  bool isCompatible(PdgId beam1, PdgId beam2, double e1, double e2) const;
324 
326  bool isCompatible(const PdgIdPair& beams, const std::pair<double,double>& energies) const;
327 
329 
331  AnalysisHandler& handler() const { return *_analysishandler; }
332 
333 
334  protected:
335 
337  Log& getLog() const;
338 
340  double crossSection() const;
341 
344  double crossSectionPerEvent() const;
345 
349  size_t numEvents() const;
350 
354  double sumW() const;
356  double sumOfWeights() const { return sumW(); }
357 
361  double sumW2() const;
362 
363 
364  protected:
365 
367 
368 
370  const std::string histoDir() const;
371 
373  const std::string histoPath(const std::string& hname) const;
374 
376  const std::string histoPath(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const;
377 
379  const std::string mkAxisCode(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const;
380 
382 
383 
385 
386 
389  template <typename T=YODA::Scatter2D>
390  const T& refData(const string& hname) const {
391  _cacheRefData();
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.");
396  }
397  return dynamic_cast<T&>(*_refdata[hname]);
398  }
399 
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);
405  return refData(hname);
406  }
407 
409 
410 
412 
413 
415  CounterPtr & book(CounterPtr &, const std::string& name);
416 
420  CounterPtr & book(CounterPtr &, unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId);
421 
423 
424 
426 
427 
429  Histo1DPtr & book(Histo1DPtr &,const std::string& name, size_t nbins, double lower, double upper);
430 
432  Histo1DPtr & book(Histo1DPtr &,const std::string& name, const std::vector<double>& binedges);
433 
435  Histo1DPtr & book(Histo1DPtr &,const std::string& name, const std::initializer_list<double>& binedges);
436 
438  Histo1DPtr & book(Histo1DPtr &,const std::string& name, const Scatter2D& refscatter);
439 
441  Histo1DPtr & book(Histo1DPtr &,const std::string& name);
442 
446  Histo1DPtr & book(Histo1DPtr &,unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId);
447 
449 
450 
452 
453 
457  Histo2DPtr & book(Histo2DPtr &,const std::string& name,
458  size_t nxbins, double xlower, double xupper,
459  size_t nybins, double ylower, double yupper);
460 
463  Histo2DPtr & book(Histo2DPtr &,const std::string& name,
464  const std::vector<double>& xbinedges,
465  const std::vector<double>& ybinedges);
466 
469  Histo2DPtr & book(Histo2DPtr &,const std::string& name,
470  const std::initializer_list<double>& xbinedges,
471  const std::initializer_list<double>& ybinedges);
472 
474  Histo2DPtr & book(Histo2DPtr &,const std::string& name,
475  const Scatter3D& refscatter);
476 
478  Histo2DPtr & book(Histo2DPtr &,const std::string& name);
479 
483  Histo2DPtr & book(Histo2DPtr &,unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId);
484 
486 
487 
489 
490 
492  Profile1DPtr & book(Profile1DPtr &, const std::string& name, size_t nbins, double lower, double upper);
493 
495  Profile1DPtr & book(Profile1DPtr &, const std::string& name, const std::vector<double>& binedges);
496 
498  Profile1DPtr & book(Profile1DPtr &, const std::string& name, const std::initializer_list<double>& binedges);
499 
501  Profile1DPtr & book(Profile1DPtr &, const std::string& name, const Scatter2D& refscatter);
502 
504  Profile1DPtr & book(Profile1DPtr &, const std::string& name);
505 
509  Profile1DPtr & book(Profile1DPtr &, unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId);
510 
512 
513 
515 
516 
520  Profile2DPtr & book(Profile2DPtr &, const std::string& name,
521  size_t nxbins, double xlower, double xupper,
522  size_t nybins, double ylower, double yupper);
523 
526  Profile2DPtr & book(Profile2DPtr &, const std::string& name,
527  const std::vector<double>& xbinedges,
528  const std::vector<double>& ybinedges);
529 
532  Profile2DPtr & book(Profile2DPtr &, const std::string& name,
533  const std::initializer_list<double>& xbinedges,
534  const std::initializer_list<double>& ybinedges);
535 
537 
538  // /// Book a 2D profile histogram with binning from a reference scatter.
539  // Profile2DPtr & book(const Profile2DPtr &, const std::string& name,
540  // const Scatter3D& refscatter);
541 
542  // /// Book a 2D profile histogram, using the binnings in the reference data histogram.
543  // Profile2DPtr & book(const Profile2DPtr &, const std::string& name);
544 
545  // /// Book a 2D profile histogram, using the binnings in the reference data histogram.
546  // ///
547  // /// The paper, dataset and x/y-axis IDs will be used to build the histo name in the HepData standard way.
548  // Profile2DPtr & book(const Profile2DPtr &, unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId);
549 
551 
552 
554 
555 
566  Scatter2DPtr & book(Scatter2DPtr & s2d, const string& hname, bool copy_pts = false);
567 
578  Scatter2DPtr & book(Scatter2DPtr & s2d, unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId, bool copy_pts = false);
579 
583  Scatter2DPtr & book(Scatter2DPtr & s2d, const string& hname, size_t npts, double lower, double upper);
584 
588  Scatter2DPtr & book(Scatter2DPtr & s2d, const string& hname, const std::vector<double>& binedges);
589 
591  Scatter2DPtr & book(Scatter2DPtr & s2d, const string& hname, const Scatter2D& refscatter);
592 
594 
596 
597 
608  Scatter3DPtr & book(Scatter3DPtr & s3d, const std::string& hname, bool copy_pts=false);
609 
620  Scatter3DPtr & book(Scatter3DPtr & s3d, unsigned int datasetId, unsigned int xAxisId,
621  unsigned int yAxisId, unsigned int zAxisId, bool copy_pts=false);
622 
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);
629 
633  Scatter3DPtr & book(Scatter3DPtr & s3d, const std::string& hname,
634  const std::vector<double>& xbinedges,
635  const std::vector<double>& ybinedges);
636 
638  Scatter3DPtr & book(Scatter3DPtr & s3d, const std::string& hname, const Scatter3D& refscatter);
639 
641 
642 
643  public:
644 
646 
647 
649  const std::map<std::string,std::string> & options() {
650  return _options;
651  }
652 
654  std::string getOption(std::string optname) {
655  if ( _options.find(optname) != _options.end() )
656  return _options.find(optname)->second;
657  return "";
658  }
659 
662  template<typename T>
663  T getOption(std::string optname, T def) {
664  if (_options.find(optname) == _options.end()) return def;
665  std::stringstream ss;
666  ss << _options.find(optname)->second;
667  T ret;
668  ss >> ret;
669  return ret;
670  }
671 
673  const CentralityProjection&
691  string calAnaName, string calHistName,
692  const string projName, bool increasing = false);
693 
702  template <class T>
703  Percentile<T> bookPercentile(string projName,
704  vector<pair<float, float> > centralityBins,
705  vector<tuple<int, int, int> > ref) {
706 
707  typedef typename ReferenceTraits<T>::RefT RefT;
708  typedef rivet_shared_ptr<Wrapper<T>> WrapT;
709 
710  Percentile<T> pctl(this, projName);
711 
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);
718 
719  WrapT wtf(_weightNames(), T(refscatter, histoPath(axisCode)));
720  wtf = addAnalysisObject(wtf);
721 
722  CounterPtr cnt(_weightNames(), Counter(histoPath("TMP/COUNTER/" + axisCode)));
723  cnt = addAnalysisObject(cnt);
724 
725  pctl.add(wtf, cnt, centralityBins[iCent]);
726  }
727  return pctl;
728  }
729 
730  // /// @brief Book Percentile wrappers around AnalysisObjects.
731  // ///
732  // /// Based on a previously registered CentralityProjection named @a
733  // /// projName book one (or several) AnalysisObject(s) named
734  // /// according to @a ref where the x-axis will be filled according
735  // /// to the percentile output(s) of the @projName.
736  // ///
737  // /// @todo Convert to just be called book() cf. others
738  // template <class T>
739  // PercentileXaxis<T> bookPercentileXaxis(string projName,
740  // tuple<int, int, int> ref) {
741 
742  // typedef typename ReferenceTraits<T>::RefT RefT;
743  // typedef rivet_shared_ptr<Wrapper<T>> WrapT;
744 
745  // PercentileXaxis<T> pctl(this, projName);
746 
747  // const string axisCode = mkAxisCode(std::get<0>(ref),
748  // std::get<1>(ref),
749  // std::get<2>(ref));
750  // const RefT & refscatter = refData<RefT>(axisCode);
751 
752  // WrapT wtf(_weightNames(), T(refscatter, histoPath(axisCode)));
753  // wtf = addAnalysisObject(wtf);
754 
755  // CounterPtr cnt(_weightNames(), Counter());
756  // cnt = addAnalysisObject(cnt);
757 
758  // pctl.add(wtf, cnt);
759  // return pctl;
760  // }
761 
762 
763  private:
764 
765  // Functions that have to be defined in the .cc file to avoid circular #includes
766 
768  vector<string> _weightNames() const;
769 
771  YODA::AnalysisObjectPtr _getPreload(string name) const;
772 
774  size_t _defaultWeightIndex() const;
775 
777  MultiweightAOPtr _getOtherAnalysisObject(const std::string & ananame, const std::string& name);
778 
780  void _checkBookInit() const;
781 
783  bool inInit() const;
784 
786  bool inFinalize() const;
787 
788  private:
789 
791  class CounterAdapter {
792  public:
793  CounterAdapter(double x) : x_(x ) {}
794 
795  CounterAdapter(const YODA::Counter & c) : x_(c.val() ) {}
796 
797  // CounterAdapter(CounterPtr cp) : x_(cp->val() ) {}
798 
799  CounterAdapter(const YODA::Scatter1D & s) : x_(s.points()[0].x()) {
800  assert( s.numPoints() == 1 || "Can only scale by a single value.");
801  }
802 
803  // CounterAdapter(Scatter1DPtr sp) : x_(sp->points()[0].x()) {
804  // assert( sp->numPoints() == 1 || "Can only scale by a single value.");
805  // }
806 
807  operator double() const { return x_; }
808 
809  private:
810  double x_;
811 
812  };
813 
814 
815  public:
816 
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();
822  }
823 
826 
827 
829  void scale(CounterPtr cnt, CounterAdapter factor);
830 
834  void scale(const std::vector<CounterPtr>& cnts, CounterAdapter factor) {
835  for (auto& c : cnts) scale(c, factor);
836  }
838  template <std::size_t array_size>
839  void scale(const CounterPtr (&cnts)[array_size], CounterAdapter factor) {
840  // for (size_t i = 0; i < std::extent<decltype(cnts)>::value; ++i) scale(cnts[i], factor);
841  for (auto& c : cnts) scale(c, factor);
842  }
843 
844 
846  void normalize(Histo1DPtr histo, CounterAdapter norm=1.0, bool includeoverflows=true);
847 
851  void normalize(const std::vector<Histo1DPtr>& histos, CounterAdapter norm=1.0, bool includeoverflows=true) {
852  for (auto& h : histos) normalize(h, norm, includeoverflows);
853  }
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);
858  }
859 
861  void scale(Histo1DPtr histo, CounterAdapter factor);
862 
866  void scale(const std::vector<Histo1DPtr>& histos, CounterAdapter factor) {
867  for (auto& h : histos) scale(h, factor);
868  }
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);
873  }
874 
875 
877  void normalize(Histo2DPtr histo, CounterAdapter norm=1.0, bool includeoverflows=true);
878 
882  void normalize(const std::vector<Histo2DPtr>& histos, CounterAdapter norm=1.0, bool includeoverflows=true) {
883  for (auto& h : histos) normalize(h, norm, includeoverflows);
884  }
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);
889  }
890 
892  void scale(Histo2DPtr histo, CounterAdapter factor);
893 
897  void scale(const std::vector<Histo2DPtr>& histos, CounterAdapter factor) {
898  for (auto& h : histos) scale(h, factor);
899  }
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);
904  }
905 
906 
910  void divide(CounterPtr c1, CounterPtr c2, Scatter1DPtr s) const;
911 
915  void divide(const YODA::Counter& c1, const YODA::Counter& c2, Scatter1DPtr s) const;
916 
917 
921  void divide(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const;
922 
926  void divide(const YODA::Histo1D& h1, const YODA::Histo1D& h2, Scatter2DPtr s) const;
927 
928 
932  void divide(Profile1DPtr p1, Profile1DPtr p2, Scatter2DPtr s) const;
933 
937  void divide(const YODA::Profile1D& p1, const YODA::Profile1D& p2, Scatter2DPtr s) const;
938 
939 
943  void divide(Histo2DPtr h1, Histo2DPtr h2, Scatter3DPtr s) const;
944 
948  void divide(const YODA::Histo2D& h1, const YODA::Histo2D& h2, Scatter3DPtr s) const;
949 
950 
954  void divide(Profile2DPtr p1, Profile2DPtr p2, Scatter3DPtr s) const;
955 
959  void divide(const YODA::Profile2D& p1, const YODA::Profile2D& p2, Scatter3DPtr s) const;
960 
961 
965  void efficiency(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const;
966 
970  void efficiency(const YODA::Histo1D& h1, const YODA::Histo1D& h2, Scatter2DPtr s) const;
971 
972 
976  void asymm(Histo1DPtr h1, Histo1DPtr h2, Scatter2DPtr s) const;
977 
981  void asymm(const YODA::Histo1D& h1, const YODA::Histo1D& h2, Scatter2DPtr s) const;
982 
983 
987  void integrate(Histo1DPtr h, Scatter2DPtr s) const;
988 
992  void integrate(const Histo1D& h, Scatter2DPtr s) const;
993 
995 
996 
997  public:
998 
1000  const vector<MultiweightAOPtr>& analysisObjects() const {
1001  return _analysisobjects;
1002  }
1003 
1004 
1005  protected:
1006 
1008 
1009 
1011  template <typename YODAT>
1012  shared_ptr<YODAT> getPreload(string path) const {
1013  return dynamic_pointer_cast<YODAT>(_getPreload(path));
1014  }
1015 
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;
1022 
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().");
1026  }
1027 
1028  // First check that we haven't booked this before. This is
1029  // allowed when booking in finalze.
1030  for (auto & waold : analysisObjects()) {
1031  if ( yao.path() == waold.get()->basePath() ) {
1032  if ( !inInit() )
1033  MSG_WARNING("Found double-booking of " << yao.path() << " in "
1034  << name() << ". Keeping previous booking");
1035  return RAOT(dynamic_pointer_cast<WrapperT>(waold.get()));
1036  }
1037  }
1038 
1039 
1040  shared_ptr<WrapperT> wao = make_shared<WrapperT>();
1041  wao->_basePath = yao.path();
1042  YODAPtrT yaop = make_shared<YODAT>(yao);
1043 
1044  for (const string& weightname : _weightNames()) {
1045  // Create two YODA objects for each weight. Copy from
1046  // preloaded YODAs if present. First the finalized yoda:
1047  string finalpath = yao.path();
1048  if ( weightname != "" ) finalpath += "[" + weightname + "]";
1049  YODAPtrT preload = getPreload<YODAT>(finalpath);
1050  if ( preload ) {
1051  if ( !bookingCompatible(preload, yaop) ) {
1052  MSG_WARNING("Found incompatible pre-existing data object with same base path "
1053  << finalpath << " for " << name());
1054  preload = nullptr;
1055  } else {
1056  MSG_TRACE("Using preloaded " << finalpath << " in " <<name());
1057  wao->_final.push_back(make_shared<YODAT>(*preload));
1058  }
1059  }
1060  if ( !preload ) {
1061  wao->_final.push_back(make_shared<YODAT>(yao));
1062  wao->_final.back()->setPath(finalpath);
1063  }
1064 
1065  // Then the raw filling yodas.
1066  string rawpath = "/RAW" + finalpath;
1067  preload = getPreload<YODAT>(rawpath);
1068  if ( preload ) {
1069  if ( !bookingCompatible(preload, yaop) ) {
1070  MSG_WARNING("Found incompatible pre-existing data object with same base path "
1071  << rawpath << " for " << name());
1072  preload = nullptr;
1073  } else {
1074  MSG_TRACE("Using preloaded " << rawpath << " in " <<name());
1075  wao->_persistent.push_back(make_shared<YODAT>(*preload));
1076  }
1077  }
1078  if ( !preload ) {
1079  wao->_persistent.push_back(make_shared<YODAT>(yao));
1080  wao->_persistent.back()->setPath(rawpath);
1081  }
1082  }
1083  rivet_shared_ptr<WrapperT> ret(wao);
1084 
1085  ret.get()->unsetActiveWeight();
1086  if ( inFinalize() ) {
1087  // If booked in finalize() we assume it is the first time
1088  // finalize is run.
1089  ret.get()->pushToFinal();
1090  ret.get()->setActiveFinalWeightIdx(0);
1091  }
1092  _analysisobjects.push_back(ret);
1093 
1094  return ret;
1095 
1096  }
1097 
1099  template <typename AO=MultiweightAOPtr>
1100  AO addAnalysisObject(const AO & aonew) {
1101  _checkBookInit();
1102 
1103  for (const MultiweightAOPtr& ao : analysisObjects()) {
1104 
1105  // Check AO base-name first
1106  ao.get()->setActiveWeightIdx(_defaultWeightIndex());
1107  aonew.get()->setActiveWeightIdx(_defaultWeightIndex());
1108  if (ao->path() != aonew->path()) continue;
1109 
1110  // If base-name matches, check compatibility
1111  // NB. This evil is because dynamic_ptr_cast can't work on rivet_shared_ptr directly
1112  AO aoold = AO(dynamic_pointer_cast<typename AO::value_type>(ao.get())); //< OMG
1113  if ( !aoold || !bookingCompatible(aonew, aoold) ) {
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");
1117  }
1118 
1119  // Finally, check all weight variations
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");
1127  }
1128  }
1129 
1130  // They're fully compatible: bind and return
1131  aoold.get()->unsetActiveWeight();
1132  MSG_TRACE("Bound pre-existing data object " << aoold->path() << " for " << name());
1133  return aoold;
1134  }
1135 
1136  // No equivalent found
1137  MSG_TRACE("Registered " << aonew->annotation("Type") << " " << aonew->path() << " for " << name());
1138  aonew.get()->unsetActiveWeight();
1139 
1140  _analysisobjects.push_back(aonew);
1141  return aonew;
1142  }
1143 
1145  void removeAnalysisObject(const std::string& path);
1146 
1148  void removeAnalysisObject(const MultiweightAOPtr & ao);
1149 
1150  // /// Get all data objects, for all analyses, from the AnalysisHandler
1151  // /// @todo Can we remove this? Why not call handler().getData()?
1152  // vector<YODA::AnalysisObjectPtr> getAllData(bool includeorphans) const;
1153 
1154 
1156  template <typename AO=MultiweightAOPtr>
1157  const AO getAnalysisObject(const std::string& aoname) const {
1158  for (const MultiweightAOPtr& ao : analysisObjects()) {
1159  ao.get()->setActiveWeightIdx(_defaultWeightIndex());
1160  if (ao->path() == histoPath(aoname)) {
1161  // return dynamic_pointer_cast<AO>(ao);
1162  return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1163  }
1164  }
1165  throw LookupError("Data object " + histoPath(aoname) + " not found");
1166  }
1167 
1168 
1169  // /// Get a data object from the histogram system
1170  // template <typename AO=YODA::AnalysisObject>
1171  // const std::shared_ptr<AO> getAnalysisObject(const std::string& name) const {
1172  // foreach (const AnalysisObjectPtr& ao, analysisObjects()) {
1173  // if (ao->path() == histoPath(name)) return dynamic_pointer_cast<AO>(ao);
1174  // }
1175  // throw LookupError("Data object " + histoPath(name) + " not found");
1176  // }
1177 
1178  // /// Get a data object from the histogram system (non-const)
1179  // template <typename AO=YODA::AnalysisObject>
1180  // std::shared_ptr<AO> getAnalysisObject(const std::string& name) {
1181  // foreach (const AnalysisObjectPtr& ao, analysisObjects()) {
1182  // if (ao->path() == histoPath(name)) return dynamic_pointer_cast<AO>(ao);
1183  // }
1184  // throw LookupError("Data object " + histoPath(name) + " not found");
1185  // }
1186 
1187 
1190  template <typename AO=MultiweightAOPtr>
1191  AO getAnalysisObject(const std::string& ananame,
1192  const std::string& aoname) {
1193  MultiweightAOPtr ao = _getOtherAnalysisObject(ananame, aoname);
1194  // return dynamic_pointer_cast<AO>(ao);
1195  return AO(dynamic_pointer_cast<typename AO::value_type>(ao.get()));
1196  }
1197 
1198 
1199  // /// Get a named Histo1D object from the histogram system
1200  // const Histo1DPtr getHisto1D(const std::string& name) const {
1201  // return getAnalysisObject<Histo1D>(name);
1202  // }
1203 
1204  // /// Get a named Histo1D object from the histogram system (non-const)
1205  // Histo1DPtr getHisto1D(const std::string& name) {
1206  // return getAnalysisObject<Histo1D>(name);
1207  // }
1208 
1209  // /// Get a Histo1D object from the histogram system by axis ID codes (non-const)
1210  // const Histo1DPtr getHisto1D(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const {
1211  // return getAnalysisObject<Histo1D>(makeAxisCode(datasetId, xAxisId, yAxisId));
1212  // }
1213 
1214  // /// Get a Histo1D object from the histogram system by axis ID codes (non-const)
1215  // Histo1DPtr getHisto1D(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) {
1216  // return getAnalysisObject<Histo1D>(makeAxisCode(datasetId, xAxisId, yAxisId));
1217  // }
1218 
1219 
1220  // /// Get a named Histo2D object from the histogram system
1221  // const Histo2DPtr getHisto2D(const std::string& name) const {
1222  // return getAnalysisObject<Histo2D>(name);
1223  // }
1224 
1225  // /// Get a named Histo2D object from the histogram system (non-const)
1226  // Histo2DPtr getHisto2D(const std::string& name) {
1227  // return getAnalysisObject<Histo2D>(name);
1228  // }
1229 
1230  // /// Get a Histo2D object from the histogram system by axis ID codes (non-const)
1231  // const Histo2DPtr getHisto2D(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const {
1232  // return getAnalysisObject<Histo2D>(makeAxisCode(datasetId, xAxisId, yAxisId));
1233  // }
1234 
1235  // /// Get a Histo2D object from the histogram system by axis ID codes (non-const)
1236  // Histo2DPtr getHisto2D(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) {
1237  // return getAnalysisObject<Histo2D>(makeAxisCode(datasetId, xAxisId, yAxisId));
1238  // }
1239 
1240 
1241  // /// Get a named Profile1D object from the histogram system
1242  // const Profile1DPtr getProfile1D(const std::string& name) const {
1243  // return getAnalysisObject<Profile1D>(name);
1244  // }
1245 
1246  // /// Get a named Profile1D object from the histogram system (non-const)
1247  // Profile1DPtr getProfile1D(const std::string& name) {
1248  // return getAnalysisObject<Profile1D>(name);
1249  // }
1250 
1251  // /// Get a Profile1D object from the histogram system by axis ID codes (non-const)
1252  // const Profile1DPtr getProfile1D(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const {
1253  // return getAnalysisObject<Profile1D>(makeAxisCode(datasetId, xAxisId, yAxisId));
1254  // }
1255 
1256  // /// Get a Profile1D object from the histogram system by axis ID codes (non-const)
1257  // Profile1DPtr getProfile1D(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) {
1258  // return getAnalysisObject<Profile1D>(makeAxisCode(datasetId, xAxisId, yAxisId));
1259  // }
1260 
1261 
1262  // /// Get a named Profile2D object from the histogram system
1263  // const Profile2DPtr getProfile2D(const std::string& name) const {
1264  // return getAnalysisObject<Profile2D>(name);
1265  // }
1266 
1267  // /// Get a named Profile2D object from the histogram system (non-const)
1268  // Profile2DPtr getProfile2D(const std::string& name) {
1269  // return getAnalysisObject<Profile2D>(name);
1270  // }
1271 
1272  // /// Get a Profile2D object from the histogram system by axis ID codes (non-const)
1273  // const Profile2DPtr getProfile2D(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const {
1274  // return getAnalysisObject<Profile2D>(makeAxisCode(datasetId, xAxisId, yAxisId));
1275  // }
1276 
1277  // /// Get a Profile2D object from the histogram system by axis ID codes (non-const)
1278  // Profile2DPtr getProfile2D(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) {
1279  // return getAnalysisObject<Profile2D>(makeAxisCode(datasetId, xAxisId, yAxisId));
1280  // }
1281 
1282 
1283  // /// Get a named Scatter2D object from the histogram system
1284  // const Scatter2DPtr getScatter2D(const std::string& name) const {
1285  // return getAnalysisObject<Scatter2D>(name);
1286  // }
1287 
1288  // /// Get a named Scatter2D object from the histogram system (non-const)
1289  // Scatter2DPtr getScatter2D(const std::string& name) {
1290  // return getAnalysisObject<Scatter2D>(name);
1291  // }
1292 
1293  // /// Get a Scatter2D object from the histogram system by axis ID codes (non-const)
1294  // const Scatter2DPtr getScatter2D(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) const {
1295  // return getAnalysisObject<Scatter2D>(makeAxisCode(datasetId, xAxisId, yAxisId));
1296  // }
1297 
1298  // /// Get a Scatter2D object from the histogram system by axis ID codes (non-const)
1299  // Scatter2DPtr getScatter2D(unsigned int datasetId, unsigned int xAxisId, unsigned int yAxisId) {
1300  // return getAnalysisObject<Scatter2D>(makeAxisCode(datasetId, xAxisId, yAxisId));
1301  // }
1302 
1304 
1305 
1306  private:
1307 
1309  string _defaultname;
1310 
1312  unique_ptr<AnalysisInfo> _info;
1313 
1316  vector<MultiweightAOPtr> _analysisobjects;
1317 
1319 
1320  double _crossSection;
1321  bool _gotCrossSection;
1323 
1325  AnalysisHandler* _analysishandler;
1326 
1329  mutable std::map<std::string, YODA::AnalysisObjectPtr> _refdata;
1330 
1332  map<string, string> _options;
1333 
1335  string _optstring;
1336 
1337  private:
1338 
1340 
1341 
1343  void _cacheRefData() const;
1344 
1346 
1347 
1350  Analysis& operator=(const Analysis&);
1351 
1352  };
1353 
1354 
1355 }
1356 
1357 
1358 // Include definition of analysis plugin system so that analyses automatically see it when including Analysis.hh
1359 #include "Rivet/AnalysisBuilder.hh"
1360 
1363 #define DECLARE_RIVET_PLUGIN(clsname) ::Rivet::AnalysisBuilder<clsname> plugin_ ## clsname
1364 
1367 // #define DECLARE_ALIASED_RIVET_PLUGIN(clsname, alias) Rivet::AnalysisBuilder<clsname> plugin_ ## clsname ## ( ## #alias ## )
1368 #define DECLARE_ALIASED_RIVET_PLUGIN(clsname, alias) DECLARE_RIVET_PLUGIN(clsname)( #alias )
1369 
1372 #define DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname) clsname() : Analysis(# clsname) {}
1373 
1376 #define DEFAULT_RIVET_ANALYSIS_CTOR(clsname) DEFAULT_RIVET_ANALYSIS_CONSTRUCTOR(clsname)
1377 
1378 
1379 
1380 #endif
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&#39;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 &#39;NAME <EMAIL>&#39; 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