Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Friends | List of all members
JAANET::JPDB Struct Reference

Collection of particles. More...

#include <JPDB.hh>

Inheritance diagram for JAANET::JPDB:
std::vector< JParticle >

Public Member Functions

 JPDB ()
 Default constructor. More...
 
bool hasGEANT (const int geant) const
 Check if PDB has particle corresponding to given GEANT code. More...
 
const JParticlegetGEANT (const int geant) const
 Get particle corresponding to given GEANT code. More...
 
bool hasPDG (const int pdg) const
 Check if PDB has particle corresponding to given PDG code. More...
 
const JParticlegetPDG (const int pdg) const
 Get particle corresponding to given PDG code. More...
 

Static Public Member Functions

static const JPDBgetInstance ()
 Get particle data book. More...
 

Friends

std::ostream & operator<< (std::ostream &out, const JPDB &pdb)
 Print particle data book. More...
 

Detailed Description

Collection of particles.

Definition at line 105 of file JPDB.hh.

Constructor & Destructor Documentation

JAANET::JPDB::JPDB ( )
inline

Default constructor.

Definition at line 111 of file JPDB.hh.

112  {}

Member Function Documentation

static const JPDB& JAANET::JPDB::getInstance ( )
inlinestatic

Get particle data book.

This particle data book contains all known GEANT particle codes.

Returns
particle data book

Definition at line 121 of file JPDB.hh.

122  {
123  using namespace JAANET;
124  using namespace JTOOLS;
125 
126  static JPDB pdb;
127 
128  if (pdb.empty()) {
129 
151 
158  // anti-photon does not exist
172  }
173 
174  return pdb;
175  }
static const double MASS_PROTON
proton mass [GeV]
Definition: JConstants.hh:67
static const double MASS_TAU_NEUTRINO
tau neutrino mass [GeV]
Definition: JConstants.hh:56
static const double MASS_MUON
muon mass [GeV]
Definition: JConstants.hh:59
static const double MASS_CHARGED_OMEGA
Omega^+/- mass [GeV].
Definition: JConstants.hh:74
static const double MASS_CHARGED_PION
pi^+/- mass [GeV]
Definition: JConstants.hh:63
static const double MASS_TAU
tau mass [GeV]
Definition: JConstants.hh:60
static const double MASS_NEUTRAL_KAON
K_0 mass [GeV].
Definition: JConstants.hh:64
static const double MASS_CHARGED_KAON
K^+/- mass [GeV].
Definition: JConstants.hh:65
Collection of particles.
Definition: JPDB.hh:105
static const double MASS_LAMBDA
Lambda mass [GeV].
Definition: JConstants.hh:69
static const double MASS_PHOTON
Particle masses.
Definition: JConstants.hh:52
static const double MASS_NEUTRAL_XI
Xi_0 mass [GeV].
Definition: JConstants.hh:72
static const double MASS_MUON_NEUTRINO
muon neutrino mass [GeV]
Definition: JConstants.hh:55
static const double MASS_ELECTRON_NEUTRINO
electron neutrino mass [GeV]
Definition: JConstants.hh:54
static const double MASS_CHARGED_SIGMA
Sigma^+/- mass [GeV].
Definition: JConstants.hh:71
static const double MASS_NEUTRAL_PION
pi_0 mass [GeV]
Definition: JConstants.hh:62
static const double MASS_NEUTRAL_SIGMA
Sigma_0 mass [GeV].
Definition: JConstants.hh:70
static const double MASS_CHARGED_XI
Xi^+/- mass [GeV].
Definition: JConstants.hh:73
#define MAKE_PARTICLE(PDG, GEANT, MASS)
Auxiliary macro for particle creation.
Definition: JPDB.hh:99
static const double MASS_ELECTRON
electron mass [GeV]
Definition: JConstants.hh:58
static const double MASS_NEUTRON
neutron mass [GeV]
Definition: JConstants.hh:68
bool JAANET::JPDB::hasGEANT ( const int  geant) const
inline

Check if PDB has particle corresponding to given GEANT code.

Parameters
geantGEANT code
Returns
true if available; else false

Definition at line 184 of file JPDB.hh.

185  {
186  return (find_if(this->begin(), this->end(), JLANG::make_predicate(&JParticle::geant, geant)) != this->end());
187  }
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
Definition: JPredicate.hh:128
static const JGeant geant(geanx, 0.0001)
Function object for the number of photons from EM-shower as a function of emission angle...
int geant
GEANT code of particle.
Definition: JPDB.hh:87
const JParticle& JAANET::JPDB::getGEANT ( const int  geant) const
inline

Get particle corresponding to given GEANT code.


This method throws an error if the particle cannot be found.

Parameters
geantGEANT code
Returns
particle

Definition at line 197 of file JPDB.hh.

198  {
199  const_iterator p = find_if(this->begin(), this->end(), JLANG::make_predicate(&JParticle::geant, geant));
200 
201  if (p != this->end())
202  return *p;
203  else
204  THROW(JException, "Invalid GEANT particle code " << geant);
205  }
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
Definition: JPredicate.hh:128
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:633
static const JGeant geant(geanx, 0.0001)
Function object for the number of photons from EM-shower as a function of emission angle...
int geant
GEANT code of particle.
Definition: JPDB.hh:87
bool JAANET::JPDB::hasPDG ( const int  pdg) const
inline

Check if PDB has particle corresponding to given PDG code.

Parameters
pdgPDG code
Returns
true if available; else false

Definition at line 214 of file JPDB.hh.

215  {
216  return (find_if(this->begin(), this->end(), JLANG::make_predicate(&JParticle::pdg, pdg)) != this->end());
217  }
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
Definition: JPredicate.hh:128
int pdg
PDG code of particle.
Definition: JPDB.hh:86
const JParticle& JAANET::JPDB::getPDG ( const int  pdg) const
inline

Get particle corresponding to given PDG code.


This method throws an error if the particle cannot be found.

Parameters
pdgPDG code
Returns
particle

Definition at line 227 of file JPDB.hh.

228  {
229  const_iterator p = find_if(this->begin(), this->end(), JLANG::make_predicate(&JParticle::pdg, pdg));
230 
231  if (p != this->end())
232  return *p;
233  else
234  THROW(JException, "Invalid PDG particle code " << pdg);
235  }
JPredicate< JResult_t T::*, JComparison::eq > make_predicate(JResult_t T::*member, const JResult_t value)
Helper method to create predicate for data member.
Definition: JPredicate.hh:128
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:633
int pdg
PDG code of particle.
Definition: JPDB.hh:86

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const JPDB pdb 
)
friend

Print particle data book.

Parameters
outoutput stream
pdbparticle data book
Returns
output stream

Definition at line 245 of file JPDB.hh.

246  {
247  using namespace std;
248 
249  out << setw(32) << left << "particle" << " "
250  << setw( 6) << right << "PDG" << " "
251  << setw( 6) << right << "GEANT" << " "
252  << setw(12) << right << "Mass [GeV]" << endl;
253 
254  for (JPDB::const_iterator i = pdb.begin(); i != pdb.end(); ++i) {
255  out << *i << endl;
256  }
257 
258  return out;
259  }

The documentation for this struct was generated from the following file: