/////////////////////////////////////////////////////////////////////////////// // assumes libStntuple_oracle.so is loaded /////////////////////////////////////////////////////////////////////////////// int a(int RunNumber = 195409, const char* Pass = "17") { TString query; TString pass_name, retired; int process_run; int jobset, rc; TSQLResult* res; query = "select cps.passname, cps.retired, cus.process_run , cus.jobset "; query += "from used_sets cus, passes cps, passcalibs cpsc "; query += Form("where cus.process_run=%i and cus.process_name=cps.process_name ",RunNumber); query += "and cus.process_run >= cpsc.lorun "; query += "and cus.process_run <= cpsc.hirun "; query += "and cus.proc_calib_version=cpsc.proc_calib_version "; query += Form("and cpsc.pass_index=cps.pass_index and cps.passname='%s' and decode(cps.retired,NULL,'N','Y') != 'Y'",Pass) ; cdfofprd.Query(query.Data(),res); TOracleRow* row = (TOracleRow*) res->Next(); if (row == 0) { rc = -1; } else { pass_name = TCdfOracle::Strip(row->GetFieldData( 0)); retired = TCdfOracle::Strip(row->GetFieldData( 1)); process_run = *((int*) row->GetFieldData( 2)); jobset = *((int*) row->GetFieldData( 3)); rc = jobset; } delete res; return rc; } //----------------------------------------------------------------------------- int a1(int RunNumber) { TString query; TSQLResult* res; TString system, calib_table; int jobset, calib_run, rc; jobset = a(RunNumber); if (jobset < 0) return -1; query = "select ctp.system, crl.calib_run, crl.calib_table "; query += "from calibrunlists crl, calib_properties ctp, set_run_maps csrm "; query += Form("where crl.cid=csrm.cid and csrm.jobset=%i ",jobset); query += "and crl.calib_table=ctp.calib_table and crl.calib_table='SIALIGNFRAME'"; cdfofprd.Query(query.Data(),res); TOracleRow* row = (TOracleRow*) res->Next(); if (row == 0) { rc = -1; } else { system = TCdfOracle::Strip(row->GetFieldData( 0)); calib_run = *((int*) row->GetFieldData( 1)); system = TCdfOracle::Strip(row->GetFieldData( 2)); rc = calib_run; } delete res; return rc; } //----------------------------------------------------------------------------- int get_n_tables(int RunNumber, const char* Pass="17", int debug=0) { TString query; TSQLResult* res; TString system, calib_table; int jobset, calib_run, n_tables, rc; jobset = a(RunNumber,Pass); if (jobset < 0) return -1; query = "select ctp.system, crl.calib_run, crl.calib_table "; query += "from calibrunlists crl, calib_properties ctp, set_run_maps csrm "; query += Form("where crl.cid=csrm.cid and csrm.jobset=%i ",jobset); query += "and crl.calib_table=ctp.calib_table order by ctp.system"; cdfofprd.Query(query.Data(),res); n_tables = 0; while ((row = (TOracleRow*) res->Next())) { if (row == 0) { rc = -1; printf (" rc = -1\n"); } else { n_tables++; if (debug) { calib_table = TCdfOracle::Strip(row->GetFieldData( 2)); printf ("%s\n",calib_table.Data()); } } } delete res; return n_tables; } //----------------------------------------------------------------------------- // check SVX alignment //----------------------------------------------------------------------------- TGraph* gr; int a2(int MinRun, int MaxRun) { int rn, calib_run; TObjArray* list_of_runs = new TObjArray(10000); TStnRunSummary* rs; int flag = cdfofprd.ForceDisconnect(); cdfofprd.SetForceDisconnect(0); cdfofprd.GetListOfGoodRuns (list_of_runs,MinRun,MaxRun); int nruns = list_of_runs->GetEntriesFast(); float* x = new float[nruns]; float* y = new float[nruns]; for (int i=0; iAt(i); if (rs) { rn = rs->RunNumber(); calib_run = a1(rn); if (calib_run >=0) printf("run, calib_run = %7i %7i\n",rn,calib_run); x[i] = rn; y[i] = calib_run; } else { printf("i = %i\n",i); } } gr = new TGraph(nruns,x,y); gr->SetMarkerStyle(20); gr->SetMarkerSize(1); gr->GetXaxis()->SetLabelSize(0.02); gr->Draw("AP"); } //_____________________________________________________________________________ TGraph* g_n_tables; int plot_n_tables(int MinRun, int MaxRun, const char* Pass="17") { int rn, n_tables; TObjArray* list_of_runs = new TObjArray(10000); TStnRunSummary* rs; int flag = cdfofprd.ForceDisconnect(); cdfofprd.SetForceDisconnect(0); cdfofprd.GetListOfGoodRuns (list_of_runs,MinRun,MaxRun); int nruns = list_of_runs->GetEntriesFast(); float* x = new float[nruns]; float* y = new float[nruns]; for (int i=0; iAt(i); if (rs) { rn = rs->RunNumber(); n_tables = get_n_tables(rn,Pass); if (n_tables >=0) printf("run, n_tables = %7i %7i\n",rn,n_tables); x[i] = rn; y[i] = n_tables; } else { printf("i = %i\n",i); } } g_n_tables = new TGraph(nruns,x,y); g_n_tables->SetMarkerStyle(20); g_n_tables->SetMarkerSize(1); g_n_tables->GetXaxis()->SetLabelSize(0.02); g_n_tables->Draw("AP"); }