CMS 3D CMS Logo

ThingExtSource.cc
Go to the documentation of this file.
1 #include "ThingExtSource.h"
2 #include "DataFormats/TestObjects/interface/ThingCollection.h"
7 
8 namespace edmtest {
10  : ProducerSourceFromFiles(pset, desc, true), alg_() {
11  produces<ThingCollection>();
12  produces<ThingCollection, edm::Transition::BeginLuminosityBlock>("beginLumi");
13  produces<ThingCollection, edm::Transition::BeginLuminosityBlock>("endLumi");
14  produces<ThingCollection, edm::Transition::BeginRun>("beginRun");
15  produces<ThingCollection, edm::Transition::BeginRun>("endRun");
16  }
17 
18  // Virtual destructor needed.
20 
21  // Functions that gets called by framework every event
23  // Fake running out of data.
24  if (event() > 2)
25  return false;
26  return true;
27  }
28 
30  // Step A: Get Inputs
31 
32  // Step B: Create empty output
33  auto result = std::make_unique<ThingCollection>(); //Empty
34 
35  // Step C: Invoke the algorithm, passing in inputs (NONE) and getting back outputs.
36  alg_.run(*result);
37 
38  // Step D: Put outputs into event
39  e.put(std::move(result));
40  }
41 
42  // Functions that gets called by framework every luminosity block
44  // Step A: Get Inputs
45 
46  // Step B: Create empty output
47  auto result = std::make_unique<ThingCollection>(); //Empty
48 
49  // Step C: Invoke the algorithm, passing in inputs (NONE) and getting back outputs.
50  alg_.run(*result);
51 
52  // Step D: Put outputs into lumi block
53  lb.put(std::move(result), "beginLumi");
54 
56  }
57 
59  // Step A: Get Inputs
60 
61  // Step B: Create empty output
62  auto result = std::make_unique<ThingCollection>(); //Empty
63 
64  // Step C: Invoke the algorithm, passing in inputs (NONE) and getting back outputs.
65  alg_.run(*result);
66 
67  // Step D: Put outputs into lumi block
68  lb.put(std::move(result), "endLumi");
69  }
70 
71  // Functions that gets called by framework every run
73  // Step A: Get Inputs
74 
75  // Step B: Create empty output
76  auto result = std::make_unique<ThingCollection>(); //Empty
77 
78  // Step C: Invoke the algorithm, passing in inputs (NONE) and getting back outputs.
79  alg_.run(*result);
80 
81  // Step D: Put outputs into event
82  r.put(std::move(result), "beginRun");
83 
84  endRun(r);
85  }
86 
88  // Step A: Get Inputs
89 
90  // Step B: Create empty output
91  auto result = std::make_unique<ThingCollection>(); //Empty
92 
93  // Step C: Invoke the algorithm, passing in inputs (NONE) and getting back outputs.
94  alg_.run(*result);
95 
96  // Step D: Put outputs into event
97  r.put(std::move(result), "endRun");
98  }
99 
102  desc.setComment("Creates ThingCollections from a file for testing.");
104  descriptions.add("source", desc);
105  }
106 
107 } // namespace edmtest
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void produce(edm::Event &e) override
static void fillDescription(ParameterSetDescription &desc)
void endRun(edm::Run &r)
void beginLuminosityBlock(edm::LuminosityBlock &lb) override
#define DEFINE_FWK_INPUT_SOURCE(type)
void put(std::unique_ptr< PROD > product)
Put a new product.
bool setRunAndEventInfo(edm::EventID &, edm::TimeValue_t &, edm::EventAuxiliary::ExperimentType &) override
void endLuminosityBlock(edm::LuminosityBlock &lb)
unsigned long long TimeValue_t
Definition: Timestamp.h:21
void run(ThingCollection &thingCollection) const
ThingExtSource(edm::ParameterSet const &pset, edm::InputSourceDescription const &desc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void beginRun(edm::Run &r) override
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45