print_decay_channels.C
Go to the documentation of this file.
1 //
2 // Print-out the decay channel information for the input particle
3 //
4 // eg. To print-out the tau- (pdg code = 15) decay channels,
5 // type:
6 // root[0] .L print_decay_channels.C
7 // root[1] print_decay_channels(15)
8 //
9 // Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
10 // University of Liverpool & STFC Rutherford Appleton Lab
11 //
12 #include <iostream>
13 #include <sstream>
14 using namespace std;
15 
16 // root includes
17 #include "TSystem.h"
18 #include "TParticlePDG.h"
19 #include "TDecayChannel.h"
20 #include "TDatabasePDG.h"
21 
22 void print_decay_channels(int pdgc)
23 {
24  gSystem->Load("libEG");
25 
26  //cout << " *** Printing-out decay channels for: " << pdgc << endl;
27 
28  ostringstream pdg_table;
29  pdg_table << gSystem->Getenv("GENIE")
30  << "/data/evgen/catalogues/pdg/genie_pdg_table.txt";
31 
32  TDatabasePDG * pdglib = TDatabasePDG::Instance();
33  pdglib->ReadPDGTable(pdg_table.str().c_str());
34 
35  TParticlePDG * p = pdglib->GetParticle(pdgc);
36 
37  cout << " *** Printing-out decay channels for: " << p->GetName() << endl;
38 
39  double brtot=0;
40  for(int j=0; j<p->NDecayChannels(); j++) {
41  cout << "\t - decay channel id = " << j << ", channel = "
42  << p->GetName() << " --> ";
43  TDecayChannel * dch = p->DecayChannel(j);
44  for(int k=0; k<dch->NDaughters(); k++) {
45  cout << pdglib->GetParticle(dch->DaughterPdgCode(k))->GetName();
46  if ( k < dch->NDaughters() - 1 ) cout << " + ";
47  } // k = daughters
48  cout << ", BR = " << dch->BranchingRatio() << endl;
49  brtot += dch->BranchingRatio();
50  } // j = channels
51 
52  cout << "Sum{BR} = " << brtot << endl;
53 }
const char * p
Definition: xmltok.h:285
std::string GetName(int i)
const double j
Definition: BetheBloch.cxx:29
OStream cout
Definition: OStream.cxx:6