File indexing completed on 2025-07-05 08:55:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #ifndef G4MCTEVENT_HH
0031 #define G4MCTEVENT_HH 1
0032
0033 #include <iostream>
0034 #include <map>
0035
0036 #include "G4Types.hh"
0037 #include "G4MCTGenParticle.hh"
0038
0039 class G4MCTGenEvent;
0040 class G4MCTSimEvent;
0041 class G4MCTSimParticle;
0042
0043 using MCTGen2SimParticleMap = std::map<G4MCTGenParticle, G4MCTSimParticle*>;
0044 using MCTSim2GenParticleMap = std::map<G4MCTSimParticle*, G4MCTGenParticle>;
0045
0046 class G4MCTEvent
0047 {
0048 public:
0049
0050 G4MCTEvent();
0051 virtual ~G4MCTEvent();
0052
0053 inline G4MCTEvent(const G4MCTEvent& right);
0054 inline G4MCTEvent& operator=(const G4MCTEvent& right);
0055
0056
0057 inline void SetEventNumber(G4int n);
0058 inline G4int GetEventNumber() const;
0059
0060
0061 inline G4MCTGenEvent* GetGenEvent() const;
0062 inline G4MCTSimEvent* GetSimEvent() const;
0063
0064 inline G4int GetNofPrimaries() const;
0065 G4MCTSimParticle* GetSimParticle(const G4MCTGenParticle& genpart) const;
0066 G4MCTGenParticle GetGenParticle(const G4MCTSimParticle* simpart) const;
0067 G4int AddPrimaryPair(const G4MCTGenParticle& genp,
0068 const G4MCTSimParticle* simp);
0069 void ClearEvent();
0070 void Print(std::ostream& ostr = std::cout) const;
0071
0072
0073
0074 using genprimary_const_iterator = MCTGen2SimParticleMap::const_iterator;
0075 inline genprimary_const_iterator genprimaries_begin() const;
0076 inline genprimary_const_iterator genprimaries_end() const;
0077
0078 using simprimary_const_iterator = MCTSim2GenParticleMap::const_iterator;
0079 inline simprimary_const_iterator simprimaries_begin() const;
0080 inline simprimary_const_iterator simprimaries_end() const;
0081
0082 protected:
0083
0084 G4int eventNumber = 0;
0085 G4MCTGenEvent* genEvent = nullptr;
0086 G4MCTSimEvent* simEvent = nullptr;
0087
0088
0089 MCTGen2SimParticleMap gen2simParticleMap;
0090 MCTSim2GenParticleMap sim2genParticleMap;
0091 };
0092
0093
0094
0095
0096
0097 inline G4MCTEvent::G4MCTEvent(const G4MCTEvent& right) { *this = right; }
0098
0099 inline G4MCTEvent& G4MCTEvent::operator=(const G4MCTEvent& right)
0100 {
0101 eventNumber = right.eventNumber;
0102
0103 simEvent = right.simEvent;
0104 genEvent = right.genEvent;
0105
0106 gen2simParticleMap = right.gen2simParticleMap;
0107 sim2genParticleMap = right.sim2genParticleMap;
0108
0109 return *this;
0110 }
0111
0112 inline void G4MCTEvent::SetEventNumber(G4int n)
0113 {
0114 eventNumber = n;
0115 }
0116
0117 inline G4int G4MCTEvent::GetEventNumber() const
0118 {
0119 return eventNumber;
0120 }
0121
0122 inline G4int G4MCTEvent::GetNofPrimaries() const
0123 {
0124 return (G4int)gen2simParticleMap.size();
0125 }
0126
0127 inline G4MCTSimEvent* G4MCTEvent::GetSimEvent() const
0128 {
0129 return simEvent;
0130 }
0131
0132 inline G4MCTGenEvent* G4MCTEvent::GetGenEvent() const
0133 {
0134 return genEvent;
0135 }
0136
0137
0138 inline
0139 G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_begin() const
0140 {
0141 return gen2simParticleMap.cbegin();
0142 }
0143
0144 inline
0145 G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_end() const
0146 {
0147 return gen2simParticleMap.cend();
0148 }
0149
0150 inline
0151 G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_begin() const
0152 {
0153 return sim2genParticleMap.cbegin();
0154 }
0155
0156 inline
0157 G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_end() const
0158 {
0159 return sim2genParticleMap.cend();
0160 }
0161
0162 #endif