source: trunk/source/persistency/mctruth/include/G4MCTEvent.hh@ 1089

Last change on this file since 1089 was 818, checked in by garnier, 17 years ago

import all except CVS

File size: 4.9 KB
RevLine 
[818]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// ====================================================================
42class G4MCTGenEvent;
43class G4MCTSimEvent;
44class G4MCTSimParticle;
45
46typedef std::map<G4MCTGenParticle, G4MCTSimParticle*> MCTGen2SimParticleMap;
47typedef std::map<G4MCTSimParticle*, G4MCTGenParticle> MCTSim2GenParticleMap;
48
49class G4MCTEvent {
50protected:
51 int eventNumber;
52 G4MCTGenEvent* genEvent;
53 G4MCTSimEvent* simEvent;
54
55 // primary table (bidirectional)
56 MCTGen2SimParticleMap gen2simParticleMap;
57 MCTSim2GenParticleMap sim2genParticleMap;
58
59public:
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
97inline G4MCTEvent::G4MCTEvent(const G4MCTEvent& right)
98{
99 *this= right;
100}
101
102inline const G4MCTEvent& G4MCTEvent::operator=(const G4MCTEvent& right)
103{
104 eventNumber= right.eventNumber;
105
106 simEvent= right.simEvent; // shallow copy...
107 genEvent= right.genEvent;
108
109 gen2simParticleMap= right.gen2simParticleMap;
110 sim2genParticleMap= right.sim2genParticleMap;
111
112 return *this;
113}
114
115inline void G4MCTEvent::SetEventNumber(int n) { eventNumber= n; }
116inline int G4MCTEvent::GetEventNumber() const { return eventNumber; }
117
118inline int G4MCTEvent::GetNofPrimaries() const
119 { return gen2simParticleMap.size(); }
120inline G4MCTSimEvent* G4MCTEvent::GetSimEvent() const { return simEvent; }
121inline G4MCTGenEvent* G4MCTEvent::GetGenEvent() const { return genEvent; }
122
123// iterators
124inline G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_begin() const
125{ return gen2simParticleMap.begin(); }
126
127inline G4MCTEvent::genprimary_const_iterator G4MCTEvent::genprimaries_end() const
128{ return gen2simParticleMap.end(); }
129
130inline G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_begin() const
131{ return sim2genParticleMap.begin(); }
132
133inline G4MCTEvent::simprimary_const_iterator G4MCTEvent::simprimaries_end() const
134{ return sim2genParticleMap.end(); }
135
136#endif
Note: See TracBrowser for help on using the repository browser.