source: trunk/source/particles/test/reportParticleTable/reportParticles.cc@ 1215

Last change on this file since 1215 was 1199, checked in by garnier, 16 years ago

nvx fichiers dans CVS

File size: 4.4 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: reportParticles.cc,v 1.11 2009/09/15 14:40:26 kurasige Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29//
30//
31// ---------------------------------------------------------------
32#include "G4ios.hh"
33#include "globals.hh"
34#include "tst2ParticleConstructor.hh"
35#include "G4ParticleTable.hh"
36#include "G4ParticlePropertyTable.hh"
37#include "G4SimplePPReporter.hh"
38#include "G4StateManager.hh"
39#include "G4HtmlPPReporter.hh"
40#include <fstream>
41#include <iomanip>
42
43#define USE_HTML_REPORTER 1
44
45int main()
46{
47 // set the initial application state
48 G4StateManager::GetStateManager()->SetNewState(G4State_PreInit);
49
50 G4ParticleTable::GetParticleTable()->SetReadiness();
51
52 // create all particles
53 tst2ParticleConstructor pConstructor;
54 pConstructor.ConstructParticle();
55
56
57 // particleContainer
58 G4VParticlePropertyReporter* aPPR;
59#ifdef USE_HTML_REPORTER
60 G4VParticlePropertyReporter* pLepton = new G4HtmlPPReporter();
61 G4VParticlePropertyReporter* pMeson = new G4HtmlPPReporter();
62 G4VParticlePropertyReporter* pBaryon = new G4HtmlPPReporter();
63 G4VParticlePropertyReporter* pIon = new G4HtmlPPReporter();
64 G4VParticlePropertyReporter* pQuark = new G4HtmlPPReporter();
65 G4VParticlePropertyReporter* pOther = new G4HtmlPPReporter();
66#else
67 G4VParticlePropertyReporter* pLepton = new G4SimplePPReporter();
68 G4VParticlePropertyReporter* pMeson = new G4SimplePPReporter();
69 G4VParticlePropertyReporter* pBaryon = new G4SimplePPReporter();
70 G4VParticlePropertyReporter* pIon = new G4SimplePPReporter();
71 G4VParticlePropertyReporter* pQuark = new G4SimplePPReporter();
72 G4VParticlePropertyReporter* pOther = new G4SimplePPReporter();
73#endif
74 // pointer to the particle table
75 G4ParticleTable* theParticleTable = G4ParticleTable::GetParticleTable();
76 G4ParticleTable::G4PTblDicIterator* theParticleIterator;
77 theParticleIterator = theParticleTable->GetIterator();
78
79 G4ParticlePropertyTable* thePPTable = G4ParticlePropertyTable::GetParticlePropertyTable();
80
81 // loop over all particles in G4ParticleTable
82 theParticleIterator->reset();
83 while( (*theParticleIterator)() ){
84 G4ParticleDefinition* particle = theParticleIterator->value();
85 G4String type = particle->GetParticleType();
86 if (type=="lepton") {
87 aPPR = pLepton;
88 } else if (type=="meson") {
89 aPPR = pMeson;
90
91 } else if (type=="baryon") {
92 aPPR = pBaryon;
93
94 } else if (type=="nucleus") {
95 aPPR = pIon;
96
97 } else if ((type=="quarks")||(type=="diquarks")||(type=="gluons")) {
98 aPPR = pQuark;
99
100 } else {
101 aPPR = pOther;
102 }
103 // add property data to PPDcontainer
104 aPPR->FillList(particle->GetParticleName());
105}
106 pLepton->Print("leptons");
107 pMeson->Print("mesons");
108 pBaryon->Print("baryons");
109 pIon->Print("ions");
110 pQuark->Print("quarks");
111 pOther->Print("others");
112
113 return EXIT_SUCCESS;
114}
115
116
117
118
Note: See TracBrowser for help on using the repository browser.