source: trunk/source/particles/management/src/G4ShortLivedTable.cc @ 992

Last change on this file since 992 was 992, checked in by garnier, 15 years ago

fichiers oublies

File size: 4.0 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//
27// $Id: G4ShortLivedTable.cc,v 1.16 2008/06/08 12:55:45 kurasige Exp $
28// GEANT4 tag $Name: geant4-09-02-ref-02 $
29//
30//
31// --------------------------------------------------------------
32//      GEANT 4 class implementation file
33//
34//      History: first implementation, based on object model of
35//      27 June 1998  H.Kurashige
36// ------------------------------------------------------------
37//      added Remove()                  06 Nov.,98 H.Kurashige
38
39
40#include "G4ShortLivedTable.hh"
41#include "G4ParticleTable.hh"
42
43#include "G4ios.hh"
44
45G4ShortLivedTable::G4ShortLivedTable()
46{
47  fShortLivedList = new G4ShortLivedList();
48}
49
50G4ShortLivedTable::~G4ShortLivedTable()
51{
52  if (fShortLivedList ==0) return;
53
54  //  No need to delete here because all particles are dynamic objects
55  //   
56  // remove all contents in the short lived List and delete all particles 
57  //G4ShortLivedList::iterator i;
58  //for (i = fShortLivedList->begin(); i!= fShortLivedList->end(); ++i) {
59  //  delete (*i);
60  //}
61
62  fShortLivedList->clear();
63  delete fShortLivedList;
64  fShortLivedList =0;
65}
66
67G4int G4ShortLivedTable::GetVerboseLevel() const
68{
69  return G4ParticleTable::GetParticleTable()->GetVerboseLevel();
70}
71
72G4bool G4ShortLivedTable::IsShortLived(G4ParticleDefinition* particle) const
73{
74  return particle->IsShortLived();
75}
76
77void G4ShortLivedTable::Insert(G4ParticleDefinition* particle)
78{
79  if (IsShortLived(particle)) {
80    fShortLivedList->push_back(particle);
81  } 
82}
83
84void G4ShortLivedTable::Remove(G4ParticleDefinition* particle)
85{
86  if (IsShortLived(particle)) {
87    G4ShortLivedList::iterator idx;
88    for (idx = fShortLivedList->begin(); idx!= fShortLivedList->end(); ++idx) {
89      if ( particle == *idx) {
90        fShortLivedList->erase(idx);
91        break;
92      }
93    }
94  } else {
95#ifdef G4VERBOSE
96    if (GetVerboseLevel()>1) {
97      G4cout << "G4ShortLivedTable::Remove :" << particle->GetParticleName() ;
98      G4cout << " is not short lived" << G4endl; 
99    }
100#endif
101  }
102}
103
104
105void G4ShortLivedTable::DumpTable(const G4String &particle_name) const
106{
107  G4ParticleDefinition* particle;
108
109  G4ShortLivedList::iterator idx;
110  for (idx = fShortLivedList->begin(); idx!= fShortLivedList->end(); ++idx) {
111    particle = *idx;
112    if (( particle_name == "ALL" ) || (particle_name == "all")){
113      particle->DumpTable();
114    } else if ( particle_name == particle->GetParticleName() ) {
115      particle->DumpTable();
116    }
117  }
118}
119
120
121
122
123
124
125
126
127
128
129
130
Note: See TracBrowser for help on using the repository browser.