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] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 // G4MCTEvent
 27 
 28 // Author: Youhei Morita, 12.09.2001
 29 // --------------------------------------------------------------------
 30 #ifndef G4MCTEVENT_HH
 31 #define G4MCTEVENT_HH 1
 32 
 33 #include <iostream>
 34 #include <map>
 35 
 36 #include "G4Types.hh"
 37 #include "G4MCTGenParticle.hh"
 38 
 39 class G4MCTGenEvent;
 40 class G4MCTSimEvent;
 41 class G4MCTSimParticle;
 42 
 43 using MCTGen2SimParticleMap = std::map<G4MCTGenParticle, G4MCTSimParticle*>;
 44 using MCTSim2GenParticleMap = std::map<G4MCTSimParticle*, G4MCTGenParticle>;
 45 
 46 class G4MCTEvent
 47 {
 48   public:
 49 
 50     G4MCTEvent();
 51     virtual ~G4MCTEvent();
 52 
 53     inline G4MCTEvent(const G4MCTEvent& right);
 54     inline G4MCTEvent& operator=(const G4MCTEvent& right);
 55       // copy constructor and assignment operator
 56 
 57     inline void SetEventNumber(G4int n);
 58     inline G4int GetEventNumber() const;
 59       // set/get functions
 60 
 61     inline G4MCTGenEvent* GetGenEvent() const;
 62     inline G4MCTSimEvent* GetSimEvent() const;
 63 
 64     inline G4int GetNofPrimaries() const;
 65     G4MCTSimParticle* GetSimParticle(const G4MCTGenParticle& genpart) const;
 66     G4MCTGenParticle GetGenParticle(const G4MCTSimParticle* simpart) const;
 67     G4int AddPrimaryPair(const G4MCTGenParticle& genp,
 68                         const G4MCTSimParticle* simp);
 69     void ClearEvent();
 70     void Print(std::ostream& ostr = std::cout) const;
 71 
 72     // iterators
 73 
 74     using genprimary_const_iterator = MCTGen2SimParticleMap::const_iterator;
 75     inline genprimary_const_iterator genprimaries_begin() const;
 76     inline genprimary_const_iterator genprimaries_end() const;
 77 
 78     using simprimary_const_iterator = MCTSim2GenParticleMap::const_iterator;
 79     inline simprimary_const_iterator simprimaries_begin() const;
 80     inline simprimary_const_iterator simprimaries_end() const;
 81 
 82   protected:
 83 
 84     G4int eventNumber = 0;
 85     G4MCTGenEvent* genEvent = nullptr;
 86     G4MCTSimEvent* simEvent = nullptr;
 87 
 88     // primary table (bidirectional)
 89     MCTGen2SimParticleMap gen2simParticleMap;
 90     MCTSim2GenParticleMap sim2genParticleMap;
 91 };
 92 
 93 // ====================================================================
 94 // inline methods
 95 // ====================================================================
 96 
 97 inline G4MCTEvent::G4MCTEvent(const G4MCTEvent& right) { *this = right; }
 98 
 99 inline G4MCTEvent& G4MCTEvent::operator=(const G4MCTEvent& right)
100 {
101   eventNumber = right.eventNumber;
102 
103   simEvent = right.simEvent;  // shallow copy...
104   genEvent = right.genEvent;
105 
106   gen2simParticleMap = right.gen2simParticleMap;
107   sim2genParticleMap = right.sim2genParticleMap;
108 
109   return *this;
110 }
111 
112 inline void G4MCTEvent::SetEventNumber(G4int n)
113 {
114   eventNumber = n;
115 }
116 
117 inline G4int G4MCTEvent::GetEventNumber() const
118 {
119   return eventNumber;
120 }
121 
122 inline G4int G4MCTEvent::GetNofPrimaries() const
123 {
124   return (G4int)gen2simParticleMap.size();
125 }
126 
127 inline G4MCTSimEvent* G4MCTEvent::GetSimEvent() const
128 { 
129   return simEvent;
130 }
131 
132 inline G4MCTGenEvent* G4MCTEvent::GetGenEvent() const
133 {
134   return genEvent;
135 }
136 
137 // iterators
138 inline
139 G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_begin() const
140 {
141   return gen2simParticleMap.cbegin();
142 }
143 
144 inline
145 G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_end() const
146 {
147   return gen2simParticleMap.cend();
148 }
149 
150 inline
151 G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_begin() const
152 {
153   return sim2genParticleMap.cbegin();
154 }
155 
156 inline
157 G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_end() const
158 {
159   return sim2genParticleMap.cend();
160 }
161 
162 #endif
163