139 if (parentCollection.isValid()) {
140 throw cms::Exception(
"TestFailure") <<
"parent collection present, should have been dropped";
144 throw cms::Exception(
"TestFailure") <<
"parent collection has unexpected size, got " << parentCollection->size()
149 for (
auto const& detset : *parentCollection) {
150 auto const& expectedContent = *iExpected;
153 if (detset.id() != expectedContent.id) {
155 <<
"parent collection detset has unexpected id " << detset.id() <<
" expected " << expectedContent.id;
157 if (detset.size() != expectedContent.values.size()) {
159 <<
"parent collection detset with id " << detset.id() <<
" has unexpected size, got " << detset.size()
160 <<
" expected " << expectedContent.values.size();
162 auto iValue = expectedContent.values.begin();
163 for (
auto const& thing : detset) {
168 if (thing.a != expected) {
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)
184 if (thinnedCollection.isValid()) {
185 throw cms::Exception(
"TestFailure") <<
"thinned collection present, should have been dropped";
191 <<
"thinned collection has unexpected size, got " << thinnedCollection->size() <<
" expected " 196 for (
auto const& detset : *thinnedCollection) {
197 auto const& expectedContent = *iExpected;
200 if (detset.id() != expectedContent.id) {
202 <<
"thinned collection detset has unexpected id " << detset.id() <<
" expected " << expectedContent.id;
204 if (detset.size() != expectedContent.values.size()) {
206 <<
"thinned collection detset with id " << detset.id() <<
" has unexpected size, got " << detset.size()
207 <<
" expected " << expectedContent.values.size();
209 auto iValue = expectedContent.values.begin();
210 for (
auto const& thing : detset) {
213 if (thing.a != expected) {
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)
225 throw cms::Exception(
"TestFailure") <<
"association collection should have been dropped but was not";
228 unsigned int expectedIndex = 0;
231 <<
"association collection has unexpected size " << associationCollection->indexesIntoParent().size()
234 for (
auto const&
association : associationCollection->indexesIntoParent()) {
237 <<
"association collection has unexpected content, for index " << expectedIndex <<
" got " <<
association 245 if (associationCollection->parentCollectionID() != parentCollection.id()) {
246 throw cms::Exception(
"TestFailure") <<
"analyze parent ProductID is not correct";
251 if (associationCollection->thinnedCollectionID() != thinnedCollection.id()) {
252 throw cms::Exception(
"TestFailure") <<
"analyze thinned ProductID is not correct";
265 int eventOffset = (
static_cast<int>(
event.eventAuxiliary().event()) - 1) * 100;
267 std::vector<int>::const_iterator expectedValue =
expectedValues_.begin();
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();
275 if (!
track.ref1.isAvailable()) {
276 throw cms::Exception(
"TestFailure") <<
"ref1 is not available when it should be";
280 if (
track.ref1->a != expected) {
282 <<
"Unexpected values from ref1, got " <<
track.ref1->a <<
" expected " << expected;
284 if (
track.ref1->a != expected) {
286 <<
"Unexpected values from ref1 (2nd try), got " <<
track.ref1->a <<
" expected " << expected;
293 if (*expectedValue == -1) {
294 if (refToThinned.isNonnull()) {
295 throw cms::Exception(
"TestFailure") <<
"thinnedRefFrom(ref1) is non-null when it should be null";
297 if (refToThinned.isAvailable()) {
298 throw cms::Exception(
"TestFailure") <<
"thinnedRefFrom(ref1) is available when it should not be";
301 if (refToThinned.isNull()) {
302 throw cms::Exception(
"TestFailure") <<
"thinnedRefFrom(ref1) is null when it should not be";
304 if (refToThinned.id() != thinnedCollection.id()) {
305 throw cms::Exception(
"TestFailure") <<
"thinnedRefFrom(ref).id() " << refToThinned.id()
306 <<
" differs from expectation " << thinnedCollection.id();
308 if (not refToThinned.isAvailable()) {
309 throw cms::Exception(
"TestFailure") <<
"thinnedRefFrom(ref1) is not available when it should be";
314 if (refToThinned->a != expected) {
316 <<
"Unexpected values from thinnedRefFrom(ref1), got " << refToThinned->a <<
" expected " << expected;
318 if (refToThinned->a != expected) {
319 throw cms::Exception(
"TestFailure") <<
"Unexpected values from thinnedRefFrom(ref1) (2nd try) " 320 << refToThinned->a <<
" expected " << expected;
327 if (
track.ref2.isAvailable()) {
328 throw cms::Exception(
"TestFailure") <<
"ref2 is available when it should not be";
331 if (!
track.ref2.isAvailable()) {
332 throw cms::Exception(
"TestFailure") <<
"ref2 is not available when it should be";
336 if (
track.ref2->a != expected) {
338 <<
"unexpected values from ref2, got " <<
track.ref2->a <<
" expected " << expected;
340 if (
track.ref2->a != expected) {
342 <<
"unexpected values from ref2 (2nd try), got " <<
track.ref2->a <<
" expected " << expected;
348 if (*expectedValue == -1) {
349 if (refToThinned.isNonnull()) {
350 throw cms::Exception(
"TestFailure") <<
"thinnedRefFrom(ref2) is non-null when it should be null";
352 if (refToThinned.isAvailable()) {
353 throw cms::Exception(
"TestFailure") <<
"thinnedRefFrom(ref2) is available when it should not be";
356 if (refToThinned.isNull()) {
357 throw cms::Exception(
"TestFailure") <<
"thinnedRefFrom(ref2) is null when it should not be";
359 if (refToThinned.id() != thinnedCollection.id()) {
360 throw cms::Exception(
"TestFailure") <<
"thinnedRefFrom(ref2).id() " << refToThinned.id()
361 <<
" differs from expectation " << thinnedCollection.id();
363 if (not refToThinned.isAvailable()) {
364 throw cms::Exception(
"TestFailure") <<
"thinnedRefFrom(ref2) is not available when it should be";
369 if (refToThinned->a != expected) {
371 <<
"Unexpected values from thinnedRefFrom(ref2), got " << refToThinned->a <<
" expected " << expected;
373 if (refToThinned->a != expected) {
374 throw cms::Exception(
"TestFailure") <<
"Unexpected values from thinnedRefFrom(ref2) (2nd try), got " 375 << refToThinned->a <<
" expected " << expected;
384 bool allPresent =
true;
386 if (iExpectedValue != -1) {
391 if (refToThinned->a != expected) {
392 throw cms::Exception(
"TestFailure") <<
"unexpected values from thinnedRefFrom(refVector1), got " 393 << refToThinned->a <<
" expected " << expected;
398 if (
track.refVector1[
k]->a != expected) {
400 <<
"unexpected values from refVector1, got " <<
track.refVector1[
k]->a <<
" expected " << expected;
410 if (!
track.refVector1.isAvailable()) {
411 throw cms::Exception(
"TestFailure") <<
"unexpected value (false) from refVector::isAvailable";
414 if (
track.refVector1.isAvailable()) {
415 throw cms::Exception(
"TestFailure") <<
"unexpected value (true) from refVector::isAvailable";
422 if (
track.refVector1[
k]->a != expected) {
424 <<
"unexpected values from refVector1, got " <<
track.refVector1[
k]->a <<
" expected " << expected;
int refSlimmedValueFactor_
void incrementExpectedValue(std::vector< int >::const_iterator &iter) const
edm::EDGetTokenT< edmNew::DetSetVector< Thing > > parentToken_
int parentSlimmedValueFactor_
bool refToParentIsAvailable_
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
unsigned int expectedNumberOfTracks_
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
std::vector< DSContent > expectedThinnedContent_
edm::EDGetTokenT< edmNew::DetSetVector< Thing > > thinnedToken_
edm::EDGetTokenT< edm::ThinnedAssociation > associationToken_
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...
std::vector< DSContent > expectedParentContent_
bool associationShouldBeDropped_
std::vector< int > expectedValues_
edm::EDGetTokenT< TrackOfDSVThingsCollection > trackToken_
std::vector< unsigned int > expectedIndexesIntoParent_
int thinnedSlimmedValueFactor_