CMS 3D CMS Logo

L1TGlobalUtilHelper.h
Go to the documentation of this file.
1 #ifndef L1TGlobal_l1TGlobalUtilHelper_h
2 #define L1TGlobal_l1TGlobalUtilHelper_h
3 
22 
27 
28 #include <string>
29 #include <utility>
30 
31 namespace edm {
32  class BranchDescription;
34 } // namespace edm
35 
36 namespace l1t {
37 
39  public:
40  // Using this constructor will require InputTags to be specified in the configuration
42 
43  // Using this constructor will cause it to look for valid InputTags in
44  // the following ways in the specified order until they are found.
45  // 1. The configuration
46  // 2. Search all products from the preferred input tags for the required type
47  // 3. Search all products from any other process for the required type
48  template <typename T>
50 
51  // Using this constructor will cause it to look for valid InputTags in
52  // the following ways in the specified order until they are found.
53  // 1. The constructor arguments
54  // 2. The configuration
55  // 3. Search all products from the preferred input tags for the required type
56  // 4. Search all products from any other process for the required type
57  template <typename T>
60  T& module,
63 
64  // A module defining its fillDescriptions function might want to use this
66 
67  // Callback which will be registered with the Framework if the InputTags
68  // are not specified in the configuration or constructor arguments. It
69  // will get called for each product in the ProductRegistry.
70  void operator()(edm::BranchDescription const& branchDescription);
71 
74 
75  bool const& readPrescalesFromFile() const { return m_readPrescalesFromFile; }
76 
79 
80  private:
82 
85 
88 
91 
93 
96 
99 
100  // use vector here, InputTag has no '<' operator to use std::set
101  std::vector<edm::InputTag> m_inputTagsL1TAlgBlk;
102  std::vector<edm::InputTag> m_inputTagsL1TExtBlk;
103  };
104 
105  template <typename T>
108 
109  template <typename T>
112  T& module,
115  : m_consumesCollector(iC),
116 
117  // Set InputTags from arguments
118  m_l1tAlgBlkInputTag(l1tAlgBlkInputTag),
119  m_l1tExtBlkInputTag(l1tExtBlkInputTag),
120 
121  m_findL1TAlgBlk(false),
122  m_findL1TExtBlk(false),
123 
124  m_readPrescalesFromFile(false),
125 
126  m_foundPreferredL1TAlgBlk(false),
127  m_foundPreferredL1TExtBlk(false),
128 
129  m_foundMultipleL1TAlgBlk(false),
130  m_foundMultipleL1TExtBlk(false) {
131  if (pset.existsAs<bool>("ReadPrescalesFromFile")) {
132  m_readPrescalesFromFile = pset.getParameter<bool>("ReadPrescalesFromFile");
133  }
134  // If the InputTags are not set to valid values by the arguments, then
135  // try to set them from the configuration.
136  if (m_l1tAlgBlkInputTag.label().empty() && pset.existsAs<edm::InputTag>("l1tAlgBlkInputTag")) {
137  m_l1tAlgBlkInputTag = pset.getParameter<edm::InputTag>("l1tAlgBlkInputTag");
138  }
139  if (m_l1tExtBlkInputTag.label().empty() && pset.existsAs<edm::InputTag>("l1tExtBlkInputTag")) {
140  m_l1tExtBlkInputTag = pset.getParameter<edm::InputTag>("l1tExtBlkInputTag");
141  }
142 
143  // If the InputTags were set to valid values, make the consumes calls.
144  if (!m_l1tAlgBlkInputTag.label().empty()) {
146  }
147  if (!m_l1tExtBlkInputTag.label().empty()) {
149  }
150 
151  // Do we still need to search for each InputTag?
154 
155  // Register the callback function with the Framework
156  // if any InputTags still need to be found.
158  module.callWhenNewProductsRegistered(std::ref(*this));
159  }
160  }
161 
162 } // namespace l1t
163 
164 #endif
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< edm::InputTag > m_inputTagsL1TAlgBlk
edm::EDGetTokenT< GlobalAlgBlkBxCollection > const & l1tAlgBlkToken() const
edm::InputTag const & l1tAlgBlkInputTag() const
bool const & readPrescalesFromFile() const
delete x;
Definition: CaloConfig.h:22
std::string const & label() const
Definition: InputTag.h:36
L1TGlobalUtilHelper(edm::ParameterSet const &pset, edm::ConsumesCollector &iC)
std::vector< edm::InputTag > m_inputTagsL1TExtBlk
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
edm::ConsumesCollector m_consumesCollector
static void fillDescription(edm::ParameterSetDescription &desc)
edm::InputTag const & l1tExtBlkInputTag() const
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken
edm::EDGetTokenT< GlobalExtBlkBxCollection > const & l1tExtBlkToken() const
HLT enums.
void operator()(edm::BranchDescription const &branchDescription)
long double T