CMS 3D CMS Logo

L1GtUtilsHelper.h
Go to the documentation of this file.
1 #ifndef GlobalTriggerAnalyzer_L1GtUtilsHelper_h
2 #define GlobalTriggerAnalyzer_L1GtUtilsHelper_h
3 
23 
28 
29 #include <string>
30 #include <utility>
31 
32 namespace edm {
33  class BranchDescription;
35 } // namespace edm
36 
38 public:
39  // Using this constructor will require InputTags to be specified in the configuration
41 
42  // Using this constructor will cause it to look for valid InputTags in
43  // the following ways in the specified order until they are found.
44  // 1. The configuration
45  // 2. Search all products from the preferred input tags for the required type
46  // 3. Search all products from any other process for the required type
47  template <typename T>
48  L1GtUtilsHelper(edm::ParameterSet const& pset, edm::ConsumesCollector& iC, bool useL1GtTriggerMenuLite, T& module);
49 
50  // Using this constructor will cause it to look for valid InputTags in
51  // the following ways in the specified order until they are found.
52  // 1. The constructor arguments
53  // 2. The configuration
54  // 3. Search all products from the preferred input tags for the required type
55  // 4. Search all products from any other process for the required type
56  template <typename T>
59  bool useL1GtTriggerMenuLite,
60  T& module,
64 
65  // A module defining its fillDescriptions function might want to use this
66  static void fillDescription(edm::ParameterSetDescription& desc);
67 
68  // Callback which will be registered with the Framework if the InputTags
69  // are not specified in the configuration or constructor arguments. It
70  // will get called for each product in the ProductRegistry.
71  void operator()(edm::BranchDescription const& branchDescription);
72 
73  edm::InputTag const& l1GtRecordInputTag() const { return m_l1GtRecordInputTag; }
74  edm::InputTag const& l1GtReadoutRecordInputTag() const { return m_l1GtReadoutRecordInputTag; }
75  edm::InputTag const& l1GtTriggerMenuLiteInputTag() const { return m_l1GtTriggerMenuLiteInputTag; }
76 
77  edm::EDGetTokenT<L1GlobalTriggerRecord> const& l1GtRecordToken() const { return m_l1GtRecordToken; }
79  return m_l1GtReadoutRecordToken;
80  }
81  edm::EDGetTokenT<L1GtTriggerMenuLite> const& l1GtTriggerMenuLiteToken() const { return m_l1GtTriggerMenuLiteToken; }
82 
83 private:
85 
89 
93 
97 
101 
105 
106  // use vector here, InputTag has no '<' operator to use std::set
107  std::vector<edm::InputTag> m_inputTagsL1GtRecord;
108  std::vector<edm::InputTag> m_inputTagsL1GtReadoutRecord;
109  std::vector<edm::InputTag> m_inputTagsL1GtMenuLite;
110 };
111 
112 template <typename T>
116  T& module)
117  : L1GtUtilsHelper(pset, iC, useL1GtTriggerMenuLite, module, edm::InputTag(), edm::InputTag(), edm::InputTag()) {}
118 
119 template <typename T>
123  T& module,
127  : m_consumesCollector(std::move(iC)),
128 
129  // Set InputTags from arguments
130  m_l1GtRecordInputTag(l1GtRecordInputTag),
131  m_l1GtReadoutRecordInputTag(l1GtReadoutRecordInputTag),
132  m_l1GtTriggerMenuLiteInputTag(l1GtTriggerMenuLiteInputTag),
133 
137 
141 
145  // If the InputTags are not set to valid values by the arguments, then
146  // try to set them from the configuration.
147  if (m_l1GtRecordInputTag.label().empty() && pset.existsAs<edm::InputTag>("l1GtRecordInputTag")) {
148  m_l1GtRecordInputTag = pset.getParameter<edm::InputTag>("l1GtRecordInputTag");
149  }
150  if (m_l1GtReadoutRecordInputTag.label().empty() && pset.existsAs<edm::InputTag>("l1GtReadoutRecordInputTag")) {
151  m_l1GtReadoutRecordInputTag = pset.getParameter<edm::InputTag>("l1GtReadoutRecordInputTag");
152  }
153  if (useL1GtTriggerMenuLite && m_l1GtTriggerMenuLiteInputTag.label().empty() &&
154  pset.existsAs<edm::InputTag>("l1GtTriggerMenuLiteInputTag")) {
155  m_l1GtTriggerMenuLiteInputTag = pset.getParameter<edm::InputTag>("l1GtTriggerMenuLiteInputTag");
156  }
157 
158  // If the InputTags were set to valid values, make the consumes calls.
159  if (!m_l1GtRecordInputTag.label().empty()) {
161  }
162  if (!m_l1GtReadoutRecordInputTag.label().empty()) {
164  }
165  if (useL1GtTriggerMenuLite && !m_l1GtTriggerMenuLiteInputTag.label().empty()) {
167  }
168 
169  // Do we still need to search for each InputTag?
173 
174  // Register the callback function with the Framework
175  // if any InputTags still need to be found.
176  if (m_findRecord || m_findReadoutRecord || m_findMenuLite) {
177  module.callWhenNewProductsRegistered(std::ref(*this));
178  }
179 }
180 #endif
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::InputTag const & l1GtReadoutRecordInputTag() const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
edm::InputTag m_l1GtReadoutRecordInputTag
edm::EDGetTokenT< L1GtTriggerMenuLite > m_l1GtTriggerMenuLiteToken
std::vector< edm::InputTag > m_inputTagsL1GtReadoutRecord
edm::EDGetTokenT< L1GlobalTriggerRecord > const & l1GtRecordToken() const
edm::InputTag m_l1GtTriggerMenuLiteInputTag
edm::InputTag const & l1GtRecordInputTag() const
edm::InputTag m_l1GtRecordInputTag
std::vector< edm::InputTag > m_inputTagsL1GtMenuLite
bool m_foundMultipleL1GtReadoutRecord
std::vector< edm::InputTag > m_inputTagsL1GtRecord
bool m_foundMultipleL1GtRecord
edm::EDGetTokenT< L1GlobalTriggerRecord > m_l1GtRecordToken
bool m_foundMultipleL1GtMenuLite
edm::ConsumesCollector m_consumesCollector
edm::InputTag const & l1GtTriggerMenuLiteInputTag() const
bool m_foundPreferredReadoutRecord
static const bool useL1GtTriggerMenuLite(true)
std::string const & label() const
Definition: InputTag.h:36
HLT enums.
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtReadoutRecordToken
long double T
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > const & l1GtReadoutRecordToken() const
Definition: vlib.h:198
edm::EDGetTokenT< L1GtTriggerMenuLite > const & l1GtTriggerMenuLiteToken() const
def move(src, dest)
Definition: eostools.py:511
L1GtUtilsHelper(edm::ParameterSet const &pset, edm::ConsumesCollector &iC, bool useL1GtTriggerMenuLite)