STB/TFndStbMon.cxx

00001 // @(#)fROOT/STB:$Name:  $:$Id: TFndStbMon.cxx,v 1.27 2007/09/24 07:32:41 Diego_Faso Exp $
00002 // Revision Author: Diego Faso <mailto:faso@to.infn.it>, 2005/06/24
00003 // Original Author: Piergiorgio Cerello <mailto:cerello@to.infn.it>, 2001
00004 
00006 //                                                //
00007 //                 TFnsStbMon                     //
00008 //                                                //
00009 //  Base Class for the STB monitoring             //
00010 //   - histograms collection and filling          //
00011 //   - shared memories management                 //
00012 //                                                //
00013 //  (see GTS relative class for descriptions)     //
00014 //                                                //
00015 //                                                //
00017 
00018 #include <Riostream.h>
00019 #include <TDirectory.h>
00020 #include <TSystem.h>
00021 #include "TApplication.h"
00022 
00023 #include "TFndRun.h"
00024 #include "TFndHStb.h"
00025 #include "TFndHdt.h"
00026 #include "TFndStbMon.h"
00027 
00028 ClassImp(TFndStbMon)
00029 
00030 //_____________________________________________
00031 TFndStbMon::TFndStbMon(const TString &fmode,Int_t stb_tdc_bins,Double_t stb_tdc_min,Double_t stb_tdc_max):
00032   shmflg(),fout(),fstb(),
00033   fShmStbMain(),fShmStbTdc(),
00034   fMustRecoverHistos(),
00035   fSharedMemName_Main(),fSharedMemName_Tdc(),fSharedFileName_Main(),fSharedFileName_Tdc(),
00036   stbmult(),stbmaptdc(),
00037   stb_pattern(),stbtdc(),stb1d(),stb2d(),fLine()
00038 {
00039   
00040   Init();
00041   OpenSharedFiles(fmode);
00042   InitHistos(stb_tdc_bins,stb_tdc_min,stb_tdc_max);  
00043 
00044 
00045 
00046 
00047 
00048 
00049 
00050   
00051 }
00052 
00053 //_____________________________________________
00054 TFndStbMon::TFndStbMon():
00055   shmflg(),fout(),fstb(),
00056   fShmStbMain(),fShmStbTdc(),
00057   fMustRecoverHistos(),
00058   fSharedMemName_Main(),fSharedMemName_Tdc(),fSharedFileName_Main(),fSharedFileName_Tdc(),
00059   stbmult(),stbmaptdc(),
00060   stb_pattern(),stbtdc(),stb1d(),stb2d(),fLine()
00061 {
00062   // This constructor was used by the consumer,
00063   // but now there is no need to open the shared memory
00064   // in read/update mode here... (Diego - 03/03/2005)
00065   Init();
00066 
00067 }
00068 
00069 //_____________________________________________
00070 TFndStbMon::TFndStbMon(TString *filename):
00071   shmflg(),fout(),fstb(),
00072   fShmStbMain(),fShmStbTdc(),
00073   fMustRecoverHistos(),
00074   fSharedMemName_Main(),fSharedMemName_Tdc(),fSharedFileName_Main(),fSharedFileName_Tdc(),
00075   stbmult(),stbmaptdc(),
00076   stb_pattern(),stbtdc(),stb1d(),stb2d(),fLine()
00077 {
00078 
00079   Init();
00080 
00081   fstb = new TFile(filename->Data());
00082   TString hname;
00083   hname = "stbmult";
00084   stbmult = (TH1F *) fstb->Get(hname); 
00085   hname = "stbmaptdc";
00086   stbmaptdc = (TH2F *) fstb->Get(hname); 
00087 
00088   for(Int_t i=0;i<K_N_STB_CROWNS;i++) {
00089     hname = "stb_pattern_";
00090     hname+=i+1;
00091     stb_pattern[i] = (TH1F *) fstb->Get(hname);
00092     for(Int_t j=0;j<K_N_STB_TUBES;j++) {
00093       hname = "stbtdc_";
00094       hname+=i+1;
00095       hname+="_";
00096       hname+=j+1;
00097       stbtdc[i][j] = (TH1F *) fstb->Get(hname);
00098     }
00099   }
00100 
00101 }
00102 
00103 //_____________________________________________
00104 TFndStbMon::~TFndStbMon() {
00105     
00106   delete fLine;
00107   delete stb1d;
00108   delete stb2d;
00109   delete stbmult;
00110   delete stbmaptdc;
00111 
00112   for(Int_t i=0;i<K_N_STB_CROWNS;i++) {
00113     for(Int_t j=0;j<K_N_STB_TUBES;j++) {
00114       delete stbtdc[i][j];
00115     }
00116   }
00117   
00118   if(! shmflg){
00119     if(fstb && fstb->IsOpen()) fstb->Close();
00120     delete fstb;
00121   }
00122     
00123   if(fout) fout->Close();
00124   delete fout;
00125 
00126   if(fShmStbMain){ fShmStbMain->Close(); fShmStbMain = 0; }
00127   else delete fShmStbMain;
00128 
00129   for(Int_t si=0;si<K_N_STB_CROWNS;si++){
00130     if(fShmStbTdc[si]){ fShmStbTdc[si]->Close(); fShmStbTdc[si] = 0; }
00131     else delete fShmStbTdc[si];
00132   }
00133   
00134 }
00135 //_____________________________________________
00136 void TFndStbMon::Init(){
00137   
00138   fSharedMemName_Main   = FROOT::ExpandPathName("$FND_SHR/stb.map");
00139   fSharedMemName_Tdc[0] = FROOT::ExpandPathName("$FND_SHR/stb_tdc_1.map");
00140   fSharedMemName_Tdc[1] = FROOT::ExpandPathName("$FND_SHR/stb_tdc_2.map");
00141   fSharedMemName_Tdc[2] = FROOT::ExpandPathName("$FND_SHR/stb_tdc_3.map");
00142   fSharedMemName_Tdc[3] = FROOT::ExpandPathName("$FND_SHR/stb_tdc_4.map");
00143   fSharedMemName_Tdc[4] = FROOT::ExpandPathName("$FND_SHR/stb_tdc_5.map");
00144   fSharedMemName_Tdc[5] = FROOT::ExpandPathName("$FND_SHR/stb_tdc_6.map");
00145   
00146   fSharedFileName_Main   = FROOT::ExpandPathName("stb.file.map");
00147   fSharedFileName_Tdc[0] = FROOT::ExpandPathName("stb_tdc_1.file.map");
00148   fSharedFileName_Tdc[1] = FROOT::ExpandPathName("stb_tdc_2.file.map");
00149   fSharedFileName_Tdc[2] = FROOT::ExpandPathName("stb_tdc_3.file.map");
00150   fSharedFileName_Tdc[3] = FROOT::ExpandPathName("stb_tdc_4.file.map");
00151   fSharedFileName_Tdc[4] = FROOT::ExpandPathName("stb_tdc_5.file.map");
00152   fSharedFileName_Tdc[5] = FROOT::ExpandPathName("stb_tdc_6.file.map");
00153 }
00154 
00155 //_____________________________________________
00156 void TFndStbMon::OpenSharedFiles(const TString &fmode){
00157 
00158 
00159   TString fhist = "_stb.root";
00160   shmflg = fndrun->Onlflg();
00161   cout << "Stb Shm flag is " << shmflg << endl;
00162   
00163   TString stbnam_str = (fmode.IsNull())? "ONLM" : fmode;
00164   stbnam_str+=fhist;
00165   
00166   fstb = new TFile(stbnam_str.Data(),"RECREATE","Stb Histogram File");   
00167   
00168   if(shmflg) {
00169 #if defined _FND_ONL_USE_MAP_FILES_
00170     fShmStbMain = TMapFile::Create(fSharedMemName_Main,"RECREATE",(Int_t)(1048576*FROOT::K_StbMapSize),"Stb memory mapped file with histograms");
00171     fShmStbMain->Print();
00172 #elif defined _FND_ONL_USE_SHARED_FILES_
00173     if(gSystem->AccessPathName(fSharedFileName_Main)){
00174       Printf("Shared file missing: creating it now...");
00175       fShmStbMain = new TFile(fSharedFileName_Main,"RECREATE");
00176     }
00177     else{
00178       Printf("Shared file found: histograms will be recovered...");
00179       fShmStbMain = TFile::Open(fSharedFileName_Main,"UPDATE");
00180       fMustRecoverHistos = kTRUE;
00181       //fShmStbMain->ls();
00182     }
00183 #endif
00184     
00185     //   STB   TDC Crowns
00186     for(Int_t si=0;si<K_N_STB_CROWNS;si++){
00187 #if defined _FND_ONL_USE_MAP_FILES_
00188       fShmStbTdc[si] = TMapFile::Create(fSharedMemName_Tdc[si],"RECREATE",(Int_t)(1048576*FROOT::K_StbC1MapSize),"Stb memory mapped file with TDC histograms (Crown 1)");
00189       fShmStbTdc[si]->Print();
00190 #elif defined _FND_ONL_USE_SHARED_FILES_
00191       if( gSystem->AccessPathName(fSharedFileName_Tdc[si]) && fMustRecoverHistos == kTRUE){
00192         Printf("Shared file missing: creating it now...");
00193         fShmStbTdc[si] = new TFile(fSharedFileName_Tdc[si],"RECREATE");
00194         fMustRecoverHistos = kFALSE;
00195       }
00196       else{
00197         Printf("Shared file found: histograms will be recovered...");
00198         fShmStbTdc[si] = TFile::Open(fSharedFileName_Tdc[si],"UPDATE");
00199         //fShmStbTdc[si]->ls();
00200       }
00201 #endif
00202     }
00203   }
00204   
00205 }
00206 
00207 //_____________________________________________
00208 void TFndStbMon::InitHistos(const Int_t &stb_tdc_bins,const Double_t &stb_tdc_min,const Double_t &stb_tdc_max){
00209   
00210   TString hnam = "";
00211   TString htit = "";
00212   
00213   if(shmflg) fShmStbMain->cd();
00214   
00215   hnam = "stbmult";
00216   htit = "Stb multiplicity";
00217   stbmult = (fMustRecoverHistos) ? 
00218     ((TH1F*) (fShmStbMain->Get(hnam))) :
00219     new TH1F(hnam,htit,50,-0.5,49.5);
00220   
00221   hnam = "stbmaptdc";
00222   htit = "Stb TDC pattern (Crown vs Tube)";
00223   stbmaptdc = (fMustRecoverHistos) ? 
00224     ((TH2F*) (fShmStbMain->Get(hnam))) :
00225     new TH2F(hnam,htit,K_N_STB_TUBES,0.5,K_N_STB_TUBES + 0.5,K_N_STB_CROWNS,0.5,K_N_STB_CROWNS + 0.5);   
00226   
00227   // Define Histogram Parameters
00228 
00229   for (Int_t ll=0;ll<K_N_STB_CROWNS;ll++) {
00230     hnam.Form("stb_pattern_%d",ll+1);
00231     htit.Form("Hit Pattern for Crown: %d",ll+1);
00232     stb_pattern[ll] = (fMustRecoverHistos) ? 
00233       ((TH1F*) (fShmStbMain->Get(hnam))) :
00234       new TH1F(hnam,htit,K_N_STB_TUBES,0.5,0.5+K_N_STB_TUBES);
00235     stb_pattern[ll]->SetFillColor(4); 
00236   }
00237   
00238   //   STB   TDC Crown 1
00239   for(Int_t si=0;si<K_N_STB_CROWNS;si++){
00240     if(shmflg) fShmStbTdc[si]->cd();
00241     
00242     for (Int_t l=0;l<K_N_STB_TUBES;l++) {
00243       hnam.Form("stbtdc_%d_%d",si+1,l+1);
00244       htit.Form("TDC  for Crown: %d Tube: %d",si+1,l+1);
00245       stbtdc[si][l] = (fMustRecoverHistos) ? 
00246         ((TH1F*) (fShmStbTdc[si]->Get(hnam))) :
00247         new TH1F(hnam,htit,stb_tdc_bins,stb_tdc_min,stb_tdc_max);
00248       stbtdc[si][l]->SetFillColor(6); 
00249     }
00250   }
00251 
00252 }
00253 
00254 
00255 //_____________________________________________
00256 void TFndStbMon::Fill() {
00257   
00258   TClonesArray *cl = fndrun->GetCurrentHdt()->GetStbHits();
00259   Fill(*cl);
00260 }
00261 
00262 //_____________________________________________
00263 void TFndStbMon::Fill(const TClonesArray &StbHit) {
00264 
00265   Int_t nhstb = StbHit.GetEntries();
00266   stbmult->Fill((Float_t) nhstb);
00267   
00268   for (Int_t j=0; j<nhstb; j++) {
00269     TFndHStb *hstb = (TFndHStb*) StbHit[j];
00270     Int_t crown = hstb->GetCrown();
00271     Int_t tube =  hstb->GetTube();
00272     Float_t tdc = (Float_t) hstb->GetTdc();
00273 
00274     if(tdc <0) continue;
00275     
00276     stbmaptdc->Fill((Float_t ) tube,(Float_t ) crown);
00277     stbtdc[crown-1][tube-1]->Fill(tdc);
00278     stb_pattern[crown-1]->Fill((Float_t) tube);
00279     
00280   }
00281 }
00282 
00283 //_____________________________________________
00284 void TFndStbMon::Update(Bool_t purge) {
00285 
00286   if(!shmflg) return; 
00287   
00288 #if defined _FND_ONL_USE_MAP_FILES_
00289   Info("TFndStbMon::Update","1");
00290   if( fShmStbMain && fShmStbMain->IsWritable() ) fShmStbMain->Update();
00291 
00292 
00293   for(Int_t si=0;si<K_N_STB_CROWNS;si++){
00294     if( fShmStbTdc[si] && fShmStbTdc[si]->IsWritable() ) fShmStbTdc[si]->Update();
00295   }
00296 #elif defined _FND_ONL_USE_SHARED_FILES_
00297   WriteToFile(0,kTRUE);
00298   
00299   fShmStbMain->cd();
00300   if(purge) fShmStbMain->Purge();
00301   fShmStbMain->Flush();
00302   //
00303   for(Int_t si=0;si<K_N_STB_CROWNS;si++){
00304     fShmStbTdc[si]->cd();
00305     if(purge) fShmStbTdc[si]->Purge();
00306     fShmStbTdc[si]->Flush();
00307   }
00308 
00309   // --- copy shared files from here to shared directory
00310   //     (NFS safe)
00311   TString comm_cp = "";
00312   comm_cp.Form("cp ./stb.file.map %s",FROOT::ExpandPathName("$FND_SHR/stb.file.map").Data());
00313   gSystem->Exec(comm_cp);
00314   comm_cp.Form("cp ./stb_tdc_1.file.map %s",FROOT::ExpandPathName("$FND_SHR/stb_tdc_1.file.map").Data());
00315   gSystem->Exec(comm_cp);
00316   comm_cp.Form("cp ./stb_tdc_2.file.map %s",FROOT::ExpandPathName("$FND_SHR/stb_tdc_2.file.map").Data());
00317   gSystem->Exec(comm_cp);
00318   comm_cp.Form("cp ./stb_tdc_3.file.map %s",FROOT::ExpandPathName("$FND_SHR/stb_tdc_3.file.map").Data());
00319   gSystem->Exec(comm_cp);
00320   comm_cp.Form("cp ./stb_tdc_4.file.map %s",FROOT::ExpandPathName("$FND_SHR/stb_tdc_4.file.map").Data());
00321   gSystem->Exec(comm_cp);
00322   comm_cp.Form("cp ./stb_tdc_5.file.map %s",FROOT::ExpandPathName("$FND_SHR/stb_tdc_5.file.map").Data());
00323   gSystem->Exec(comm_cp);
00324   comm_cp.Form("cp ./stb_tdc_6.file.map %s",FROOT::ExpandPathName("$FND_SHR/stb_tdc_6.file.map").Data());
00325   gSystem->Exec(comm_cp);
00326 
00327 
00328 #endif  
00329   
00330   Info("Update","STB histograms updated (producer)");
00331   
00332 }
00333 
00334 //_____________________________________________
00335 void TFndStbMon::ResetHistos(){
00336 
00337   stbmult->Reset();
00338   stbmaptdc->Reset();
00339 
00340   for(Int_t i=0; i<K_N_STB_CROWNS; i++) {
00341     stb_pattern[i]->Reset();
00342     for(Int_t j=0; j<K_N_STB_TUBES; j++) {
00343       stbtdc[i][j]->Reset();
00344     }
00345   }
00346 
00347 }
00348 
00349 //_____________________________________________
00350 void TFndStbMon::WriteToFile(TString file,Bool_t IsShared) {
00351 
00352   if(IsShared){
00353     fShmStbMain->cd();
00354   }
00355   else{
00356     if(file.IsNull()) 
00357       fstb->cd();
00358     else {
00359       fout = new TFile(file.Data(),"RECREATE","Lmd Histogram File");
00360       fout->cd();
00361     }
00362   }
00363   
00364   stbmult->Write();
00365   stbmaptdc->Write();
00366   for(Int_t i=0; i<K_N_STB_CROWNS; i++) stb_pattern[i]->Write();
00367 
00368 
00369   
00370   for(Int_t i=0; i<K_N_STB_CROWNS; i++) {
00371     if(IsShared){
00372       fShmStbTdc[i]->cd();
00373     }
00374     for(Int_t j=0; j<K_N_STB_TUBES; j++) {
00375       stbtdc[i][j]->Write();
00376     }
00377   }
00378   if(!file.IsNull()) fout->Close();
00379   delete fout; fout = 0;
00380 }
00381 
00382 //_____________________________________________
00383 void TFndStbMon::Add(TFndStbMon *stbmon) {
00384 
00385   stbmult->Add((const TH1 *) stbmon->StbMult()); // STB multiplicity
00386   stbmaptdc->Add((const TH2 *) stbmon->StbMapTdc());  // STB TDC pattern
00387   for (Int_t i=0;i<K_N_STB_CROWNS;i++) {    
00388     stb_pattern[i]->Add((const TH1 *) stbmon->StbPattern(i+1)); // hit pattern for various crowns
00389     for (Int_t j=0;j<K_N_STB_TUBES;j++) {     
00390       stbtdc[i][j]->Add((const TH1 *) stbmon->StbTdc(i+1,j+1)); // TDCs 
00391     } 
00392   }
00393 }
00394 
00395 //_____________________________________________
00396 // void TFndStbMon::TimeCalibration(){
00397 //   cout << " ...calibrating t0..." << endl;
00398 //   for(Int_t i=1; i<=K_N_STB_CROWNS; i++) TimeCalibration(i);
00399 //   cout << " ...calibration completed..." << endl;
00400 // }
00401 
00402 //_____________________________________________
00403 // void TFndStbMon::TimeCalibration(Int_t crown){
00404 //   for(Int_t i=1; i<=K_N_STB_TUBES; i++) TimeCalibration(crown,i);
00405 // }
00406 
00407 //_____________________________________________
00408 // void TFndStbMon::TimeCalibration(Int_t crown, Int_t tube){
00409 //   Int_t flagSum = 0;
00410 //   Int_t flagDesc = 0;
00411 //   if(crown < 1 || crown > K_N_STB_CROWNS) {
00412 //     cout << "Wrong crown number" << endl;
00413 //     return;
00414 //   }
00415 //   if(tube < 1 || tube > K_N_STB_TUBES) {
00416 //     cout << "Wrong tube number" << endl;
00417 //     return;
00418 //   }
00419 //   ZeroTime[crown-1][tube-1] = 0.;
00420 
00421 //   Int_t stb_tdc_bins = stbtdc[crown-1][tube-1]->GetNbinsX();
00422 //   Float_t Entries = stbtdc[crown-1][tube-1]->GetEntries();
00423 //   //Float_t binsize = stbtdc[crown-1][tube-1]->GetBinWidth(1);
00424 //   //  Float_t stb_tdc_min = stbtdc[crown-1][tube-1]->GetBinLowEdge(1);
00425 //   //  Float_t stb_tdc_max = stbtdc[crown-1][tube-1]->GetBinLowEdge(stb_tdc_bins) + binsize;
00426 
00427 //   Int_t max = 0;
00428 //   Float_t tmax = 0.;
00429 //   Int_t bmax = 0;
00430 //   for(Int_t nb=0; nb<stb_tdc_bins; nb++) {
00431 //     Int_t cont = (Int_t) stbtdc[crown-1][tube-1]->GetBinContent(nb+1);
00432 //     if(cont >= max) { 
00433 //       max = cont; 
00434 //       bmax = nb+1; 
00435 //       tmax = stbtdc[crown-1][tube-1]->GetBinCenter(nb+1); 
00436 //     }
00437 //   }
00438 //   Float_t tflex = 0.;
00439 //   Stat_t flexbincont = 0;
00440 //   Stat_t dndtmin = 0; 
00441 //   for(Int_t n=bmax+1; n<stb_tdc_bins-3; n++) {
00442 //     Stat_t dndt = (Int_t) stbtdc[crown-1][tube-1]->GetBinContent(n+1) - stbtdc[crown-1][tube-1]->GetBinContent(n-1);
00443 //     if(dndt <= dndtmin) {
00444 //       dndtmin = dndt;
00445 //       tflex =  stbtdc[crown-1][tube-1]->GetBinCenter(n);
00446 //       flexbincont = stbtdc[crown-1][tube-1]->GetBinContent(n); 
00447       
00448 //       Stat_t sumdown = 0;
00449 //       Stat_t sumup = 0;
00450 //       for(Int_t i=0;i<100;i++){
00451 //      sumdown = sumdown + stbtdc[crown-1][tube-1]->GetBinContent(n-i);
00452 //      sumup = sumup + stbtdc[crown-1][tube-1]->GetBinContent(n+i+1);
00453 
00454 // //        Stat_t sumdown = stbtdc[crown-1][tube-1]->GetBinContent(n-6) + stbtdc[crown-1][tube-1]->GetBinContent(n-5)+ stbtdc[crown-1][tube-1]->GetBinContent(n-4) + stbtdc[crown-1][tube-1]->GetBinContent(n-3) + stbtdc[crown-1][tube-1]->GetBinContent(n-2) + stbtdc[crown-1][tube-1]->GetBinContent(n-1) + stbtdc[crown-1][tube-1]->GetBinContent(n);
00455 // //        Stat_t sumup = stbtdc[crown-1][tube-1]->GetBinContent(n+1) + stbtdc[crown-1][tube-1]->GetBinContent(n+2) + stbtdc[crown-1][tube-1]->GetBinContent(n+3) + stbtdc[crown-1][tube-1]->GetBinContent(n+4) + stbtdc[crown-1][tube-1]->GetBinContent(n+5) + stbtdc[crown-1][tube-1]->GetBinContent(n+6) + stbtdc[crown-1][tube-1]->GetBinContent(n+7) ;
00456 //       }
00457 //       if(flexbincont != 0 && sumup > sumdown) {
00458 //      flagSum = 1;
00459 //      dndtmin = 0;
00460 //      flexbincont =0;
00461 //      tflex = 0;
00462 //       }
00463       
00464 //       for(Int_t i=2;i<3;i++){
00465 //      if(stbtdc[crown-1][tube-1]->GetBinContent(n+i) > stbtdc[crown-1][tube-1]->GetBinContent(n+1)) {
00466 //        dndtmin = 0;
00467 //        flexbincont =0;
00468 //        tflex = 0;
00469 //        flagDesc = 1;
00470 //      } 
00471 //       }
00472 //     }
00473 //   }
00474 //   if(Entries < 150){
00475 //     tflex = 0;
00476 //     //  cout << " Low entries for " << crown << " - " << tube << endl;
00477 //   }  
00478 //   //  if(flagSum) cout << " sumup > sumdown for " << crown << " - " << tube << endl;
00479 //   //  if(flagDesc) cout << " No descending for " << crown << " - " << tube << endl;
00480 //   ZeroTime[crown-1][tube-1] = tflex;
00481 //   cout << "Crown: " << crown << ", Tube: " << tube << ", TZero: " << ZeroTime[crown-1][tube-1] << endl;
00482 // }
00483 /*
00484   TH1F *TFndStbMon::TimeMap() {
00485   
00486   char hname[20];
00487   char htitle[80];
00488   
00489   sprintf(hname,"Stb_Time_Map");
00490   sprintf(htitle,"TDC Calibration for stb:");
00491   
00492   TH1F *pattern = new TH1F(hname,htitle,4,0.5,4.5);
00493   pattern->SetFillColor(4);
00494   
00495   for(Int_t j=0; j<2; j++) 
00496   for (Int_t i=0; i<2 ; i++) 
00497   pattern->Fill(j+1+i*2,ZeroTime[j][i]);    
00498   return pattern;
00499   }
00500 */
00501 
00502 //_____________________________________________
00503 // void TFndStbMon::WriteTimeToMsql(){
00504 //   TString *stb_cal_file = new TString("stb_calibration.msql");
00505 //   cout << "Write Stb Msql Calibration file" << endl;
00506 //   FILE *fstbcal;
00507 //   fstbcal = fopen(stb_cal_file->Data(),"w+");
00508 //   fprintf(fstbcal,"# Host: localhost    Database: stbdb\n");
00509 //   fprintf(fstbcal,"# Table structure for table 'time_cal'\n");
00510 //   fprintf(fstbcal,"CREATE TABLE time_cal (\n");
00511 //   fprintf(fstbcal,"  w INT,\n");
00512 //   fprintf(fstbcal,"  A INT,\n");
00513 //   fprintf(fstbcal,"  Z INT,\n");
00514 //   fprintf(fstbcal,"  t0_ue FLOAT,\n");
00515 //   fprintf(fstbcal,"  t0_uo FLOAT,\n");
00516 //   fprintf(fstbcal,"  t0_de FLOAT,\n");
00517 //   fprintf(fstbcal,"  t0_do FLOAT,\n");
00518 //   fprintf(fstbcal,") g\n");
00519 //   fprintf(fstbcal,"# Dumping data for table 'time_cal'\n");
00520 
00521 //   Int_t start_time = 11111;
00522 //   Int_t stop_time = 2000000000;
00523   
00524 //   for(Int_t i=0; i<K_N_STB_CROWNS;i++){ 
00525 //     for(Int_t j=0; j<K_N_STB_TUBES;j++){ 
00526 //       TString line_start = TString("INSERT INTO time_cal VALUES (");
00527 //       Int_t tube = 1000*(i+1)+j+1;
00528       
00529 //       line_start+=tube;
00530 //       line_start+=",";
00531 //       line_start+=start_time;
00532 //       line_start+=",";
00533 //       line_start+=stop_time;
00534 //       line_start+=",";
00535 //       line_start+=ZeroTime[i][j];
00536 //       line_start+=",";
00537 //       line_start+=ZeroTime[i][j];
00538 //       line_start+=",";
00539 //       line_start+=ZeroTime[i][j];
00540 //       line_start+=",";
00541 //       line_start+=ZeroTime[i][j];
00542 //       line_start+=")g";
00543 //       fprintf(fstbcal,"%s\n",line_start.Data());
00544 //     }
00545 //   }
00546 //   fclose(fstbcal);
00547 // }

Generated on Tue Oct 16 15:40:48 2007 by  doxygen 1.5.2