GENIEGenerator
Loading...
Searching...
No Matches
Pythia8Singleton.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6*/
7//____________________________________________________________________________
8
9#include <sstream>
10#include <iostream>
11
14
15namespace genie {
16
17//____________________________________________________________________________
18//ostream & operator << (ostream & stream, const Pythia8Singleton & cache)
19//{
20// cache.Print(stream);
21// return stream;
22//}
23//____________________________________________________________________________
25//____________________________________________________________________________
27{
28 fInstance = 0;
29#ifdef __GENIE_PYTHIA8_ENABLED__
30 fPythia = 0;
31#endif
32
33}
34//____________________________________________________________________________
36{
37#ifdef __GENIE_PYTHIA8_ENABLED__
38 if (fPythia) {
39 delete fPythia;
40 }
41#endif
42 fInstance = 0;
43}
44//____________________________________________________________________________
46{
47 if (fInstance == 0) {
48 static Pythia8Singleton::Cleaner cleaner;
50
52
53#ifdef __GENIE_PYTHIA8_ENABLED__
54 // actually create the one to be held
55 fInstance->fPythia = new Pythia8::Pythia();
56#endif
57 }
58 return fInstance;
59}
60//____________________________________________________________________________
61//void Pythia8Singleton::Print(ostream & stream) const
62//{
63// stream << "\n [-] GENIE Pythia8Singleton:";
64// stream << "\n ";
65// stream << "\n";
66//}
67//___________________________________________________________________________
68
69} // genie namespace
Manage a single instance of pythia8.
static Pythia8Singleton * fInstance
print
Pythia8Singleton()
singleton class: constructors are private
static Pythia8Singleton * Instance(void)
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
proper de-allocation of the singleton object