source: trunk/source/persistency/mctruth/include/G4MCTSimEvent.hh @ 1202

Last change on this file since 1202 was 818, checked in by garnier, 16 years ago

import all except CVS

File size: 4.9 KB
Line 
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//   G4MCTSimEvent.hh
27//
28// ====================================================================
29#ifndef MCT_SIM_EVENT_H
30#define MCT_SIM_EVENT_H
31
32#include "G4Types.hh"
33#include <iostream>
34#include <vector>
35#include <map>
36 
37// ====================================================================
38//
39// class definition
40//
41// ====================================================================
42class G4MCTSimParticle;
43class G4MCTSimVertex;
44
45typedef std::map<int, G4MCTSimParticle*> G4MCTSimParticleContainer;
46typedef std::vector<G4MCTSimVertex*> G4MCTSimVertexContainer;
47
48class G4MCTSimEvent {
49protected:
50G4MCTSimParticleContainer particleMap;
51G4MCTSimVertexContainer vertexVec;
52 
53public:
54  G4MCTSimEvent();
55  ~G4MCTSimEvent();
56 
57  // copy constructor and assignment operator
58  G4MCTSimEvent(const G4MCTSimEvent& right);
59  const G4MCTSimEvent& operator=(const G4MCTSimEvent& right);
60
61  // methods...
62  G4bool AddParticle(const G4MCTSimParticle* aparticle);
63  int GetNofParticles() const;
64  int GetNofVertices() const;
65  int GetNofStoredParticles() const;
66  int GetNofStoredVertices() const;
67  G4MCTSimParticle* FindParticle(int tid) const;
68  G4MCTSimVertex* GetVertex(int vid) const;
69
70  void BuildVertexContainer();
71  void ClearEvent();
72  void Print(std::ostream& ostr= std::cout) const; 
73
74  // iterators
75  typedef G4MCTSimParticleContainer::iterator particle_iterator;
76  typedef G4MCTSimParticleContainer::const_iterator particle_const_iterator;
77  particle_iterator particles_begin();
78  particle_iterator particles_end();
79  particle_const_iterator particles_begin() const;
80  particle_const_iterator particles_end() const;
81 
82  typedef G4MCTSimVertexContainer::iterator vertex_iterator;
83  typedef G4MCTSimVertexContainer::const_iterator vertex_const_iterator;
84  vertex_iterator vertices_begin();
85  vertex_iterator vertices_end();
86  vertex_const_iterator vertices_begin() const;
87  vertex_const_iterator vertices_end() const;
88};
89
90// ====================================================================
91// inline functions
92// ====================================================================
93
94inline G4MCTSimEvent::G4MCTSimEvent(const G4MCTSimEvent& right)
95{
96  *this= right;
97}
98 
99inline const G4MCTSimEvent& G4MCTSimEvent::operator=(const G4MCTSimEvent& right)
100{
101  particleMap= right.particleMap; // shallow copy
102
103  return *this;
104}
105
106inline int G4MCTSimEvent::GetNofParticles() const
107{
108  return particleMap.size();
109}
110
111inline int G4MCTSimEvent::GetNofVertices() const
112{
113  return vertexVec.size();
114}
115
116// iterators
117inline G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_begin()
118{ return particleMap.begin(); }
119
120inline G4MCTSimEvent::particle_iterator G4MCTSimEvent::particles_end()
121{ return particleMap.end(); }
122
123inline G4MCTSimEvent::particle_const_iterator
124                    G4MCTSimEvent::particles_begin() const
125{ return particleMap.begin(); }
126
127inline G4MCTSimEvent::particle_const_iterator G4MCTSimEvent::particles_end() const
128{ return particleMap.end(); }
129
130inline G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_begin()
131{ return vertexVec.begin(); }
132
133inline G4MCTSimEvent::vertex_iterator G4MCTSimEvent::vertices_end()
134{ return vertexVec.end(); }
135
136inline G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_begin() const
137{ return vertexVec.begin(); }
138
139inline G4MCTSimEvent::vertex_const_iterator G4MCTSimEvent::vertices_end() const
140{ return vertexVec.end(); }
141
142#endif
Note: See TracBrowser for help on using the repository browser.