CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LHEWriter.cc
Go to the documentation of this file.
1 #include <algorithm>
2 #include <iostream>
3 #include <iterator>
4 #include <fstream>
5 #include <string>
6 #include <memory>
7 
14 
17 
18 using namespace lhef;
19 
20 class LHEWriter : public edm::EDAnalyzer {
21  public:
22  explicit LHEWriter(const edm::ParameterSet &params);
23  virtual ~LHEWriter();
24 
25  protected:
26  virtual void beginRun(const edm::Run &run, const edm::EventSetup &es) override;
27  virtual void endRun(const edm::Run &run, const edm::EventSetup &es) override;
28  virtual void analyze(const edm::Event &event, const edm::EventSetup &es) override;
29 
30  private:
31  std::ofstream file;
32 };
33 
35 {
36 }
37 
39 {
40 }
41 
43 {
45  run.getByLabel("source", product);
46 
47  file.open("writer.lhe", std::fstream::out | std::fstream::trunc);
48  std::copy(product->begin(), product->end(),
49  std::ostream_iterator<std::string>(file));
50 }
51 
53 {
55  file.close();
56 }
57 
59 {
61  event.getByLabel("source", product);
62 
63  std::copy(product->begin(), product->end(),
64  std::ostream_iterator<std::string>(file));
65 }
66 
bool getByLabel(std::string const &label, Handle< PROD > &result) const
Definition: Run.h:214
std::ofstream file
Definition: LHEWriter.cc:31
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void endRun(const edm::Run &run, const edm::EventSetup &es) override
Definition: LHEWriter.cc:52
virtual void beginRun(const edm::Run &run, const edm::EventSetup &es) override
Definition: LHEWriter.cc:42
virtual void analyze(const edm::Event &event, const edm::EventSetup &es) override
Definition: LHEWriter.cc:58
LHEWriter(const edm::ParameterSet &params)
Definition: LHEWriter.cc:34
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
tuple out
Definition: dbtoconf.py:99
virtual ~LHEWriter()
Definition: LHEWriter.cc:38
static const std::string & endOfFile()
Definition: Run.h:41