set_tsql.h File Reference

Go to the source code of this file.

Functions

void Set_TSQL_Override ()

Function Documentation

void Set_TSQL_Override (  ) 

Definition at line 1 of file set_tsql.h.

References JobCEnv::GetFileName(), gSystem(), and JobCEnv::Instance().

00002 {
00003   // decide whether to flip bfield ... based on file name
00004   JobCEnv& jce = JobCEnv::Instance();
00005   std::string filename = gSystem->BaseName(jce.GetFileName(0));
00006   cout << endl << "processing file: " << filename << endl;
00007 
00008   const char* tmppth = gSystem->Getenv("ASCII_DB_PATH");
00009   if ( ! tmppth ) tmppth =
00010                     "$SRT_PUBLIC_CONTEXT/Production/asciidb/cedar_daikon";
00011   std::string asciidbpath = gSystem->ExpandPathName(tmppth);
00012 
00013 
00014   std::string asciidbset = "";
00015 
00016   // automagically switch direction of reverse field running
00017   // reversed field daikon files are n1tb2rrrr or f2tb2rrrr
00018   // the "2" before the run # is the relevant flag
00019   char bfield_dirchar = filename[4];
00020   if ( bfield_dirchar == '2' ) {
00021     asciidbset = "brev";
00022     cout << "Override BField (reverse) based on filename." << endl << endl;
00023   }
00024 
00025   // set the asciidbset if the env variable is set ... even if the
00026   // file name indicates we should use "brev"
00027   const char* tmpset = gSystem->Getenv("ASCII_DB_SET");
00028   if ( tmpset ) {
00029     asciidbset = tmpset;
00030     cout << "Select ASCII DB set \"" << asciidbset
00031          << "\" based on ASCII_DB_SET." << endl << endl;
00032   }
00033 
00034   // only if an asciidbset has been chosen do we use add to the URL
00035   if ( asciidbset != "" ) {
00036     std::string tsql_url_orig = gSystem->Getenv("ENV_TSQL_URL");
00037     std::string first_url     = tsql_url_orig.substr(0,tsql_url_orig.find(";"));
00038     std::string base_url      = first_url.substr(0,first_url.find_last_of("/"));
00039     // assume "temp" DB follows the first URL structure
00040     std::string tsql_url_add  = base_url +
00041       "/temp#" + asciidbpath + "/" + asciidbset + "/catalogue.db";
00042 
00043     std::string tsql_whole    = tsql_url_add + ";" + tsql_url_orig;
00044     gSystem->Setenv("ENV_TSQL_URL",tsql_whole.c_str());
00045   }
00046 
00047 }


Generated on 8 Jul 2019 for loon by  doxygen 1.6.1