/[PAMELA software]/yoda/techmodel/techmodelreader.cpp
ViewVC logotype

Diff of /yoda/techmodel/techmodelreader.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5.1 by kusanagi, Sat Feb 4 12:37:45 2006 UTC revision 6.1 by kusanagi, Wed Mar 8 13:51:45 2006 UTC
# Line 26  int main(int argc, char* argv[]) { Line 26  int main(int argc, char* argv[]) {
26      char nomeFileLog[L_tmpnam];      char nomeFileLog[L_tmpnam];
27      tmpnam(nomeFileLog);      tmpnam(nomeFileLog);
28      DIR *dirp;      DIR *dirp;
29        char *outDir = "";
30      // check if yoda_DATA exist!!!!      
     char *outDir;  
     try {  
     outDir = getenv("YODA_DATA");  
     if (getenv("YODA_DATA") == NULL) throw NotFoundEnvironmentVarException("The variable YODA_DATA has not been found.");  
     } catch (NotFoundEnvironmentVarException exc) {  
      cout << "The variable YODA_DATA has not been found. \n";  
      cout << "Please check your environment variables \n";  
      oss.str("");  
      oss << exc.print();  
      logger->fatal(oss.str().c_str());  
      exit(1);  
     }  
   
     string pathDir(outDir);  
   
     string pathLog = nomeFileLog;  
     bool ANALIZE = false;  
31      //---------------- Log4cxx configuration-----------------------------------------------      //---------------- Log4cxx configuration-----------------------------------------------
     //Define the configuration file to be used on log4cxx  
     PropertyConfigurator::configure(pathDir + "/log4cxx.conf");  
32      //BasicConfigurator::configure();      //BasicConfigurator::configure();
33      //Retrieve the rootLogger and append to it a default FileAppender.      //Retrieve the rootLogger and append to it a default FileAppender.
34      //Note that the priority level of the rootLogger (defined in log4cxx.conf) is unmodified      //Note that the priority level of the rootLogger (defined in log4cxx.conf) is unmodified
# Line 65  int main(int argc, char* argv[]) { Line 46  int main(int argc, char* argv[]) {
46      //rootLogger->addAppender(fileAppender);      //rootLogger->addAppender(fileAppender);
47      //rootLogger->removeAppender('A1');      //rootLogger->removeAppender('A1');
48      //---------------- Log4cxx configuration-----------------------------------------------      //---------------- Log4cxx configuration-----------------------------------------------
49        
50    // Check file name    // Check file name
51        
52    if (argc < 2){    if (argc < 2){
# Line 79  int main(int argc, char* argv[]) { Line 60  int main(int argc, char* argv[]) {
60          cout << "Usage: yoda FILE [OPTION] \n";          cout << "Usage: yoda FILE [OPTION] \n";
61          cout << "\t --help              print this help and exit \n";          cout << "\t --help              print this help and exit \n";
62          cout << "\t -p                  maximum number of packets to process [default all] \n";          cout << "\t -p                  maximum number of packets to process [default all] \n";
63          cout << "\t -m                  generate multiple root files. Values: {'true', 'false'} [default = 'false']\n";          cout << "\t -multi              generate multiple root files \n";
64          cout << "\t -c                  set the compression level for the generated root files. Values: [0,9] [default = 3]\n";          cout << "\t -c                  set the compression level for the generated root file(s). Values: [0,9] [default = 3]\n";
65            cout << "\t -o                  set the output directory for the generated root file(s). [default = $YODA_DATA]. Notice that in the same directory have to be prensent a log4cxx configuration file called \"log4cxx.conf\" \n";
66          exit(1);          exit(1);
67    }    }
68    
# Line 109  int main(int argc, char* argv[]) { Line 91  int main(int argc, char* argv[]) {
91          continue;          continue;
92      }      }
93    
94      if (!strcmp(argv[i], "-multifile")) multiFile = 1;      if (!strcmp(argv[i], "-multi")) multiFile = 1;
95    
96      if (!strcmp(argv[i], "-c")){      if (!strcmp(argv[i], "-c")){
97          if (++i >= argc){          if (++i >= argc){
# Line 127  int main(int argc, char* argv[]) { Line 109  int main(int argc, char* argv[]) {
109          }          }
110          continue;          continue;
111      }      }
112        
113        if (!strcmp(argv[i], "-o")){
114            if (++i >= argc){
115                cerr << "-o needs arguments. \n";
116                cout << "Try '--help' for more information. \n";
117                exit(1);
118            }
119            DIR* tempdir;
120            if ((tempdir = opendir(argv[i])) != 0) {
121                outDir = argv[i];
122                closedir(tempdir);
123            } else {
124                //logger->info(_T("The file does not exist."));
125                cerr << "-o needs an existing/accessable directory. \n";
126                cout << "Try '--help' for more information. \n";
127                exit(1);
128            }
129            continue;
130        }
131        
132    }    }
133    
134      if (outDir == ""){
135            try {
136                    outDir = getenv("YODA_DATA");
137                    if (getenv("YODA_DATA") == NULL) throw NotFoundEnvironmentVarException("The variable YODA_DATA has not been found.");
138            } catch (NotFoundEnvironmentVarException exc) {
139                    cout << "The variable YODA_DATA has not been found. \n";
140                    cout << "Please check your environment variables \n";
141                    oss.str("");
142                    oss << exc.print();
143                    logger->fatal(oss.str().c_str());
144                    exit(1);
145            }
146      }
147      
148        string pathDir(outDir);
149        string pathLog = nomeFileLog;
150        //Define the configuration file to be used on log4cxx
151        PropertyConfigurator::configure(pathDir + "/log4cxx.conf");
152    
153      time_t rawtime;      time_t rawtime;
154      struct tm * timeinfo;      struct tm * timeinfo;
155      time ( &rawtime );      time ( &rawtime );

Legend:
Removed from v.5.1  
changed lines
  Added in v.6.1

  ViewVC Help
Powered by ViewVC 1.1.23