CMS 3D CMS Logo

ThingSource.cc
Go to the documentation of this file.
1 #include "ThingSource.h"
2 #include "DataFormats/TestObjects/interface/ThingCollection.h"
7 
8 namespace edmtest {
10  : ProducerSourceBase(pset, desc, false), 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  // Step A: Get Inputs
24 
25  // Step B: Create empty output
26  auto result = std::make_unique<ThingCollection>(); //Empty
27 
28  // Step C: Invoke the algorithm, passing in inputs (NONE) and getting back outputs.
29  alg_.run(*result);
30 
31  // Step D: Put outputs into event
32  e.put(std::move(result));
33  }
34 
35  // Functions that gets called by framework every luminosity block
37  // Step A: Get Inputs
38 
39  // Step B: Create empty output
40  auto result = std::make_unique<ThingCollection>(); //Empty
41 
42  // Step C: Invoke the algorithm, passing in inputs (NONE) and getting back outputs.
43  alg_.run(*result);
44 
45  // Step D: Put outputs into lumi block
46  lb.put(std::move(result), "beginLumi");
47 
49  }
50 
52  // Step A: Get Inputs
53 
54  // Step B: Create empty output
55  auto result = std::make_unique<ThingCollection>(); //Empty
56 
57  // Step C: Invoke the algorithm, passing in inputs (NONE) and getting back outputs.
58  alg_.run(*result);
59 
60  // Step D: Put outputs into lumi block
61  lb.put(std::move(result), "endLumi");
62  }
63 
64  // Functions that gets called by framework every run
66  // Step A: Get Inputs
67 
68  // Step B: Create empty output
69  auto result = std::make_unique<ThingCollection>(); //Empty
70 
71  // Step C: Invoke the algorithm, passing in inputs (NONE) and getting back outputs.
72  alg_.run(*result);
73 
74  // Step D: Put outputs into event
75  r.put(std::move(result), "beginRun");
76 
77  endRun(r);
78  }
79 
81  // Step A: Get Inputs
82 
83  // Step B: Create empty output
84  auto result = std::make_unique<ThingCollection>(); //Empty
85 
86  // Step C: Invoke the algorithm, passing in inputs (NONE) and getting back outputs.
87  alg_.run(*result);
88 
89  // Step D: Put outputs into event
90  r.put(std::move(result), "endRun");
91  }
92 
95  desc.setComment("Creates ThingCollections for testing.");
97  descriptions.add("source", desc);
98  }
99 
100 } // namespace edmtest
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: ThingSource.cc:93
~ThingSource() override
Definition: ThingSource.cc:19
void produce(edm::Event &e) override
Definition: ThingSource.cc:22
void endLuminosityBlock(edm::LuminosityBlock &lb)
Definition: ThingSource.cc:51
ThingAlgorithm alg_
Definition: ThingSource.h:43
#define DEFINE_FWK_INPUT_SOURCE(type)
void endRun(edm::Run &r)
Definition: ThingSource.cc:80
void put(std::unique_ptr< PROD > product)
Put a new product.
void run(ThingCollection &thingCollection) const
ThingSource(edm::ParameterSet const &pset, edm::InputSourceDescription const &desc)
Definition: ThingSource.cc:9
static void fillDescription(ParameterSetDescription &desc)
void beginRun(edm::Run &r) override
Definition: ThingSource.cc:65
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void beginLuminosityBlock(edm::LuminosityBlock &lb) override
Definition: ThingSource.cc:36
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45