SampledInfo.h
Go to the documentation of this file.
1 #ifndef canvas_Persistency_Provenance_SampledInfo_h
2 #define canvas_Persistency_Provenance_SampledInfo_h
3 
8 
9 #include <map>
10 #include <string>
11 #include <type_traits>
12 #include <vector>
13 
14 namespace art {
15  template <typename T>
16  struct SampledInfo {
17  static_assert(std::is_same_v<T, RunID> || std::is_same_v<T, SubRunID>,
18  "The template argument must be either RunID or SubRunID.");
19  double weight;
20  double probability;
21  std::vector<T> ids;
22 
23  // MUST UPDATE WHEN CLASS IS CHANGED!
24  static short
26  {
27  return 10;
28  }
29  };
30 
34  double weight;
35  double probability;
36  };
37 
38  using SampledRunInfo = std::map<std::string, SampledInfo<RunID>>;
39  using SampledSubRunInfo = std::map<std::string, SampledInfo<SubRunID>>;
40 
41  inline std::ostream&
42  operator<<(std::ostream& os, SampledEventInfo const& eventInfo)
43  {
44  os << "Sampled EventID: '" << eventInfo.id << "' Dataset: '"
45  << eventInfo.dataset << "' Weight: " << eventInfo.weight
46  << " Probability: " << eventInfo.probability;
47  return os;
48  }
49 }
50 
51 #endif /* canvas_Persistency_Provenance_SampledInfo_h */
52 
53 // Local Variables:
54 // mode: c++
55 // End:
static short Class_Version()
Definition: SampledInfo.h:25
std::string string
Definition: nybbler.cc:12
std::string dataset
Definition: SampledInfo.h:33
std::ostream & operator<<(std::ostream &os, const GroupSelector &gs)
std::map< std::string, SampledInfo< SubRunID >> SampledSubRunInfo
Definition: SampledInfo.h:39
double probability
Definition: SampledInfo.h:20
std::map< std::string, SampledInfo< RunID >> SampledRunInfo
Definition: SampledInfo.h:38
std::vector< T > ids
Definition: SampledInfo.h:21