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 }
36 
38 
39 public:
40 
41  // Using this constructor will require InputTags to be specified in the configuration
45 
46  // Using this constructor will cause it to look for valid InputTags in
47  // the following ways in the specified order until they are found.
48  // 1. The configuration
49  // 2. Search all products from the preferred input tags for the required type
50  // 3. Search all products from any other process for the required type
51  template <typename T>
54  bool useL1GtTriggerMenuLite,
55  T& module);
56 
57  // Using this constructor will cause it to look for valid InputTags in
58  // the following ways in the specified order until they are found.
59  // 1. The constructor arguments
60  // 2. The configuration
61  // 3. Search all products from the preferred input tags for the required type
62  // 4. Search all products from any other process for the required type
63  template <typename T>
66  bool useL1GtTriggerMenuLite,
67  T& module,
71 
72  // A module defining its fillDescriptions function might want to use this
73  static void fillDescription(edm::ParameterSetDescription & desc);
74 
75  // Callback which will be registered with the Framework if the InputTags
76  // are not specified in the configuration or constructor arguments. It
77  // will get called for each product in the ProductRegistry.
78  void operator()(edm::BranchDescription const& branchDescription);
79 
80  edm::InputTag const& l1GtRecordInputTag() const { return m_l1GtRecordInputTag; }
81  edm::InputTag const& l1GtReadoutRecordInputTag() const { return m_l1GtReadoutRecordInputTag; }
82  edm::InputTag const& l1GtTriggerMenuLiteInputTag() const { return m_l1GtTriggerMenuLiteInputTag; }
83 
84  edm::EDGetTokenT<L1GlobalTriggerRecord> const& l1GtRecordToken() const { return m_l1GtRecordToken; }
85  edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> const& l1GtReadoutRecordToken() const { return m_l1GtReadoutRecordToken; }
86  edm::EDGetTokenT<L1GtTriggerMenuLite> const& l1GtTriggerMenuLiteToken() const { return m_l1GtTriggerMenuLiteToken; }
87 
88 private:
89 
91 
95 
99 
103 
107 
111 
112  // use vector here, InputTag has no '<' operator to use std::set
113  std::vector<edm::InputTag> m_inputTagsL1GtRecord;
114  std::vector<edm::InputTag> m_inputTagsL1GtReadoutRecord;
115  std::vector<edm::InputTag> m_inputTagsL1GtMenuLite;
116 
117 };
118 
119 template <typename T>
123  T& module) :
124  L1GtUtilsHelper(pset, iC, useL1GtTriggerMenuLite, module, edm::InputTag(), edm::InputTag(), edm::InputTag()) {
125 }
126 
127 template <typename T>
131  T& module,
136 
137  // Set InputTags from arguments
138  m_l1GtRecordInputTag(l1GtRecordInputTag),
139  m_l1GtReadoutRecordInputTag(l1GtReadoutRecordInputTag),
140  m_l1GtTriggerMenuLiteInputTag(l1GtTriggerMenuLiteInputTag),
141 
145 
149 
153 
154  // If the InputTags are not set to valid values by the arguments, then
155  // try to set them from the configuration.
156  if(m_l1GtRecordInputTag.label().empty() &&
157  pset.existsAs<edm::InputTag>("l1GtRecordInputTag")) {
158  m_l1GtRecordInputTag = pset.getParameter<edm::InputTag>("l1GtRecordInputTag");
159  }
160  if(m_l1GtReadoutRecordInputTag.label().empty() &&
161  pset.existsAs<edm::InputTag>("l1GtReadoutRecordInputTag")) {
162  m_l1GtReadoutRecordInputTag = pset.getParameter<edm::InputTag>("l1GtReadoutRecordInputTag");
163  }
164  if(useL1GtTriggerMenuLite &&
166  pset.existsAs<edm::InputTag>("l1GtTriggerMenuLiteInputTag")) {
167  m_l1GtTriggerMenuLiteInputTag = pset.getParameter<edm::InputTag>("l1GtTriggerMenuLiteInputTag");
168  }
169 
170  // If the InputTags were set to valid values, make the consumes calls.
171  if(!m_l1GtRecordInputTag.label().empty()) {
173  }
174  if(!m_l1GtReadoutRecordInputTag.label().empty()) {
176  }
177  if(useL1GtTriggerMenuLite && !m_l1GtTriggerMenuLiteInputTag.label().empty()) {
179  }
180 
181  // Do we still need to search for each InputTag?
185 
186  // Register the callback function with the Framework
187  // if any InputTags still need to be found.
188  if(m_findRecord || m_findReadoutRecord || m_findMenuLite) {
189  module.callWhenNewProductsRegistered(std::ref(*this));
190  }
191 }
192 #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:186
edm::InputTag m_l1GtReadoutRecordInputTag
edm::EDGetTokenT< L1GtTriggerMenuLite > m_l1GtTriggerMenuLiteToken
std::vector< edm::InputTag > m_inputTagsL1GtReadoutRecord
static const bool useL1GtTriggerMenuLite(true)
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
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:208
edm::EDGetTokenT< L1GtTriggerMenuLite > const & l1GtTriggerMenuLiteToken() const
def move(src, dest)
Definition: eostools.py:510
L1GtUtilsHelper(edm::ParameterSet const &pset, edm::ConsumesCollector &iC, bool useL1GtTriggerMenuLite)