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.12 2010/10/11 03:08:03 kurasige Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
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 | |
---|
45 | int 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 | |
---|
89 | } else if (type=="meson") { |
---|
90 | aPPR = pMeson; |
---|
91 | |
---|
92 | } else if (type=="baryon") { |
---|
93 | aPPR = pBaryon; |
---|
94 | |
---|
95 | } else if ( (type=="nucleus") ||(type=="anti_nucleus") ){ |
---|
96 | aPPR = pIon; |
---|
97 | |
---|
98 | } else if ((type=="quarks")||(type=="diquarks")||(type=="gluons")) { |
---|
99 | aPPR = pQuark; |
---|
100 | |
---|
101 | } else { |
---|
102 | aPPR = pOther; |
---|
103 | } |
---|
104 | // add property data to PPDcontainer |
---|
105 | aPPR->FillList(particle->GetParticleName()); |
---|
106 | } |
---|
107 | pLepton->Print("leptons"); |
---|
108 | pMeson->Print("mesons"); |
---|
109 | pBaryon->Print("baryons"); |
---|
110 | pIon->Print("ions"); |
---|
111 | pQuark->Print("quarks"); |
---|
112 | pOther->Print("others"); |
---|
113 | |
---|
114 | return EXIT_SUCCESS; |
---|
115 | } |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | |
---|