CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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)
 

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
 

Detailed Description

Definition at line 39 of file L1TGlobalUtilHelper.h.

Constructor & Destructor Documentation

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

Definition at line 10 of file L1TGlobalUtilHelper.cc.

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

10  :
12  m_l1tAlgBlkInputTag(pset.getParameter<edm::InputTag>("l1tAlgBlkInputTag")),
13  m_l1tExtBlkInputTag(pset.getParameter<edm::InputTag>("l1tExtBlkInputTag")),
14  m_findL1TAlgBlk(false),
15  m_findL1TExtBlk(false),
18 
21 
22 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
def move
Definition: eostools.py:510
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 110 of file L1TGlobalUtilHelper.h.

112  :
114  }
L1TGlobalUtilHelper(edm::ParameterSet const &pset, edm::ConsumesCollector &iC)
Definition: vlib.h:208
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 117 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, and m_l1tExtBlkToken.

121  :
123 
124  // Set InputTags from arguments
127 
128  m_findL1TAlgBlk(false),
129  m_findL1TExtBlk(false),
130 
133 
135  m_foundMultipleL1TExtBlk(false) {
136 
137  // If the InputTags are not set to valid values by the arguments, then
138  // try to set them from the configuration.
139  if(m_l1tAlgBlkInputTag.label().empty() &&
140  pset.existsAs<edm::InputTag>("l1tAlgBlkInputTag")) {
141  m_l1tAlgBlkInputTag = pset.getParameter<edm::InputTag>("l1tAlgBlkInputTag");
142  }
143  if(m_l1tExtBlkInputTag.label().empty() &&
144  pset.existsAs<edm::InputTag>("l1tExtBlkInputTag")) {
145  m_l1tExtBlkInputTag = pset.getParameter<edm::InputTag>("l1tExtBlkInputTag");
146  }
147 
148  // If the InputTags were set to valid values, make the consumes calls.
149  if(!m_l1tAlgBlkInputTag.label().empty()) {
151  }
152  if(!m_l1tExtBlkInputTag.label().empty()) {
154  }
155 
156  // Do we still need to search for each InputTag?
159 
160  // Register the callback function with the Framework
161  // if any InputTags still need to be found.
163  module.callWhenNewProductsRegistered(std::ref(*this));
164  }
165  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
edm::InputTag const & l1tExtBlkInputTag() const
def move
Definition: eostools.py:510
edm::ConsumesCollector m_consumesCollector
edm::InputTag const & l1tAlgBlkInputTag() const
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken
std::string const & label() const
Definition: InputTag.h:36
Definition: vlib.h:208

Member Function Documentation

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

Definition at line 24 of file L1TGlobalUtilHelper.cc.

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

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

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

Definition at line 78 of file L1TGlobalUtilHelper.h.

References m_l1tAlgBlkInputTag.

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

Definition at line 81 of file L1TGlobalUtilHelper.h.

References m_l1tAlgBlkToken.

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

Definition at line 79 of file L1TGlobalUtilHelper.h.

References m_l1tExtBlkInputTag.

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

Definition at line 82 of file L1TGlobalUtilHelper.h.

References m_l1tExtBlkToken.

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

Definition at line 29 of file L1TGlobalUtilHelper.cc.

References edm::BranchDescription::branchType(), edm::InEvent, HLT_25ns10e33_v2_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().

29  {
30 
31  // This is only used if required InputTags were not specified already.
32  // This is called early in the process, once for each product in the ProductRegistry.
33  // The callback is registered when callWhenNewProductsRegistered is called.
34  // It finds products by type and sets the token so that it can be used
35  // later when getting the product.
36 
37  // The code will look for the corresponding product in ProductRegistry.
38  // If the product is found, it checks the product label in
39  // a vector of preferred input tags (hardwired now to "gtDigis" and
40  // "hltGtDigis"). The first input tag from the vector of preferred input tags, with the
41  // same label as the input tag found from provenance, is kept as input tag, if there are no
42  // multiple products with the same label.
43 
44  // If multiple products are found and no one has a label in the vector of preferred input tags,
45  // or if multiple products are found with the label in the vector of preferred input tags
46  // (with different instance or process) the input tag is set to empty input tag, and L1GtUtil
47  // will produce an error, as it is not possible to safely choose a product. In this case, one must
48  // provide explicitly the correct input tag via configuration or in the constructor.
49 
50  // TODO decide if the preferred input tags must be given as input parameters
51  // or stay hardwired
52 
53  std::vector<edm::InputTag> preferredL1TAlgBlkInputTag = {
54  edm::InputTag("gtStage2Digis"), edm::InputTag("hltGtStage2Digis") };
55 
56  std::vector<edm::InputTag> preferredL1TExtBlkInputTag = {
57  edm::InputTag("gtStage2Digis"), edm::InputTag("hltGtStage2Digis") };
58 
59 
60  // GlobalAlgBlkBxCollection
61 
63  && (branchDescription.unwrappedTypeID()
65  && (branchDescription.branchType() == edm::InEvent)) {
66 
67  edm::InputTag tag { branchDescription.moduleLabel(),
68  branchDescription.productInstanceName(),
69  branchDescription.processName() };
70 
72  // check if a preferred input tag was already found and compare it with the actual tag
73  // if the instance or the process names are different, one has incompatible tags - set
74  // the tag to empty input tag and indicate that multiple preferred input tags are found
75  // so it is not possibly to choose safely an input tag
76 
77  if ((m_l1tAlgBlkInputTag.label() == branchDescription.moduleLabel())
79  != branchDescription.productInstanceName())
81  != branchDescription.processName()))) {
82 
83  LogDebug("L1TGlobalUtil")
84  << "\nWARNING: Found multiple preferred input tags for GlobalAlgBlkBxCollection, "
85  << "\nwith different instaces or processes."
86  << "\nInput tag already found: "
87  << (m_l1tAlgBlkInputTag) << "\nActual tag: " << (tag)
88  << "\nInput tag set to empty tag." << std::endl;
89 
92  }
93  } else {
94  // no preferred input tag found yet, check now with the actual tag
95  for (std::vector<edm::InputTag>::const_iterator itPrefTag =
96  preferredL1TAlgBlkInputTag.begin(), itPrefTagEnd =
97  preferredL1TAlgBlkInputTag.end();
98  itPrefTag != itPrefTagEnd; ++itPrefTag) {
99 
100  if (branchDescription.moduleLabel() == itPrefTag->label()) {
104  m_inputTagsL1TAlgBlk.push_back(tag);
105 
106  LogDebug("L1TGlobalUtil")
107  << "\nWARNING: Input tag for GlobalAlgBlkBxCollection product set to preferred input tag"
108  << (tag) << std::endl;
109  break;
110  }
111  }
112  }
113 
115 
116  // check if other input tag was found - if true, there are multiple input tags in the event,
117  // none in the preferred input tags, so it is not possibly to choose safely an input tag
118 
119  if (m_inputTagsL1TAlgBlk.size() > 1) {
120 
121  LogDebug("L1TGlobalUtil")
122  << "\nWARNING: Found multiple input tags for GlobalAlgBlkBxCollection product."
123  << "\nNone is in the preferred input tags - no safe choice."
124  << "\nInput tag already found: "
125  << (m_l1tAlgBlkInputTag) << "\nActual tag: " << (tag)
126  << "\nInput tag set to empty tag." << std::endl;
129 
130  } else {
131  if (m_l1tAlgBlkToken.isUninitialized()) {
132 
134  m_inputTagsL1TAlgBlk.push_back(tag);
136 
137  LogDebug("L1TGlobalUtil")
138  << "\nWARNING: No preferred input tag found for GlobalAlgBlkBxCollection."
139  << "\nInput tag set to " << (tag) << std::endl;
140  }
141  }
142  }
143  }
144 
145  // GlobalExtBlkBxCollection
146 
148  && (branchDescription.unwrappedTypeID()
150  && (branchDescription.branchType() == edm::InEvent)) {
151 
152  edm::InputTag tag { branchDescription.moduleLabel(),
153  branchDescription.productInstanceName(),
154  branchDescription.processName() };
155 
157 
158  // check if a preferred input tag was already found and compare it with the actual tag
159  // if the instance or the process names are different, one has incompatible tags - set
160  // the tag to empty input tag and indicate that multiple preferred input tags are found
161  // so it is not possibly to choose safely an input tag
162 
164  == branchDescription.moduleLabel())
166  != branchDescription.productInstanceName())
168  != branchDescription.processName()))) {
169 
170  LogDebug("L1TGlobalUtil")
171  << "\nWARNING: Found multiple preferred input tags for GlobalExtBlkBxCollection, "
172  << "\nwith different instaces or processes."
173  << "\nInput tag already found: "
174  << (m_l1tExtBlkInputTag) << "\nActual tag: "
175  << (tag) << "\nInput tag set to empty tag."
176  << std::endl;
177 
180  }
181  } else {
182  // no preferred input tag found yet, check now with the actual tag
183 
184  for (std::vector<edm::InputTag>::const_iterator itPrefTag =
185  preferredL1TExtBlkInputTag.begin(), itPrefTagEnd =
186  preferredL1TExtBlkInputTag.end();
187  itPrefTag != itPrefTagEnd; ++itPrefTag) {
188 
189  if (branchDescription.moduleLabel() == itPrefTag->label()) {
193  m_inputTagsL1TExtBlk.push_back(tag);
194 
195  LogDebug("L1TGlobalUtil")
196  << "\nWARNING: Input tag for GlobalExtBlkBxCollection product set to preferred input tag"
197  << (tag) << std::endl;
198  break;
199  }
200  }
201  }
202 
204 
205  // check if other input tag was found - if true, there are multiple input tags in the event,
206  // none in the preferred input tags, so it is not possibly to choose safely an input tag
207 
208  if (m_inputTagsL1TExtBlk.size() > 1) {
209 
210  LogDebug("L1TGlobalUtil")
211  << "\nWARNING: Found multiple input tags for GlobalExtBlkBxCollection."
212  << "\nNone is in the preferred input tags - no safe choice."
213  << "\nInput tag already found: "
214  << (m_l1tExtBlkInputTag) << "\nActual tag: "
215  << (tag) << "\nInput tag set to empty tag."
216  << std::endl;
219 
220  } else {
221  if (m_l1tExtBlkToken.isUninitialized()) {
222 
224  m_inputTagsL1TExtBlk.push_back(tag);
226 
227  LogDebug("L1TGlobalUtil")
228  << "\nWARNING: No preferred input tag found for GlobalExtBlkBxCollection product."
229  << "\nInput tag set to " << (tag) << std::endl;
230  }
231  }
232  }
233  }
234 }
#define LogDebug(id)
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

Member Data Documentation

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

Definition at line 86 of file L1TGlobalUtilHelper.h.

bool l1t::L1TGlobalUtilHelper::m_findL1TAlgBlk
private

Definition at line 94 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper().

bool l1t::L1TGlobalUtilHelper::m_findL1TExtBlk
private

Definition at line 95 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper().

bool l1t::L1TGlobalUtilHelper::m_foundMultipleL1TAlgBlk
private

Definition at line 100 of file L1TGlobalUtilHelper.h.

bool l1t::L1TGlobalUtilHelper::m_foundMultipleL1TExtBlk
private

Definition at line 101 of file L1TGlobalUtilHelper.h.

bool l1t::L1TGlobalUtilHelper::m_foundPreferredL1TAlgBlk
private

Definition at line 97 of file L1TGlobalUtilHelper.h.

bool l1t::L1TGlobalUtilHelper::m_foundPreferredL1TExtBlk
private

Definition at line 98 of file L1TGlobalUtilHelper.h.

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

Definition at line 104 of file L1TGlobalUtilHelper.h.

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

Definition at line 105 of file L1TGlobalUtilHelper.h.

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

Definition at line 88 of file L1TGlobalUtilHelper.h.

Referenced by l1tAlgBlkInputTag(), and L1TGlobalUtilHelper().

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

Definition at line 91 of file L1TGlobalUtilHelper.h.

Referenced by l1tAlgBlkToken(), and L1TGlobalUtilHelper().

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

Definition at line 89 of file L1TGlobalUtilHelper.h.

Referenced by l1tExtBlkInputTag(), and L1TGlobalUtilHelper().

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

Definition at line 92 of file L1TGlobalUtilHelper.h.

Referenced by l1tExtBlkToken(), and L1TGlobalUtilHelper().