CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
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 
83 
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,
132  edm::InputTag const& l1GtRecordInputTag,
133  edm::InputTag const& l1GtReadoutRecordInputTag,
134  edm::InputTag const& l1GtTriggerMenuLiteInputTag) :
135  m_consumesCollector(std::move(iC)),
136 
137  // Set InputTags from arguments
138  m_l1GtRecordInputTag(l1GtRecordInputTag),
139  m_l1GtReadoutRecordInputTag(l1GtReadoutRecordInputTag),
140  m_l1GtTriggerMenuLiteInputTag(l1GtTriggerMenuLiteInputTag),
141 
142  m_findRecord(false),
143  m_findReadoutRecord(false),
144  m_findMenuLite(false),
145 
146  m_foundPreferredRecord(false),
147  m_foundPreferredReadoutRecord(false),
148  m_foundPreferredMenuLite(false),
149 
150  m_foundMultipleL1GtRecord(false),
151  m_foundMultipleL1GtReadoutRecord(false),
152  m_foundMultipleL1GtMenuLite(false) {
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.
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
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
def move
Definition: eostools.py:510
bool m_foundMultipleL1GtReadoutRecord
std::vector< edm::InputTag > m_inputTagsL1GtRecord
static void fillDescription(edm::ParameterSetDescription &desc)
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:43
void operator()(edm::BranchDescription const &branchDescription)
volatile std::atomic< bool > shutdown_flag false
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_l1GtReadoutRecordToken
long double T
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > const & l1GtReadoutRecordToken() const
Definition: vlib.h:208
edm::EDGetTokenT< L1GtTriggerMenuLite > const & l1GtTriggerMenuLiteToken() const
L1GtUtilsHelper(edm::ParameterSet const &pset, edm::ConsumesCollector &iC, bool useL1GtTriggerMenuLite)