//----------------------------------------------------------------------------- // 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 //----------------------------------------------------------------------------- #include "Stntuple/scripts/global_vars.h" void stnana (TString Book , TString Dataset, TString Fileset = "", TString File = "", 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.C", "parse_job_parameters.C", "create_modules.C", "lumi.C", "validation.C", "debug.C", "catalog.C", 0 }; const char* work_dir = gSystem->Getenv("WORK_DIR"); for (int i=0; script[i] != 0; i++) { sprintf(macro,"%s/Stntuple/scripts/%s",work_dir,script[i]); if (! gInterpreter->IsLoaded(macro)) gInterpreter->LoadMacro(macro); } g.ListOfTasks->Print(); //----------------------------------------------------------------------------- // parse job options: /mc /grl /output /save /debug //----------------------------------------------------------------------------- parse_job_parameters(JobName,g); //----------------------------------------------------------------------------- // initialize chain - this will be a datas //----------------------------------------------------------------------------- if (! dataset) { catalog = new TStnCatalog(); dataset = new TStnDataset(); if (Book == "") Book = "file"; catalog->InitDataset(dataset,Book,Dataset,Fileset,File,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 ((g.DoMc == 0) && (g.GoodRunList != "NONE")) { grl = new TStnGoodRunList(g.GoodRunList.Data()); g.x->SetGoodRunList(grl); } //----------------------------------------------------------------------------- // modules to be used //----------------------------------------------------------------------------- create_modules(); } //----------------------------------------------------------------------------- // jobs, handle debug //----------------------------------------------------------------------------- printf(" --- job_name = .%s. task = %s\n",g.JobName.Data(), g.Task.Data()); int ind = g.Task.Index("("); TString task = g.Task(0,ind); TObjString* s = (TObjString*) g.ListOfTasks->FindObject(task.Data()); if (s) { char cmd[100]; sprintf(cmd,"%s;",g.Task.Data()); printf(" cmd=%s\n",cmd); gInterpreter->ProcessLine(cmd); } else { printf(" ****** unknown job : %s, bailing out ****** \n",task.Data()); return; } if (g.Debug != 0) debug(m_dbg); //----------------------------------------------------------------------------- // handle debug option //----------------------------------------------------------------------------- if (g.Debug != 0) debug(m_dbg); //----------------------------------------------------------------------------- // 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()); } }