//----------------------------------------------------------------------------- // available job configurations: // ---------------------------- // lum : // // env variables used : // ---------------------- //----------------------------------------------------------------------------- // run range for the publication: 141544-156487 (before the winter'2003 shutdown) // good run list: "WZ_PRD" // last run before the Sept'2003 shutdown: 168899 //----------------------------------------------------------------------------- void lum_ana(TString Book , TString Dataset, TString Fileset = "", TString JobName = "lumi", // Int_t NEvents = 0) // 0: process all events { //----------------------------------------------------------------------------- // step 1: make sure that all the needed scripts are loaded //----------------------------------------------------------------------------- char macro[200]; const char* script[] = { "global_vars.h", "lumi.C", 0 }; const char* work_dir = gSystem->Getenv("SRT_LOCAL"); for (int i=0; script[i] != 0; i++) { sprintf(macro,"%s/Stntuple/ana/%s",work_dir,script[i]); if (! gInterpreter->IsLoaded(macro)) gInterpreter->LoadMacro(macro); } //----------------------------------------------------------------------------- // parse job options: /mc /grl /do_little //----------------------------------------------------------------------------- Int_t mc, loc, debug, do_little, loc, loc1, loc2, len, lopt; TString Job = JobName; mc = 0; len = Job.Length(); loc = Job.Index("/mc"); if (loc > 0) { mc = 1; } loc = Job.Index("/debug"); if (loc > 0) g.Debug = 1; else g.Debug = 0; loc = Job.Index("/little="); if (loc > 0) { g.DoLittle = 1; loc1 = loc+strlen ("/little="); loc2 = Job.Index("/",loc+1); if (loc2 < 0) loc2 = len; g.LittleFileName = Job(loc1,loc2-loc1); } loc = Job.Index("/output="); g.OutputFileName = ""; if (loc > 0) { g.Save = 1; loc1 = loc+strlen ("/output="); loc2 = Job.Index("/",loc+1); if (loc2 < 0) loc2 = len; g.OutputFileName = Job(loc1,loc2-loc1); } loc = Job.Index("/save="); g.HistFileName = ""; if (loc > 0) { loc1 = loc+strlen ("/save="); loc2 = Job.Index("/",loc+1); if (loc2 < 0) loc2 = len; g.HistFileName = Job(loc1,loc2-loc1); } //----------------------------------------------------------------------------- // 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("ETF,141544,156487"); env = gSystem->Getenv("STNTUPLE_GRL"); if (env != 0) s = env; loc = Job.Index("/grl="); if (loc > 0) { loc1 = loc+strlen ("/grl="); loc2 = Job.Index("/",loc+1); if (loc2 < 0) loc2 = len; s = Job(loc1,loc2-loc1); } s.ReplaceAll(","," "); sscanf(s.Data(),"%s %i %i",good_run_list,&g.MinRun,&g.MaxRun); g.GoodRunList = good_run_list; g.GoodRunList.ToUpper(); printf(" *** USE good run list \"%s\" with run range %i-%i\n" ,g.GoodRunList.Data(),g.MinRun,g.MaxRun); //----------------------------------------------------------------------------- loc = Job.Index("/"); if (loc > 0 ) Job = Job(0,loc); g.JobName = Job; //----------------------------------------------------------------------------- // check if specific L3 trigger path has been requested //----------------------------------------------------------------------------- g.L3TrigPath=gSystem->Getenv("L3_TRIG_PATH"); //----------------------------------------------------------------------------- // initialize chain - this will be a datas //----------------------------------------------------------------------------- if (! dataset) { catalog = new TStnCatalog(); dataset = new TStnDataset(); catalog->InitDataset(dataset,Book,Dataset,Fileset,"",g.MinRun,g.MaxRun); if (dataset->GetNFiles() <= 0) { printf(" empty dataset! exiting...\n"); return; } g.x = new TStnAna(dataset); g.x->SetPrintLevel(0); //----------------------------------------------------------------------------- // initialize geometry of CDF detector and simultaneously - this is the key // point! - declare it to the geometry manager //----------------------------------------------------------------------------- if ((mc == 0) && (g.GoodRunList != "NONE")) { grl = new TStnGoodRunList(g.GoodRunList.Data()); g.x->SetGoodRunList(grl); } //----------------------------------------------------------------------------- // modules to be used //----------------------------------------------------------------------------- m_lum = new TLumiMonModule; } //----------------------------------------------------------------------------- // jobs //----------------------------------------------------------------------------- if (Job == "lumi" ) { lumi (); } else { printf(" ****** unknown job : %s, bailing out ****** \n",Job.Data()); printf(" ****** allowed jobs: tau_met ele_met hpte fakes_1 fakes_2 ***** \n"); return; } //----------------------------------------------------------------------------- // output module if requested //----------------------------------------------------------------------------- TStnOutputModule* om; if (g.OutputFileName != "") { printf(" ... writing output file %s\n",g.OutputFileName.Data()); om = new TStnOutputModule(g.OutputFileName.Data()); om->SetMaxFileSize(1500); g.x->SetOutputModule(om); } //----------------------------------------------------------------------------- // run the job //----------------------------------------------------------------------------- if (g.JobType == 0) g.x->Run(NEvents,g.MinRun,g.MaxRun); elseif (g.JobType == 1) g.x->ProcessEventList(g.EventList); //----------------------------------------------------------------------------- // save histogram file in the end of job //----------------------------------------------------------------------------- if (g.HistFileName != "") { printf(" ... saving histograms into %s\n",g.HistFileName.Data()); g.x->SaveHist(g.HistFileName.Data()); } }