Geant4  10.02.p01
G4MCTEvent.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 // G4MCTEvent.hh
27 //
28 // ====================================================================
29 #ifndef MCT_EVENT_H
30 #define MCT_EVENT_H
31 
32 #include "G4Types.hh"
33 #include <iostream>
34 #include <map>
35 #include "G4MCTGenParticle.hh"
36 
37 // ====================================================================
38 //
39 // class definition
40 //
41 // ====================================================================
42 class G4MCTGenEvent;
43 class G4MCTSimEvent;
45 
46 typedef std::map<G4MCTGenParticle, G4MCTSimParticle*> MCTGen2SimParticleMap;
47 typedef std::map<G4MCTSimParticle*, G4MCTGenParticle> MCTSim2GenParticleMap;
48 
49 class G4MCTEvent {
50 protected:
54 
55  // primary table (bidirectional)
58 
59 public:
60  G4MCTEvent();
61  virtual ~G4MCTEvent();
62 
63  // copy constructor and assignment operator
64  G4MCTEvent(const G4MCTEvent& right);
65  const G4MCTEvent& operator=(const G4MCTEvent& right);
66 
67  // set/get functions
68  void SetEventNumber(int n);
69  int GetEventNumber() const;
70 
71  G4MCTGenEvent* GetGenEvent() const;
72  G4MCTSimEvent* GetSimEvent() const;
73 
74  // methods...
75  int GetNofPrimaries() const;
76  G4MCTSimParticle* GetSimParticle(const G4MCTGenParticle& genpart) const;
77  G4MCTGenParticle GetGenParticle(const G4MCTSimParticle* simpart) const;
78  int AddPrimaryPair(const G4MCTGenParticle& genp,
79  const G4MCTSimParticle* simp);
80  void ClearEvent();
81  void Print(std::ostream& ostr= std::cout) const;
82 
83  // iterators
84  typedef MCTGen2SimParticleMap::const_iterator genprimary_const_iterator;
85  genprimary_const_iterator genprimaries_begin() const;
86  genprimary_const_iterator genprimaries_end() const;
87 
88  typedef MCTSim2GenParticleMap::const_iterator simprimary_const_iterator;
89  simprimary_const_iterator simprimaries_begin() const;
90  simprimary_const_iterator simprimaries_end() const;
91 };
92 
93 // ====================================================================
94 // inline functions
95 // ====================================================================
96 
98 {
99  *this= right;
100 }
101 
103 {
104  eventNumber= right.eventNumber;
105 
106  simEvent= right.simEvent; // shallow copy...
107  genEvent= right.genEvent;
108 
111 
112  return *this;
113 }
114 
116 inline int G4MCTEvent::GetEventNumber() const { return eventNumber; }
117 
118 inline int G4MCTEvent::GetNofPrimaries() const
119  { return gen2simParticleMap.size(); }
120 inline G4MCTSimEvent* G4MCTEvent::GetSimEvent() const { return simEvent; }
121 inline G4MCTGenEvent* G4MCTEvent::GetGenEvent() const { return genEvent; }
122 
123 // iterators
125 { return gen2simParticleMap.begin(); }
126 
128 { return gen2simParticleMap.end(); }
129 
131 { return sim2genParticleMap.begin(); }
132 
134 { return sim2genParticleMap.end(); }
135 
136 #endif
G4MCTGenEvent * GetGenEvent() const
Definition: G4MCTEvent.hh:121
MCTSim2GenParticleMap sim2genParticleMap
Definition: G4MCTEvent.hh:57
const G4MCTEvent & operator=(const G4MCTEvent &right)
Definition: G4MCTEvent.hh:102
void ClearEvent()
Definition: G4MCTEvent.cc:100
virtual ~G4MCTEvent()
Definition: G4MCTEvent.cc:52
MCTSim2GenParticleMap::const_iterator simprimary_const_iterator
Definition: G4MCTEvent.hh:88
G4MCTSimEvent * GetSimEvent() const
Definition: G4MCTEvent.hh:120
int GetNofPrimaries() const
Definition: G4MCTEvent.hh:118
std::map< G4MCTGenParticle, G4MCTSimParticle * > MCTGen2SimParticleMap
Definition: G4MCTEvent.hh:44
G4MCTGenParticle GetGenParticle(const G4MCTSimParticle *simpart) const
Definition: G4MCTEvent.cc:74
G4MCTSimEvent * simEvent
Definition: G4MCTEvent.hh:53
void Print(std::ostream &ostr=std::cout) const
Definition: G4MCTEvent.cc:111
G4MCTGenEvent * genEvent
Definition: G4MCTEvent.hh:52
simprimary_const_iterator simprimaries_end() const
Definition: G4MCTEvent.hh:133
simprimary_const_iterator simprimaries_begin() const
Definition: G4MCTEvent.hh:130
std::pair< void *, void * > G4MCTGenParticle
MCTGen2SimParticleMap::const_iterator genprimary_const_iterator
Definition: G4MCTEvent.hh:84
genprimary_const_iterator genprimaries_end() const
Definition: G4MCTEvent.hh:127
int GetEventNumber() const
Definition: G4MCTEvent.hh:116
const G4int n
void SetEventNumber(int n)
Definition: G4MCTEvent.hh:115
int AddPrimaryPair(const G4MCTGenParticle &genp, const G4MCTSimParticle *simp)
Definition: G4MCTEvent.cc:87
G4MCTSimParticle * GetSimParticle(const G4MCTGenParticle &genpart) const
Definition: G4MCTEvent.cc:61
MCTGen2SimParticleMap gen2simParticleMap
Definition: G4MCTEvent.hh:56
std::map< G4MCTSimParticle *, G4MCTGenParticle > MCTSim2GenParticleMap
Definition: G4MCTEvent.hh:47
int eventNumber
Definition: G4MCTEvent.hh:51
genprimary_const_iterator genprimaries_begin() const
Definition: G4MCTEvent.hh:124