Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:58

0001 void test_TempHistory(){
0002 
0003 /*connect with oracle server */
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  // c1->Divide(2,3);
0012 
0013 temp_vs_time  = new TH2F("temp_vs_time","TEMP CHAN VS TIME", 100, 450, 550, 100, 15.,25. );
0014  temp_vs_time->GetXaxis()->SetTitle("Time(days since 1/1/2005)");
0015  temp_vs_time->GetYaxis()->SetTitle("Temperature (C)");
0016 
0017  /* first see how many rows we have */
0018 char * sql="SELECT count(dcu_iov.iov_id)  from channelview, DCU_CAPSULE_TEMP_DAT, dcu_iov WHERE channelview.id1=4 and channelview.id2=10 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, since "  ;
0019 
0020  TSQLResult *res=db->Query(sql);   
0021  int j=0;
0022  int nRows=0;
0023 
0024  do {
0025    j++;
0026    TSQLRow *row1=res->Next();
0027    TOracleRow * row2=(TOracleRow *)row1;  
0028    nRows=atoi( row2->GetField(0));
0029    delete row2;
0030    
0031  } while (j<1);
0032  cout <<"loop done "<< endl; 
0033 
0034 
0035 
0036 char * sql="SELECT channelview.id1, channelview.id2, CAST(DCU_CAPSULE_TEMP_DAT.capsule_temp AS NUMBER), (since-to_date('01-JAN-2005 00:00:00','DD-MON-YYYY HH24:MI:SS')) , channelview.logic_id  from channelview, DCU_CAPSULE_TEMP_DAT, dcu_iov WHERE channelview.id1=4 and channelview.id2=10 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, since "  ;
0037 
0038 
0039  TSQLResult *res=db->Query(sql);   
0040  
0041  float temp=0;
0042  float time_meas=0;
0043  int chan=0;
0044  int j=0; 
0045  do {
0046    j++;
0047    TSQLRow *row1=res->Next();
0048    TOracleRow * row2=(TOracleRow *)row1;  
0049    
0050    for (int i=0; i<res->GetFieldCount();i++) {
0051      printf(" %*.*s ",row2->GetFieldLength(i),row2->GetFieldLength(i),row2->GetField(i)); 
0052      if(i==1) chan=atoi( row2->GetField(i));
0053      if(i==2) temp=atof( row2->GetField(i));
0054      if(i==3) time_meas=atof( row2->GetField(i));
0055    }
0056    cout <<  endl;
0057    
0058    Float_t tpippo= (Float_t)temp;
0059    Float_t tchanx= (Float_t) ((chan-1)/10) ;
0060    Float_t tchany= (Float_t) ((chan-1)%10) ;
0061    temp_vs_time->Fill(time_meas, tpippo,1.);
0062    
0063    
0064    cout << chan << " " << tchanx << " " << tchany << " " << tpippo << endl; 
0065    
0066    
0067    
0068    delete row2;
0069    
0070  } while (j<nRows);
0071  cout <<"loop done "<< endl; 
0072 
0073  
0074  // c1->cd(1);
0075  //hv_vmon->Draw();
0076  //c1->Update();
0077 
0078  //  c1->cd(1);
0079  temp_vs_time->Draw();
0080  c1->Update(); 
0081  
0082 
0083  
0084  printf("end \n");
0085 
0086  delete res;
0087  delete db;
0088  
0089 }