ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4MCTEvent.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4MCTEvent.hh
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;
87 
88  typedef MCTSim2GenParticleMap::const_iterator simprimary_const_iterator;
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