File indexing completed on 2024-04-06 12:22:58
0001 void test_TempMap(){
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 Temperatures",200,10,600,400);
0010 c1->SetGrid();
0011
0012
0013
0014 temp_chan = new TH2F("temp_chan","temp chan", 17, -0.5, 16.5,10,-0.5, 9.5 );
0015 temp_chan->SetMaximum(25.);
0016 temp_chan->SetMinimum(15.);
0017
0018
0019
0020
0021 char * sql="SELECT channelview.id1, channelview.id2, CAST(DCU_CAPSULE_TEMP_DAT.capsule_temp AS NUMBER), (since-to_date('01-JAN-2005 14:55:33','DD-MON-YYYY HH24:MI:SS'))*24 , channelview.logic_id from channelview, DCU_CAPSULE_TEMP_DAT, dcu_iov WHERE DCU_CAPSULE_TEMP_DAT.iov_id = (select max(iov_id) from DCU_IOV, DCU_TAG where dcu_iov.tag_id=dcu_tag.tag_id and dcu_tag.LOCATION_ID=1) and dcu_iov.iov_id=DCU_CAPSULE_TEMP_DAT.iov_id and channelview.logic_id=DCU_CAPSULE_TEMP_DAT.logic_id order by id1, id2 " ;
0022
0023 TSQLResult *res=db->Query(sql);
0024
0025 float temp=0;
0026 int chan=0;
0027 int j=0;
0028 do {
0029 j++;
0030 TSQLRow *row1=res->Next();
0031 TOracleRow * row2=(TOracleRow *)row1;
0032
0033 for (int i=0; i<res->GetFieldCount();i++) {
0034 printf(" %*.*s ",row2->GetFieldLength(i),row2->GetFieldLength(i),row2->GetField(i));
0035 if(i==1) chan=atoi( row2->GetField(i));
0036 if(i==2) temp=atof( row2->GetField(i));
0037 }
0038 cout << endl;
0039
0040 Float_t tpippo= (Float_t)temp;
0041 Float_t tchanx= (Float_t) ((chan-1)/10) ;
0042 Float_t tchany= (Float_t) ((chan-1)%10) ;
0043 temp_chan->Fill(tchanx, tchany, tpippo);
0044
0045 cout << chan << " " << tchanx << " " << tchany << " " << tpippo << endl;
0046
0047
0048
0049 delete row2;
0050
0051 } while (j<170);
0052 cout <<"loop done "<< endl;
0053
0054
0055
0056
0057
0058
0059
0060 temp_chan->Draw("colz");
0061 c1->Update();
0062
0063
0064
0065 printf("end \n");
0066
0067 delete res;
0068 delete db;
0069
0070 }