Belle II Software development
HerwigLHEWriterModule.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/core/Module.h>
12#include <mdst/dataobjects/MCParticle.h>
13
14#include <fstream>
15#include <string>
16#include <map>
17
18namespace Belle2 {
23
33 class HerwigLHEWriterModule : public Module {
34
35 public:
36 HerwigLHEWriterModule();
37 virtual ~HerwigLHEWriterModule();
38
40 virtual void initialize() override;
42 virtual void terminate() override;
44 virtual void event() override;
45
46 private:
48 struct EventRecord {
49 std::string sidecarFile;
50 };
51
52 // Steerable module parameters
53 std::string m_workDir{};
54 double m_showerScale{11.0};
55
56 // Non-steerable internal state
57 std::string m_workingDir{};
58 std::ofstream m_lheStream;
59 std::map<int, EventRecord> m_manifest;
60 unsigned int m_batchSeed{0};
62
64 bool writeLHEEventBlock(const std::vector<MCParticle*>& quarks);
65
67 bool writeKKMCSidecar(int globalEvtNum);
68 };
69
71} // namespace Belle2
unsigned int m_batchSeed
Batch seed drawn from gRandom in initialize().
std::map< int, EventRecord > m_manifest
global_event_number -> EventRecord
std::string m_workingDir
Resolved working directory path.
virtual void initialize() override
Register required MCParticle StoreArray.
virtual void event() override
Accumulate one event into an LHE file and write its KKMC sidecar.
virtual void terminate() override
Close LHE file and write manifest.txt.
std::ofstream m_lheStream
Output stream to all_events.lhe (open from initialize to terminate).
std::string m_workDir
User-specified working dir; auto-created via mkdtemp if empty.
int m_eventCounter
Counts event() calls.
bool writeLHEEventBlock(const std::vector< MCParticle * > &quarks)
Write one <event>...</event> block to m_lheStream.
bool writeKKMCSidecar(int globalEvtNum)
Write per-event KKMC sidecar file: all MCParticles with momenta + parent links.
double m_showerScale
Maximum shower scale ceiling in GeV (default 11.0).
Module()
Constructor.
Definition Module.cc:30
Abstract base class for different kinds of events.
Per-event record stored for manifest.txt.
std::string sidecarFile
Basename of the KKMC sidecar file.