FairRoot/PandaRoot
Static Public Member Functions | Private Member Functions | List of all members
RhoPdtLoader Class Reference

#include <RhoPdtLoader.h>

Static Public Member Functions

static TDatabasePDG * ReadPDGTable (const char *filename, bool force=false)
 

Private Member Functions

 RhoPdtLoader ()
 
 ~RhoPdtLoader ()
 

Detailed Description

Definition at line 17 of file RhoPdtLoader.h.

Constructor & Destructor Documentation

RhoPdtLoader::RhoPdtLoader ( )
inlineprivate

Definition at line 23 of file RhoPdtLoader.h.

23 {}
RhoPdtLoader::~RhoPdtLoader ( )
inlineprivate

Definition at line 24 of file RhoPdtLoader.h.

24 {}

Member Function Documentation

TDatabasePDG * RhoPdtLoader::ReadPDGTable ( const char *  filename,
bool  force = false 
)
static

Definition at line 27 of file RhoPdtLoader.cxx.

References Bool_t, cut, i, and name.

28 {
29  TDatabasePDG* pdgtable = TDatabasePDG::Instance();
30  if(force) {
31  //cout<<"RhoPdtLoader: old pdg "<<pdgtable<<endl;
32  pdgtable->~TDatabasePDG();
33  //cout<<"RhoPdtLoader: deleted pdg "<<pdgtable<<endl;
34  pdgtable = TDatabasePDG::Instance();
35  //pdgtable = new TDatabasePDG();
36  //cout<<"RhoPdtLoader: new pdg "<<pdgtable<<endl;
37  Info("RhoPdtLoader","Forcing an empty PDG table start.");
38  pdgtable->ReadPDGTable("/dev/null"); // ensure to have a total empty table
39  }
40 
41  // read list of particles from a file in EvtGen format.
42  // if the particle list does not exist, it is created, otherwise
43  // particles are added to the existing list.
44  // See $ROOTSYS/etc/pdg_table.txt and EvtGen/evt.pdl to see the
45  // file formats.
46 
47  const Float_t HBARC = 197.327*1.e-3*1.e-13; // GeV*cm
48 
49  FILE *ifl = fopen(filename,"r");
50  if (ifl == 0) {
51  Error("ReadPDGTable","Could not open PDG particle file %s",filename);
52  return pdgtable;
53  }
54 
55  char line[512];
56  while ( fgets(line,512,ifl) ) {
57  if (strlen(line) >= 511) {
58  Error("ReadPDGTable","input line is too long");
59  return pdgtable;
60  }
61  istringstream linestr(line);
62  string opcode;
63  char subcode;
64  linestr >> opcode >> subcode;
65 
66  if ( opcode == "*" )
67  continue;
68 
69  if ( opcode == "end" )
70  break;
71 
72  else if ( opcode == "add" ) {
73  switch (subcode) {
74  case 'p':
75  {
76  string classname;
77  linestr >> classname;
78  // if (classname == "Collision" || classname == "Parton")
79  if (classname == "Collision" )
80  continue;
81 
82  string name;
83  int type;
84  float mass, width, cut, charge, spin, lifetime;
85 
86  linestr >> name >> type;
87  linestr >> mass >> width >> cut >> charge;
88  linestr >> spin >> lifetime;
89 
90  //charge /= 3.0;
91  if (classname != "Meson")
92  spin /= 2.0;
93 
94  // lifetime is c*tau (mm)
95  if (lifetime > 0.0 && width < 1e-10)
96  width = HBARC / (lifetime/10.0);
97 
98  Bool_t stable = (lifetime <= 0);
99 
100  pdgtable->AddParticle(name.c_str(), name.c_str(), mass, stable, width,
101  charge, classname.c_str(), type, -1, 0);
102  break;
103  }
104 
105  case 'c':
106  {
107  int ptype, nchild;
108  float bf;
109  string decayer;
110 
111  linestr >> ptype >> bf >> decayer >> nchild;
112  TParticlePDG *parent = pdgtable->GetParticle(ptype);
113  if (parent == 0) continue;
114 
115  TList kids;
116 
117  int i;
118  for (i=0; i<nchild; i++ )
119  {
120  int ctype;
121  linestr >> ctype;
122  TParticlePDG* secondary = pdgtable->GetParticle(ctype);
123  if ( secondary ==0 ) break;
124  kids.Add(secondary);
125  }
126 
127  //parent->AddDecay(bf, kids ); // Not yet implemented
128  break;
129  }
130 
131  case 'd':
132  break;
133 
134  default:
135  Error("ReadPDGTable","unknown subcode %d for operation add",subcode);
136  break;
137  }
138  }
139  }
140 
141  fclose(ifl);
142 
143  return pdgtable;
144 }
Int_t i
Definition: run_full.C:25
double cut[MAX]
Definition: autocutx.C:36
TString name
const string filename

The documentation for this class was generated from the following files: