Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 void test_HVHisto(){
0002 
0003 /*connect with oracle server */
0004 TSQLServer *db=TSQLServer::Connect("oracle://pccmsecdb:1521/ecalh4db","test01","oratest01");
0005 
0006  gStyle->SetOptStat(0);
0007    gStyle->SetOptFit();
0008  gStyle->SetPalette(1,0);
0009 c1 = new TCanvas("c1","The HV",200,10,600,400);
0010 c1->SetGrid();
0011 c1->Divide(2,3);
0012 
0013 /* c2 = new TCanvas("c2","The HV evolution in time",200,10,600,400);
0014 c2->SetGrid();
0015 c3 = new TCanvas("c3","The HV versus channel",200,10,600,400);
0016 c3->SetGrid();
0017 c4 = new TCanvas("c4","The Current",200,10,600,400);
0018 c4->SetGrid();
0019 c5 = new TCanvas("c5","The HV Current evolution in time",200,10,600,400);
0020 c5->SetGrid();
0021 c6 = new TCanvas("c6","The HV Current versus channel",200,10,600,400);
0022 c6->SetGrid();
0023 */
0024 
0025 hv_imon  = new TH1F("hv_imon","HV IMON",100,0.,10.);
0026 hv_time_vs_imon  = new TH2F("hv_time_vs_imon","HV TIME VS IMON",100,1.E+12,10.E+12,100,0.,10.);
0027 hv_vmon  = new TH1F("hv_vmon","HV VMON",100,0.,500.);
0028 hv_time_vs_vmon  = new TH2F("hv_time_vs_vmon","HV TIME VS VMON",100,1.E+12,10.E+12,100,0.,500.);
0029 hv_chan_vs_imon  = new TH2F("hv_chan_vs_imon","HV CHAN VS IMON", 17, 0.5, 17.5,2,0.5, 2.5 );
0030 hv_chan_vs_vmon  = new TH2F("hv_chan_vs_vmon","HV CHAN VS VMON", 17, 0.5, 17.5, 2,0.5, 2.5 );
0031 hv_chan_vs_v0  = new TH2F("hv_chan_vs_v0","HV CHAN VS V0", 17, 0.5, 17.5, 2,0.5, 2.5 );
0032 hv_chan_vs_diff  = new TH2F("hv_chan_vs_v0","HV CHAN VS V0", 17, 0.5, 17.5, 2,0.5, 2.5 );
0033 
0034 /*print rows one by one */
0035 
0036 
0037 char * sql="select logic_id, since-1.1E+15, till, value00 from COND_HV_VMON where logic_id=1051110034 order by logic_id, since";
0038 TSQLResult *res=db->Query(sql);   
0039 
0040  float vmon;
0041  float tmon;
0042  float ttill;
0043  
0044  do {int j; 
0045  TSQLRow *row1=res->Next();
0046  TOracleRow * row2=(TOracleRow *)row1;  
0047 
0048  for (int i=0; i<res->GetFieldCount();i++) {
0049    printf(" %*.*s ",row2->GetFieldLength(i),row2->GetFieldLength(i),row2->GetField(i)); 
0050    if(i==3) vmon=atof( row2->GetField(i));
0051    if(i==1) tmon=atof( row2->GetField(i));
0052    if(i==2) ttill=atof( row2->GetField(i));
0053  }
0054  cout <<  endl;
0055  Float_t tpippo= (Float_t)vmon;
0056  Float_t tt= (Float_t)tmon;
0057  hv_vmon->Fill(tpippo);
0058  hv_time_vs_vmon->Fill(tt, tpippo,1.);
0059  cout << tpippo<< tmon<< ttill << endl; 
0060  delete row2;
0061  
0062  } while (ttill<5E+15);
0063  
0064  c1->cd(1);
0065  hv_vmon->Draw();
0066  c1->Update();
0067 
0068  c1->cd(3);
0069  hv_time_vs_vmon->Draw();
0070  c1->Update();
0071 
0072  // now actual Idark plot
0073  
0074 char * sql_act_id="select logic_id-1051110000, till,  value00 from COND_HV_IMON where logic_id>1051110000 and till>9E+15 order by logic_id";
0075 TSQLResult *res_act_id=db->Query(sql_act_id);   
0076 
0077  float idark=0.;
0078  int chan=0;
0079 
0080  do{ int j;
0081  TSQLRow *row1=res_act_id->Next();
0082  TOracleRow * row2=(TOracleRow *)row1;  
0083  
0084  for (int i=0; i<res_act_id->GetFieldCount();i++) {
0085    printf(" %*.*s ",row2->GetFieldLength(i),row2->GetFieldLength(i),row2->GetField(i)); 
0086    if(i==0) chan=atoi( row2->GetField(i));
0087    if(i==2) idark=atof( row2->GetField(i));
0088  }
0089  cout <<  endl;
0090 
0091 
0092  Float_t tpippo= (Float_t) idark;
0093   Float_t tchanx= (Float_t) (2-chan%2) ;
0094  Float_t tchany= (Float_t) ((chan-1)/2+1) ;
0095  hv_chan_vs_imon->Fill(tchany, tchanx, tpippo);
0096  cout << chan << " " << tchanx << " " << tchany << endl; 
0097  // delete row2;
0098  } while (chan!=34);
0099  
0100  c1->cd(5);
0101  hv_chan_vs_imon->SetMaximum(10.0);
0102  hv_chan_vs_imon->Draw("colz");
0103  c1->Update();
0104 
0105 
0106  // now actual HV plot 
0107 char * sql_act_hv="select logic_id-1051110000,  till, value00 from COND_HV_VMON where logic_id>1051110000 and till>9E+15 order by logic_id";
0108 TSQLResult *res_act_hv=db->Query(sql_act_hv);   
0109  Float_t data[35];
0110 
0111  do{ int j;
0112  TSQLRow *row1=res_act_hv->Next();
0113  TOracleRow * row2=(TOracleRow *)row1;  
0114  
0115  for (int i=0; i<res_act_hv->GetFieldCount();i++) {
0116    printf(" %*.*s ",row2->GetFieldLength(i),row2->GetFieldLength(i),row2->GetField(i)); 
0117    if(i==0) chan=atoi( row2->GetField(i));
0118    if(i==2) idark=atof( row2->GetField(i));
0119  }
0120  cout <<  endl;
0121 
0122  Float_t tpippo= (Float_t) idark;
0123  data[chan]=tpippo;
0124  Float_t tchanx= (Float_t) (2-chan%2) ;
0125  Float_t tchany= (Float_t) ((chan-1)/2+1) ;
0126  hv_chan_vs_vmon->Fill(tchany, tchanx, tpippo);
0127 
0128 
0129  cout << chan << " " << tchanx << " " << tchany << endl; 
0130  delete row2;
0131 
0132  } while (chan!=34);
0133  
0134  // now actual HV V0 plot 
0135 char * sql_act_v0="select logic_id-1051110000,  till, value00 from COND_HV_V0 where logic_id>1051110000 and till>9E+15 order by logic_id";
0136 TSQLResult *res_act_v0=db->Query(sql_act_v0);   
0137  float v0=0.;
0138 
0139 do{ int j;
0140  
0141  TSQLRow *rows=res_act_v0->Next();
0142  TOracleRow * row3=(TOracleRow *)rows;  
0143  
0144  for (int i=0; i<res_act_v0->GetFieldCount();i++) {
0145    printf(" %*.*s ",row3->GetFieldLength(i),row3->GetFieldLength(i),row3->GetField(i)); 
0146    if(i==0) chan=atoi( row3->GetField(i));
0147    if(i==2) v0=atof( row3->GetField(i));   
0148  }
0149  cout <<  endl;
0150 
0151  
0152  Float_t tv0   = (Float_t) v0;
0153  Float_t tchanx= (Float_t) (2-chan%2) ;
0154  Float_t tchany= (Float_t) ((chan-1)/2+1) ;
0155  Float_t diff=data[chan]-tv0;
0156  
0157  hv_chan_vs_diff->Fill(tchany, tchanx, diff);
0158  hv_chan_vs_v0->Fill(tchany, tchanx, tv0);
0159  
0160  cout << chan << " " << tchanx << " " << tchany << endl; 
0161  
0162  delete row3;
0163  } while (chan!=34);
0164  
0165 
0166 
0167  c1->cd(4);
0168  hv_chan_vs_vmon->SetMaximum(450.0);
0169  hv_chan_vs_vmon->SetMinimum(350.0);
0170 hv_chan_vs_vmon->Draw("colz");
0171 
0172  c1->cd(6);
0173  hv_chan_vs_diff->SetMaximum(30.0);
0174  hv_chan_vs_diff->SetMinimum(-30.0);
0175  hv_chan_vs_diff->Draw("colz");
0176  c1->cd(2);
0177  hv_chan_vs_v0->SetMaximum(450.0);
0178  hv_chan_vs_v0->SetMinimum(350.0);
0179  hv_chan_vs_v0->Draw("colz");
0180  c1->Update();
0181 
0182  
0183  printf("end \n");
0184 
0185  delete res;
0186  delete db;
0187  
0188 }