CMS 3D CMS Logo

L1TGlobalUtilHelper.h
Go to the documentation of this file.
1 #ifndef L1TGlobal_l1TGlobalUtilHelper_h
2 #define L1TGlobal_l1TGlobalUtilHelper_h
3 
23 
28 
29 #include <string>
30 #include <utility>
31 
32 namespace edm {
33  class BranchDescription;
35 }
36 
37 namespace l1t {
38 
40 
41  public:
42 
43  // Using this constructor will require InputTags to be specified in the configuration
46 
47  // Using this constructor will cause it to look for valid InputTags in
48  // the following ways in the specified order until they are found.
49  // 1. The configuration
50  // 2. Search all products from the preferred input tags for the required type
51  // 3. Search all products from any other process for the required type
52  template <typename T>
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  T& module,
69 
70  // A module defining its fillDescriptions function might want to use this
71  static void fillDescription(edm::ParameterSetDescription & desc);
72 
73  // Callback which will be registered with the Framework if the InputTags
74  // are not specified in the configuration or constructor arguments. It
75  // will get called for each product in the ProductRegistry.
76  void operator()(edm::BranchDescription const& branchDescription);
77 
78  edm::InputTag const& l1tAlgBlkInputTag() const { return m_l1tAlgBlkInputTag; }
79  edm::InputTag const& l1tExtBlkInputTag() const { return m_l1tExtBlkInputTag; }
80 
81  bool const& readPrescalesFromFile() const {return m_readPrescalesFromFile; }
82 
83  edm::EDGetTokenT<GlobalAlgBlkBxCollection> const& l1tAlgBlkToken() const { return m_l1tAlgBlkToken; }
84  edm::EDGetTokenT<GlobalExtBlkBxCollection> const& l1tExtBlkToken() const { return m_l1tExtBlkToken; }
85 
86  private:
87 
89 
92 
95 
98 
100 
103 
106 
107  // use vector here, InputTag has no '<' operator to use std::set
108  std::vector<edm::InputTag> m_inputTagsL1TAlgBlk;
109  std::vector<edm::InputTag> m_inputTagsL1TExtBlk;
110 
111  };
112 
113  template <typename T>
114  L1TGlobalUtilHelper::L1TGlobalUtilHelper(edm::ParameterSet const& pset,
116  T& module) :
117  L1TGlobalUtilHelper(pset, iC, module, edm::InputTag(), edm::InputTag()) {
118  }
119 
120  template <typename T>
123  T& module,
127 
128  // Set InputTags from arguments
129  m_l1tAlgBlkInputTag(l1tAlgBlkInputTag),
130  m_l1tExtBlkInputTag(l1tExtBlkInputTag),
131 
134 
136 
139 
142 
143  if (pset.existsAs<bool>("ReadPrescalesFromFile")) {
144  m_readPrescalesFromFile = pset.getParameter<bool>("ReadPrescalesFromFile");
145  }
146  // If the InputTags are not set to valid values by the arguments, then
147  // try to set them from the configuration.
148  if(m_l1tAlgBlkInputTag.label().empty() &&
149  pset.existsAs<edm::InputTag>("l1tAlgBlkInputTag")) {
150  m_l1tAlgBlkInputTag = pset.getParameter<edm::InputTag>("l1tAlgBlkInputTag");
151  }
152  if(m_l1tExtBlkInputTag.label().empty() &&
153  pset.existsAs<edm::InputTag>("l1tExtBlkInputTag")) {
154  m_l1tExtBlkInputTag = pset.getParameter<edm::InputTag>("l1tExtBlkInputTag");
155  }
156 
157  // If the InputTags were set to valid values, make the consumes calls.
158  if(!m_l1tAlgBlkInputTag.label().empty()) {
160  }
161  if(!m_l1tExtBlkInputTag.label().empty()) {
163  }
164 
165  // Do we still need to search for each InputTag?
168 
169  // Register the callback function with the Framework
170  // if any InputTags still need to be found.
171  if(m_findL1TAlgBlk || m_findL1TExtBlk) {
172  module.callWhenNewProductsRegistered(std::ref(*this));
173  }
174  }
175 
176 }
177 
178 #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:161
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:208
def move(src, dest)
Definition: eostools.py:511