File indexing completed on 2023-03-17 11:15:09
0001 void test_PedestalMapGain12(){
0002
0003
0004 TSQLServer *db=TSQLServer::Connect("oracle://pccmsecdb:1521/ecalh4db","read01","XXXpasswordXXX");
0005
0006 gStyle->SetOptStat(0);
0007 gStyle->SetOptFit();
0008 gStyle->SetPalette(1,0);
0009 c1 = new TCanvas("c1","The Map",200,10,600,400);
0010 c1->SetGrid();
0011
0012
0013
0014 temp_chan = new TH2F("temp_chan","Pedestal RMS (ADC Counts)", 85, 0.1, 85.1,20,0.1, 20.1 );
0015 temp_chan->SetMaximum(2.);
0016 temp_chan->SetMinimum(0.5);
0017 temp_chan->GetXaxis()->SetTitle("Channel j");
0018 temp_chan->GetYaxis()->SetTitle("Channel i");
0019
0020
0021
0022
0023
0024
0025 char * sql="SELECT count( channelview.logic_id) from channelview,MON_PEDESTALS_DAT , mon_run_iov, run_iov WHERE run_iov.run_num=18085 and run_iov.iov_id=mon_run_iov.run_iov_id and mon_run_iov.iov_id=MON_PEDESTALS_DAT.iov_id and channelview.logic_id=MON_PEDESTALS_DAT.logic_id and channelview.name=channelview.maps_to order by id1, id2 " ;
0026
0027 TSQLResult *res=db->Query(sql);
0028
0029
0030 int nlines=0;
0031 int j=0;
0032 do {
0033 j++;
0034 TSQLRow *row1=res->Next();
0035 TOracleRow * row2=(TOracleRow *)row1;
0036
0037 for (int i=0; i<res->GetFieldCount();i++) {
0038
0039 if(i==0) nlines=atoi( row2->GetField(i));
0040 }
0041
0042 delete row2;
0043
0044 } while (j<1);
0045 cout << "Number of records in the DB: " << nlines << endl;
0046 cout <<"first loop done "<< endl;
0047
0048
0049
0050
0051
0052
0053 char * sql="SELECT channelview.id2, CAST( MON_PEDESTALS_DAT.PED_RMS_G12 AS NUMBER), run_iov.run_num from channelview,MON_PEDESTALS_DAT , mon_run_iov, run_iov WHERE run_iov.run_num=18085 and run_iov.iov_id=mon_run_iov.run_iov_id and mon_run_iov.iov_id=MON_PEDESTALS_DAT.iov_id and channelview.logic_id=MON_PEDESTALS_DAT.logic_id and channelview.name=channelview.maps_to order by id1, id2 " ;
0054
0055
0056 TSQLResult *res=db->Query(sql);
0057
0058 float temp=0;
0059 int chan=0;
0060 int j=0;
0061 int run_num=0;
0062 do {
0063 j++;
0064 TSQLRow *row1=res->Next();
0065 TOracleRow * row2=(TOracleRow *)row1;
0066
0067 for (int i=0; i<res->GetFieldCount();i++) {
0068
0069 if(i==0) chan=atoi( row2->GetField(i));
0070 if(i==1) temp=atof( row2->GetField(i));
0071 if(i==2) run_num=atoi( row2->GetField(i));
0072 }
0073
0074
0075 Float_t tpippo= (Float_t)temp;
0076 Float_t tchanx= (Float_t) ((chan-1)/20)+1 ;
0077 Float_t tchany= (Float_t) ((chan-1)%20)+1 ;
0078 temp_chan->Fill(tchanx, tchany, tpippo);
0079
0080
0081 delete row2;
0082
0083 } while (j<nlines);
0084 cout << "run number: " << run_num << endl;
0085 cout <<"loop done "<< endl;
0086
0087
0088
0089
0090
0091
0092
0093 temp_chan->Draw("colz");
0094 c1->Update();
0095
0096
0097
0098 printf("end \n");
0099 delete res;
0100 delete db;
0101
0102 }