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
65  static void fillDescription(edm::ParameterSetDescription& desc);
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 
72  edm::InputTag const& l1tAlgBlkInputTag() const { return m_l1tAlgBlkInputTag; }
73  edm::InputTag const& l1tExtBlkInputTag() const { return m_l1tExtBlkInputTag; }
74 
75  bool const& readPrescalesFromFile() const { return m_readPrescalesFromFile; }
76 
77  edm::EDGetTokenT<GlobalAlgBlkBxCollection> const& l1tAlgBlkToken() const { return m_l1tAlgBlkToken; }
78  edm::EDGetTokenT<GlobalExtBlkBxCollection> const& l1tExtBlkToken() const { return m_l1tExtBlkToken; }
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>
106  L1TGlobalUtilHelper::L1TGlobalUtilHelper(edm::ParameterSet const& pset, edm::ConsumesCollector& iC, T& module)
107  : L1TGlobalUtilHelper(pset, iC, module, edm::InputTag(), edm::InputTag()) {}
108 
109  template <typename T>
112  T& module,
115  : m_consumesCollector(std::move(iC)),
116 
117  // Set InputTags from arguments
118  m_l1tAlgBlkInputTag(l1tAlgBlkInputTag),
119  m_l1tExtBlkInputTag(l1tExtBlkInputTag),
120 
123 
125 
128 
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.
157  if (m_findL1TAlgBlk || m_findL1TExtBlk) {
158  module.callWhenNewProductsRegistered(std::ref(*this));
159  }
160  }
161 
162 } // namespace l1t
163 
164 #endif
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< GlobalAlgBlkBxCollection > const & l1tAlgBlkToken() const
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
std::vector< edm::InputTag > m_inputTagsL1TAlgBlk
delete x;
Definition: CaloConfig.h:22
L1TGlobalUtilHelper(edm::ParameterSet const &pset, edm::ConsumesCollector &iC)
bool const & readPrescalesFromFile() const
std::vector< edm::InputTag > m_inputTagsL1TExtBlk
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
edm::InputTag const & l1tExtBlkInputTag() const
edm::EDGetTokenT< GlobalExtBlkBxCollection > const & l1tExtBlkToken() const
edm::ConsumesCollector m_consumesCollector
edm::InputTag const & l1tAlgBlkInputTag() const
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken
std::string const & label() const
Definition: InputTag.h:36
HLT enums.
long double T
Definition: vlib.h:198
def move(src, dest)
Definition: eostools.py:511