Jpp  19.1.0
the software that should make you happy
Functions
JPrintPDB.cc File Reference

Auxiliary program to print particle codes and masses. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JAAnet/JPDB.hh"
#include "JLang/JComparator.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to print particle codes and masses.

Author
mdejong

Definition in file JPrintPDB.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 19 of file JPrintPDB.cc.

20 {
21  using namespace std;
22 
23  string key;
24  int debug;
25 
26  try {
27 
28  JParser<> zap("Auxiliary program to print particle codes and masses.");
29 
30  zap['k'] = make_field(key) = "name", "geant", "pdg", "mass", "charge";
31  zap['d'] = make_field(debug) = 2;
32 
33  zap(argc, argv);
34  }
35  catch(const exception& error) {
36  FATAL(error.what() << endl);
37  }
38 
39  using namespace JPP;
40 
41  JPDB pdb = JPDB::getInstance();
42 
43  if (key == "name")
44  sort(pdb.begin(), pdb.end(), make_comparator(&JParticle::name));
45  else if (key == "pdg")
46  sort(pdb.begin(), pdb.end(), make_comparator(&JParticle::pdg));
47  else if (key == "geant")
48  sort(pdb.begin(), pdb.end(), make_comparator(&JParticle::geant));
49  else if (key == "mass")
50  sort(pdb.begin(), pdb.end(), make_comparator(&JParticle::mass));
51  else if (key == "mass")
52  sort(pdb.begin(), pdb.end(), make_comparator(&JParticle::charge));
53 
54  cout << pdb << endl;
55 }
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
Utility class to parse command line options.
Definition: JParser.hh:1698
JComparator< JResult_t T::*, JComparison::lt > make_comparator(JResult_t T::*member)
Helper method to create comparator between values of data member.
T & getInstance(const T &object)
Get static instance from temporary object.
Definition: JObject.hh:75
static const JGeant geant(geanx, 0.0001)
Function object for the number of photons from EM-shower as a function of emission angle.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14
Collection of particles.
Definition: JPDB.hh:117