CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
edmtest::ThinningDSVTestAnalyzer Class Reference
Inheritance diagram for edmtest::ThinningDSVTestAnalyzer:
edm::global::EDAnalyzer<> edm::global::EDAnalyzerBase edm::EDConsumerBase

Classes

struct  DSContent
 

Public Member Functions

void analyze (edm::StreamID, edm::Event const &e, edm::EventSetup const &c) const override
 
 ThinningDSVTestAnalyzer (edm::ParameterSet const &pset)
 
- Public Member Functions inherited from edm::global::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
bool wantsStreamLuminosityBlocks () const final
 
bool wantsStreamRuns () const final
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void incrementExpectedValue (std::vector< int >::const_iterator &iter) const
 

Private Attributes

bool associationShouldBeDropped_
 
edm::EDGetTokenT< edm::ThinnedAssociationassociationToken_
 
std::vector< unsigned int > expectedIndexesIntoParent_
 
unsigned int expectedNumberOfTracks_
 
std::vector< DSContentexpectedParentContent_
 
std::vector< DSContentexpectedThinnedContent_
 
std::vector< int > expectedValues_
 
int parentSlimmedValueFactor_
 
edm::EDGetTokenT< edmNew::DetSetVector< Thing > > parentToken_
 
bool parentWasDropped_
 
int refSlimmedValueFactor_
 
bool refToParentIsAvailable_
 
bool thinnedIsAlias_
 
int thinnedSlimmedValueFactor_
 
edm::EDGetTokenT< edmNew::DetSetVector< Thing > > thinnedToken_
 
bool thinnedWasDropped_
 
edm::EDGetTokenT< TrackOfDSVThingsCollection > trackToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Definition at line 23 of file ThinningDSVTestAnalyzer.cc.

Constructor & Destructor Documentation

◆ ThinningDSVTestAnalyzer()

edmtest::ThinningDSVTestAnalyzer::ThinningDSVTestAnalyzer ( edm::ParameterSet const &  pset)
explicit

Definition at line 59 of file ThinningDSVTestAnalyzer.cc.

References associationShouldBeDropped_, submitPVResolutionJobs::count, expectedIndexesIntoParent_, expectedParentContent_, expectedThinnedContent_, mps_fire::i, AlCaHLTBitMon_ParallelJobs::p, parentSlimmedValueFactor_, parentWasDropped_, muonDTDigis_cfi::pset, refSlimmedValueFactor_, runTheMatrix::ret, thinnedSlimmedValueFactor_, thinnedWasDropped_, and edm::vector_transform().

60  : parentToken_(consumes<edmNew::DetSetVector<Thing>>(pset.getParameter<edm::InputTag>("parentTag"))),
62  associationToken_(consumes<edm::ThinnedAssociation>(pset.getParameter<edm::InputTag>("associationTag"))),
63  trackToken_(consumes<TrackOfDSVThingsCollection>(pset.getParameter<edm::InputTag>("trackTag"))),
64  parentWasDropped_(pset.getParameter<bool>("parentWasDropped")),
65  thinnedWasDropped_(pset.getParameter<bool>("thinnedWasDropped")),
66  thinnedIsAlias_(pset.getParameter<bool>("thinnedIsAlias")),
67  refToParentIsAvailable_(pset.getParameter<bool>("refToParentIsAvailable")),
68  associationShouldBeDropped_(pset.getParameter<bool>("associationShouldBeDropped")),
69  expectedNumberOfTracks_(pset.getParameter<unsigned int>("expectedNumberOfTracks")),
70  expectedValues_(pset.getParameter<std::vector<int>>("expectedValues")) {
71  auto makeDSContent = [](edm::ParameterSet const& p) {
72  return DSContent{p.getParameter<unsigned int>("id"), p.getParameter<std::vector<int>>("values")};
73  };
74  if (!parentWasDropped_) {
76  pset.getParameter<std::vector<edm::ParameterSet>>("expectedParentContent"), makeDSContent);
77  }
78  if (!thinnedWasDropped_) {
80  pset.getParameter<std::vector<edm::ParameterSet>>("expectedThinnedContent"), makeDSContent);
81  }
83  expectedIndexesIntoParent_ = pset.getParameter<std::vector<unsigned int>>("expectedIndexesIntoParent");
84  }
85 
86  auto slimmedFactor = [](int count, int factor) {
87  int ret = 1;
88  for (int i = 0; i < count; ++i) {
89  ret *= factor;
90  }
91  return ret;
92  };
93  int const slimmedValueFactor = pset.getParameter<int>("slimmedValueFactor");
94  parentSlimmedValueFactor_ = slimmedFactor(pset.getParameter<int>("parentSlimmedCount"), slimmedValueFactor);
95  thinnedSlimmedValueFactor_ = slimmedFactor(pset.getParameter<int>("thinnedSlimmedCount"), slimmedValueFactor);
96  refSlimmedValueFactor_ = slimmedFactor(pset.getParameter<int>("refSlimmedCount"), slimmedValueFactor);
97  }
ret
prodAgent to be discontinued
edm::EDGetTokenT< edmNew::DetSetVector< Thing > > parentToken_
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< DSContent > expectedThinnedContent_
edm::EDGetTokenT< edmNew::DetSetVector< Thing > > thinnedToken_
edm::EDGetTokenT< edm::ThinnedAssociation > associationToken_
std::vector< DSContent > expectedParentContent_
edm::EDGetTokenT< TrackOfDSVThingsCollection > trackToken_
std::vector< unsigned int > expectedIndexesIntoParent_

Member Function Documentation

◆ analyze()

void edmtest::ThinningDSVTestAnalyzer::analyze ( edm::StreamID  ,
edm::Event const &  e,
edm::EventSetup const &  c 
) const
overridevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 132 of file ThinningDSVTestAnalyzer.cc.

References associationShouldBeDropped_, associationToken_, HLT_2023v12_cff::distance, Exception, expectedIndexesIntoParent_, expectedNumberOfTracks_, expectedParentContent_, expectedThinnedContent_, expectedValues_, incrementExpectedValue(), dqmdumpme::k, or, parentSlimmedValueFactor_, parentToken_, parentWasDropped_, refSlimmedValueFactor_, refToParentIsAvailable_, edm::thinnedRefFrom(), thinnedSlimmedValueFactor_, thinnedToken_, thinnedWasDropped_, HLT_2023v12_cff::track, JetHT_cfg::trackCollection, and trackToken_.

132  {
133  auto parentCollection = event.getHandle(parentToken_);
134  auto thinnedCollection = event.getHandle(thinnedToken_);
135  auto associationCollection = event.getHandle(associationToken_);
136  auto trackCollection = event.getHandle(trackToken_);
137 
138  if (parentWasDropped_) {
139  if (parentCollection.isValid()) {
140  throw cms::Exception("TestFailure") << "parent collection present, should have been dropped";
141  }
142  } else if (!expectedParentContent_.empty()) {
143  if (parentCollection->size() != expectedParentContent_.size()) {
144  throw cms::Exception("TestFailure") << "parent collection has unexpected size, got " << parentCollection->size()
145  << " expected " << expectedParentContent_.size();
146  }
147 
148  auto iExpected = expectedParentContent_.begin();
149  for (auto const& detset : *parentCollection) {
150  auto const& expectedContent = *iExpected;
151  ++iExpected;
152 
153  if (detset.id() != expectedContent.id) {
154  throw cms::Exception("TestFailure")
155  << "parent collection detset has unexpected id " << detset.id() << " expected " << expectedContent.id;
156  }
157  if (detset.size() != expectedContent.values.size()) {
158  throw cms::Exception("TestFailure")
159  << "parent collection detset with id " << detset.id() << " has unexpected size, got " << detset.size()
160  << " expected " << expectedContent.values.size();
161  }
162  auto iValue = expectedContent.values.begin();
163  for (auto const& thing : detset) {
164  // Just some numbers that match the somewhat arbitrary values put in
165  // by the ThingProducer.
166  int expected =
167  static_cast<int>(*iValue + (event.eventAuxiliary().event() - 1) * 100) * parentSlimmedValueFactor_;
168  if (thing.a != expected) {
169  throw cms::Exception("TestFailure")
170  << "parent collection has unexpected content for detset with id " << detset.id() << ", got " << thing.a
171  << " expected " << expected << " (element " << std::distance(expectedContent.values.begin(), iValue)
172  << ")";
173  }
174  ++iValue;
175  }
176  }
177  }
178 
179  // Check to see the content is what we expect based on what was written
180  // by ThingProducer and TrackOfThingsProducer. The values are somewhat
181  // arbitrary and meaningless.
183  if (thinnedWasDropped_) {
184  if (thinnedCollection.isValid()) {
185  throw cms::Exception("TestFailure") << "thinned collection present, should have been dropped";
186  }
187  } else {
188  thinnedRefProd = edm::RefProd<edmNew::DetSetVector<Thing>>{thinnedCollection};
189  if (thinnedCollection->size() != expectedThinnedContent_.size()) {
190  throw cms::Exception("TestFailure")
191  << "thinned collection has unexpected size, got " << thinnedCollection->size() << " expected "
192  << expectedThinnedContent_.size();
193  }
194 
195  auto iExpected = expectedThinnedContent_.begin();
196  for (auto const& detset : *thinnedCollection) {
197  auto const& expectedContent = *iExpected;
198  ++iExpected;
199 
200  if (detset.id() != expectedContent.id) {
201  throw cms::Exception("TestFailure")
202  << "thinned collection detset has unexpected id " << detset.id() << " expected " << expectedContent.id;
203  }
204  if (detset.size() != expectedContent.values.size()) {
205  throw cms::Exception("TestFailure")
206  << "thinned collection detset with id " << detset.id() << " has unexpected size, got " << detset.size()
207  << " expected " << expectedContent.values.size();
208  }
209  auto iValue = expectedContent.values.begin();
210  for (auto const& thing : detset) {
211  int expected =
212  static_cast<int>(*iValue + (event.eventAuxiliary().event() - 1) * 100) * thinnedSlimmedValueFactor_;
213  if (thing.a != expected) {
214  throw cms::Exception("TestFailure")
215  << "thinned collection has unexpected content for detset with id " << detset.id() << ", got " << thing.a
216  << " expected " << expected << " (element " << std::distance(expectedContent.values.begin(), iValue)
217  << ")";
218  }
219  ++iValue;
220  }
221  }
222  }
223 
224  if (associationShouldBeDropped_ && associationCollection.isValid()) {
225  throw cms::Exception("TestFailure") << "association collection should have been dropped but was not";
226  }
228  unsigned int expectedIndex = 0;
229  if (associationCollection->indexesIntoParent().size() != expectedIndexesIntoParent_.size()) {
230  throw cms::Exception("TestFailure")
231  << "association collection has unexpected size " << associationCollection->indexesIntoParent().size()
232  << " expected " << expectedIndexesIntoParent_.size();
233  }
234  for (auto const& association : associationCollection->indexesIntoParent()) {
235  if (association != expectedIndexesIntoParent_.at(expectedIndex)) {
236  throw cms::Exception("TestFailure")
237  << "association collection has unexpected content, for index " << expectedIndex << " got " << association
238  << " expected " << expectedIndexesIntoParent_.at(expectedIndex);
239  }
240  ++expectedIndex;
241  }
242  }
243 
245  if (associationCollection->parentCollectionID() != parentCollection.id()) {
246  throw cms::Exception("TestFailure") << "analyze parent ProductID is not correct";
247  }
248  }
249 
251  if (associationCollection->thinnedCollectionID() != thinnedCollection.id()) {
252  throw cms::Exception("TestFailure") << "analyze thinned ProductID is not correct";
253  }
254  }
255 
256  if (trackCollection->size() != expectedNumberOfTracks_) {
257  throw cms::Exception("TestFailure")
258  << "unexpected Track size " << trackCollection->size() << " expected " << expectedNumberOfTracks_;
259  }
260 
261  if (expectedValues_.empty()) {
262  return;
263  }
264 
265  int eventOffset = (static_cast<int>(event.eventAuxiliary().event()) - 1) * 100;
266 
267  std::vector<int>::const_iterator expectedValue = expectedValues_.begin();
268  for (auto const& track : *trackCollection) {
269  if (not refToParentIsAvailable_ or *expectedValue == -1) {
270  if (track.ref1.isAvailable()) {
271  throw cms::Exception("TestFailure") << "ref1 is available when it should not be, refers to "
272  << track.ref1.id() << " key " << track.ref1.key();
273  }
274  } else {
275  if (!track.ref1.isAvailable()) {
276  throw cms::Exception("TestFailure") << "ref1 is not available when it should be";
277  }
278  // Check twice to test some possible caching problems.
279  const int expected = (*expectedValue + eventOffset) * refSlimmedValueFactor_;
280  if (track.ref1->a != expected) {
281  throw cms::Exception("TestFailure")
282  << "Unexpected values from ref1, got " << track.ref1->a << " expected " << expected;
283  }
284  if (track.ref1->a != expected) {
285  throw cms::Exception("TestFailure")
286  << "Unexpected values from ref1 (2nd try), got " << track.ref1->a << " expected " << expected;
287  ;
288  }
289  }
290 
291  if (not thinnedWasDropped_) {
292  auto refToThinned = edm::thinnedRefFrom(track.ref1, thinnedRefProd, event.productGetter());
293  if (*expectedValue == -1) {
294  if (refToThinned.isNonnull()) {
295  throw cms::Exception("TestFailure") << "thinnedRefFrom(ref1) is non-null when it should be null";
296  }
297  if (refToThinned.isAvailable()) {
298  throw cms::Exception("TestFailure") << "thinnedRefFrom(ref1) is available when it should not be";
299  }
300  } else {
301  if (refToThinned.isNull()) {
302  throw cms::Exception("TestFailure") << "thinnedRefFrom(ref1) is null when it should not be";
303  }
304  if (refToThinned.id() != thinnedCollection.id()) {
305  throw cms::Exception("TestFailure") << "thinnedRefFrom(ref).id() " << refToThinned.id()
306  << " differs from expectation " << thinnedCollection.id();
307  }
308  if (not refToThinned.isAvailable()) {
309  throw cms::Exception("TestFailure") << "thinnedRefFrom(ref1) is not available when it should be";
310  }
311  // Check twice to test some possible caching problems.
312  // need to account for slimming because going through an explicit ref-to-slimmed
313  const int expected = (*expectedValue + eventOffset) * thinnedSlimmedValueFactor_;
314  if (refToThinned->a != expected) {
315  throw cms::Exception("TestFailure")
316  << "Unexpected values from thinnedRefFrom(ref1), got " << refToThinned->a << " expected " << expected;
317  }
318  if (refToThinned->a != expected) {
319  throw cms::Exception("TestFailure") << "Unexpected values from thinnedRefFrom(ref1) (2nd try) "
320  << refToThinned->a << " expected " << expected;
321  }
322  }
323  }
324  incrementExpectedValue(expectedValue);
325 
326  if (not refToParentIsAvailable_ or *expectedValue == -1) {
327  if (track.ref2.isAvailable()) {
328  throw cms::Exception("TestFailure") << "ref2 is available when it should not be";
329  }
330  } else {
331  if (!track.ref2.isAvailable()) {
332  throw cms::Exception("TestFailure") << "ref2 is not available when it should be";
333  }
334 
335  const int expected = (*expectedValue + eventOffset) * refSlimmedValueFactor_;
336  if (track.ref2->a != expected) {
337  throw cms::Exception("TestFailure")
338  << "unexpected values from ref2, got " << track.ref2->a << " expected " << expected;
339  }
340  if (track.ref2->a != expected) {
341  throw cms::Exception("TestFailure")
342  << "unexpected values from ref2 (2nd try), got " << track.ref2->a << " expected " << expected;
343  }
344  }
345 
346  if (not thinnedWasDropped_) {
347  auto refToThinned = edm::thinnedRefFrom(track.ref2, thinnedRefProd, event.productGetter());
348  if (*expectedValue == -1) {
349  if (refToThinned.isNonnull()) {
350  throw cms::Exception("TestFailure") << "thinnedRefFrom(ref2) is non-null when it should be null";
351  }
352  if (refToThinned.isAvailable()) {
353  throw cms::Exception("TestFailure") << "thinnedRefFrom(ref2) is available when it should not be";
354  }
355  } else {
356  if (refToThinned.isNull()) {
357  throw cms::Exception("TestFailure") << "thinnedRefFrom(ref2) is null when it should not be";
358  }
359  if (refToThinned.id() != thinnedCollection.id()) {
360  throw cms::Exception("TestFailure") << "thinnedRefFrom(ref2).id() " << refToThinned.id()
361  << " differs from expectation " << thinnedCollection.id();
362  }
363  if (not refToThinned.isAvailable()) {
364  throw cms::Exception("TestFailure") << "thinnedRefFrom(ref2) is not available when it should be";
365  }
366  // Check twice to test some possible caching problems.
367  // need to account for slimming because going through an explicit ref-to-slimmed
368  const int expected = (*expectedValue + eventOffset) * thinnedSlimmedValueFactor_;
369  if (refToThinned->a != expected) {
370  throw cms::Exception("TestFailure")
371  << "Unexpected values from thinnedRefFrom(ref2), got " << refToThinned->a << " expected " << expected;
372  }
373  if (refToThinned->a != expected) {
374  throw cms::Exception("TestFailure") << "Unexpected values from thinnedRefFrom(ref2) (2nd try), got "
375  << refToThinned->a << " expected " << expected;
376  }
377  }
378  }
379 
380  incrementExpectedValue(expectedValue);
381 
382  // Test RefVector
383  unsigned int k = 0;
384  bool allPresent = true;
385  for (auto iExpectedValue : expectedValues_) {
386  if (iExpectedValue != -1) {
387  if (not thinnedWasDropped_) {
388  auto refToThinned = edm::thinnedRefFrom(track.refVector1[k], thinnedRefProd, event.productGetter());
389  // need to account for slimming because going through an explicit ref-to-slimmed
390  const int expected = (iExpectedValue + eventOffset) * thinnedSlimmedValueFactor_;
391  if (refToThinned->a != expected) {
392  throw cms::Exception("TestFailure") << "unexpected values from thinnedRefFrom(refVector1), got "
393  << refToThinned->a << " expected " << expected;
394  }
395  }
397  const int expected = (iExpectedValue + eventOffset) * refSlimmedValueFactor_;
398  if (track.refVector1[k]->a != expected) {
399  throw cms::Exception("TestFailure")
400  << "unexpected values from refVector1, got " << track.refVector1[k]->a << " expected " << expected;
401  }
402  }
403  } else {
404  allPresent = false;
405  }
406  ++k;
407  }
408 
409  if (refToParentIsAvailable_ and allPresent) {
410  if (!track.refVector1.isAvailable()) {
411  throw cms::Exception("TestFailure") << "unexpected value (false) from refVector::isAvailable";
412  }
413  } else {
414  if (track.refVector1.isAvailable()) {
415  throw cms::Exception("TestFailure") << "unexpected value (true) from refVector::isAvailable";
416  }
417  }
418  k = 0;
419  for (auto iExpectedValue : expectedValues_) {
420  if (refToParentIsAvailable_ and iExpectedValue != -1) {
421  const int expected = (iExpectedValue + eventOffset) * refSlimmedValueFactor_;
422  if (track.refVector1[k]->a != expected) {
423  throw cms::Exception("TestFailure")
424  << "unexpected values from refVector1, got " << track.refVector1[k]->a << " expected " << expected;
425  }
426  } else {
427  allPresent = false;
428  }
429  ++k;
430  }
431  }
432  }
void incrementExpectedValue(std::vector< int >::const_iterator &iter) const
edm::EDGetTokenT< edmNew::DetSetVector< Thing > > parentToken_
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
std::vector< DSContent > expectedThinnedContent_
edm::EDGetTokenT< edmNew::DetSetVector< Thing > > thinnedToken_
edm::EDGetTokenT< edm::ThinnedAssociation > associationToken_
trackCollection
Definition: JetHT_cfg.py:51
Ref< C, T, F > thinnedRefFrom(Ref< C, T, F > const &parent, RefProd< C > const &thinned, edm::EDProductGetter const &prodGetter)
Return a Ref to thinned collection corresponding to an element of the Ref to parent collection...
Definition: RefItemGet.h:129
std::vector< DSContent > expectedParentContent_
edm::EDGetTokenT< TrackOfDSVThingsCollection > trackToken_
std::vector< unsigned int > expectedIndexesIntoParent_
Definition: event.py:1

◆ fillDescriptions()

void edmtest::ThinningDSVTestAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 99 of file ThinningDSVTestAnalyzer.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

99  {
101  desc.add<edm::InputTag>("parentTag");
102  desc.add<edm::InputTag>("thinnedTag");
103  desc.add<edm::InputTag>("associationTag");
104  desc.add<edm::InputTag>("trackTag");
105  desc.add<bool>("parentWasDropped", false);
106  desc.add<bool>("thinnedWasDropped", false);
107  desc.add<bool>("thinnedIsAlias", false);
108  desc.add<bool>("refToParentIsAvailable", true)
109  ->setComment(
110  "If Ref-to-parent is generally available. With thinnedRefFrom it may happen that the Ref-to-parent is not "
111  "available, but the Ref-to-thinned is. In such case this parameter should be set to 'False', and the "
112  "'expectedValues' should be set to correspond the values via Ref-to-thinned.");
113  std::vector<int> defaultV;
114  std::vector<unsigned int> defaultVU;
115  std::vector<edm::ParameterSet> defaultVPSet;
116  edm::ParameterSetDescription dsValidator;
117  dsValidator.add<unsigned int>("id");
118  dsValidator.add<std::vector<int>>("values", defaultV);
119  desc.addVPSet("expectedParentContent", dsValidator, defaultVPSet);
120  desc.addVPSet("expectedThinnedContent", dsValidator, defaultVPSet);
121  desc.add<std::vector<unsigned int>>("expectedIndexesIntoParent", defaultVU);
122  desc.add<bool>("associationShouldBeDropped", false);
123  desc.add<unsigned int>("expectedNumberOfTracks", 5);
124  desc.add<std::vector<int>>("expectedValues");
125  desc.add<int>("parentSlimmedCount", 0);
126  desc.add<int>("thinnedSlimmedCount", 0);
127  desc.add<int>("refSlimmedCount", 0);
128  desc.add<int>("slimmedValueFactor", 10);
129  descriptions.addDefault(desc);
130  }
void addDefault(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)

◆ incrementExpectedValue()

void edmtest::ThinningDSVTestAnalyzer::incrementExpectedValue ( std::vector< int >::const_iterator &  iter) const
private

Definition at line 434 of file ThinningDSVTestAnalyzer.cc.

References expectedValues_.

Referenced by analyze().

434  {
435  ++iter;
436  if (iter == expectedValues_.end())
437  iter = expectedValues_.begin();
438  }

Member Data Documentation

◆ associationShouldBeDropped_

bool edmtest::ThinningDSVTestAnalyzer::associationShouldBeDropped_
private

Definition at line 51 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze(), and ThinningDSVTestAnalyzer().

◆ associationToken_

edm::EDGetTokenT<edm::ThinnedAssociation> edmtest::ThinningDSVTestAnalyzer::associationToken_
private

Definition at line 36 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze().

◆ expectedIndexesIntoParent_

std::vector<unsigned int> edmtest::ThinningDSVTestAnalyzer::expectedIndexesIntoParent_
private

Definition at line 50 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze(), and ThinningDSVTestAnalyzer().

◆ expectedNumberOfTracks_

unsigned int edmtest::ThinningDSVTestAnalyzer::expectedNumberOfTracks_
private

Definition at line 52 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze().

◆ expectedParentContent_

std::vector<DSContent> edmtest::ThinningDSVTestAnalyzer::expectedParentContent_
private

Definition at line 45 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze(), and ThinningDSVTestAnalyzer().

◆ expectedThinnedContent_

std::vector<DSContent> edmtest::ThinningDSVTestAnalyzer::expectedThinnedContent_
private

Definition at line 49 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze(), and ThinningDSVTestAnalyzer().

◆ expectedValues_

std::vector<int> edmtest::ThinningDSVTestAnalyzer::expectedValues_
private

Definition at line 53 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze(), and incrementExpectedValue().

◆ parentSlimmedValueFactor_

int edmtest::ThinningDSVTestAnalyzer::parentSlimmedValueFactor_
private

Definition at line 54 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze(), and ThinningDSVTestAnalyzer().

◆ parentToken_

edm::EDGetTokenT<edmNew::DetSetVector<Thing> > edmtest::ThinningDSVTestAnalyzer::parentToken_
private

Definition at line 34 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze().

◆ parentWasDropped_

bool edmtest::ThinningDSVTestAnalyzer::parentWasDropped_
private

Definition at line 44 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze(), and ThinningDSVTestAnalyzer().

◆ refSlimmedValueFactor_

int edmtest::ThinningDSVTestAnalyzer::refSlimmedValueFactor_
private

Definition at line 56 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze(), and ThinningDSVTestAnalyzer().

◆ refToParentIsAvailable_

bool edmtest::ThinningDSVTestAnalyzer::refToParentIsAvailable_
private

Definition at line 48 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze().

◆ thinnedIsAlias_

bool edmtest::ThinningDSVTestAnalyzer::thinnedIsAlias_
private

Definition at line 47 of file ThinningDSVTestAnalyzer.cc.

◆ thinnedSlimmedValueFactor_

int edmtest::ThinningDSVTestAnalyzer::thinnedSlimmedValueFactor_
private

Definition at line 55 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze(), and ThinningDSVTestAnalyzer().

◆ thinnedToken_

edm::EDGetTokenT<edmNew::DetSetVector<Thing> > edmtest::ThinningDSVTestAnalyzer::thinnedToken_
private

Definition at line 35 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze().

◆ thinnedWasDropped_

bool edmtest::ThinningDSVTestAnalyzer::thinnedWasDropped_
private

Definition at line 46 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze(), and ThinningDSVTestAnalyzer().

◆ trackToken_

edm::EDGetTokenT<TrackOfDSVThingsCollection> edmtest::ThinningDSVTestAnalyzer::trackToken_
private

Definition at line 37 of file ThinningDSVTestAnalyzer.cc.

Referenced by analyze().