CombineHarvester
CombineHarvester.h
Go to the documentation of this file.
1 #ifndef CombineTools_CombineHarvester_h
2 #define CombineTools_CombineHarvester_h
3 #include <string>
4 #include <utility>
5 #include <vector>
6 #include <memory>
7 #include <map>
8 #include <unordered_map>
9 #include <list>
10 #include <cmath>
11 #include <set>
12 #include <functional>
13 #include "boost/range/algorithm_ext/erase.hpp"
14 #include "TFile.h"
15 #include "TH1.h"
16 #include "RooWorkspace.h"
23 
24 
25 namespace ch {
26 
27 // Define some useful CombineHarvester-specific typedefs
28 typedef std::vector<std::pair<int, std::string>> Categories;
29 
31  public:
45 
59  CombineHarvester(CombineHarvester const& other);
62 
68  void SetFlag(std::string const& flag, bool const& value);
69  bool GetFlag(std::string const& flag) const;
70 
75 
95  inline void SetVerbosity(unsigned verbosity) { verbosity_ = verbosity; }
96  inline unsigned Verbosity() { return verbosity_; }
109  int ParseDatacard(std::string const& filename,
110  std::string const& analysis,
111  std::string const& era,
112  std::string const& channel,
113  int bin_id,
114  std::string const& mass);
115  int ParseDatacard(std::string const& filename,
116  std::string parse_rule = "");
117 
118  void WriteDatacard(std::string const& name, std::string const& root_file);
119  void WriteDatacard(std::string const& name, TFile & root_file);
120  void WriteDatacard(std::string const& name);
141  CombineHarvester& bin(std::vector<std::string> const& vec, bool cond = true);
142  CombineHarvester& bin_id(std::vector<int> const& vec, bool cond = true);
143  CombineHarvester& process(std::vector<std::string> const& vec, bool cond = true);
144  CombineHarvester& analysis(std::vector<std::string> const& vec, bool cond = true);
145  CombineHarvester& era(std::vector<std::string> const& vec, bool cond = true);
146  CombineHarvester& channel(std::vector<std::string> const& vec, bool cond = true);
147  CombineHarvester& mass(std::vector<std::string> const& vec, bool cond = true);
148  CombineHarvester& attr(std::vector<std::string> const& vec,std::string attr_label, bool cond = true);
149  CombineHarvester& syst_name(std::vector<std::string> const& vec, bool cond = true);
150  CombineHarvester& syst_type(std::vector<std::string> const& vec, bool cond = true);
151 
152  CombineHarvester& process_rgx(std::vector<std::string> const& vec, bool cond = true);
153 
159 
160  template<typename Function>
161  CombineHarvester& FilterAll(Function func);
162  template<typename Function>
163  CombineHarvester& FilterObs(Function func);
164  template<typename Function>
165  CombineHarvester& FilterProcs(Function func);
166  template<typename Function>
167  CombineHarvester& FilterSysts(Function func);
178  // Set generation
179  std::set<std::string> bin_set();
180  std::set<int> bin_id_set();
181  std::set<std::string> process_set();
182  std::set<std::string> analysis_set();
183  std::set<std::string> era_set();
184  std::set<std::string> channel_set();
185  std::set<std::string> mass_set();
186  std::set<std::string> syst_name_set();
187  std::set<std::string> syst_type_set();
188 
202  template <typename T,
203  typename R = typename std::decay<
204  typename std::result_of<T(Object const*)>::type>::type>
205  std::set<R> SetFromAll(T func);
206 
212  template <typename T,
213  typename R = typename std::decay<
214  typename std::result_of<T(Observation const*)>::type>::type>
215  std::set<R> SetFromObs(T func);
216 
222  template <typename T,
223  typename R = typename std::decay<
224  typename std::result_of<T(Process const*)>::type>::type>
225  std::set<R> SetFromProcs(T func);
226 
232  template <typename T,
233  typename R = typename std::decay<
234  typename std::result_of<T(Systematic const*)>::type>::type>
235  std::set<R> SetFromSysts(T func);
246  ch::Parameter const* GetParameter(std::string const& name) const;
247  ch::Parameter* GetParameter(std::string const& name);
248 
249  void UpdateParameters(std::vector<ch::Parameter> const& params);
250 
258  void UpdateParameters(RooFitResult const* fit);
259  void UpdateParameters(RooFitResult const& fit);
260 
261  std::vector<ch::Parameter> GetParameters() const;
262  void RenameParameter(std::string const& oldname, std::string const& newname);
263 
264  template<typename Function>
265  void ForEachObj(Function func);
266 
267  template<typename Function>
268  void ForEachProc(Function func);
269 
270  template<typename Function>
271  void ForEachObs(Function func);
272 
273  template<typename Function>
274  void ForEachSyst(Function func);
275 
276  void VariableRebin(std::vector<double> bins);
277  void ZeroBins(double min, double max);
278  void SetPdfBins(unsigned nbins);
279 
280  //
281  double getParFromWs(const std::string name);
282  void setParInWs(const std::string name,double value) ;
283  void renameParInWs(const std::string& name, const std::string& newName,const std::string& wsName="");
284 
295  void SetGroup(std::string const& name, std::vector<std::string> const& patterns);
296 
306  void RemoveGroup(std::string const& name, std::vector<std::string> const& patterns);
307 
314  void RenameGroup(std::string const& oldname, std::string const& newname);
315 
321  void AddDatacardLineAtEnd(std::string const& line);
322 
340  double GetRate();
341  double GetObservedRate();
342  double GetUncertainty();
343 
352  double GetUncertainty(RooFitResult const* fit, unsigned n_samples);
353  double GetUncertainty(RooFitResult const& fit, unsigned n_samples);
354  TH1F GetShape();
356 
366  TH1F GetShapeWithUncertainty(RooFitResult const* fit, unsigned n_samples);
367  TH1F GetShapeWithUncertainty(RooFitResult const& fit, unsigned n_samples);
368  TH1F GetObservedShape();
369 
370  TH2F GetRateCovariance(RooFitResult const& fit, unsigned n_samples);
371  TH2F GetRateCorrelation(RooFitResult const& fit, unsigned n_samples);
397  void AddObservations(std::vector<std::string> mass,
398  std::vector<std::string> analysis,
399  std::vector<std::string> era,
400  std::vector<std::string> channel,
402 
403  void AddProcesses(std::vector<std::string> mass,
404  std::vector<std::string> analysis,
405  std::vector<std::string> era,
406  std::vector<std::string> channel,
407  std::vector<std::string> procs,
408  ch::Categories bin, bool signal);
409 
410  void AddSystFromProc(Process const& proc, std::string const& name,
411  std::string const& type, bool asymm, double val_u,
412  double val_d, std::string const& formula,
413  std::string const& args);
414 
415  template <class Map>
416  void AddSyst(CombineHarvester & target, std::string const& name,
417  std::string const& type, Map const& valmap);
418 
419  void ExtractShapes(std::string const& file, std::string const& rule,
420  std::string const& syst_rule);
421  void ExtractPdfs(CombineHarvester& target, std::string const& ws_name,
422  std::string const& rule, std::string norm_rule = "");
423  void ExtractData(std::string const& ws_name, std::string const& rule);
424 
425  void AddWorkspace(RooWorkspace const& ws, bool can_rename = false);
426 
427  void InsertObservation(ch::Observation const& obs);
428  void InsertProcess(ch::Process const& proc);
429  void InsertSystematic(ch::Systematic const& sys);
430 
436  void RenameSystematic(CombineHarvester& target, std::string const& old_name, std::string const& new_name);
437 
438  void CreateParameterIfEmpty(std::string const& name);
439 
446  void AddBinByBin(double threshold, bool fixed_norm, CombineHarvester* other);
447 
448 
455  void AddBinByBin(double threshold, bool fixed_norm, CombineHarvester & other);
456 
457 
464  void MergeBinErrors(double bbb_threshold, double merge_threshold);
467  void SetAutoMCStats(CombineHarvester &target, double thresh, bool sig=false, int mode=1);
468  void RenameAutoMCStatsBin(std::string const& oldname, std::string const& newname);
469  std::set<std::string> GetAutoMCStatsBins() const;
470 
471  void AddExtArgValue(std::string const& name, double const& value);
472  private:
473  friend void swap(CombineHarvester& first, CombineHarvester& second);
474 
475  // ---------------------------------------------------------------
476  // Main data members
477  // ---------------------------------------------------------------
478  std::vector<std::shared_ptr<Observation>> obs_;
479  std::vector<std::shared_ptr<Process>> procs_;
480  std::vector<std::shared_ptr<Systematic>> systs_;
481  std::map<std::string, std::shared_ptr<Parameter>> params_;
482  std::map<std::string, std::shared_ptr<RooWorkspace>> wspaces_;
483 
484  std::unordered_map<std::string, bool> flags_;
485 
486  struct AutoMCStatsSettings {
487  double event_threshold;
488  bool include_signal;
489  int hist_mode;
490 
491  AutoMCStatsSettings(double thresh, bool sig=false, int mode=1) {
492  event_threshold = thresh;
493  include_signal = sig;
494  hist_mode = mode;
495  }
496 
497  AutoMCStatsSettings() : AutoMCStatsSettings(0.) {}
498  };
499 
500  std::map<std::string, AutoMCStatsSettings> auto_stats_settings_;
501  std::vector<std::string> post_lines_;
502 
503  // ---------------------------------------------------------------
504  // typedefs
505  // ---------------------------------------------------------------
506  typedef std::pair<std::string, std::string> StrPair;
507  typedef std::vector<StrPair> StrPairVec;
508  typedef std::vector<std::string> StrVec;
509 
510 
511  // ---------------------------------------------------------------
512  // Logging
513  // ---------------------------------------------------------------
514  unsigned verbosity_;
515  std::ostream * log_;
516  std::ostream& log() const { return *log_; }
517 
518  // ---------------------------------------------------------------
519  // Private methods for the shape extraction routines
520  // --> implementation in src/CombineHarvester.cc
521  // ---------------------------------------------------------------
522  void LoadShapes(Observation* entry,
523  std::vector<HistMapping> const& mappings);
524  void LoadShapes(Process* entry,
525  std::vector<HistMapping> const& mappings);
526  void LoadShapes(Systematic* entry,
527  std::vector<HistMapping> const& mappings);
528 
529  HistMapping const& ResolveMapping(std::string const& process,
530  std::string const& bin,
531  std::vector<HistMapping> const& mappings);
532 
533  StrPairVec GenerateShapeMapAttempts(std::string process,
534  std::string category);
535 
536  std::shared_ptr<RooWorkspace> SetupWorkspace(RooWorkspace const& ws,
537  bool can_rename = false);
538 
539  void ImportParameters(RooArgSet *vars);
540 
541  RooAbsData const* FindMatchingData(Process const* proc);
542 
543  ch::Parameter * SetupRateParamVar(std::string const& name, double val, bool is_ext_arg = false);
544  void SetupRateParamFunc(std::string const& name, std::string const& formula,
545  std::string const& pars);
546  void SetupRateParamWspObj(std::string const& name, std::string const& obj, bool is_ext_arg = false);
547  // ---------------------------------------------------------------
548  // Private methods for the shape writing routines
549  // ---------------------------------------------------------------
550  void WriteHistToFile(
551  TH1 * hist,
552  TFile * file,
553  std::vector<HistMapping> const& mappings,
554  std::string const& bin,
555  std::string const& process,
556  std::string const& mass,
557  std::string const& nuisance,
558  unsigned type);
559 
560 void FillHistMappings(std::vector<HistMapping> & mappings);
561 
562  // ---------------------------------------------------------------
563  // Private methods for shape/yield evaluation
564  // --> implementation in src/CombineHarvester_Evaluate.cc
565  // ---------------------------------------------------------------
566  typedef std::vector<std::vector<Systematic const*>> ProcSystMap;
567  ProcSystMap GenerateProcSystMap();
568 
569  double GetRateInternal(ProcSystMap const& lookup,
570  std::string const& single_sys = "");
571 
572  TH1F GetShapeInternal(ProcSystMap const& lookup,
573  std::string const& single_sys = "");
574 
575  inline double smoothStepFunc(double x) const {
576  if (std::fabs(x) >= 1.0/*_smoothRegion*/) return x > 0 ? +1 : -1;
577  double xnorm = x/1.0;/*_smoothRegion*/
578  double xnorm2 = xnorm*xnorm;
579  return 0.125 * xnorm * (xnorm2 * (3.*xnorm2 - 10.) + 15);
580  }
581 
582  double logKappaForX(double x, double k_low, double k_high) const;
583 
584  void ShapeDiff(double x, TH1F* target, TH1 const* nom, TH1 const* low,
585  TH1 const* high, bool linear);
586  void ShapeDiff(double x, TH1F* target, RooDataHist const* nom,
587  RooDataHist const* low, RooDataHist const* high);
588 };
589 
590 
591 // ---------------------------------------------------------------
592 // Template method implementation
593 // ---------------------------------------------------------------
594 template <typename T, typename R>
595 std::set<R> CombineHarvester::SetFromAll(T func) {
596  std::set<R> ret;
597  for (auto const& item : obs_) ret.insert(func(item.get()));
598  for (auto const& item : procs_) ret.insert(func(item.get()));
599  for (auto const& item : systs_) ret.insert(func(item.get()));
600  return ret;
601 };
602 
603 template <typename T, typename R>
604 std::set<R> CombineHarvester::SetFromObs(T func) {
605  std::set<R> ret;
606  for (auto const& item : obs_) ret.insert(func(item.get()));
607  return ret;
608 };
609 
610 template <typename T, typename R>
611 std::set<R> CombineHarvester::SetFromProcs(T func) {
612  std::set<R> ret;
613  for (auto const& item : procs_) ret.insert(func(item.get()));
614  return ret;
615 };
616 
617 template <typename T, typename R>
618 std::set<R> CombineHarvester::SetFromSysts(T func) {
619  std::set<R> ret;
620  for (auto const& item : systs_) ret.insert(func(item.get()));
621  return ret;
622 };
623 
624 template<typename Function>
625 void CombineHarvester::ForEachObj(Function func) {
626  ForEachObs(func);
627  ForEachProc(func);
628  ForEachSyst(func);
629 }
630 
631 template<typename Function>
632 void CombineHarvester::ForEachProc(Function func) {
633  for (auto & item: procs_) func(item.get());
634 }
635 
636 template<typename Function>
637 void CombineHarvester::ForEachObs(Function func) {
638  for (auto & item: obs_) func(item.get());
639 }
640 
641 template<typename Function>
642 void CombineHarvester::ForEachSyst(Function func) {
643  for (auto & item: systs_) func(item.get());
644 }
645 
646 template<typename Function>
648  FilterObs(func);
649  FilterProcs(func);
650  FilterSysts(func);
651  return *this;
652 }
653 
654 template<typename Function>
656  boost::remove_erase_if(
657  obs_, [&](std::shared_ptr<Observation> ptr) { return func(ptr.get());
658  });
659  return *this;
660 }
661 
662 template<typename Function>
664  boost::remove_erase_if(
665  procs_, [&](std::shared_ptr<Process> ptr) { return func(ptr.get());
666  });
667  return *this;
668 }
669 template<typename Function>
671  boost::remove_erase_if(
672  systs_, [&](std::shared_ptr<Systematic> ptr) { return func(ptr.get());
673  });
674  return *this;
675 }
676 
677 template <class Map>
679  std::string const& name, std::string const& type,
680  Map const& valmap) {
681  // Keep track of which Process entries get a Systematic assigned and which
682  // don't. If verbosity is on we'll print lists of these processes at the end.
683  std::vector<ch::Process *> not_added_procs;
684  std::vector<ch::Process *> added_procs;
685  // Also track which tuples in the map did not get used. Do this by getting the
686  // full map here and then removing elements as they are used to create a
687  // Systematic.
688  auto tuples = valmap.GetTupleSet();
689  if (verbosity_ >= 1) {
690  log() << (name + ":" + type) << "\n";
691  }
692  for (unsigned i = 0; i < procs_.size(); ++i) {
693  if (!valmap.Contains(procs_[i].get())) {
694  not_added_procs.push_back(procs_[i].get());
695  continue;
696  }
697  tuples.erase(valmap.GetTuple(procs_[i].get()));
698  added_procs.push_back(procs_[i].get());
699  double val_u = valmap.ValU(procs_[i].get());
700  double val_d = valmap.ValD(procs_[i].get());
701  std::string formula = valmap.Formula(procs_[i].get());
702  std::string args = valmap.Args(procs_[i].get());
703  target.AddSystFromProc(*(procs_[i]), name, type, valmap.IsAsymm(),
704  val_u, val_d, formula, args);
705  }
706  if (tuples.size() && verbosity_ >= 1) {
707  log() << ">> Map keys that were not used to create a Systematic:\n";
708  for (auto s : tuples) {
709  log() << ch::Tuple2String(s) << "\n";
710  }
711  }
712  if (verbosity_ >= 2) {
713  Process::PrintHeader(log());
714  log() << ">> Process entries that did not get a Systematic:\n";
715  for (auto p : not_added_procs) {
716  log() << *p << "\n";
717  }
718  log() << ">> Process entries that did get a Systematic:\n";
719  for (auto p : added_procs) {
720  log() << *p << "\n";
721  }
722  }
723 }
724 }
725 
726 #endif
ch::CombineHarvester::ExtractData
void ExtractData(std::string const &ws_name, std::string const &rule)
Definition: CombineHarvester_Creation.cc:199
ch::CombineHarvester::FilterSysts
CombineHarvester & FilterSysts(Function func)
Definition: CombineHarvester.h:670
ch::CombineHarvester::channel_set
std::set< std::string > channel_set()
Definition: CombineHarvester_Filters.cc:247
ch::CombineHarvester::analysis
CombineHarvester & analysis(std::vector< std::string > const &vec, bool cond=true)
Definition: CombineHarvester_Filters.cc:55
ch::CombineHarvester::ForEachProc
void ForEachProc(Function func)
Definition: CombineHarvester.h:632
ch::CombineHarvester::AddDatacardLineAtEnd
void AddDatacardLineAtEnd(std::string const &line)
Add a line of text at the end of all datacards.
Definition: CombineHarvester_Evaluate.cc:819
ch::CombineHarvester::AddWorkspace
void AddWorkspace(RooWorkspace const &ws, bool can_rename=false)
Definition: CombineHarvester_Creation.cc:176
ch::CombineHarvester::GetObservedRate
double GetObservedRate()
Definition: CombineHarvester_Evaluate.cc:425
ch::CombineHarvester::PrintProcs
CombineHarvester & PrintProcs()
Definition: CombineHarvester.cc:237
ch::CombineHarvester::ForEachObs
void ForEachObs(Function func)
Definition: CombineHarvester.h:637
ch::CombineHarvester::ForEachObj
void ForEachObj(Function func)
Definition: CombineHarvester.h:625
ch::CombineHarvester::GetRateCovariance
TH2F GetRateCovariance(RooFitResult const &fit, unsigned n_samples)
Definition: CombineHarvester_Evaluate.cc:179
Parameter.h
ch::CombineHarvester::mass
CombineHarvester & mass(std::vector< std::string > const &vec, bool cond=true)
Definition: CombineHarvester_Filters.cc:97
ch::CombineHarvester::RenameGroup
void RenameGroup(std::string const &oldname, std::string const &newname)
Rename a nuisance parameter group.
Definition: CombineHarvester_Evaluate.cc:808
ch::CombineHarvester::process_set
std::set< std::string > process_set()
Definition: CombineHarvester_Filters.cc:214
ch::CombineHarvester::SetFromAll
std::set< R > SetFromAll(T func)
Fill an std::set with the return values from an arbitrary function.
Definition: CombineHarvester.h:595
ch::CombineHarvester::Verbosity
unsigned Verbosity()
Definition: CombineHarvester.h:96
HistMapping.h
ch::CombineHarvester::PrintParams
CombineHarvester & PrintParams()
Definition: CombineHarvester.cc:251
ch::CombineHarvester::syst_type
CombineHarvester & syst_type(std::vector< std::string > const &vec, bool cond=true)
Definition: CombineHarvester_Filters.cc:136
ch::CombineHarvester::VariableRebin
void VariableRebin(std::vector< double > bins)
Definition: CombineHarvester_Evaluate.cc:591
ch::CombineHarvester::GetFlag
bool GetFlag(std::string const &flag) const
Definition: CombineHarvester.cc:78
Utilities.h
Process.h
ch::CombineHarvester::CreateParameterIfEmpty
void CreateParameterIfEmpty(std::string const &name)
Definition: CombineHarvester_Creation.cc:228
ch::syst::era
Definition: Systematics.h:21
ch::CombineHarvester::InsertProcess
void InsertProcess(ch::Process const &proc)
Definition: CombineHarvester_Creation.cc:249
ch::CombineHarvester::AddSyst
void AddSyst(CombineHarvester &target, std::string const &name, std::string const &type, Map const &valmap)
Definition: CombineHarvester.h:678
ch::CombineHarvester::SetVerbosity
void SetVerbosity(unsigned verbosity)
Definition: CombineHarvester.h:95
ch::CombineHarvester::~CombineHarvester
~CombineHarvester()
Definition: CombineHarvester.cc:31
ch::CombineHarvester::process_rgx
CombineHarvester & process_rgx(std::vector< std::string > const &vec, bool cond=true)
Definition: CombineHarvester_Filters.cc:48
ch::Categories
std::vector< std::pair< int, std::string > > Categories
Definition: CombineHarvester.h:28
ch::CombineHarvester::FilterProcs
CombineHarvester & FilterProcs(Function func)
Definition: CombineHarvester.h:663
ch::CombineHarvester::GetShape
TH1F GetShape()
Definition: CombineHarvester_Evaluate.cc:277
ch::CombineHarvester::AddBinByBin
void AddBinByBin(double threshold, bool fixed_norm, CombineHarvester *other)
Create bin-by-bin uncertainties.
Definition: CombineHarvester_Creation.cc:219
ch::CombineHarvester::deep
CombineHarvester deep()
Creates and retunrs a deep copy of the CombineHarvester instance.
Definition: CombineHarvester.cc:87
ch::CombineHarvester::FilterObs
CombineHarvester & FilterObs(Function func)
Definition: CombineHarvester.h:655
ch::CombineHarvester::InsertObservation
void InsertObservation(ch::Observation const &obs)
Definition: CombineHarvester_Creation.cc:245
ch::CombineHarvester::bin_id
CombineHarvester & bin_id(std::vector< int > const &vec, bool cond=true)
Definition: CombineHarvester_Filters.cc:27
ch::Process
Definition: Process.h:15
ch::CombineHarvester::UpdateParameters
void UpdateParameters(std::vector< ch::Parameter > const &params)
Definition: CombineHarvester_Evaluate.cc:544
ch::CombineHarvester::GetUncertainty
double GetUncertainty()
Definition: CombineHarvester_Evaluate.cc:44
ch::Parameter
Definition: Parameter.h:12
ch::syst::channel
Definition: Systematics.h:26
ch::CombineHarvester::AddExtArgValue
void AddExtArgValue(std::string const &name, double const &value)
Definition: CombineHarvester.cc:897
ch::CombineHarvester::GetParameter
ch::Parameter const * GetParameter(std::string const &name) const
Definition: CombineHarvester_Evaluate.cc:525
ch::CombineHarvester::channel
CombineHarvester & channel(std::vector< std::string > const &vec, bool cond=true)
Definition: CombineHarvester_Filters.cc:83
ch::CombineHarvester::syst_name_set
std::set< std::string > syst_name_set()
Definition: CombineHarvester_Filters.cc:271
ch::CombineHarvester::backgrounds
CombineHarvester & backgrounds()
Definition: CombineHarvester_Filters.cc:156
ch::CombineHarvester::ClearDatacardLinesAtEnd
void ClearDatacardLinesAtEnd()
Clear all added datacard lines.
Definition: CombineHarvester_Evaluate.cc:823
ch::syst::bin_id
Definition: Systematics.h:41
ch::CombineHarvester::AddSystFromProc
void AddSystFromProc(Process const &proc, std::string const &name, std::string const &type, bool asymm, double val_u, double val_d, std::string const &formula, std::string const &args)
Definition: CombineHarvester_Creation.cc:76
ch::CombineHarvester::AddProcesses
void AddProcesses(std::vector< std::string > mass, std::vector< std::string > analysis, std::vector< std::string > era, std::vector< std::string > channel, std::vector< std::string > procs, ch::Categories bin, bool signal)
Definition: CombineHarvester_Creation.cc:45
ch::CombineHarvester::bin_set
std::set< std::string > bin_set()
Definition: CombineHarvester_Filters.cc:190
ch::CombineHarvester::ExtractShapes
void ExtractShapes(std::string const &file, std::string const &rule, std::string const &syst_rule)
Definition: CombineHarvester_Creation.cc:147
ch::CombineHarvester::SetFlag
void SetFlag(std::string const &flag, bool const &value)
Set a named flag value.
Definition: CombineHarvester.cc:67
ch::CombineHarvester::operator=
CombineHarvester & operator=(CombineHarvester other)
Definition: CombineHarvester.cc:213
ch::CombineHarvester::GetAutoMCStatsBins
std::set< std::string > GetAutoMCStatsBins() const
Definition: CombineHarvester.cc:889
ch::CombineHarvester::era
CombineHarvester & era(std::vector< std::string > const &vec, bool cond=true)
Definition: CombineHarvester_Filters.cc:69
ch::CombineHarvester::SetPdfBins
void SetPdfBins(unsigned nbins)
Definition: CombineHarvester_Evaluate.cc:732
ch::CombineHarvester::getParFromWs
double getParFromWs(const std::string name)
Definition: CombineHarvester.cc:903
ch::CombineHarvester::MergeBinErrors
void MergeBinErrors(double bbb_threshold, double merge_threshold)
Merge bin errors within a bin.
Definition: CombineHarvester_Creation.cc:236
ch::CombineHarvester::signals
CombineHarvester & signals()
Definition: CombineHarvester_Filters.cc:146
ch::CombineHarvester::mass_set
std::set< std::string > mass_set()
Definition: CombineHarvester_Filters.cc:259
ch::CombineHarvester::bin_id_set
std::set< int > bin_id_set()
Definition: CombineHarvester_Filters.cc:202
Systematic.h
ch::CombineHarvester::SetFromSysts
std::set< R > SetFromSysts(T func)
Fill an std::set using only the Systematic entries.
Definition: CombineHarvester.h:618
ch
Definition: Algorithm.h:10
ch::CombineHarvester::InsertSystematic
void InsertSystematic(ch::Systematic const &sys)
Definition: CombineHarvester_Creation.cc:253
ch::CombineHarvester::cp
CombineHarvester cp()
Creates and returns a shallow copy of the CombineHarvester instance.
Definition: CombineHarvester.cc:220
ch::CombineHarvester::SetAutoMCStats
void SetAutoMCStats(CombineHarvester &target, double thresh, bool sig=false, int mode=1)
Definition: CombineHarvester.cc:875
ch::CombineHarvester::GetParameters
std::vector< ch::Parameter > GetParameters() const
Definition: CombineHarvester_Evaluate.cc:583
ch::CombineHarvester::SetFromProcs
std::set< R > SetFromProcs(T func)
Fill an std::set using only the Process entries.
Definition: CombineHarvester.h:611
ch::CombineHarvester::histograms
CombineHarvester & histograms()
Definition: CombineHarvester_Filters.cc:166
ch::CombineHarvester::PrintObs
CombineHarvester & PrintObs()
Definition: CombineHarvester.cc:230
ch::CombineHarvester::era_set
std::set< std::string > era_set()
Definition: CombineHarvester_Filters.cc:235
ch::CombineHarvester::GetShapeWithUncertainty
TH1F GetShapeWithUncertainty()
Definition: CombineHarvester_Evaluate.cc:103
ch::CombineHarvester::FilterAll
CombineHarvester & FilterAll(Function func)
Definition: CombineHarvester.h:647
ch::Systematic
Definition: Systematic.h:12
ch::CombineHarvester::RemoveGroup
void RemoveGroup(std::string const &name, std::vector< std::string > const &patterns)
Remove parameters to a given group.
Definition: CombineHarvester_Evaluate.cc:794
ch::CombineHarvester::GetRate
double GetRate()
Definition: CombineHarvester_Evaluate.cc:272
ch::CombineHarvester::PrintSysts
CombineHarvester & PrintSysts()
Definition: CombineHarvester.cc:244
ch::CombineHarvester::setParInWs
void setParInWs(const std::string name, double value)
Definition: CombineHarvester.cc:915
ch::CombineHarvester::analysis_set
std::set< std::string > analysis_set()
Definition: CombineHarvester_Filters.cc:223
ch::CombineHarvester::SetFromObs
std::set< R > SetFromObs(T func)
Fill an std::set using only the Observation entries.
Definition: CombineHarvester.h:604
ch::CombineHarvester::data
CombineHarvester & data()
Definition: CombineHarvester_Filters.cc:183
ch::CombineHarvester::GetObservedShape
TH1F GetObservedShape()
Definition: CombineHarvester_Evaluate.cc:433
ch::CombineHarvester::RenameSystematic
void RenameSystematic(CombineHarvester &target, std::string const &old_name, std::string const &new_name)
Rename a systematic from 'old_name' to 'new_name' and add a parameter 'new_name' to CH instance 'targ...
Definition: CombineHarvester_Creation.cc:137
ch::Object
Definition: Object.h:8
ch::CombineHarvester::ParseDatacard
int ParseDatacard(std::string const &filename, std::string const &analysis, std::string const &era, std::string const &channel, int bin_id, std::string const &mass)
Definition: CombineHarvester_Datacards.cc:56
ch::CombineHarvester::GetRateCorrelation
TH2F GetRateCorrelation(RooFitResult const &fit, unsigned n_samples)
Definition: CombineHarvester_Evaluate.cc:252
ch::CombineHarvester::RenameAutoMCStatsBin
void RenameAutoMCStatsBin(std::string const &oldname, std::string const &newname)
Definition: CombineHarvester.cc:881
ch::CombineHarvester::bin
CombineHarvester & bin(std::vector< std::string > const &vec, bool cond=true)
Definition: CombineHarvester_Filters.cc:13
ch::CombineHarvester
Definition: CombineHarvester.h:30
ch::CombineHarvester::ForEachSyst
void ForEachSyst(Function func)
Definition: CombineHarvester.h:642
ch::CombineHarvester::PrintAll
CombineHarvester & PrintAll()
Definition: CombineHarvester.cc:226
ch::CombineHarvester::pdfs
CombineHarvester & pdfs()
Definition: CombineHarvester_Filters.cc:176
ch::CombineHarvester::ExtractPdfs
void ExtractPdfs(CombineHarvester &target, std::string const &ws_name, std::string const &rule, std::string norm_rule="")
Definition: CombineHarvester_Creation.cc:181
ch::CombineHarvester::RenameParameter
void RenameParameter(std::string const &oldname, std::string const &newname)
Definition: CombineHarvester_Evaluate.cc:515
ch::CombineHarvester::AddObservations
void AddObservations(std::vector< std::string > mass, std::vector< std::string > analysis, std::vector< std::string > era, std::vector< std::string > channel, ch::Categories bin)
Definition: CombineHarvester_Creation.cc:20
ch::CombineHarvester::CombineHarvester
CombineHarvester()
Definition: CombineHarvester.cc:17
ch::CombineHarvester::SetGroup
void SetGroup(std::string const &name, std::vector< std::string > const &patterns)
Add parameters to a given group.
Definition: CombineHarvester_Evaluate.cc:780
ch::Tuple2String
std::string Tuple2String(const std::tuple< Args... > &t)
Format any std::tuple as a string.
Definition: Utilities.h:214
ch::CombineHarvester::attr
CombineHarvester & attr(std::vector< std::string > const &vec, std::string attr_label, bool cond=true)
Definition: CombineHarvester_Filters.cc:111
ch::Process::PrintHeader
static std::ostream & PrintHeader(std::ostream &out)
Definition: Process.cc:153
Observation.h
ch::CombineHarvester::WriteDatacard
void WriteDatacard(std::string const &name, std::string const &root_file)
Definition: CombineHarvester_Datacards.cc:529
ch::CombineHarvester::syst_name
CombineHarvester & syst_name(std::vector< std::string > const &vec, bool cond=true)
Definition: CombineHarvester_Filters.cc:126
ch::CombineHarvester::syst_type_set
std::set< std::string > syst_type_set()
Definition: CombineHarvester_Filters.cc:277
ch::CombineHarvester::renameParInWs
void renameParInWs(const std::string &name, const std::string &newName, const std::string &wsName="")
Definition: CombineHarvester.cc:925
ch::Observation
Definition: Observation.h:12
ch::CombineHarvester::ZeroBins
void ZeroBins(double min, double max)
Definition: CombineHarvester_Evaluate.cc:654
ch::CombineHarvester::swap
friend void swap(CombineHarvester &first, CombineHarvester &second)
Definition: CombineHarvester.cc:35
ch::CombineHarvester::process
CombineHarvester & process(std::vector< std::string > const &vec, bool cond=true)
Definition: CombineHarvester_Filters.cc:35