G4VParticlePropertyReporter.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // the GEANT4 collaboration.
00027 //
00028 // By copying, distributing or modifying the Program (or any work
00029 // based on the Program) you indicate your acceptance of this statement,
00030 // and all its terms.
00031 //
00032 // $Id$
00033 //
00034 // 
00035 // ---------------------------------------------------------------
00036 #include "G4VParticlePropertyReporter.hh"
00037 #include "G4ParticleDefinition.hh"
00038 #include "G4ParticleTable.hh"
00039 
00041 G4VParticlePropertyReporter::G4VParticlePropertyReporter()
00042 {
00043   pPropertyTable =   G4ParticlePropertyTable::GetParticlePropertyTable();
00044 }
00045 
00047 G4VParticlePropertyReporter::~G4VParticlePropertyReporter()
00048 {
00049   pList.clear();
00050   pPropertyTable->Clear();
00051 }    
00052 
00054 G4bool G4VParticlePropertyReporter::FillList(G4String name)
00055 {
00056   G4ParticlePropertyData* pData = pPropertyTable->GetParticleProperty(name);
00057   G4bool result = false;
00058   if (pData != 0) {
00059     //the particle exists
00060     pList.push_back(pData);
00061     result = true;
00062   } else {
00063     // pointer to the particle table
00064     G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
00065     G4ParticleTable::G4PTblDicIterator* theParticleIterator;
00066     theParticleIterator = theParticleTable->GetIterator();
00067     
00068     // loop over all particles in G4ParticleTable 
00069     theParticleIterator->reset();
00070     while( (*theParticleIterator)() ){
00071       G4ParticleDefinition* particle = theParticleIterator->value();
00072       G4String type = particle->GetParticleType();
00073       pData =pPropertyTable->GetParticleProperty(particle);
00074       if ( name == "all" ) {
00075         pList.push_back(pData);
00076         result = true;
00077       } else if ( name == type ) {
00078         pList.push_back(pData);
00079         result = true;
00080       } 
00081     }
00082   }
00083   return result;
00084 }
00085 
00086 void G4VParticlePropertyReporter::Clear()
00087 {
00088   pList.clear();
00089 }
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 

Generated on Mon May 27 17:50:19 2013 for Geant4 by  doxygen 1.4.7