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>
107  : L1TGlobalUtilHelper(pset, iC, module, edm::InputTag(), edm::InputTag()) {}
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
funct::false
false
Definition: Factorize.h:29
l1t::L1TGlobalUtilHelper::l1tAlgBlkInputTag
edm::InputTag const & l1tAlgBlkInputTag() const
Definition: L1TGlobalUtilHelper.h:72
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
GlobalExtBlk.h
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
l1t::L1TGlobalUtilHelper::m_findL1TExtBlk
bool m_findL1TExtBlk
Definition: L1TGlobalUtilHelper.h:90
l1t::L1TGlobalUtilHelper::m_foundMultipleL1TAlgBlk
bool m_foundMultipleL1TAlgBlk
Definition: L1TGlobalUtilHelper.h:97
BXVector
Definition: BXVector.h:15
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
l1t::L1TGlobalUtilHelper::fillDescription
static void fillDescription(edm::ParameterSetDescription &desc)
Definition: L1TGlobalUtilHelper.cc:22
l1t::L1TGlobalUtilHelper::m_l1tExtBlkInputTag
edm::InputTag m_l1tExtBlkInputTag
Definition: L1TGlobalUtilHelper.h:84
l1t::L1TGlobalUtilHelper::L1TGlobalUtilHelper
L1TGlobalUtilHelper(edm::ParameterSet const &pset, edm::ConsumesCollector &iC)
Definition: L1TGlobalUtilHelper.cc:9
l1t::L1TGlobalUtilHelper::readPrescalesFromFile
bool const & readPrescalesFromFile() const
Definition: L1TGlobalUtilHelper.h:75
SiStripSourceConfigTier0_cff.l1tExtBlkInputTag
l1tExtBlkInputTag
Definition: SiStripSourceConfigTier0_cff.py:73
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
l1t::L1TGlobalUtilHelper::l1tAlgBlkToken
edm::EDGetTokenT< GlobalAlgBlkBxCollection > const & l1tAlgBlkToken() const
Definition: L1TGlobalUtilHelper.h:77
l1t::L1TGlobalUtilHelper::m_foundPreferredL1TAlgBlk
bool m_foundPreferredL1TAlgBlk
Definition: L1TGlobalUtilHelper.h:94
EDGetToken.h
l1t::L1TGlobalUtilHelper::m_inputTagsL1TExtBlk
std::vector< edm::InputTag > m_inputTagsL1TExtBlk
Definition: L1TGlobalUtilHelper.h:102
l1t::L1TGlobalUtilHelper::m_l1tExtBlkToken
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
Definition: L1TGlobalUtilHelper.h:87
l1t::L1TGlobalUtilHelper::m_findL1TAlgBlk
bool m_findL1TAlgBlk
Definition: L1TGlobalUtilHelper.h:89
l1t::L1TGlobalUtilHelper::m_foundMultipleL1TExtBlk
bool m_foundMultipleL1TExtBlk
Definition: L1TGlobalUtilHelper.h:98
l1t::L1TGlobalUtilHelper::m_inputTagsL1TAlgBlk
std::vector< edm::InputTag > m_inputTagsL1TAlgBlk
Definition: L1TGlobalUtilHelper.h:101
edm::ParameterSet
Definition: ParameterSet.h:47
l1t
delete x;
Definition: CaloConfig.h:22
GlobalAlgBlk.h
l1t::L1TGlobalUtilHelper::l1tExtBlkInputTag
edm::InputTag const & l1tExtBlkInputTag() const
Definition: L1TGlobalUtilHelper.h:73
l1t::L1TGlobalUtilHelper::operator()
void operator()(edm::BranchDescription const &branchDescription)
Definition: L1TGlobalUtilHelper.cc:28
InputTag.h
l1t::L1TGlobalUtilHelper::m_readPrescalesFromFile
bool m_readPrescalesFromFile
Definition: L1TGlobalUtilHelper.h:92
l1t::L1TGlobalUtilHelper::m_l1tAlgBlkToken
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken
Definition: L1TGlobalUtilHelper.h:86
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
l1t::L1TGlobalUtilHelper::m_consumesCollector
edm::ConsumesCollector m_consumesCollector
Definition: L1TGlobalUtilHelper.h:81
T
long double T
Definition: Basic3DVectorLD.h:48
l1t::L1TGlobalUtilHelper::l1tExtBlkToken
edm::EDGetTokenT< GlobalExtBlkBxCollection > const & l1tExtBlkToken() const
Definition: L1TGlobalUtilHelper.h:78
l1t::L1TGlobalUtilHelper::m_l1tAlgBlkInputTag
edm::InputTag m_l1tAlgBlkInputTag
Definition: L1TGlobalUtilHelper.h:83
ParameterSetDescription
edm::BranchDescription
Definition: BranchDescription.h:32
ConsumesCollector.h
ParameterSet.h
l1t::L1TGlobalUtilHelper::m_foundPreferredL1TExtBlk
bool m_foundPreferredL1TExtBlk
Definition: L1TGlobalUtilHelper.h:95
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
l1t::L1TGlobalUtilHelper
Definition: L1TGlobalUtilHelper.h:38
SiStripSourceConfigTier0_cff.l1tAlgBlkInputTag
l1tAlgBlkInputTag
Definition: SiStripSourceConfigTier0_cff.py:72