GENIEGenerator
Loading...
Searching...
No Matches
GHepVirtualListFolder.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 Costas Andreopoulos <c.andreopoulos \at cern.ch>
7 University of Liverpool
8*/
9//____________________________________________________________________________
10
14
15using namespace genie;
16
17//____________________________________________________________________________
19//____________________________________________________________________________
24//____________________________________________________________________________
30//____________________________________________________________________________
42//____________________________________________________________________________
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//____________________________________________________________________________
58{
59// checks whether a virtual list exists
60
61 bool exists = (fVirtualListMap.count(listname) == 1);
62 return exists;
63}
64//____________________________________________________________________________
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//____________________________________________________________________________
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//____________________________________________________________________________
97{
98 bool exists = this->VirtualListExists(listname);
99
100 if(!exists) return 0;
101 else return fVirtualListMap[listname];
102}
103//____________________________________________________________________________
105{
107 fVirtualListMap.insert(
108 map<string, GHepVirtualList *>::value_type(listname,vl) );
109}
110//____________________________________________________________________________
STDHEP-like event record entry that can fit a particle or a nucleus.
A singleton class to manage all named GHepVirtualLists.
GHepVirtualList * VirtualList(string listname)
bool VirtualListExists(string listname)
map< string, GHepVirtualList * > fVirtualListMap
static GHepVirtualListFolder * Instance(void)
void AddToVirtualList(string listname, GHepParticle *p)
static GHepVirtualListFolder * fInstance
A GHepVirtualList is a 'virtual' collection of GHepParticles. Is virtual because it does not own but ...
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25