CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public 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)
 
void operator() (edm::BranchDescription const &branchDescription)
 
bool const & readPrescalesFromFile () const
 

Static Public Member Functions

static void fillDescription (edm::ParameterSetDescription &desc)
 

Private Attributes

edm::ConsumesCollector m_consumesCollector
 
bool m_findL1TAlgBlk
 
bool m_findL1TExtBlk
 
bool m_foundMultipleL1TAlgBlk
 
bool m_foundMultipleL1TExtBlk
 
bool m_foundPreferredL1TAlgBlk
 
bool m_foundPreferredL1TExtBlk
 
std::vector< edm::InputTagm_inputTagsL1TAlgBlk
 
std::vector< edm::InputTagm_inputTagsL1TExtBlk
 
edm::InputTag m_l1tAlgBlkInputTag
 
edm::EDGetTokenT
< GlobalAlgBlkBxCollection
m_l1tAlgBlkToken
 
edm::InputTag m_l1tExtBlkInputTag
 
edm::EDGetTokenT
< GlobalExtBlkBxCollection
m_l1tExtBlkToken
 
bool m_readPrescalesFromFile
 

Detailed Description

Definition at line 38 of file L1TGlobalUtilHelper.h.

Constructor & Destructor Documentation

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_consumesCollector(iC),
11  m_l1tAlgBlkInputTag(pset.getParameter<edm::InputTag>("l1tAlgBlkInputTag")),
12  m_l1tExtBlkInputTag(pset.getParameter<edm::InputTag>("l1tExtBlkInputTag")),
13  m_findL1TAlgBlk(false),
14  m_findL1TExtBlk(false),
15  m_readPrescalesFromFile(pset.getParameter<bool>("ReadPrescalesFromFile")),
20 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
edm::ConsumesCollector m_consumesCollector
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken
template<typename T >
L1TGlobalUtilHelper::L1TGlobalUtilHelper ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC,
T module 
)

Definition at line 106 of file L1TGlobalUtilHelper.h.

L1TGlobalUtilHelper(edm::ParameterSet const &pset, edm::ConsumesCollector &iC)
tuple module
Definition: callgraph.py:69
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 110 of file L1TGlobalUtilHelper.h.

References edm::ConsumesCollector::consumes(), edm::ParameterSet::existsAs(), edm::ParameterSet::getParameter(), edm::InputTag::label(), m_findL1TAlgBlk, m_findL1TExtBlk, m_l1tAlgBlkInputTag, m_l1tAlgBlkToken, m_l1tExtBlkInputTag, m_l1tExtBlkToken, and m_readPrescalesFromFile.

115  : m_consumesCollector(iC),
116 
117  // Set InputTags from arguments
120 
121  m_findL1TAlgBlk(false),
122  m_findL1TExtBlk(false),
123 
125 
128 
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  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
edm::InputTag const & l1tExtBlkInputTag() const
edm::ConsumesCollector m_consumesCollector
edm::InputTag const & l1tAlgBlkInputTag() const
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken
std::string const & label() const
Definition: InputTag.h:36
tuple module
Definition: callgraph.py:69

Member Function Documentation

void L1TGlobalUtilHelper::fillDescription ( edm::ParameterSetDescription desc)
static

Definition at line 22 of file L1TGlobalUtilHelper.cc.

References edm::ParameterSetDescription::add(), and HLT_FULL_cff::InputTag.

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

22  {
23  desc.add<edm::InputTag>("l1tAlgBlkInputTag", edm::InputTag());
24  desc.add<edm::InputTag>("l1tExtBlkInputTag", edm::InputTag());
25  desc.add<bool>("ReadPrescalesFromFile", false);
26 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::InputTag const& l1t::L1TGlobalUtilHelper::l1tAlgBlkInputTag ( ) const
inline

Definition at line 72 of file L1TGlobalUtilHelper.h.

References m_l1tAlgBlkInputTag.

72 { return m_l1tAlgBlkInputTag; }
edm::EDGetTokenT<GlobalAlgBlkBxCollection> const& l1t::L1TGlobalUtilHelper::l1tAlgBlkToken ( ) const
inline

Definition at line 77 of file L1TGlobalUtilHelper.h.

References m_l1tAlgBlkToken.

77 { return m_l1tAlgBlkToken; }
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken
edm::InputTag const& l1t::L1TGlobalUtilHelper::l1tExtBlkInputTag ( ) const
inline

Definition at line 73 of file L1TGlobalUtilHelper.h.

References m_l1tExtBlkInputTag.

73 { return m_l1tExtBlkInputTag; }
edm::EDGetTokenT<GlobalExtBlkBxCollection> const& l1t::L1TGlobalUtilHelper::l1tExtBlkToken ( ) const
inline

Definition at line 78 of file L1TGlobalUtilHelper.h.

References m_l1tExtBlkToken.

78 { return m_l1tExtBlkToken; }
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
void L1TGlobalUtilHelper::operator() ( edm::BranchDescription const &  branchDescription)

Definition at line 28 of file L1TGlobalUtilHelper.cc.

References edm::BranchDescription::branchType(), edm::BranchDescription::dropped(), edm::InEvent, HLT_FULL_cff::InputTag, LogDebug, edm::BranchDescription::moduleLabel(), edm::BranchDescription::processName(), edm::BranchDescription::productInstanceName(), BXVector< T >::push_back(), GlobalPosition_Frontier_DevDB_cff::tag, and edm::BranchDescription::unwrappedTypeID().

28  {
29  // This is only used if required InputTags were not specified already.
30  // This is called early in the process, once for each product in the ProductRegistry.
31  // The callback is registered when callWhenNewProductsRegistered is called.
32  // It finds products by type and sets the token so that it can be used
33  // later when getting the product.
34 
35  // The code will look for the corresponding product in ProductRegistry.
36  // If the product is found, it checks the product label in
37  // a vector of preferred input tags (hardwired now to "gtDigis" and
38  // "hltGtDigis"). The first input tag from the vector of preferred input tags, with the
39  // same label as the input tag found from provenance, is kept as input tag, if there are no
40  // multiple products with the same label.
41 
42  // If multiple products are found and no one has a label in the vector of preferred input tags,
43  // or if multiple products are found with the label in the vector of preferred input tags
44  // (with different instance or process) the input tag is set to empty input tag, and L1GtUtil
45  // will produce an error, as it is not possible to safely choose a product. In this case, one must
46  // provide explicitly the correct input tag via configuration or in the constructor.
47 
48  // TODO decide if the preferred input tags must be given as input parameters
49  // or stay hardwired
50 
51  if (branchDescription.dropped()) {
52  return;
53  }
54 
55  std::vector<edm::InputTag> preferredL1TAlgBlkInputTag = {edm::InputTag("gtStage2Digis"),
56  edm::InputTag("hltGtStage2Digis")};
57 
58  std::vector<edm::InputTag> preferredL1TExtBlkInputTag = {edm::InputTag("gtStage2Digis"),
59  edm::InputTag("hltGtStage2Digis")};
60 
61  // GlobalAlgBlkBxCollection
62 
64  (branchDescription.unwrappedTypeID() == edm::TypeID(typeid(GlobalAlgBlkBxCollection))) &&
65  (branchDescription.branchType() == edm::InEvent)) {
67  branchDescription.moduleLabel(), branchDescription.productInstanceName(), branchDescription.processName()};
68 
70  // check if a preferred input tag was already found and compare it with the actual tag
71  // if the instance or the process names are different, one has incompatible tags - set
72  // the tag to empty input tag and indicate that multiple preferred input tags are found
73  // so it is not possibly to choose safely an input tag
74 
75  if ((m_l1tAlgBlkInputTag.label() == branchDescription.moduleLabel()) &&
76  ((m_l1tAlgBlkInputTag.instance() != branchDescription.productInstanceName()) ||
77  (m_l1tAlgBlkInputTag.process() != branchDescription.processName()))) {
78  LogDebug("L1TGlobalUtil") << "\nWARNING: Found multiple preferred input tags for GlobalAlgBlkBxCollection, "
79  << "\nwith different instaces or processes."
80  << "\nInput tag already found: " << (m_l1tAlgBlkInputTag) << "\nActual tag: " << (tag)
81  << "\nInput tag set to empty tag." << std::endl;
82 
85  }
86  } else {
87  // no preferred input tag found yet, check now with the actual tag
88  for (std::vector<edm::InputTag>::const_iterator itPrefTag = preferredL1TAlgBlkInputTag.begin(),
89  itPrefTagEnd = preferredL1TAlgBlkInputTag.end();
90  itPrefTag != itPrefTagEnd;
91  ++itPrefTag) {
92  if (branchDescription.moduleLabel() == itPrefTag->label()) {
96  m_inputTagsL1TAlgBlk.push_back(tag);
97 
98  LogDebug("L1TGlobalUtil")
99  << "\nWARNING: Input tag for GlobalAlgBlkBxCollection product set to preferred input tag" << (tag)
100  << std::endl;
101  break;
102  }
103  }
104  }
105 
107  // check if other input tag was found - if true, there are multiple input tags in the event,
108  // none in the preferred input tags, so it is not possibly to choose safely an input tag
109 
110  if (m_inputTagsL1TAlgBlk.size() > 1) {
111  LogDebug("L1TGlobalUtil") << "\nWARNING: Found multiple input tags for GlobalAlgBlkBxCollection product."
112  << "\nNone is in the preferred input tags - no safe choice."
113  << "\nInput tag already found: " << (m_l1tAlgBlkInputTag) << "\nActual tag: " << (tag)
114  << "\nInput tag set to empty tag." << std::endl;
117 
118  } else {
119  if (m_l1tAlgBlkToken.isUninitialized()) {
121  m_inputTagsL1TAlgBlk.push_back(tag);
123 
124  LogDebug("L1TGlobalUtil") << "\nWARNING: No preferred input tag found for GlobalAlgBlkBxCollection."
125  << "\nInput tag set to " << (tag) << std::endl;
126  }
127  }
128  }
129  }
130 
131  // GlobalExtBlkBxCollection
132 
134  (branchDescription.unwrappedTypeID() == edm::TypeID(typeid(GlobalExtBlkBxCollection))) &&
135  (branchDescription.branchType() == edm::InEvent)) {
137  branchDescription.moduleLabel(), branchDescription.productInstanceName(), branchDescription.processName()};
138 
140  // check if a preferred input tag was already found and compare it with the actual tag
141  // if the instance or the process names are different, one has incompatible tags - set
142  // the tag to empty input tag and indicate that multiple preferred input tags are found
143  // so it is not possibly to choose safely an input tag
144 
145  if ((m_l1tExtBlkInputTag.label() == branchDescription.moduleLabel()) &&
146  ((m_l1tExtBlkInputTag.instance() != branchDescription.productInstanceName()) ||
147  (m_l1tExtBlkInputTag.process() != branchDescription.processName()))) {
148  LogDebug("L1TGlobalUtil") << "\nWARNING: Found multiple preferred input tags for GlobalExtBlkBxCollection, "
149  << "\nwith different instaces or processes."
150  << "\nInput tag already found: " << (m_l1tExtBlkInputTag) << "\nActual tag: " << (tag)
151  << "\nInput tag set to empty tag." << std::endl;
152 
155  }
156  } else {
157  // no preferred input tag found yet, check now with the actual tag
158 
159  for (std::vector<edm::InputTag>::const_iterator itPrefTag = preferredL1TExtBlkInputTag.begin(),
160  itPrefTagEnd = preferredL1TExtBlkInputTag.end();
161  itPrefTag != itPrefTagEnd;
162  ++itPrefTag) {
163  if (branchDescription.moduleLabel() == itPrefTag->label()) {
167  m_inputTagsL1TExtBlk.push_back(tag);
168 
169  LogDebug("L1TGlobalUtil")
170  << "\nWARNING: Input tag for GlobalExtBlkBxCollection product set to preferred input tag" << (tag)
171  << std::endl;
172  break;
173  }
174  }
175  }
176 
178  // check if other input tag was found - if true, there are multiple input tags in the event,
179  // none in the preferred input tags, so it is not possibly to choose safely an input tag
180 
181  if (m_inputTagsL1TExtBlk.size() > 1) {
182  LogDebug("L1TGlobalUtil") << "\nWARNING: Found multiple input tags for GlobalExtBlkBxCollection."
183  << "\nNone is in the preferred input tags - no safe choice."
184  << "\nInput tag already found: " << (m_l1tExtBlkInputTag) << "\nActual tag: " << (tag)
185  << "\nInput tag set to empty tag." << std::endl;
188 
189  } else {
190  if (m_l1tExtBlkToken.isUninitialized()) {
192  m_inputTagsL1TExtBlk.push_back(tag);
194 
195  LogDebug("L1TGlobalUtil") << "\nWARNING: No preferred input tag found for GlobalExtBlkBxCollection product."
196  << "\nInput tag set to " << (tag) << std::endl;
197  }
198  }
199  }
200  }
201 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< edm::InputTag > m_inputTagsL1TAlgBlk
std::vector< edm::InputTag > m_inputTagsL1TExtBlk
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
edm::ConsumesCollector m_consumesCollector
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken
std::string const & label() const
Definition: InputTag.h:36
std::string const & process() const
Definition: InputTag.h:40
std::string const & instance() const
Definition: InputTag.h:37
#define LogDebug(id)
bool const& l1t::L1TGlobalUtilHelper::readPrescalesFromFile ( ) const
inline

Definition at line 75 of file L1TGlobalUtilHelper.h.

References m_readPrescalesFromFile.

Member Data Documentation

edm::ConsumesCollector l1t::L1TGlobalUtilHelper::m_consumesCollector
private

Definition at line 81 of file L1TGlobalUtilHelper.h.

bool l1t::L1TGlobalUtilHelper::m_findL1TAlgBlk
private

Definition at line 89 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper().

bool l1t::L1TGlobalUtilHelper::m_findL1TExtBlk
private

Definition at line 90 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper().

bool l1t::L1TGlobalUtilHelper::m_foundMultipleL1TAlgBlk
private

Definition at line 97 of file L1TGlobalUtilHelper.h.

bool l1t::L1TGlobalUtilHelper::m_foundMultipleL1TExtBlk
private

Definition at line 98 of file L1TGlobalUtilHelper.h.

bool l1t::L1TGlobalUtilHelper::m_foundPreferredL1TAlgBlk
private

Definition at line 94 of file L1TGlobalUtilHelper.h.

bool l1t::L1TGlobalUtilHelper::m_foundPreferredL1TExtBlk
private

Definition at line 95 of file L1TGlobalUtilHelper.h.

std::vector<edm::InputTag> l1t::L1TGlobalUtilHelper::m_inputTagsL1TAlgBlk
private

Definition at line 101 of file L1TGlobalUtilHelper.h.

std::vector<edm::InputTag> l1t::L1TGlobalUtilHelper::m_inputTagsL1TExtBlk
private

Definition at line 102 of file L1TGlobalUtilHelper.h.

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

Definition at line 83 of file L1TGlobalUtilHelper.h.

Referenced by l1tAlgBlkInputTag(), and L1TGlobalUtilHelper().

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

Definition at line 86 of file L1TGlobalUtilHelper.h.

Referenced by l1tAlgBlkToken(), and L1TGlobalUtilHelper().

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

Definition at line 84 of file L1TGlobalUtilHelper.h.

Referenced by l1tExtBlkInputTag(), and L1TGlobalUtilHelper().

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

Definition at line 87 of file L1TGlobalUtilHelper.h.

Referenced by l1tExtBlkToken(), and L1TGlobalUtilHelper().

bool l1t::L1TGlobalUtilHelper::m_readPrescalesFromFile
private

Definition at line 92 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper(), and readPrescalesFromFile().