CMS 3D CMS Logo

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< GlobalAlgBlkBxCollectionm_l1tAlgBlkToken
 
edm::InputTag m_l1tExtBlkInputTag
 
edm::EDGetTokenT< GlobalExtBlkBxCollectionm_l1tExtBlkToken
 
bool m_readPrescalesFromFile
 

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),
16  m_readPrescalesFromFile(pset.getParameter<bool>("ReadPrescalesFromFile")),
19 
22 
23 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< GlobalExtBlkBxCollection > m_l1tExtBlkToken
edm::ConsumesCollector m_consumesCollector
edm::EDGetTokenT< GlobalAlgBlkBxCollection > m_l1tAlgBlkToken
def move(src, dest)
Definition: eostools.py:510
template<typename T >
L1TGlobalUtilHelper::L1TGlobalUtilHelper ( edm::ParameterSet const &  pset,
edm::ConsumesCollector iC,
T module 
)

Definition at line 114 of file L1TGlobalUtilHelper.h.

116  :
118  }
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 121 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.

125  :
127 
128  // Set InputTags from arguments
131 
132  m_findL1TAlgBlk(false),
133  m_findL1TExtBlk(false),
134 
136 
139 
141  m_foundMultipleL1TExtBlk(false) {
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  }
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
Definition: vlib.h:208
def move(src, dest)
Definition: eostools.py:510

Member Function Documentation

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

Definition at line 25 of file L1TGlobalUtilHelper.cc.

References edm::ParameterSetDescription::add().

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

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

Definition at line 78 of file L1TGlobalUtilHelper.h.

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

Definition at line 83 of file L1TGlobalUtilHelper.h.

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

Definition at line 79 of file L1TGlobalUtilHelper.h.

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

Definition at line 84 of file L1TGlobalUtilHelper.h.

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

Definition at line 31 of file L1TGlobalUtilHelper.cc.

References edm::BranchDescription::branchType(), edm::ConsumesCollector::consumes(), edm::InEvent, edm::InputTag::instance(), edm::InputTag::label(), LogDebug, m_consumesCollector, m_findL1TAlgBlk, m_findL1TExtBlk, m_foundMultipleL1TAlgBlk, m_foundMultipleL1TExtBlk, m_foundPreferredL1TAlgBlk, m_foundPreferredL1TExtBlk, m_inputTagsL1TAlgBlk, m_inputTagsL1TExtBlk, m_l1tAlgBlkInputTag, m_l1tAlgBlkToken, m_l1tExtBlkInputTag, m_l1tExtBlkToken, edm::BranchDescription::moduleLabel(), edm::InputTag::process(), edm::BranchDescription::processName(), edm::BranchDescription::productInstanceName(), GlobalPosition_Frontier_DevDB_cff::tag, and edm::BranchDescription::unwrappedTypeID().

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

Definition at line 81 of file L1TGlobalUtilHelper.h.

Member Data Documentation

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

Definition at line 88 of file L1TGlobalUtilHelper.h.

Referenced by operator()().

bool l1t::L1TGlobalUtilHelper::m_findL1TAlgBlk
private

Definition at line 96 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper(), and operator()().

bool l1t::L1TGlobalUtilHelper::m_findL1TExtBlk
private

Definition at line 97 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper(), and operator()().

bool l1t::L1TGlobalUtilHelper::m_foundMultipleL1TAlgBlk
private

Definition at line 104 of file L1TGlobalUtilHelper.h.

Referenced by operator()().

bool l1t::L1TGlobalUtilHelper::m_foundMultipleL1TExtBlk
private

Definition at line 105 of file L1TGlobalUtilHelper.h.

Referenced by operator()().

bool l1t::L1TGlobalUtilHelper::m_foundPreferredL1TAlgBlk
private

Definition at line 101 of file L1TGlobalUtilHelper.h.

Referenced by operator()().

bool l1t::L1TGlobalUtilHelper::m_foundPreferredL1TExtBlk
private

Definition at line 102 of file L1TGlobalUtilHelper.h.

Referenced by operator()().

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

Definition at line 108 of file L1TGlobalUtilHelper.h.

Referenced by operator()().

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

Definition at line 109 of file L1TGlobalUtilHelper.h.

Referenced by operator()().

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

Definition at line 90 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper(), and operator()().

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

Definition at line 93 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper(), and operator()().

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

Definition at line 91 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper(), and operator()().

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

Definition at line 94 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper(), and operator()().

bool l1t::L1TGlobalUtilHelper::m_readPrescalesFromFile
private

Definition at line 99 of file L1TGlobalUtilHelper.h.

Referenced by L1TGlobalUtilHelper().