StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
particlesTest.cc
1 /***************************************************************************
2  *
3  * $Id: particlesTest.cc,v 1.2 2003/09/02 17:59:38 perev Exp $
4  *
5  * Author: Thomas Ullrich, May 1999
6  ***************************************************************************
7  *
8  * Description:
9  * Program to test Particle Definitions
10  *
11  ***************************************************************************
12  *
13  * $Log: particlesTest.cc,v $
14  * Revision 1.2 2003/09/02 17:59:38 perev
15  * gcc 3.2 updates + WarnOff
16  *
17  * Revision 1.1 1999/05/17 11:10:41 ullrich
18  * Initial Revision
19  *
20  **************************************************************************/
21 #include <Stiostream.h>
22 #include <typeinfo>
23 #include "StParticleTable.hh"
24 #include "StParticleTypes.hh"
25 
26 int main()
27 {
28  int i;
29 
30  //
31  // Write all particle definitions to stdout
32  //
33  StParticleTable *table = StParticleTable::instance();
34  table->dump();
35 
36  //
37  // Print all particles without PDG encoding
38  //
39  cout << "The following particles have no PDG encoding:" << endl;
40  StVecPtrParticleDefinition vec = table->allParticles();
41  for (i=0; i<vec.size(); i++) {
42  if (vec[i]->pdgEncoding() == 0)
43  cout << vec[i]->name().c_str() << endl;
44  }
45 
46  //
47  // Check consistency of GEANT3 lookup table
48  //
49  StParticleDefinition *p1, *p2;
50  for (i=0; i<100; i++) {
51  p1 = table->findParticleByGeantId(14);
52  if (p1) {
53  p2 = table->findParticle(p1->name());
54  if (*p1 != *p2)
55  cerr << "WARNING: inconsistency in lookup table" << endl;
56  }
57  }
58  return 0;
59 }