7 #include "DataFormats/TestObjects/interface/OtherThingCollection.h"
8 #include "DataFormats/TestObjects/interface/ThingCollection.h"
14 static const char*
kA =
"a";
15 static const char*
kRefA =
"refA";
19 h_a =
new TH1F(
kA,
"a", 100, 0, 20);
27 std::cout <<
"processing event " << std::endl;
33 iEvent.getByLabel(
"OtherThing",
"testUserTag", hOThings);
35 std::cout <<
">> other things found:" << hOThings->size() << std::endl;
36 for (
size_t i = 0;
i < hOThings->size(); ++
i) {
37 const OtherThing& thing = (*hOThings)[
i];
38 h_refA->Fill(thing.ref->a);
39 std::cout <<
">> ref->a: " << thing.ref->a << std::endl;
43 iEvent.getByLabel(
"Thing", hThings);
44 const ThingCollection&
things = *hThings;
46 for (
size_t i = 0;
i <
things.size(); ++
i) {
49 std::cout <<
">> a: " << thing.a << std::endl;
52 std::cout << std::endl <<
"Failed with cms::Exception: " << std::endl;
56 std::cout << std::endl <<
"Failed with std::exception" << std::endl;
60 std::cout << std::endl <<
"Failed with unknown exception" << std::endl;
71 TCanvas*
canvas =
new TCanvas();
74 if (
nullptr !=
hist) {
78 std::cout <<
"no '" <<
kA <<
"' histogram" << std::endl;
84 if (
nullptr !=
hist) {
86 canvas->SaveAs(
"refA.jpg");