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:511
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:511

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::BranchDescription::dropped(), 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  if (branchDescription.dropped()) { return; }
56 
57  std::vector<edm::InputTag> preferredL1TAlgBlkInputTag = {
58  edm::InputTag("gtStage2Digis"), edm::InputTag("hltGtStage2Digis") };
59 
60  std::vector<edm::InputTag> preferredL1TExtBlkInputTag = {
61  edm::InputTag("gtStage2Digis"), edm::InputTag("hltGtStage2Digis") };
62 
63 
64  // GlobalAlgBlkBxCollection
65 
67  && (branchDescription.unwrappedTypeID()
69  && (branchDescription.branchType() == edm::InEvent)) {
70 
71  edm::InputTag tag { branchDescription.moduleLabel(),
72  branchDescription.productInstanceName(),
73  branchDescription.processName() };
74 
76  // check if a preferred input tag was already found and compare it with the actual tag
77  // if the instance or the process names are different, one has incompatible tags - set
78  // the tag to empty input tag and indicate that multiple preferred input tags are found
79  // so it is not possibly to choose safely an input tag
80 
81  if ((m_l1tAlgBlkInputTag.label() == branchDescription.moduleLabel())
83  != branchDescription.productInstanceName())
85  != branchDescription.processName()))) {
86 
87  LogDebug("L1TGlobalUtil")
88  << "\nWARNING: Found multiple preferred input tags for GlobalAlgBlkBxCollection, "
89  << "\nwith different instaces or processes."
90  << "\nInput tag already found: "
91  << (m_l1tAlgBlkInputTag) << "\nActual tag: " << (tag)
92  << "\nInput tag set to empty tag." << std::endl;
93 
96  }
97  } else {
98  // no preferred input tag found yet, check now with the actual tag
99  for (std::vector<edm::InputTag>::const_iterator itPrefTag =
100  preferredL1TAlgBlkInputTag.begin(), itPrefTagEnd =
101  preferredL1TAlgBlkInputTag.end();
102  itPrefTag != itPrefTagEnd; ++itPrefTag) {
103 
104  if (branchDescription.moduleLabel() == itPrefTag->label()) {
108  m_inputTagsL1TAlgBlk.push_back(tag);
109 
110  LogDebug("L1TGlobalUtil")
111  << "\nWARNING: Input tag for GlobalAlgBlkBxCollection product set to preferred input tag"
112  << (tag) << std::endl;
113  break;
114  }
115  }
116  }
117 
119 
120  // check if other input tag was found - if true, there are multiple input tags in the event,
121  // none in the preferred input tags, so it is not possibly to choose safely an input tag
122 
123  if (m_inputTagsL1TAlgBlk.size() > 1) {
124 
125  LogDebug("L1TGlobalUtil")
126  << "\nWARNING: Found multiple input tags for GlobalAlgBlkBxCollection product."
127  << "\nNone is in the preferred input tags - no safe choice."
128  << "\nInput tag already found: "
129  << (m_l1tAlgBlkInputTag) << "\nActual tag: " << (tag)
130  << "\nInput tag set to empty tag." << std::endl;
133 
134  } else {
135  if (m_l1tAlgBlkToken.isUninitialized()) {
136 
138  m_inputTagsL1TAlgBlk.push_back(tag);
140 
141  LogDebug("L1TGlobalUtil")
142  << "\nWARNING: No preferred input tag found for GlobalAlgBlkBxCollection."
143  << "\nInput tag set to " << (tag) << std::endl;
144  }
145  }
146  }
147  }
148 
149  // GlobalExtBlkBxCollection
150 
152  && (branchDescription.unwrappedTypeID()
154  && (branchDescription.branchType() == edm::InEvent)) {
155 
156  edm::InputTag tag { branchDescription.moduleLabel(),
157  branchDescription.productInstanceName(),
158  branchDescription.processName() };
159 
161 
162  // check if a preferred input tag was already found and compare it with the actual tag
163  // if the instance or the process names are different, one has incompatible tags - set
164  // the tag to empty input tag and indicate that multiple preferred input tags are found
165  // so it is not possibly to choose safely an input tag
166 
168  == branchDescription.moduleLabel())
170  != branchDescription.productInstanceName())
172  != branchDescription.processName()))) {
173 
174  LogDebug("L1TGlobalUtil")
175  << "\nWARNING: Found multiple preferred input tags for GlobalExtBlkBxCollection, "
176  << "\nwith different instaces or processes."
177  << "\nInput tag already found: "
178  << (m_l1tExtBlkInputTag) << "\nActual tag: "
179  << (tag) << "\nInput tag set to empty tag."
180  << std::endl;
181 
184  }
185  } else {
186  // no preferred input tag found yet, check now with the actual tag
187 
188  for (std::vector<edm::InputTag>::const_iterator itPrefTag =
189  preferredL1TExtBlkInputTag.begin(), itPrefTagEnd =
190  preferredL1TExtBlkInputTag.end();
191  itPrefTag != itPrefTagEnd; ++itPrefTag) {
192 
193  if (branchDescription.moduleLabel() == itPrefTag->label()) {
197  m_inputTagsL1TExtBlk.push_back(tag);
198 
199  LogDebug("L1TGlobalUtil")
200  << "\nWARNING: Input tag for GlobalExtBlkBxCollection product set to preferred input tag"
201  << (tag) << std::endl;
202  break;
203  }
204  }
205  }
206 
208 
209  // check if other input tag was found - if true, there are multiple input tags in the event,
210  // none in the preferred input tags, so it is not possibly to choose safely an input tag
211 
212  if (m_inputTagsL1TExtBlk.size() > 1) {
213 
214  LogDebug("L1TGlobalUtil")
215  << "\nWARNING: Found multiple input tags for GlobalExtBlkBxCollection."
216  << "\nNone is in the preferred input tags - no safe choice."
217  << "\nInput tag already found: "
218  << (m_l1tExtBlkInputTag) << "\nActual tag: "
219  << (tag) << "\nInput tag set to empty tag."
220  << std::endl;
223 
224  } else {
225  if (m_l1tExtBlkToken.isUninitialized()) {
226 
228  m_inputTagsL1TExtBlk.push_back(tag);
230 
231  LogDebug("L1TGlobalUtil")
232  << "\nWARNING: No preferred input tag found for GlobalExtBlkBxCollection product."
233  << "\nInput tag set to " << (tag) << std::endl;
234  }
235  }
236  }
237  }
238 }
#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().