25 #include <unordered_set> 28 class MixFilterTestDetail;
29 #if ART_TEST_EVENTS_TO_SKIP_CONST 30 #define ART_MFT MixFilterTestETSc 31 #define ART_TEST_EVENTS_TO_SKIP_CONST_TXT const 32 #elif defined ART_TEST_EVENTS_TO_SKIP_CONST 33 #define ART_MFT MixFilterTestETS 34 #define ART_TEST_EVENTS_TO_SKIP_CONST_TXT 35 #elif defined ART_TEST_OLD_STARTEVENT 36 #define ART_MT MixFilterTestOldStartEvent 37 #elif defined ART_TEST_NO_STARTEVENT 38 #define ART_MT MixFilterTestNoStartEvent 41 #define ART_MFT MixFilterTest 47 class SecondaryFileNameProvider {
49 SecondaryFileNameProvider(std::vector<std::string>&& fileNames)
50 : fileNames_{move(fileNames)}, fileNameIter_{fileNames_.cbegin()}
53 SecondaryFileNameProvider(SecondaryFileNameProvider
const&
other)
54 : fileNames_{other.fileNames_}
55 , fileNameIter_{fileNames_.cbegin() +
56 (other.fileNameIter_ - other.fileNames_.cbegin())}
59 SecondaryFileNameProvider&
60 operator=(SecondaryFileNameProvider
const& other)
62 SecondaryFileNameProvider tmp{other};
67 ~SecondaryFileNameProvider() noexcept =
default;
72 if (fileNameIter_ == fileNames_.end()) {
75 return *(fileNameIter_++);
80 std::vector<std::string> fileNames_;
81 decltype(fileNames_.cbegin()) fileNameIter_;
85 using namespace fhicl;
102 Name{
"expectedRespondFunctionCalls"},
105 Name{
"fileNamesToProvide"}};
121 #ifdef ART_TEST_OLD_STARTEVENT 124 #elif !defined ART_TEST_NO_STARTEVENT 135 #ifdef ART_TEST_EVENTS_TO_SKIP_CONST 137 eventsToSkip() ART_TEST_EVENTS_TO_SKIP_CONST_TXT
177 template <
typename PROD,
typename OPROD = PROD>
184 std::vector<double>& out,
195 #ifndef ART_NO_MIX_PTRVECTOR 202 std::vector<arttest::ProductWithPtrs const*>
const& in,
216 bool mixRProduct(std::vector<double const*>
const& in,
220 template <
typename COLL>
228 std::unique_ptr<art::EventIDSequence>
eIDs_{};
256 template <
typename COLL>
277 std::vector<std::string> fnToProvide;
278 if (
p().fileNamesToProvide(fnToProvide)) {
279 std::cerr <<
"Calling registerSecondaryFileNameProvider.\n";
282 std::ostream_iterator<std::string>(std::cerr,
", "));
284 helper.registerSecondaryFileNameProvider(
285 SecondaryFileNameProvider{move(fnToProvide)});
290 helper.createEngine(123456);
291 helper.createEngine(123456,
"HepJamesRandom");
292 helper.createEngine(123456,
"HepJamesRandom",
"");
294 BOOST_REQUIRE_THROW(helper.createEngine(123456,
"MTwistEngine"),
297 BOOST_REQUIRE_THROW(helper.createEngine(123456,
"HEPJamesRandom",
"Edna"),
301 auto const mixProducerLabel =
p().mixProducerLabel();
306 helper.declareMixOp(
art::InputTag{mixProducerLabel,
"doubleLabel"},
307 &MixFilterTestDetail::mixByAddition<double>,
309 helper.declareMixOp(
art::InputTag{mixProducerLabel,
"IntProductLabel"},
310 &MixFilterTestDetail::mixByAddition<arttest::IntProduct>,
312 helper.declareMixOp(
art::InputTag{mixProducerLabel,
"stringLabel",
"SWRITE"},
313 &MixFilterTestDetail::mixByAddition<std::string>,
315 helper.declareMixOp(
art::InputTag{mixProducerLabel,
"doubleCollectionLabel"},
318 helper.declareMixOp(
art::InputTag{mixProducerLabel,
"doubleVectorPtrLabel"},
321 #ifndef ART_NO_MIX_PTRVECTOR 322 helper.declareMixOp(
art::InputTag{mixProducerLabel,
"doublePtrVectorLabel"},
326 helper.declareMixOp(
art::InputTag{mixProducerLabel,
"ProductWithPtrsLabel"},
329 helper.declareMixOp(
art::InputTag{mixProducerLabel,
"mapVectorLabel"},
332 helper.declareMixOp(
art::InputTag{mixProducerLabel,
"intVectorPtrLabel"},
336 [
this](std::vector<IntProduct const*>
const& in,
339 auto const sz = in.size();
344 return (eID.event() % 100) == 0;
347 for (
auto i = 0ul;
i < sz; ++
i) {
360 art::InputTag{mixProducerLabel,
"SpottyProductLabel"}, mixfunc,
false);
392 #ifndef ART_TEST_NO_STARTEVENT 395 #ifdef ART_TEST_OLD_STARTEVENT 417 #ifdef ART_TEST_NO_STARTEVENT 422 eIDs_ = std::make_unique<art::EventIDSequence>(seq);
429 for (
auto const& eid : seq) {
430 BOOST_REQUIRE_EQUAL(eid.event(),
436 std::unordered_set<int>
s;
438 std::inserter(s, s.begin()),
440 BOOST_CHECK_GT(seq.size(), s.size());
445 std::unordered_set<int>
s;
447 seq, std::inserter(s, s.begin()), [](
art::EventID const& eid) {
450 BOOST_CHECK_EQUAL(seq.size(), s.size());
486 for (
auto const&
val : seq) {
487 BOOST_REQUIRE_EQUAL(
val.event(),
offset);
496 e.
put(std::make_unique<std::string>(
"BlahBlahBlah"));
498 #ifndef ART_TEST_NO_STARTEVENT 560 template <
typename PROD,
typename OPROD>
567 for (
auto const* prod : in) {
568 if (prod !=
nullptr) {
578 std::vector<double>& out,
588 std::vector<mv_t const*>
const& in,
611 #ifndef ART_NO_MIX_PTRVECTOR 626 std::vector<arttest::ProductWithPtrs const*>
const& in,
631 #ifndef ART_NO_MIX_PTRVECTOR
void startEvent(art::Event const &)
bool const testNoLimEventDupes_
size_t beginSubRunCounter_
std::vector< EventAuxiliary > EventAuxiliarySequence
void respondToCloseInputFile(art::FileBlock const &fb)
void endSubRun(art::SubRun &sr)
std::vector< EventID > EventIDSequence
bool processEventAuxiliaries_called_
art::PtrVector< double > const & ptrVectorDouble() const
std::vector< art::Ptr< double > > const & vectorPtrDouble() const
bool mixPtrs(std::vector< std::vector< art::Ptr< double >> const * > const &in, std::vector< art::Ptr< double >> &out, art::PtrRemapper const &remap)
size_t const nSecondaries_
void respondToCloseOutputFiles(art::FileBlock const &fb)
bool mixByAddition(std::vector< PROD const * > const &, OPROD &, art::PtrRemapper const &)
std::pair< key_type, mapped_type > value_type
std::vector< int > allEvents_
MixFilterTestDetail(Parameters const &p, art::MixHelper &helper)
size_t respondFunctionsSeen_
bool const testPtrFailure_
bool mixPtrVectors(std::vector< art::PtrVector< double > const * > const &in, art::PtrVector< double > &out, art::PtrRemapper const &remap)
bool processEventIDs_called_
bool mixmap_vectorPtrs(std::vector< std::vector< art::Ptr< cet::map_vector< unsigned int >::value_type >> const * > const &in, std::vector< art::Ptr< cet::map_vector< unsigned int >::value_type >> &out, art::PtrRemapper const &remap)
bool const compactMissingProducts_
size_t const expectedRespondFunctionCalls_
void processEventAuxiliaries(art::EventAuxiliarySequence const &)
bool aggregateDoubleCollection(std::vector< std::vector< double > const * > const &in, std::vector< double > &out, art::PtrRemapper const &)
auto vector(Vector const &v)
Returns a manipulator which will print the specified array.
void beginRun(art::Run const &r)
void flattenCollections(std::vector< COLLECTION const * > const &in, COLLECTION &out)
#define DEFINE_ART_MODULE(klass)
void swap(Handle< T > &a, Handle< T > &b)
void verifyInSize(COLL const &in) const
std::vector< size_t > map_vectorOffsets_
std::function< bool(std::vector< PROD const * > const &, OPROD &, PtrRemapper const &)> MixFunc
size_t nSecondaries() const
void beginSubRun(art::SubRun const &sr)
art::MixHelper::Mode const readMode_
auto transform_all(Container &, OutputIt, UnaryOp)
MixFilterTestDetail & operator=(MixFilterTestDetail const &)=delete
bool mixRProduct(std::vector< double const * > const &in, DoubleProduct &out, art::PtrRemapper const &)
std::unique_ptr< art::EventIDSequence > eIDs_
std::vector< art::Ptr< double > > vpd_
std::unordered_set< int > uniqueEvents_
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
bool aggregate_map_vector(std::vector< mv_t const * > const &in, mv_t &out, art::PtrRemapper const &)
void respondToOpenInputFile(art::FileBlock const &fb)
std::vector< size_t > doubleVectorOffsets_
void finalizeEvent(art::Event &t)
bool const testEventOrdering_
bool mixSRProduct(std::vector< double const * > const &in, DoubleProduct &out, art::PtrRemapper const &)
void respondToOpenOutputFiles(art::FileBlock const &fb)
EventNumber_t event() const
bool const testZeroSecondaries_
bool mixProductWithPtrs(std::vector< arttest::ProductWithPtrs const * > const &in, arttest::ProductWithPtrs &out, art::PtrRemapper const &remap)
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
SubRunNumber_t subRun() const
cet::coded_exception< error, detail::translate > exception
void processEventIDs(art::EventIDSequence const &seq)