Geant4-11
G4DNAEventSet.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27#ifndef G4DNAEventSet_hh
28#define G4DNAEventSet_hh 1
29#include <list>
30#include <map>
31#include <G4memory.hh>
32#include "G4Track.hh"
33#include <set>
34#include "G4DNAMesh.hh"
35#include <variant>
38class Event
39{
40 public:
43 using JumpingData = std::pair<MolType, Index>;
45
46 // to test C++17
47 // using Data = std::variant<std::unique_ptr<JumpingData>, ReactionData*>
48 using Data = std::pair<std::unique_ptr<JumpingData>, ReactionData*>;
49
50 Event(G4double time, unsigned int key, ReactionData*);
51 Event(G4double time, unsigned int key, std::unique_ptr<JumpingData>&&);
52
53 virtual ~Event();
54 G4double GetTime() const { return fTimeStep; }
55 unsigned int GetKey() const { return fKey; }
56 void PrintEvent() const;
57
58 JumpingData* GetJumpingData() const { return std::get<0>(fData).get(); }
59
60 ReactionData* GetReactionData() const { return std::get<1>(fData); }
61
62 private:
64 unsigned int fKey;
66};
67
69{
70 G4bool operator()(std::unique_ptr<Event> const& rhs,
71 std::unique_ptr<Event> const& lhs) const;
72};
73
75{
76 public:
77 IEventSet() = default;
78 ~IEventSet() = default;
79};
80
82{
83 public:
84 using Key = unsigned int;
85 using EventSet = std::set<std::unique_ptr<Event>, comparatorEventSet>;
86 using EventMap = std::map<Key, EventSet::iterator>;
88 virtual ~G4DNAEventSet();
89
90 void CreateEvent(G4double time, Key index,
91 Event::ReactionData* pReactionData);
92 void CreateEvent(G4double time, Key index,
93 std::unique_ptr<Event::JumpingData> jum);
94
95 void AddEvent(std::unique_ptr<Event> pEvent);
97 {
98 fEventSet.clear();
99 fEventMap.clear();
100 }
101 void RemoveEventOfVoxel(const size_t& key);
102
103 EventSet::iterator end() { return fEventSet.end(); }
104 EventSet::iterator begin() { return fEventSet.begin(); }
105
106 EventSet::reverse_iterator rend() { return fEventSet.rend(); }
107 EventSet::reverse_iterator rbegin() { return fEventSet.rbegin(); }
108
109 EventSet::const_iterator end() const { return fEventSet.end(); }
110
111 EventSet::const_iterator begin() const { return fEventSet.begin(); }
112
113 size_t size() { return fEventSet.size(); }
114
115 G4bool Empty() { return fEventSet.empty(); }
116
117 void RemoveEvent(EventSet::iterator iter);
118 [[maybe_unused]] void PrintEventSet();
119
120 private:
123};
124#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
unsigned int GetKey() const
ReactionData * GetReactionData() const
G4double GetTime() const
std::pair< MolType, Index > JumpingData
void PrintEvent() const
Event(G4double time, unsigned int key, ReactionData *)
virtual ~Event()
unsigned int fKey
Data fData
G4double fTimeStep
JumpingData * GetJumpingData() const
std::pair< std::unique_ptr< JumpingData >, ReactionData * > Data
EventSet::reverse_iterator rend()
EventSet::reverse_iterator rbegin()
EventSet::iterator end()
virtual ~G4DNAEventSet()
void PrintEventSet()
EventMap fEventMap
EventSet::const_iterator begin() const
unsigned int Key
std::map< Key, EventSet::iterator > EventMap
void RemoveEventOfVoxel(const size_t &key)
void AddEvent(std::unique_ptr< Event > pEvent)
void RemoveEventSet()
std::set< std::unique_ptr< Event >, comparatorEventSet > EventSet
EventSet::iterator begin()
void RemoveEvent(EventSet::iterator iter)
EventSet fEventSet
void CreateEvent(G4double time, Key index, Event::ReactionData *pReactionData)
EventSet::const_iterator end() const
~IEventSet()=default
IEventSet()=default
G4bool operator()(std::unique_ptr< Event > const &rhs, std::unique_ptr< Event > const &lhs) const