Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:54

0001 void test_ECMLaserBlue(){
0002 
0003 /*connect with oracle server */
0004 TSQLServer *db=TSQLServer::Connect("oracle://pccmsecdb:1521/ecalh4db","test05","oratest05");
0005 
0006  gStyle->SetOptStat(0);
0007    gStyle->SetOptFit();
0008  gStyle->SetPalette(1,0);
0009 c1 = new TCanvas("c1","The BLUE Laser",200,10,600,400);
0010 c1->SetGrid();
0011 // c1->Divide(2,3);
0012 
0013 
0014 laser_chan  = new TH2F("laser_chan","laser_chan", 85, -0.5, 84.5,20,-0.5, 19.5 );
0015 
0016 /*print rows one by one */
0017 
0018 char * sql="SELECT channelview.id1, channelview.id2, CAST(MON_LASER_BLUE_DAT.APD_MEAN AS NUMBER), channelview.name, channelview.maps_to from channelview, MON_LASER_BLUE_DAT WHERE  MON_LASER_BLUE_DAT.iov_id = (select max(iov_id) from MON_LASER_BLUE_DAT) and channelview.logic_id=MON_LASER_BLUE_DAT.logic_id order by name, id1, id2 "  ;
0019 
0020  TSQLResult *res=db->Query(sql);   
0021  
0022  float temp=0;
0023  int chan=0;
0024  int j=0; 
0025  do {
0026    j++;
0027    TSQLRow *row1=res->Next();
0028    TOracleRow * row2=(TOracleRow *)row1;  
0029    
0030    for (int i=0; i<res->GetFieldCount();i++) {
0031      //     printf(" %*.*s ",row2->GetFieldLength(i),row2->GetFieldLength(i),row2->GetField(i)); 
0032      if(i==1) chan=atoi( row2->GetField(i));
0033      if(i==2) temp=atof( row2->GetField(i));
0034    }
0035    //  cout <<  endl;
0036    
0037    Float_t tpippo= (Float_t)temp;
0038    Float_t tchanx= (Float_t) ((chan-1)/20) ;
0039    Float_t tchany= (Float_t) ((chan-1)%20) ;
0040    laser_chan->Fill(tchanx, tchany, tpippo);
0041    
0042    //   cout << chan << " " << tchanx << " " << tchany << " " << tpippo << " " << j<< endl; 
0043    if(temp !=0) cout  << chan << " "<< temp<< endl;
0044    
0045    
0046    delete row2;
0047    
0048  } while (j<1700);
0049  cout <<"loop done "<< endl; 
0050 
0051  
0052  // c1->cd(1);
0053  //hv_vmon->Draw();
0054  //c1->Update();
0055 
0056  //  c1->cd(1);
0057  laser_chan->Draw("colz");
0058  c1->Update(); 
0059  
0060 
0061  
0062  printf("end \n");
0063 
0064  delete res;
0065  delete db;
0066  
0067 }