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>
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>
60  T& module,
64 
65  // A module defining its fillDescriptions function might want to use this
67 
71 
75  }
77 
78 private:
79  // Callback which will be registered with the Framework if the InputTags
80  // are not specified in the configuration or constructor arguments. It
81  // will get called for each product in the ProductRegistry.
82  void checkToUpdateTags(edm::BranchDescription const& branchDescription,
84  bool findRecord,
85  bool findReadoutRecord,
86  bool findMenuLite);
87 
91 
95 };
96 
97 template <typename T>
101  T& module)
103 
104 template <typename T>
108  T& module,
112  : // Set InputTags from arguments
113  m_l1GtRecordInputTag(l1GtRecordInputTag),
114  m_l1GtReadoutRecordInputTag(l1GtReadoutRecordInputTag),
115  m_l1GtTriggerMenuLiteInputTag(l1GtTriggerMenuLiteInputTag) {
116  // If the InputTags are not set to valid values by the arguments, then
117  // try to set them from the configuration.
118  if (m_l1GtRecordInputTag.label().empty() && pset.existsAs<edm::InputTag>("l1GtRecordInputTag")) {
119  m_l1GtRecordInputTag = pset.getParameter<edm::InputTag>("l1GtRecordInputTag");
120  }
121  if (m_l1GtReadoutRecordInputTag.label().empty() && pset.existsAs<edm::InputTag>("l1GtReadoutRecordInputTag")) {
122  m_l1GtReadoutRecordInputTag = pset.getParameter<edm::InputTag>("l1GtReadoutRecordInputTag");
123  }
125  pset.existsAs<edm::InputTag>("l1GtTriggerMenuLiteInputTag")) {
126  m_l1GtTriggerMenuLiteInputTag = pset.getParameter<edm::InputTag>("l1GtTriggerMenuLiteInputTag");
127  }
128 
129  // If the InputTags were set to valid values, make the consumes calls.
130  if (!m_l1GtRecordInputTag.label().empty()) {
132  }
133  if (!m_l1GtReadoutRecordInputTag.label().empty()) {
135  }
138  }
139 
140  // Do we still need to search for each InputTag?
141  bool findRecord = m_l1GtRecordInputTag.label().empty();
142  bool findReadoutRecord = m_l1GtReadoutRecordInputTag.label().empty();
143  bool findMenuLite = m_l1GtTriggerMenuLiteInputTag.label().empty() && useL1GtTriggerMenuLite;
144 
145  // Register the callback function with the Framework
146  // if any InputTags still need to be found.
147  if (findRecord || findReadoutRecord || findMenuLite) {
148  module.callWhenNewProductsRegistered([this, findRecord, findReadoutRecord, findMenuLite, iC](auto iBranch) {
149  checkToUpdateTags(iBranch, iC, findRecord, findReadoutRecord, findMenuLite);
150  });
151  }
152 }
153 #endif
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::InputTag m_l1GtReadoutRecordInputTag
edm::EDGetTokenT< L1GtTriggerMenuLite > m_l1GtTriggerMenuLiteToken
edm::EDGetTokenT< L1GlobalTriggerRecord > const & l1GtRecordToken() const
std::string const & label() const
Definition: InputTag.h:36
edm::InputTag m_l1GtTriggerMenuLiteInputTag
edm::InputTag m_l1GtRecordInputTag
edm::InputTag const & l1GtRecordInputTag() const
static void fillDescription(edm::ParameterSetDescription &desc)
edm::EDGetTokenT< L1GlobalTriggerRecord > m_l1GtRecordToken
edm::InputTag const & l1GtTriggerMenuLiteInputTag() const
void checkToUpdateTags(edm::BranchDescription const &branchDescription, edm::ConsumesCollector, bool findRecord, bool findReadoutRecord, bool findMenuLite)
static const bool useL1GtTriggerMenuLite(true)
edm::EDGetTokenT< L1GtTriggerMenuLite > const & l1GtTriggerMenuLiteToken() const
HLT enums.
edm::InputTag const & l1GtReadoutRecordInputTag() const
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > const & l1GtReadoutRecordToken() const
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtReadoutRecordToken
long double T
L1GtUtilsHelper(edm::ParameterSet const &pset, edm::ConsumesCollector &iC, bool useL1GtTriggerMenuLite)