Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
Generator
src
Framework
GHEP
GHepVirtualListFolder.cxx
Go to the documentation of this file.
1
//____________________________________________________________________________
2
/*
3
Copyright (c) 2003-2020, The GENIE Collaboration
4
For the full text of the license visit http://copyright.genie-mc.org
5
6
Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7
University of Liverpool & STFC Rutherford Appleton Laboratory
8
*/
9
//____________________________________________________________________________
10
11
#include "
Framework/GHEP/GHepVirtualListFolder.h
"
12
#include "
Framework/GHEP/GHepVirtualList.h
"
13
#include "
Framework/Messenger/Messenger.h
"
14
15
using namespace
genie
;
16
17
//____________________________________________________________________________
18
GHepVirtualListFolder
*
GHepVirtualListFolder::fInstance
= 0;
19
//____________________________________________________________________________
20
GHepVirtualListFolder::GHepVirtualListFolder
()
21
{
22
fInstance
= 0;
23
}
24
//____________________________________________________________________________
25
GHepVirtualListFolder::~GHepVirtualListFolder
()
26
{
27
this->
Clear
();
28
fInstance
= 0;
29
}
30
//____________________________________________________________________________
31
GHepVirtualListFolder
*
GHepVirtualListFolder::Instance
()
32
{
33
if
(
fInstance
== 0) {
34
35
static
GHepVirtualListFolder::Cleaner
cleaner;
36
cleaner.
DummyMethodAndSilentCompiler
();
37
38
fInstance
=
new
GHepVirtualListFolder
;
39
}
40
return
fInstance
;
41
}
42
//____________________________________________________________________________
43
void
GHepVirtualListFolder::AddToVirtualList
(
string
listname,
GHepParticle
*
p
)
44
{
45
// Adds a particle to the named virtual list - if the list does not exists it
46
// creates it first.
47
// The virtual list has no ownership of its
48
bool
exists
= this->
VirtualListExists
(listname);
49
50
if
(!exists) this->
AddVirtualList
(listname);
51
52
int
n
=
fVirtualListMap
[listname]->GetEntries();
53
GHepVirtualList
* vl =
fVirtualListMap
[listname];
54
(*vl)[
n
] = (TObject*)p;
55
}
56
//____________________________________________________________________________
57
bool
GHepVirtualListFolder::VirtualListExists
(
string
listname)
58
{
59
// checks whether a virtual list exists
60
61
bool
exists
= (
fVirtualListMap
.count(listname) == 1);
62
return
exists
;
63
}
64
//____________________________________________________________________________
65
void
GHepVirtualListFolder::RemoveList
(
string
listname)
66
{
67
// removes the input virtual list (if it exists)
68
69
bool
exists
= (
fVirtualListMap
.count(listname) == 1);
70
if
(!exists)
return
;
71
72
map<string, GHepVirtualList *>::iterator
73
vlmiter =
fVirtualListMap
.find(listname);
74
75
GHepVirtualList
* vlist = vlmiter->second;
76
if
(vlist)
delete
vlist;
77
vlist = 0;
78
79
fVirtualListMap
.erase(listname);
80
}
81
//____________________________________________________________________________
82
void
GHepVirtualListFolder::Clear
(
void
)
83
{
84
// removes all virtual lists
85
86
map<string, GHepVirtualList *>::iterator
vlmiter;
87
for
(vlmiter =
fVirtualListMap
.begin();
88
vlmiter !=
fVirtualListMap
.end(); ++vlmiter) {
89
GHepVirtualList
* vlist = vlmiter->second;
90
if
(vlist)
delete
vlist;
91
vlist = 0;
92
}
93
fVirtualListMap
.clear();
94
}
95
//____________________________________________________________________________
96
GHepVirtualList
*
GHepVirtualListFolder::VirtualList
(
string
listname)
97
{
98
bool
exists
= this->
VirtualListExists
(listname);
99
100
if
(!exists)
return
0;
101
else
return
fVirtualListMap
[listname];
102
}
103
//____________________________________________________________________________
104
void
GHepVirtualListFolder::AddVirtualList
(
string
listname)
105
{
106
GHepVirtualList
* vl =
new
GHepVirtualList
;
107
fVirtualListMap
.insert(
108
map<string, GHepVirtualList *>::value_type(listname,vl) );
109
}
110
//____________________________________________________________________________
iterator
intermediate_table::iterator iterator
Definition:
intermediate_table.cc:27
GHepVirtualListFolder.h
genie::GHepVirtualListFolder::RemoveList
void RemoveList(string listname)
Definition:
GHepVirtualListFolder.cxx:65
genie::GHepVirtualListFolder::Cleaner
Definition:
GHepVirtualListFolder.h:56
genie
THE MAIN GENIE PROJECT NAMESPACE
Definition:
AlgCmp.h:25
genie::GHepVirtualListFolder::VirtualListExists
bool VirtualListExists(string listname)
Definition:
GHepVirtualListFolder.cxx:57
exists
bool exists(std::string path)
Definition:
simplifyGDML.cc:290
genie::GHepVirtualListFolder::Cleaner::DummyMethodAndSilentCompiler
void DummyMethodAndSilentCompiler()
Definition:
GHepVirtualListFolder.h:57
genie::GHepVirtualList
A GHepVirtualList is a 'virtual' collection of GHepParticles. Is virtual because it does not own but ...
Definition:
GHepVirtualList.h:35
cet::n
std::void_t< T > n
Definition:
metaprogramming.h:28
test.p
p
Definition:
test.py:223
genie::GHepVirtualListFolder
A singleton class to manage all named GHepVirtualLists.
Definition:
GHepVirtualListFolder.h:32
genie::GHepVirtualListFolder::fInstance
static GHepVirtualListFolder * fInstance
Definition:
GHepVirtualListFolder.h:50
Messenger.h
genie::GHepVirtualListFolder::Instance
static GHepVirtualListFolder * Instance(void)
Definition:
GHepVirtualListFolder.cxx:31
GHepVirtualList.h
genie::GHepVirtualListFolder::fVirtualListMap
map< string, GHepVirtualList * > fVirtualListMap
Definition:
GHepVirtualListFolder.h:52
genie::GHepVirtualListFolder::AddToVirtualList
void AddToVirtualList(string listname, GHepParticle *p)
Definition:
GHepVirtualListFolder.cxx:43
genie::GHepVirtualListFolder::AddVirtualList
void AddVirtualList(string listname)
Definition:
GHepVirtualListFolder.cxx:104
genie::GHepVirtualListFolder::Clear
void Clear(void)
Definition:
GHepVirtualListFolder.cxx:82
genie::GHepVirtualListFolder::GHepVirtualListFolder
GHepVirtualListFolder()
Definition:
GHepVirtualListFolder.cxx:20
genie::GHepVirtualListFolder::~GHepVirtualListFolder
virtual ~GHepVirtualListFolder()
Definition:
GHepVirtualListFolder.cxx:25
genie::GHepParticle
STDHEP-like event record entry that can fit a particle or a nucleus.
Definition:
GHepParticle.h:39
genie::GHepVirtualListFolder::VirtualList
GHepVirtualList * VirtualList(string listname)
Definition:
GHepVirtualListFolder.cxx:96
Generated by
1.8.11