#include <iomanip>
#include <string>
#include "Framework/Messenger/Messenger.h"
#include "Framework/ParticleData/NaturalIsotopes.h"
#include "Framework/ParticleData/PDGLibrary.h"
#include "TParticlePDG.h"
#include "TMath.h"
Go to the source code of this file.
|
int | getA (int pdg) |
|
int | setA (int pdg, int a) |
|
std::string | PDGcheck (int pdg) |
|
int | main (int argc, char **argv) |
|
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 35 of file gtestNaturalIsotopes.cxx.
References genie::NaturalIsotopeElementData::Abundance(), genie::NaturalIsotopes::ElementData(), getA(), genie::NaturalIsotopes::Instance(), genie::PDGLibrary::Instance(), LOG, genie::NaturalIsotopes::NElements(), PDGcheck(), genie::NaturalIsotopeElementData::PdgCode(), pNOTICE, and setA().
37 bool docheckpdg =
false;
40 for (
int iarg=1; iarg < argc; ++iarg) {
44 std::string argvstr = std::string(argv[iarg]);
45 if ( argvstr ==
"--check-pdg" ) docheckpdg =
true;
46 else if ( argvstr ==
"--avg-a" ) calcavg =
true;
48 cout <<
"Usage: " << argv[0] <<
" [--check-pdg] [--avg-a]" << endl;
54 <<
"Testing the NaturalIsotopes utility";
56 PDGLibrary::Instance();
62 <<
"Check on PDG in PDGLibrary: [PDG,PDG-proton,PDG-neutron]";
65 for(
int Z = 1; Z < 104; Z++){
68 <<
" Number of elements = " << nel;
71 double abund, avg_a = 0;
73 for(
int n = 0; n < nel; n++){
77 avg_a += double(
getA(pdg)) * abund;
78 extra = ( docheckpdg ) ?
PDGcheck(pdg) :
"";
80 <<
" -- Element: " << n
81 <<
", PdgCode = " << pdg
83 <<
", Abundance = " << abund;
85 if ( calcavg && ( nel > 1 ) ) {
87 pdg =
setA(pdg,TMath::Nint(avg_a));
88 extra = ( docheckpdg ) ?
PDGcheck(pdg) :
"";
91 <<
" PdgCode = " << pdg
93 <<
", average <A> " << avg_a ;
double Abundance(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
std::string PDGcheck(int pdg)
int NElements(int Z) const
Singleton class to load & serve tables of natural occurring isotopes.
const NaturalIsotopeElementData * ElementData(int Z, int ielement) const
std::string PDGcheck |
( |
int |
pdg | ) |
|
Definition at line 108 of file gtestNaturalIsotopes.cxx.
References genie::PDGLibrary::Find(), and genie::PDGLibrary::Instance().
Referenced by main().
110 const int minus_p = 10010;
111 const int minus_n = 10;
114 int pdg_minus_p = pdg - minus_p;
115 int pdg_minus_n = pdg - minus_n;
116 const TParticlePDG * part = pdglib->
Find(pdg);
117 const TParticlePDG * part_minus_p = pdglib->
Find(pdg_minus_p);
118 const TParticlePDG * part_minus_n = pdglib->
Find(pdg_minus_n);
119 string codeck =
" [";
120 codeck += ( (part) ?
"ok" :
"NO" );
121 if ( pdg != 1000010010 ) {
123 codeck += ( (part_minus_p) ?
"ok" :
"NO" );
125 codeck += ( (part_minus_n) ?
"ok" :
"NO" );
Singleton class to load & serve a TDatabasePDG.
TParticlePDG * Find(int pdgc, bool must_exist=true)
int setA |
( |
int |
pdg, |
|
|
int |
a |
|
) |
| |