//----------------------------------------------------------------------------- // //----------------------------------------------------------------------------- int parse_job_parameters(TString& Parameters, StnAnaGlobals_t& Glob) { TString fileset, job_number; int loc, loc1, loc2, len; // printf("job = %s\n",Job.Data()); //----------------------------------------------------------------------------- // environment variables which may be defined by default // tau_ana keeps list of the known jobs //----------------------------------------------------------------------------- fileset = gSystem->Getenv("FILESET"); g.JobName = gSystem->Getenv("JOB_NAME"); g.JobNumber = gSystem->Getenv("JOB_NUMBER"); //----------------------------------------------------------------------------- // job_name: name of the job (may be redefined) //----------------------------------------------------------------------------- loc = Parameters.Index("/job_name="); len = Parameters.Length(); if (loc > 0) { loc1 = loc+strlen ("/job_name="); loc2 = Parameters.Index("/",loc+1); if (loc2 < 0) loc2 = len; g.JobName = Parameters(loc1,loc2-loc1); printf("JOB name : %s\n",g.JobName.Data()); } loc = Parameters.Index("/"); if (loc > 0) g.Task = Parameters(0,loc); else g.Task = Parameters; if (g.JobName == "") { loc = Parameters.Index("("); g.JobName = Parameters(0,loc); } //----------------------------------------------------------------------------- // job_number: //----------------------------------------------------------------------------- loc = Parameters.Index("/job_number="); if (loc > 0) { loc1 = loc+strlen ("/job_number="); loc2 = Parameters.Index("/",loc+1); if (loc2 < 0) loc2 = len; g.JobNumber = Parameters(loc1,loc2-loc1); } gSystem->Setenv("JOB_NUMBER",g.JobNumber.Data()); printf("JOB NUMBER : %s\n",g.JobNumber.Data()); //----------------------------------------------------------------------------- // MC flag (default: -1) //----------------------------------------------------------------------------- loc = Parameters.Index("/mc"); if (loc > 0) { loc = Parameters.Index("/mc="); if (loc <= 0) g.DoMc = 1; else { loc1 = loc+strlen ("/mc="); loc2 = Parameters.Index("/",loc+1); if (loc2 < 0) loc2 = len; g.DoMc = atoi(Parameters(loc1,loc2-loc1).Data()); } } //----------------------------------------------------------------------------- // debug //----------------------------------------------------------------------------- loc = Parameters.Index("/debug"); if (loc > 0) g.Debug = 1; else g.Debug = 0; //----------------------------------------------------------------------------- // flag controlling writing out "little" ntuple //----------------------------------------------------------------------------- loc = Parameters.Index("/little="); if (loc > 0) { g.DoLittle = 1; loc1 = loc+strlen ("/little="); loc2 = Parameters.Index("/",loc+1); if (loc2 < 0) loc2 = len; g.LittleFileName = Parameters(loc1,loc2-loc1); printf("LITTLE_FILE : %s\n",g.LittleFileName.Data()); } //----------------------------------------------------------------------------- // flag controlling writing output of stripping //----------------------------------------------------------------------------- g.OutputFileName = ""; loc = Parameters.Index("/output"); if (loc > 0) { loc1 = loc+strlen("/output="); loc2 = Parameters.Index("/",loc+1); if (loc2 < 0) loc2 = len; if (loc2 > loc1) { g.OutputFileName = Parameters(loc1,loc2-loc1); } else { g.OutputFileName = Form("%s",gSystem->Getenv("DSID")); if (fileset != "") g.OutputFileName += Form(".%s",fileset.Data()); g.OutputFileName += Form(".%s",g.JobName.Data()); g.OutputFileName += ".stn"; } printf("OUTPUT_FILE : %s\n",g.OutputFileName.Data()); } //----------------------------------------------------------------------------- // saving the histograms: /save //----------------------------------------------------------------------------- g.HistFileName = ""; loc = Parameters.Index("/save"); if (loc > 0) { loc1 = loc+strlen ("/save="); loc2 = Parameters.Index("/",loc+1); if (loc2 <= 0) loc2 = len; if (loc2 > loc1) { g.HistFileName = Parameters(loc1,loc2-loc1); } else { g.HistFileName = Form("%s",gSystem->Getenv("DSID")); if (fileset != "") g.HistFileName += Form(".%s",fileset.Data()); g.HistFileName += Form(".%s",g.JobName.Data()); g.HistFileName += ".hist"; } printf("HISTOGRAM_FILE: %s\n",g.HistFileName.Data()); } //----------------------------------------------------------------------------- // handle good run list ( use -x STNTUPLE_GRL=ETF,141544,156487 ) // use GRL only for non-MC jobs // finally allow to redefine GRL from the command line //----------------------------------------------------------------------------- const char *env, good_run_list[200]; TString s("none,1,300000"); env = gSystem->Getenv("STNTUPLE_GRL"); if (env != 0) s = env; loc = Parameters.Index("/grl="); // printf("loc= %i\n",loc); if (loc > 0) { loc1 = loc+strlen ("/grl="); loc2 = Parameters.Index("/",loc+1); if (loc2 <= 0) loc2 = len; // printf("loc1,loc2,len= %i %i %i\n",loc1,loc2,len); s = Parameters(loc1,loc2-loc1); // printf("s= %s\n",s.Data()); } s.ReplaceAll(","," "); sscanf(s.Data(),"%s %i %i",good_run_list,&g.MinRun,&g.MaxRun); g.GoodRunList = good_run_list; g.GoodRunList.ToUpper(); printf("GOOD RUN LIST : \"%s\" with run range %i-%i\n" ,g.GoodRunList.Data(),g.MinRun,g.MaxRun); //----------------------------------------------------------------------------- // check if specific L3 trigger path has been requested //----------------------------------------------------------------------------- g.L3TrigPath=gSystem->Getenv("L3_TRIG_PATH"); //----------------------------------------------------------------------------- // Steve's "newcuts" flag //----------------------------------------------------------------------------- loc = Parameters.Index("/newcuts"); if (loc > 0) g.IDMode = 2; // use the new cuts else g.IDMode = 1; // use the old cuts return 0; }