Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

LoadMinosPDG.cxx

Go to the documentation of this file.
00001 
00002 // $Id: LoadMinosPDG.cxx,v 1.2 2009/05/12 22:36:19 rhatcher Exp $
00003 //
00004 // Load PDG database and insert MINOS data
00005 //
00006 // rhatcher@fnal.gov
00008 
00009 #include "MessageService/MsgService.h"
00010 CVSID("$Id: LoadMinosPDG.cxx,v 1.2 2009/05/12 22:36:19 rhatcher Exp $");
00011 
00012 //#include "TString.h"
00013 #include "TSystem.h"
00014 #include "TEnv.h"
00015 #include "TDatabasePDG.h"
00016 #include "TParticle.h"
00017 
00018 
00019 void LoadMinosPDG(bool onlyRootVersion, bool fake)
00020 {
00021 
00022   static bool first = true;
00023   if (!first) return;
00024   first = false;
00025 
00026   if (fake) {
00027     MSG("DataUtil", Msg::kInfo) 
00028       << "LoadMinosPDG fake: NOT initializing PDG database " 
00029       << ", assume user will do so via alternative method (e.g. GENIE)"
00030       << endl;
00031     return;
00032   }
00033 
00034   MSG("DataUtil", Msg::kInfo) 
00035     << "LoadMinosPDG: initializing PDG database " 
00036     << (onlyRootVersion ? "(root version only)" : "(minos version)" )
00037     << endl;
00038 
00039   TDatabasePDG *pdg = TDatabasePDG::Instance();
00040 
00041   // read default $ROOTSYS/etc/pdg_table.txt 
00042   // (unless overridden by Root.DatabasePDG)
00043   // Only do it once, since it crashes the program the second time. NJT Sept 03
00044 
00045   const char* minos_search_path =
00046     ".:$SRT_PRIVATE_CONTEXT/etc:$SRT_PUBLIC_CONTEXT/etc";
00047   const char* minos_file = "minos_pdg_table.txt";  
00048 
00049   char *minos_pdg = (onlyRootVersion) ? 0 :
00050     gSystem->Which(minos_search_path,minos_file,kReadPermission);
00051   if ( minos_pdg ) {
00052     MSG("DataUtil", Msg::kInfo) 
00053       << "LoadMinosPDG: reading " << minos_pdg << endl;
00054 
00055     pdg->ReadPDGTable(minos_pdg);
00056     // gSystem->Which returns a string the user must delete
00057     delete [] minos_pdg;
00058   }
00059   else {
00060     if (!onlyRootVersion)
00061       MSG("DataUtil", Msg::kInfo)
00062         << "No \"" << minos_file << "\" file found " << endl
00063         << "search path was: " << minos_search_path << endl;
00064     
00065     const char* root_search_path =
00066       ".:$ROOTSYS/etc:/etc/root";
00067     const char* root_file = "pdg_table.txt";
00068 
00069     char *root_pdg =
00070       gSystem->Which(root_search_path,root_file,kReadPermission);
00071     if ( root_pdg ) {
00072 
00073       MSG("DataUtil", Msg::kInfo) 
00074         << "LoadMinosPDG: reading " << root_pdg << endl;
00075 
00076       pdg->ReadPDGTable(root_pdg);
00077       // gSystem->Which returns a string the user must delete
00078       delete [] root_pdg;
00079     }
00080     else {
00081       MSG("DataUtil", Msg::kInfo)
00082         << "No \"" << root_file << "\" file found " << endl
00083         << "search path was: " << root_search_path << endl;
00084     }
00085   }
00086 }

Generated on Mon Feb 15 11:06:53 2010 for loon by  doxygen 1.3.9.1