CombineHarvester
CardWriter.h
Go to the documentation of this file.
1 #ifndef CombineTools_CardWriter_h
2 #define CombineTools_CardWriter_h
3 #include <string>
4 #include <map>
5 #include <vector>
6 #include <set>
9 
10 namespace ch {
11 
50 class CardWriter {
51  public:
53  CardWriter(std::string const& text_pattern, std::string const& root_pattern);
55  std::map<std::string, CombineHarvester> WriteCards(std::string const& tag, ch::CombineHarvester& cmb) const;
57  CardWriter& SetVerbosity(unsigned v);
59  CardWriter& CreateDirectories(bool flag);
61  CardWriter& SetWildcardMasses(std::vector<std::string> const& masses);
62 
63  private:
64  typedef std::map<std::string, std::set<std::string>> PatternMap;
65  std::string text_pattern_;
66  std::string root_pattern_;
67  mutable std::string tag_;
68  std::vector<std::string> wildcard_masses_;
69  unsigned v_;
70  bool create_dirs_;
71 
72  std::string Compile(std::string pattern, ch::Object const* obj,
73  bool skip_mass = false) const;
74  PatternMap BuildMap(std::string const& pattern,
75  ch::CombineHarvester& cmb) const;
76  void MakeDirs(PatternMap const& map) const;
77 };
78 }
79 
80 #endif
Automates the writing of datacards into directory structures.
Definition: CardWriter.h:50
CardWriter & CreateDirectories(bool flag)
Control whether directories can be created if missing.
Definition: CardWriter.cc:25
CardWriter & SetWildcardMasses(std::vector< std::string > const &masses)
Redefine the mass values that should be treated as wildcards.
Definition: CardWriter.cc:31
std::map< std::string, CombineHarvester > WriteCards(std::string const &tag, ch::CombineHarvester &cmb) const
Write datacards according to patterns, substituting $TAG for tag
Definition: CardWriter.cc:96
CardWriter & SetVerbosity(unsigned v)
Set >= 1 for verbose output, otherwise silent.
Definition: CardWriter.cc:20
CardWriter(std::string const &text_pattern, std::string const &root_pattern)
Must be constructed with text and ROOT file patterns.
Definition: CardWriter.cc:12
Definition: Algorithm.h:10