CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
l1t::L1TGlobalUtilHelper Class Reference

#include <L1TGlobalUtilHelper.h>

Public Member Functions

edm::InputTag const & l1tAlgBlkInputTag () const
 
edm::EDGetTokenT< GlobalAlgBlkBxCollection > const & l1tAlgBlkToken () const
 
edm::InputTag const & l1tExtBlkInputTag () const
 
edm::EDGetTokenT< GlobalExtBlkBxCollection > const & l1tExtBlkToken () const
 
 L1TGlobalUtilHelper (edm::ParameterSet const &pset, edm::ConsumesCollector &iC)
 
template<typename T >
 L1TGlobalUtilHelper (edm::ParameterSet const &pset, edm::ConsumesCollector &iC, T &module)
 
template<typename T >
 L1TGlobalUtilHelper (edm::ParameterSet const &pset, edm::ConsumesCollector &iC, T &module, edm::InputTag const &l1tAlgBlkInputTag, edm::InputTag const &l1tExtBlkInputTag)
 
bool const & readPrescalesFromFile () const
 

Static Public Member Functions

static void fillDescription (edm::ParameterSetDescription &desc, edm::InputTag const &iAlg, edm::InputTag const &iExt, bool readPrescalesFromFile)
 

Private Member Functions

void checkToUpdateTags (edm::BranchDescription const &branchDescription, edm::ConsumesCollector, bool findL1TAlgBlk, bool findL1TExtBlk)
 

Private Attributes

edm::InputTag m_l1tAlgBlkInputTag
 
edm::EDGetTokenT< GlobalAlgBlkBxCollectionm_l1tAlgBlkToken
 
edm::InputTag m_l1tExtBlkInputTag
 
edm::EDGetTokenT< GlobalExtBlkBxCollectionm_l1tExtBlkToken
 
bool m_readPrescalesFromFile
 

Detailed Description

Definition at line 38 of file L1TGlobalUtilHelper.h.

Constructor & Destructor Documentation

◆ L1TGlobalUtilHelper() [1/3]

L1TGlobalUtilHelper::L1TGlobalUtilHelper ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC 
)

Definition at line 9 of file L1TGlobalUtilHelper.cc.

References edm::ConsumesCollector::consumes(), m_l1tAlgBlkInputTag, m_l1tAlgBlkToken, m_l1tExtBlkInputTag, and m_l1tExtBlkToken.

10  : m_l1tAlgBlkInputTag(pset.getParameter<edm::InputTag>("l1tAlgBlkInputTag")),
11  m_l1tExtBlkInputTag(pset.getParameter<edm::InputTag>("l1tExtBlkInputTag")),
12  m_readPrescalesFromFile(pset.getParameter<bool>("ReadPrescalesFromFile")) {
15 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken

◆ L1TGlobalUtilHelper() [2/3]

template<typename T >
L1TGlobalUtilHelper::L1TGlobalUtilHelper ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC,
T module 
)

Definition at line 97 of file L1TGlobalUtilHelper.h.

L1TGlobalUtilHelper(edm::ParameterSet const &pset, edm::ConsumesCollector &iC)

◆ L1TGlobalUtilHelper() [3/3]

template<typename T >
L1TGlobalUtilHelper::L1TGlobalUtilHelper ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC,
T module,
edm::InputTag const &  l1tAlgBlkInputTag,
edm::InputTag const &  l1tExtBlkInputTag 
)

Definition at line 101 of file L1TGlobalUtilHelper.h.

References cms::Exception::addContext(), checkToUpdateTags(), edm::ConsumesCollector::consumes(), label, edm::InputTag::label(), m_l1tAlgBlkInputTag, m_l1tAlgBlkToken, m_l1tExtBlkInputTag, m_l1tExtBlkToken, m_readPrescalesFromFile, callgraph::module, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

106  : // Set InputTags from arguments
109  m_readPrescalesFromFile(false) {
110  if (pset.existsAs<bool>("ReadPrescalesFromFile")) {
111  m_readPrescalesFromFile = pset.getParameter<bool>("ReadPrescalesFromFile");
112  }
113  // If the InputTags are not set to valid values by the arguments, then
114  // try to set them from the configuration.
115  if (m_l1tAlgBlkInputTag.label().empty() && pset.existsAs<edm::InputTag>("l1tAlgBlkInputTag")) {
116  m_l1tAlgBlkInputTag = pset.getParameter<edm::InputTag>("l1tAlgBlkInputTag");
117  }
118  if (m_l1tExtBlkInputTag.label().empty() && pset.existsAs<edm::InputTag>("l1tExtBlkInputTag")) {
119  m_l1tExtBlkInputTag = pset.getParameter<edm::InputTag>("l1tExtBlkInputTag");
120  }
121 
122  // If the InputTags were set to valid values, make the consumes calls.
123  if (!m_l1tAlgBlkInputTag.label().empty()) {
125  }
126 
127  if (!m_l1tExtBlkInputTag.label().empty()) {
129  }
130 
131  // Do we still need to search for each InputTag?
132  bool findL1TAlgBlk = m_l1tAlgBlkInputTag.label().empty();
133  bool findL1TExtBlk = m_l1tExtBlkInputTag.label().empty();
134 
135  // Register the callback function with the Framework
136  // if any InputTags still need to be found.
137  if (findL1TAlgBlk || findL1TExtBlk) {
138  auto const* pModule = &module;
139  module.callWhenNewProductsRegistered([this, findL1TAlgBlk, findL1TExtBlk, iC, pModule](auto iBranch) {
140  try {
141  checkToUpdateTags(iBranch, iC, findL1TAlgBlk, findL1TExtBlk);
142  } catch (cms::Exception& iExcept) {
143  auto const& label = pModule->moduleDescription().moduleLabel();
144  iExcept.addContext(std::string("Running 'callWhenNewProductRegistered' for module ") + label);
145  throw;
146  }
147  });
148  }
149  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::InputTag const & l1tAlgBlkInputTag() const
std::string const & label() const
Definition: InputTag.h:36
char const * label
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
edm::InputTag const & l1tExtBlkInputTag() const
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken
void addContext(std::string const &context)
Definition: Exception.cc:165
void checkToUpdateTags(edm::BranchDescription const &branchDescription, edm::ConsumesCollector, bool findL1TAlgBlk, bool findL1TExtBlk)

Member Function Documentation

◆ checkToUpdateTags()

void L1TGlobalUtilHelper::checkToUpdateTags ( edm::BranchDescription const &  branchDescription,
edm::ConsumesCollector  consumesCollector,
bool  findL1TAlgBlk,
bool  findL1TExtBlk 
)
private

Definition at line 85 of file L1TGlobalUtilHelper.cc.

References edm::BranchDescription::branchType(), edm::BranchDescription::dropped(), edm::InEvent, HLT_2022v15_cff::InputTag, and edm::BranchDescription::unwrappedTypeID().

Referenced by L1TGlobalUtilHelper().

88  {
89  // This is only used if required InputTags were not specified already.
90  // This is called early in the process, once for each product in the ProductRegistry.
91  // The callback is registered when callWhenNewProductsRegistered is called.
92  // It finds products by type and sets the token so that it can be used
93  // later when getting the product.
94 
95  // The code will look for the corresponding product in ProductRegistry.
96  // If the product is found, it checks the product label in
97  // a vector of preferred input tags (hardwired now to "gtDigis" and
98  // "hltGtDigis"). The first input tag from the vector of preferred input tags, with the
99  // same label as the input tag found from provenance, is kept as input tag, if there are no
100  // multiple products with the same label.
101 
102  // If multiple products are found and no one has a label in the vector of preferred input tags,
103  // or if multiple products are found with the label in the vector of preferred input tags
104  // (with different instance or process) the input tag is set to empty input tag, and L1GtUtil
105  // will produce an error, as it is not possible to safely choose a product. In this case, one must
106  // provide explicitly the correct input tag via configuration or in the constructor.
107 
108  // TODO decide if the preferred input tags must be given as input parameters
109  // or stay hardwired
110 
111  if (branchDescription.dropped()) {
112  return;
113  }
114 
115  std::vector<edm::InputTag> preferredL1TAlgBlkInputTag = {edm::InputTag("gtStage2Digis"),
116  edm::InputTag("hltGtStage2Digis")};
117 
118  std::vector<edm::InputTag> preferredL1TExtBlkInputTag = {edm::InputTag("gtStage2Digis"),
119  edm::InputTag("hltGtStage2Digis")};
120 
121  // GlobalAlgBlkBxCollection
122 
123  if (findL1TAlgBlk && (branchDescription.unwrappedTypeID() == edm::TypeID(typeid(GlobalAlgBlkBxCollection))) &&
124  (branchDescription.branchType() == edm::InEvent)) {
125  setConsumesAndCheckAmbiguities(branchDescription,
126  preferredL1TAlgBlkInputTag,
129  consumesCollector,
130  "GlobalAlgBlkBxCollection");
131  }
132 
133  // GlobalExtBlkBxCollection
134 
135  if (findL1TExtBlk && (branchDescription.unwrappedTypeID() == edm::TypeID(typeid(GlobalExtBlkBxCollection))) &&
136  (branchDescription.branchType() == edm::InEvent)) {
137  setConsumesAndCheckAmbiguities(branchDescription,
138  preferredL1TExtBlkInputTag,
141  consumesCollector,
142  "GlobalExtBlkBxCollection");
143  }
144 }
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken

◆ fillDescription()

void L1TGlobalUtilHelper::fillDescription ( edm::ParameterSetDescription desc,
edm::InputTag const &  iAlg,
edm::InputTag const &  iExt,
bool  readPrescalesFromFile 
)
static

Definition at line 17 of file L1TGlobalUtilHelper.cc.

References submitPVResolutionJobs::desc.

Referenced by l1t::L1TGlobalUtil::fillDescription().

20  {
21  desc.add<edm::InputTag>("l1tAlgBlkInputTag", iAlg);
22  desc.add<edm::InputTag>("l1tExtBlkInputTag", iExt);
23  desc.add<bool>("ReadPrescalesFromFile", readPrescalesFromFile);
24 }
bool const & readPrescalesFromFile() const

◆ l1tAlgBlkInputTag()

edm::InputTag const& l1t::L1TGlobalUtilHelper::l1tAlgBlkInputTag ( ) const
inline

Definition at line 70 of file L1TGlobalUtilHelper.h.

References m_l1tAlgBlkInputTag.

70 { return m_l1tAlgBlkInputTag; }

◆ l1tAlgBlkToken()

edm::EDGetTokenT<GlobalAlgBlkBxCollection> const& l1t::L1TGlobalUtilHelper::l1tAlgBlkToken ( ) const
inline

Definition at line 75 of file L1TGlobalUtilHelper.h.

References m_l1tAlgBlkToken.

75 { return m_l1tAlgBlkToken; }
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken

◆ l1tExtBlkInputTag()

edm::InputTag const& l1t::L1TGlobalUtilHelper::l1tExtBlkInputTag ( ) const
inline

Definition at line 71 of file L1TGlobalUtilHelper.h.

References m_l1tExtBlkInputTag.

71 { return m_l1tExtBlkInputTag; }

◆ l1tExtBlkToken()

edm::EDGetTokenT<GlobalExtBlkBxCollection> const& l1t::L1TGlobalUtilHelper::l1tExtBlkToken ( ) const
inline

Definition at line 76 of file L1TGlobalUtilHelper.h.

References m_l1tExtBlkToken.

76 { return m_l1tExtBlkToken; }
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken

◆ readPrescalesFromFile()

bool const& l1t::L1TGlobalUtilHelper::readPrescalesFromFile ( ) const
inline

Definition at line 73 of file L1TGlobalUtilHelper.h.

References m_readPrescalesFromFile.

Member Data Documentation

◆ m_l1tAlgBlkInputTag

edm::InputTag l1t::L1TGlobalUtilHelper::m_l1tAlgBlkInputTag
private

Definition at line 87 of file L1TGlobalUtilHelper.h.

Referenced by l1tAlgBlkInputTag(), and L1TGlobalUtilHelper().

◆ m_l1tAlgBlkToken

edm::EDGetTokenT<GlobalAlgBlkBxCollection> l1t::L1TGlobalUtilHelper::m_l1tAlgBlkToken
private

Definition at line 90 of file L1TGlobalUtilHelper.h.

Referenced by l1tAlgBlkToken(), and L1TGlobalUtilHelper().

◆ m_l1tExtBlkInputTag

edm::InputTag l1t::L1TGlobalUtilHelper::m_l1tExtBlkInputTag
private

Definition at line 88 of file L1TGlobalUtilHelper.h.

Referenced by l1tExtBlkInputTag(), and L1TGlobalUtilHelper().

◆ m_l1tExtBlkToken

edm::EDGetTokenT<GlobalExtBlkBxCollection> l1t::L1TGlobalUtilHelper::m_l1tExtBlkToken
private

Definition at line 91 of file L1TGlobalUtilHelper.h.

Referenced by l1tExtBlkToken(), and L1TGlobalUtilHelper().

◆ m_readPrescalesFromFile

bool l1t::L1TGlobalUtilHelper::m_readPrescalesFromFile
private

Definition at line 93 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper(), and readPrescalesFromFile().