FlyoDoc_2011 Pisa 2011 by GmP --- 011
|
#include "parm.h"
#include "ctype.h"
#include "evento.h"
#include <getopt.h>
#include <dirent.h>
Go to the source code of this file.
Functions | |
void | Print_Help () |
void | File_Manager () |
void | check_file_name (const char *outdir, string &filename) |
Controlla la linea di comando di input,definisce le file di lettura e scrittura, e richiede la lettura delle carte (file di definizioni dati e controllo globale della procedura di simulazione.
Definition in file filemg.cpp.
void File_Manager | ( | ) |
Start reading the input files ===
Definition at line 52 of file filemg.cpp.
{ // char *OutDir=0; string Versione="V 2010 Psa " ; printf ( "\n----------------------------------------------------------------" ); printf ( "\n ************************************************************** " ); printf ( "\n**** Pisa 2006 ****" ); printf ( "\n*** ***" ); printf ( "\n** C++ F L Y O Running **" ); printf ( "\n*** ***" ); printf ( "\n**** < by GmP/LF/SG/Am > ****" ); printf ( "\n ************************************************************** " ); printf ( "\n **" ); // if ( gargc<2 ) { cout <<"\n Input error: no input parameters...\n"; Print_Help(); } int inparm=0; int o; while ( ( o = getopt ( gargc, gargv, "p:d:i:t:r:e:b:l:h" ) ) !=-1 ) { switch ( o ) { case 'h': Print_Help(); break; case 'p': if ( strncmp ( optarg,"si",2 ) ==0 ) Pipeline=1; if ( strncmp ( optarg,"yes",2 ) ==0 ) Pipeline=1; cout<< "\n Pipeline status ==> "<< ( Pipeline?"on":"off" ); //Pipeline time window =0.250 ns fixed in tempo.h fflush ( stdout ); break; case 'd': OutDir= new char[strlen ( optarg ) +2]; strcpy ( OutDir,optarg ); printf ( "\n Output Directory by operator ==> %s",OutDir ); inparm++; break; case 'b': GasBegin= atol ( optarg ); printf ( "\n First Gas event from file ==> %d",GasBegin ); inparm++; break; case 'i': Cardin= new char[strlen ( optarg ) +2]; strcpy ( Cardin,optarg ); printf ( "\n Input file by operator ==> %s",Cardin ); inparm++; break; case 't': Wrt_type_out=optarg; cout<<"\n Data out type ==> "<<Wrt_type_out; break; case 'r': evento_.Gen.Run = atol ( optarg ); printf ( "\n Run num. defined by operator ==> %d", evento_.Gen.Run ); fflush ( stdout ); break; case 'e': evento_.Mxev= atol ( optarg ); printf ( "\n MaxEvents defined by operator ==> %d",evento_.Mxev ); fflush ( stdout ); break; default: printf ( "errore nella linea di comando\n" ); exit ( -1 ); break; } } if ( inparm<2 ) { cout<<"\n\n\n Error: Not enough input parameters!"; Print_Help(); } cout<<"\n------ End input parsing --------"<<endl; // get run by string stringstream ostr; string Srun; ostr<<evento_.Gen.Run; ostr>>Srun; //============= define the nt files or the binary file ================== // default out file dipendente dal run ... // char *OutGn_byrun=new char[256]; string OutGn_byrun; if ( Wrt_type_out=="root" ) { OutGn_byrun= "Fly_"+Srun+".root"; // sprintf ( OutGn_byrun,"fly_%d.root",evento_.Gen.Run ); Wrtype=1; } else if ( Wrt_type_out=="hroot" ) { OutGn_byrun= "Fly_h"+Srun+".root"; // sprintf ( OutGn_byrun,"fly_h%d.root",evento_.Gen.Run ); Wrtype=2; } else if ( Wrt_type_out=="null" ) { OutGn_byrun= "Fly_null"+Srun+".root"; // sprintf ( OutGn_byrun,"fly_null%d.gn",evento_.Gen.Run ); Wrtype=0; } else if ( Wrt_type_out=="paw" ||Wrt_type_out=="hpaw" ) { cout<<" \n Attenzione.... Paw รจ obsoleto..si usa root: exit!?"<<endl ; exit ( 0 ); } else { printf ( "\n ERROR File di output non defined, \n Pls set \" -t root, hroot or null\" in command line!" ); exit ( 0 ); } if ( OutDir ) { check_file_name ( OutDir,OutGn_byrun ); sprintf ( OutGn,"%s/%s",OutDir,OutGn_byrun.c_str() ); // Flyo running } else { check_file_name ( ".",OutGn_byrun ); sprintf ( OutGn,"./%s",OutGn_byrun.c_str() ); } cout<<"\n Results file (by run): ==> "<<OutGn_byrun; // define the nt out dir/file cout<<"\n Out location (list,hbook...): ==> "<<OutDir; cout<<"\n Program name: ==> "<<gargv[0]; cout<<"\n Program Version: ==> "<<Versione; cout<< "\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^" ; cout<<"\n ===================================================\n"; //============= define the output list file================= // char *Lista_nome=new char[256]; string Serie; Serie=OutGn_byrun; string Lista_nome; Lista_nome=OutDir; if ( OutDir ) { Serie=Serie.substr ( Serie.find ( "." ) +1,Serie.size() ); Serie=Serie.substr ( 0,Serie.find ( "." ) ); Lista_nome+="/list"+Srun+"."+Serie+".txt"; } else Lista_nome ="list"+Srun+"."+Serie+".txt"; //default // redirect the standard output to the file Lista cout<< "\n You may continue to read the Flyo output lista in\n ==> "<<Lista_nome; cout<< "\n -----------------------------\n" ; //*********************************************************************************** //********************************************************************************* // uscita in list di debug.... //*************************************** Gout.open ( Lista_nome.c_str() ,ios::out ); //******************************** if ( Gout ) { Gout<<"\n----------------------------------------------------------------"; Gout<<"\n ************************************************************** "; Gout<<"\n**** Pisa 2006 ****"; Gout<<"\n*** ***"; Gout<<"\n** C++ F L Y O Running **"; Gout<<"\n*** ***"; Gout<<"\n**** < by GmP/LF/SG/Am > ****"; Gout<<"\n ************************************************************** "; Gout<<"\n **"; Gout<<"\n Program name: ==> "<<gargv[0]; Gout<<"\n Program Version: ==> "<<Versione; if ( OutDir ) Gout<<"\n Output Directory by operator ==> "<<OutDir; if ( Cardin ) Gout<<"\n Input file by operator ==> "<<Cardin; if ( evento_.Gen.Run ) Gout<<"\n Run number ==> "<<evento_.Gen.Run; if ( evento_.Mxev ) Gout<<"\n MaxEvents ==> "<<evento_.Mxev; } Gout<<"\n ----------"; //============= data output file ================== Gout<<"\n Out data file : ==> "<<OutGn; Gout<<"\n ==============\n"; Gout<<"\n Output list: ==> "<<Lista_nome; time_t tck; time_t clockstart=time ( &tck ); Gout<<"\n Flyo starts output list ==> "<<ctime ( &clockstart ); Gout<<"\n Flyo input base .epc file ==> "<<Cardin; Legge_input_file ( Cardin ); // end reading input files...... }