LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
get_ProductDescription.h
Go to the documentation of this file.
1 #ifndef art_Framework_Principal_get_ProductDescription_h
2 #define art_Framework_Principal_get_ProductDescription_h
3 
5 // Helper class to find a product's BranchDescription in the
6 // MasterProductRegistry.
8 
12 
13 #include <string>
14 
15 namespace art {
16  // Forward declarations.
17  class BranchDescription;
18  class Principal;
19 
20  // 1. Get:
21  // a. type info from template arg;
22  // b. process name from TriggerNameService;
23  // c. product registry from ProductMetaData.
24  template <typename T>
25  BranchDescription const& get_ProductDescription(
26  BranchType branch_type,
27  std::string const& module_label,
28  std::string const& instance_name);
29 
30  // 2. Get:
31  // a. type info from template arg;
32  // b. process name from principal;
33  // c. product registry from principal;
34  // d. branch type from principal.
35  template <typename T>
36  BranchDescription const& get_ProductDescription(
37  Principal const& principal,
38  std::string const& module_label,
39  std::string const& instance_name);
40 
41  // 3. Get:
42  // a. type info from TypeID;
43  // b. process name from TriggerNameService;
44  // c. product registry from ProductMetaData.
45  BranchDescription const& get_ProductDescription(
46  TypeID type_id,
47  BranchType branch_type,
48  std::string const& module_label,
49  std::string const& instance_name);
50 
51  // 4. Get:
52  // a. type info from TypeID;
53  // b. process name from principal;
54  // c. product registry from principal.
55  // d. branch type from principal.
56  BranchDescription const& get_ProductDescription(
57  TypeID type_id,
58  Principal const& principal,
59  std::string const& module_label,
60  std::string const& instance_name);
61 
62  // 5. Get:
63  // a. type info from TypeID;
64  // b. process name from string;
65  // c. product list from reference.
66  BranchDescription const& get_ProductDescription(
67  TypeID tid,
68  std::string const& process_name,
69  ProductList const& product_list,
70  BranchType branch_type,
71  std::string const& module_label,
72  std::string const& instance_name);
73 }
74 
75 // 1
76 template <typename T>
77 inline art::BranchDescription const&
79  std::string const& module_label,
80  std::string const& instance_name)
81 {
82  return get_ProductDescription(TypeID{typeid(T)},
83  branch_type,
84  module_label,
85  instance_name); // 3.
86 }
87 
88 // 2.
89 template <typename T>
90 inline art::BranchDescription const&
91 art::get_ProductDescription(Principal const& principal,
92  std::string const& module_label,
93  std::string const& instance_name)
94 {
95  return get_ProductDescription(TypeID{typeid(T)},
96  principal,
97  module_label,
98  instance_name); // 4.
99 }
100 
101 #endif /* art_Framework_Principal_get_ProductDescription_h */
102 
103 // Local Variables:
104 // mode: c++
105 // End:
BranchDescription const & get_ProductDescription(BranchType branch_type, std::string const &module_label, std::string const &instance_name)
std::map< BranchKey, BranchDescription > ProductList
Definition: ProductList.h:15
BranchType
Definition: BranchType.h:18
HLT enums.