Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

DbuDaqFileSummary.cxx

Go to the documentation of this file.
00001 
00002 // $Id: DbuDaqFileSummary.cxx,v 1.14 2007/02/15 14:15:48 rhatcher Exp $
00003 //
00004 // DbuDaqFileSummary
00005 //
00006 // Package: DatabaseUpdater
00007 //
00008 // R. Hatcher  2002-04-19
00009 //
00010 // Concept:
00011 //   
00012 // Purpose:
00013 //
00015 
00016 #include "DatabaseUpdater/DbuDaqFileSummary.h"
00017 #include "DatabaseUpdater/DbuSignalHandler.h"
00018 
00019 #include "MessageService/MsgService.h"
00020 
00021 #include "DatabaseInterface/DbiOutRowStream.h"
00022 #include "DatabaseInterface/DbiResultSet.h"
00023 #include "DatabaseInterface/DbiValidityRec.h"
00024 #include "DatabaseInterface/DbiString.h"
00025 
00026 #include <iostream>
00027 #include <cassert>
00028 #include <sstream>
00029 
00030 #include "DatabaseUpdater/RunTypeName.h"
00031 #include "OnlineUtil/msgLogLib/msgLog.h"
00032 #include "Util/UtilString.h"
00033 #include "RawData/RawTriggerCodes.h"
00034 
00035 ClassImp(DbuDaqFileSummary)
00036 
00037 //   Definition of static data members
00038 //   *********************************
00039 
00040 CVSID("$Id: DbuDaqFileSummary.cxx,v 1.14 2007/02/15 14:15:48 rhatcher Exp $ CVSID_DBIRESULTPTR ");
00041 
00042 const std::string DbuDaqFileSummary::kNoBaseName = "<<No BaseName>>";
00043 const std::string DbuDaqFileSummary::kNoDirName  = "<<No DirName>>";
00044 
00045 UInt_t DbuDaqFileSummary::fgFmtFlag = 0xffff;
00046 
00047 //  Instantiate associated Result Pointer class.
00048 //  *******************************************
00049 
00050 #include "DatabaseInterface/DbiResultPtr.tpl"
00051 template class  DbiResultPtr<DbuDaqFileSummary>;
00052 
00053 #include "DatabaseInterface/DbiWriter.tpl"
00054 template class  DbiWriter<DbuDaqFileSummary>;
00055 
00056 //.....................................................................
00057 
00058 std::ostream& operator<<(std::ostream& os, const DbuDaqFileSummary& ddfs)
00059 {
00060    os << ddfs.GetName() 
00061       << " " << Detector::AsString(ddfs.fDetector)
00062       << " Run " << ddfs.fRun
00063       << " SubRun " << ddfs.fSubRun
00064       << endl
00065       << " RecSets " << ddfs.fRecSets
00066       << " (" << ddfs.fRecSetsNotLIOnly << ")"
00067       << std::right
00068       << "  TimeFrames "
00069       << "# [" << setw(8) << ddfs.fFirstTimeFrame << ":"
00070       << setw(8) << ddfs.fLastTimeFrame << "] "
00071       << endl
00072       << "  Snarls " 
00073       << setw(8) << ddfs.fSnarlRecs << " : "
00074       << "  {" << ddfs.fFirstSnarlTime.AsString("sql") 
00075       << "} {" << ddfs.fLastSnarlTime.AsString("sql") << "}"
00076       << endl
00077       << "   " 
00078       << " TrigBits 0x" << setfill('0') << setw(8) << hex << ddfs.fTrigBitsSeen
00079       << dec << setfill(' ')
00080       << " \"" << RawTriggerCodes::MaskToString(ddfs.fTrigBitsSeen) << "\""
00081       << endl
00082       << "    Snarl # [" << setw(8) << ddfs.fFirstSnarlNum << ":"
00083       << setw(8) << ddfs.fLastSnarlNum << "] "
00084       << endl
00085       << "   "
00086       << " Digits: " 
00087       << ddfs.fTotalDigits << " (" << ddfs.fErrorDigits << ")"
00088       << " in "
00089       << ddfs.fTotalDigitBlocks << " (" << ddfs.fErrorDigitBlocks << ") blocks (errors)"
00090       << endl
00091       << "  Other  "
00092       << setw(8) << (ddfs.fMonitorRecs+ddfs.fLightInjRecs) << " : "
00093       << "  {" << ddfs.fFirstMonitorTime.AsString("sql") 
00094       << "} {" << ddfs.fLastMonitorTime.AsString("sql") << "}"
00095       << endl
00096       << "    Monitors " << ddfs.fMonitorRecs
00097       << " LightInj " << ddfs.fLightInjRecs
00098       << "  (LI Blocks: Adc " << ddfs.fAdcLIBlocks 
00099       << ", Timing " << ddfs.fTimingLIBlocks << ")"
00100       << resetiosflags(ios::adjustfield) // undo "right"/"left"
00101       << endl;
00102 
00103    if ( DbuDaqFileSummary::fgFmtFlag & DbuDaqFileSummary::fmt_BlockCount ) {
00104      os << "  Block Counts:" << endl;
00105      bool doendl = false;
00106      std::map<string,int>::const_iterator mapItr = ddfs.fBlockCount.begin();
00107      while (mapItr != ddfs.fBlockCount.end()) {
00108        string blkName = mapItr->first;
00109        int    blkCnt  = mapItr->second;
00110        os << "    " << std::left << setw(26) << blkName 
00111           << " " << std::right << setw(8) << blkCnt;
00112        if (doendl) os  << endl;
00113        doendl = !doendl; // toggle
00114        mapItr++;  // move on
00115      }
00116      os << std::right;
00117      if (doendl) os  << endl;  // if last line still hanging complete it
00118    }
00119    os << resetiosflags(ios::adjustfield); // undo "right"/"left"
00120 
00121    os << "  BaseName: " << ddfs.fBaseName 
00122       << endl
00123       << "  DirName: " << ddfs.fDirName << endl;
00124 
00125    os << "  Size " << ddfs.fSize << " bytes,"
00126       << " Compression level " << ddfs.fCompressLevel
00127       << " factor " << ddfs.fCompressFactor
00128       << " ROOT " << ddfs.fRootVersion
00129       << endl
00130       << "  ModTime " << ddfs.fModTime.AsString("sql")
00131       << ", processed on " << ddfs.fProcHost
00132       << endl;
00133 
00134    return os;
00135 }
00136 
00137 //.....................................................................
00138 
00139 // Definition of member functions (alphabetical order)
00140 // ***************************************************
00141 
00142 //.....................................................................
00143 
00144 void DbuDaqFileSummary::Fill(DbiResultSet& rs,
00145                                       const DbiValidityRec* vrec) {
00146 //
00147 //
00148 //  Purpose:  Fill object from Result Set
00149 //
00150 //  Arguments: 
00151 //    rs           in    Result Set used to fill object
00152 //    vrec         in    Associated validity record (or 0 if filling
00153 //                                                    DbiValidityRec)
00154 //
00155 //  Return:    
00156 //
00157 //  Contact:   R. Hatcher
00158 //
00159 //  Specification:-
00160 //  =============
00161 //
00162 //  o Fill object from current row of Result Set.
00163 
00164 //  Program Notes:-
00165 //  =============
00166 
00167 //  None.
00168 
00169    Detector::Detector_t det =
00170       (Detector::Detector_t) 
00171       ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00172 
00173    string detname, runtypename, mapstring;   
00174    Int_t size_32;
00175 
00176    // count of data columns (not including SEQNO and ROW_COUNTER)
00177    Int_t numDataCol = rs.NumCols() - (rs.HasRowCounter() ? 1 : 0) - 1;
00178    if ( 32 == numDataCol ) {  
00179        rs >> detname
00180           >> fRun
00181           >> fSubRun
00182           >> fFirstTimeFrame
00183           >> fLastTimeFrame
00184           >> fRecSets
00185           >> fRecSetsNotLIOnly
00186           >> fFirstSnarlTime
00187           >> fLastSnarlTime
00188           >> fFirstSnarlNum
00189           >> fLastSnarlNum
00190           >> fSnarlRecs
00191           >> fTrigBitsSeen
00192           >> fTotalDigitBlocks
00193           >> fErrorDigitBlocks
00194           >> fTotalDigits
00195           >> fErrorDigits
00196           >> fFirstMonitorTime
00197           >> fLastMonitorTime
00198           >> fMonitorRecs
00199           >> fLightInjRecs
00200           >> fAdcLIBlocks
00201           >> fTimingLIBlocks
00202           >> mapstring
00203           >> fBaseName
00204           >> fDirName
00205           >> size_32
00206           >> fCompressLevel
00207           >> fCompressFactor
00208           >> fRootVersion
00209           >> fModTime
00210           >> fProcHost;
00211    }
00212    else if ( 31 == numDataCol ) {    // before fRecSetsNotLIOnly
00213        rs >> detname
00214           >> fRun
00215           >> fSubRun
00216           >> fFirstTimeFrame
00217           >> fLastTimeFrame
00218           >> fRecSets
00219           >> fFirstSnarlTime
00220           >> fLastSnarlTime
00221           >> fFirstSnarlNum
00222           >> fLastSnarlNum
00223           >> fSnarlRecs
00224           >> fTrigBitsSeen
00225           >> fTotalDigitBlocks
00226           >> fErrorDigitBlocks
00227           >> fTotalDigits
00228           >> fErrorDigits
00229           >> fFirstMonitorTime
00230           >> fLastMonitorTime
00231           >> fMonitorRecs
00232           >> fLightInjRecs
00233           >> fAdcLIBlocks
00234           >> fTimingLIBlocks
00235           >> mapstring
00236           >> fBaseName
00237           >> fDirName
00238           >> size_32
00239           >> fCompressLevel
00240           >> fCompressFactor
00241           >> fRootVersion
00242           >> fModTime
00243           >> fProcHost;
00244    }
00245    else {
00246        MAXMSG("Dbu",Msg::kWarning,25)
00247            << "Table " << GetName() << " has " << numDataCol
00248            << ", but we only know how to handle 19 or 18."
00249            << endl;
00250    }
00251 
00252    
00253    fSize = size_32;
00254 
00255    fDetector = Detector::CharToEnum(detname.c_str()[0]);
00256    if (fDetector != det) 
00257       MSG("Dbu",Msg::kWarning)
00258          << "Detector column '" << detname << "' (" << (int)fDetector
00259          << ") did not match DetectorMask (" << (int)det << ")" << endl;
00260 
00261    FillMapFromString(mapstring);
00262 
00263 }
00264 
00265 //.....................................................................
00266 
00267 void DbuDaqFileSummary::Store(DbiOutRowStream& ors,
00268                              const DbiValidityRec* /* vrec */) const {
00269 //
00270 //
00271 //  Purpose:  Stream object to output row stream
00272 //
00273 //  Arguments: 
00274 //    ors          in     Output row stream.
00275 //    vrec         in     Associated validity record (or 0 if filling
00276 //                                                    DbiValidityRec)
00277 //
00278 //  Return:    
00279 //
00280 //  Contact:   R. Hatcher
00281 //
00282 //  Specification:-
00283 //  =============
00284 //
00285 //  o  Stream object to output row stream.
00286 
00287 //  Program Notes:-
00288 //  =============
00289 
00290 //  None.
00291 
00292    Int_t size_32 = fSize;  // hope it doesn't overflow
00293    string mapstring;
00294    GetStringFromMap(mapstring);
00295 
00296    ors << Detector::AsString(fDetector)
00297        << fRun
00298        << fSubRun
00299        << fFirstTimeFrame
00300        << fLastTimeFrame
00301        << fRecSets
00302        << fRecSetsNotLIOnly
00303        << fFirstSnarlTime
00304        << fLastSnarlTime
00305        << fFirstSnarlNum
00306        << fLastSnarlNum
00307        << fSnarlRecs
00308        << fTrigBitsSeen
00309        << fTotalDigitBlocks
00310        << fErrorDigitBlocks
00311        << fTotalDigits
00312        << fErrorDigits
00313        << fFirstMonitorTime
00314        << fLastMonitorTime
00315        << fMonitorRecs
00316        << fLightInjRecs
00317        << fAdcLIBlocks
00318        << fTimingLIBlocks
00319        << mapstring
00320        << fBaseName
00321        << fDirName
00322        << size_32
00323        << fCompressLevel
00324        << fCompressFactor
00325        << fRootVersion
00326        << fModTime
00327        << fProcHost;
00328    
00329 }
00330 
00331 //.....................................................................
00332 
00333 Int_t DbuDaqFileSummary::CalcUniqueSeqNo(Detector::Detector_t det, 
00334                                          Int_t run, Short_t subrun)
00335 {
00336 //
00337 //
00338 //  Purpose:  Calculate unique SeqNo
00339 //
00340 //  Return:   an integer
00341 //
00342 //  Contact:   R. Hatcher
00343 //
00344 //  Specification:-
00345 //  =============
00346 //
00347 
00348 //  Program Notes:-
00349 //  =============
00350 
00351 //  None.
00352 
00353 // similar to file naming convention
00354 //   Char_t detchar = Detector::AsString(det)[0];
00355 //   string fname = Form("%c%8.8d_%4.4d",detchar,run,subrun);
00356 // take care since can overflow int
00357 //  use two fewers places for sub and two fewer for run
00358 //  "drrrrrrss"
00359 
00360    return subrun%kModSubRun + kModSubRun*(run%kModRun + kModRun*det);
00361 }
00362 
00363 //.....................................................................
00364 
00365 const char* DbuDaqFileSummary::GetTableDescr()
00366 {
00367 //
00368 //
00369 //  Purpose:  Return a string describing rows in the table
00370 //            Used in creating temporary tables
00371 //
00372 //  Return:   const char* to parenthesized comma separated list
00373 //            of column name and type pairs
00374 //
00375 //  Contact:   R. Hatcher
00376 //
00377 //  Specification:-
00378 //  =============
00379 //
00380 
00381 //  Program Notes:-
00382 //  =============
00383 
00384 //  None.
00385 
00386    const char* const_tabledescr = "(\
00387        SEQNO              int,          \
00388        ROW_COUNTER        int,          \
00389        DETECTOR           varchar(10),  \
00390        RUN                int,          \
00391        SUBRUN             smallint,     \
00392        FIRST_TIMEFRAME    int,          \
00393        LAST_TIMEFRAME     int,          \
00394        REC_SETS           int,          \
00395        REC_SETS_NOTLIONLY int,          \
00396        FIRST_SNARL_TIME   datetime,     \
00397        LAST_SNARL_TIME    datetime,     \
00398        FIRST_SNARL_NUM    int,          \
00399        LAST_SNARL_NUM     int,          \
00400        SNARL_RECS         int,          \
00401        TRIGBITS_SEEN      int,          \
00402        DIGITBLOCKS_TOTAL  int,          \
00403        DIGITBLOCKS_ERROR  int,          \
00404        DIGITS_TOTAL       int,          \
00405        DIGITS_ERROR       int,          \
00406        FIRST_MONITOR_TIME datetime,     \
00407        LAST_MONITOR_TIME  datetime,     \
00408        MONITOR_RECS       int,          \
00409        LIGHTINJ_RECS      int,          \
00410        ADC_LI_BLKS        int,          \
00411        TIMING_LI_BLKS     int,          \
00412        BLOCK_COUNT        text,         \
00413        BASENAME           varchar(24),  \
00414        DIRNAME            varchar(255), \
00415        FILESIZE           int,          \
00416        COMPRESSLEVEL      smallint,     \
00417        COMPRESSFACTOR     float,        \
00418        ROOTVERSION        int,          \
00419        MODTIME            datetime,     \
00420        PROC_HOST          varchar(80),  \
00421        primary key (SEQNO,ROW_COUNTER), \
00422        index (RUN) )";
00423 
00424    return const_tabledescr;
00425 }
00426 
00427 //.....................................................................
00428 
00429 Bool_t DbuDaqFileSummary::Commit(DbiStatement* stmt)
00430 {
00431 //
00432 //
00433 //  Purpose:  
00434 //
00435 //  Arguments: 
00436 //    xxxxxxxxx    in    yyyyyy
00437 //
00438 //  Return:    
00439 //
00440 //  Contact:   R. Hatcher
00441 //
00442 //  Specification:-
00443 //  =============
00444 //
00445 //  o 
00446 
00447 //  Program Notes:-
00448 //  =============
00449 
00450 //  None.
00451 
00452   if (!stmt) return false; 
00453 
00454   // protect ODBC code against signals
00455   DbuSignalHandler::Instance().Delay();
00456   
00457   Int_t seqno = GetSeqNo();
00458   string tbl  = "DBUDAQFILESUMMARY";
00459   string tblv = "DBUDAQFILESUMMARYVLD";
00460   
00461   // just blast away any existing entry
00462 
00463   DbiString sqlrm, sqlrmv;
00464   
00465   sqlrm  << "delete from " << tbl  << " where SEQNO=" << seqno << ";\0";
00466   Int_t nrm  = stmt->ExecuteUpdate(sqlrm.c_str());
00467   stmt->PrintExceptions();
00468 
00469   sqlrmv << "delete from " << tblv << " where SEQNO=" << seqno << ";\0";
00470   Int_t nrmv = stmt->ExecuteUpdate(sqlrmv.c_str());
00471   stmt->PrintExceptions();
00472 
00473   // prepare to fill table
00474 
00475   string mapstring;
00476   GetStringFromMap(mapstring);
00477   string printableMapString;
00478   UtilString::MakePrintable(mapstring.c_str(),printableMapString);
00479 
00480   DbiString sqlcol, sqlval;
00481   sqlcol << " SEQNO ";
00482   sqlval << seqno;
00483   sqlcol << ", DETECTOR ";
00484   sqlval << ",'" << Detector::AsString(fDetector) << "'";
00485   sqlcol << ", RUN ";
00486   sqlval << "," << fRun;
00487   sqlcol << ", SUBRUN ";
00488   sqlval << "," << fSubRun;
00489   sqlcol << ", FIRST_TIMEFRAME ";
00490   sqlval << "," << fFirstTimeFrame;
00491   sqlcol << ", LAST_TIMEFRAME ";
00492   sqlval << "," << fLastTimeFrame;
00493   sqlcol << ", REC_SETS ";
00494   sqlval << "," << fRecSets;
00495   sqlcol << ", REC_SETS_NOTLIONLY ";
00496   sqlval << "," << fRecSetsNotLIOnly;
00497   sqlcol << ", FIRST_SNARL_TIME ";
00498   sqlval << ",'" << fFirstSnarlTime.AsString("s") << "'";
00499   sqlcol << ", LAST_SNARL_TIME ";
00500   sqlval << ",'" << fLastSnarlTime.AsString("s") << "'";
00501   sqlcol << ", FIRST_SNARL_NUM ";
00502   sqlval << "," << fFirstSnarlNum;
00503   sqlcol << ", LAST_SNARL_NUM ";
00504   sqlval << "," << fLastSnarlNum;
00505   sqlcol << ", SNARL_RECS ";
00506   sqlval << "," << fSnarlRecs;
00507   sqlcol << ", TRIGBITS_SEEN ";
00508   sqlval << "," << fTrigBitsSeen;
00509 
00510   sqlcol << ", DIGITBLOCKS_TOTAL ";
00511   sqlval << "," << fTotalDigitBlocks;
00512   sqlcol << ", DIGITBLOCKS_ERROR ";
00513   sqlval << "," << fErrorDigitBlocks;
00514   sqlcol << ", DIGITS_TOTAL ";
00515   sqlval << "," << fTotalDigits;
00516   sqlcol << ", DIGITS_ERROR ";
00517   sqlval << "," << fErrorDigits;
00518 
00519   sqlcol << ", FIRST_MONITOR_TIME ";
00520   sqlval << ",'" << fFirstMonitorTime.AsString("s") << "'";
00521   sqlcol << ", LAST_MONITOR_TIME ";
00522   sqlval << ",'" << fLastMonitorTime.AsString("s") << "'";
00523   sqlcol << ", MONITOR_RECS ";
00524   sqlval << "," << fMonitorRecs;
00525   sqlcol << ", LIGHTINJ_RECS ";
00526   sqlval << "," << fLightInjRecs;
00527   sqlcol << ", ADC_LI_BLKS ";
00528   sqlval << "," << fAdcLIBlocks;
00529   sqlcol << ", TIMING_LI_BLKS ";
00530   sqlval << "," << fTimingLIBlocks;
00531 
00532   sqlcol << ", BLOCK_COUNT ";
00533   sqlval << ",'" << printableMapString << "'";
00534   
00535   sqlcol << ", BASENAME ";
00536   sqlval << ",'" << fBaseName << "'";
00537   sqlcol << ", DIRNAME ";
00538   sqlval << ",'" << fDirName << "'";
00539   sqlcol << ", FILESIZE ";
00540   Int_t size_32 = fSize;  // hope it doesn't overflow
00541   sqlval << "," << size_32;
00542   sqlcol << ", COMPRESSLEVEL ";
00543   sqlval << "," << fCompressLevel;
00544   sqlcol << ", COMPRESSFACTOR ";
00545   sqlval << "," << fCompressFactor;
00546   sqlcol << ", ROOTVERSION ";
00547   sqlval << "," << fRootVersion;
00548   sqlcol << ", MODTIME ";
00549   sqlval << ",'" << fModTime.AsString("s") << "'";
00550   sqlcol << ", PROC_HOST ";
00551   sqlval << ",'" << fProcHost << "'";
00552 
00553   DbiString sqlinsert;
00554   sqlinsert << "insert into " << tbl
00555             << " ( " << sqlcol.c_str() << " ) "
00556             << " values ( " << sqlval.c_str() << " ) ;\0";
00557   
00558   MSG("Dbu",Msg::kDebug) << sqlinsert.c_str() << endl;
00559 
00560   VldTimeStamp now;
00561   VldTimeStamp startTime = fFirstMonitorTime;
00562   VldTimeStamp endTime   = fLastMonitorTime;
00563   // the above _should_ do in general ... but sometimes things are weird
00564   const VldTimeStamp nullTime = VldTimeStamp((time_t)0,0);  
00565   if ( nullTime != fFirstSnarlTime ) {
00566     if ( nullTime        == startTime || 
00567          fFirstSnarlTime  < startTime    ) startTime = fFirstSnarlTime;
00568   }
00569   if ( nullTime != fLastSnarlTime ) {
00570     if ( nullTime        == endTime || 
00571          fFirstSnarlTime  > endTime    ) endTime = fLastSnarlTime;
00572   }
00573 
00574   const Int_t task = 0;
00575 
00576   DbiString sqlcolv, sqlvalv;
00577   sqlcolv << " SEQNO";
00578   sqlvalv << seqno;
00579   sqlcolv << ", TIMESTART ";
00580   sqlvalv << ",'" << startTime.AsString("s") << "'";
00581   sqlcolv << ", TIMEEND ";
00582   sqlvalv << ",'" << endTime.AsString("s") << "'";
00583   sqlcolv << ", DETECTORMASK ";
00584   sqlvalv << "," << fDetector;
00585   sqlcolv << ", SIMMASK ";
00586   sqlvalv << "," << fSimFlag;
00587   sqlcolv << ", TASK ";
00588   sqlvalv << "," << task;
00589   sqlcolv << ", AGGREGATENO ";
00590   sqlvalv << "," << fSubRun;
00591   sqlcolv << ", CREATIONDATE ";
00592   sqlvalv << ",'" << now.AsString("s") << "'" ;
00593   sqlcolv << ", INSERTDATE ";
00594   sqlvalv << ",'" << now.AsString("s") << "'";
00595   
00596   DbiString sqlinsertv;
00597   sqlinsertv << "insert into " << tblv
00598              << " ( " << sqlcolv.c_str() << " ) "
00599              << " VALUES ( " << sqlvalv.c_str() << " ) ;\0";
00600   
00601   MSG("Dbu",Msg::kDebug) 
00602     << "insert into " << tblv
00603     << " ( " << sqlcolv.c_str() << " ) "
00604     << " VALUES ( " << sqlvalv.c_str() << " ) ;"
00605     << endl;
00606   
00607   Int_t ninsert = stmt->ExecuteUpdate(sqlinsert.c_str());
00608   stmt->PrintExceptions();
00609   
00610   Int_t ninsertv = stmt->ExecuteUpdate(sqlinsertv.c_str());
00611   stmt->PrintExceptions();
00612   
00613   MSG("Dbu",Msg::kVerbose)
00614     << sqlinsert.c_str() << endl;
00615   MSG("Dbu",Msg::kVerbose)
00616     << sqlinsertv.c_str() << endl;
00617   
00618   char tmpbuf[1024];
00619   sprintf(tmpbuf,"Commit DbuDaqFileSummary %c%8.8d_%4.4d",
00620           Detector::AsString(fDetector)[0],fRun,fSubRun);
00621 
00622   MSG("Dbu",Msg::kDebug) 
00623     << tmpbuf
00624     //<< " Cbits " << fCurrentSubRun->fConsistency 
00625     << " rm/in " 
00626     << nrm << "," << nrmv << "/"
00627     << ninsert << "," << ninsertv 
00628     << endl;
00629 
00630   logDebug(1,"%s rm=%d,%d in=%d,%d @ %s",
00631            tmpbuf,nrm,nrmv,ninsert,ninsertv,now.AsString("s"));
00632   
00633   bool success = (ninsert==1) && (ninsertv==1);
00634   
00635   // done protecting ODBC code against signals
00636   DbuSignalHandler::Instance().HandleDelayedSignal();
00637 
00638 
00639   //rwh!
00640   MSG("Dbu",Msg::kVerbose)
00641     << "DbuDaqFileSummary::Commit " << endl << *this << endl;
00642 
00643   return success;
00644 }
00645 
00646 //.....................................................................
00647 
00648 void DbuDaqFileSummary::FillMapFromString(const string& rstring) {
00649 //
00650 //
00651 //  Purpose:  
00652 //
00653 //  Arguments: 
00654 //    xxxxxxxxx    in    yyyyyy
00655 //
00656 //  Return:    
00657 //
00658 //  Contact:   R. Hatcher
00659 //
00660 //  Specification:-
00661 //  =============
00662 //
00663 //  o 
00664 
00665 //  Program Notes:-
00666 //  =============
00667 
00668 //  Two step dance:
00669 //    2) fill Registry from string
00670 //    1) fill map from Registry
00671 
00672   fBlockCount.clear();  // clear it out first
00673 
00674   Registry reg;
00675   reg.UnLockKeys();
00676   reg.UnLockValues();
00677   reg.Clear();
00678   istringstream is(rstring);
00679   reg.ReadStream(is);
00680   reg.LockKeys();
00681   reg.LockValues();
00682 
00683   // unsigned int n = reg.Size();
00684 
00685   Registry::RegistryKey rk = reg.Key();
00686   const char* keyname;
00687   while ( ( keyname = rk() ) ) {
00688     string blkName = keyname;
00689     string valType = reg.GetType(keyname).name();
00690     if ( "i" != valType ) {  // this may be platform dependent!
00691       MSG("Dbu",Msg::kWarning)
00692         << "BlockCount string had non-int entry: key='"
00693         << blkName << "' value-type='" << valType << "'" << endl;
00694       continue;  // skip on
00695     }
00696     fBlockCount[blkName] = reg.GetInt(keyname);
00697   }
00698 
00699 }
00700 
00701 //.....................................................................
00702 
00703 void DbuDaqFileSummary::GetStringFromMap(string& rstring) const {
00704 //
00705 //
00706 //  Purpose:  
00707 //
00708 //  Arguments: 
00709 //    xxxxxxxxx    in    yyyyyy
00710 //
00711 //  Return:    
00712 //
00713 //  Contact:   R. Hatcher
00714 //
00715 //  Specification:-
00716 //  =============
00717 //
00718 //  o 
00719 
00720 //  Program Notes:-
00721 //  =============
00722 
00723 //  Two step dance:
00724 //    1) fill Registry from map
00725 //    2) fill string from Registry
00726 
00727   Registry reg;
00728   reg.SetName("BlockCount");
00729   std::map<string,int>::const_iterator mapItr = fBlockCount.begin();
00730   while (mapItr != fBlockCount.end()) {
00731     string blkName = mapItr->first;
00732     int    blkCnt  = mapItr->second;
00733     reg.Set(blkName.c_str(),blkCnt);
00734     mapItr++;  // move on
00735   }
00736   reg.LockKeys();
00737   reg.LockValues();
00738 
00739   ostringstream os;
00740   reg.PrintStream(os);
00741 
00742   rstring = os.str();
00743 
00744 }
00745 
00746 /*    Template for New Member Function
00747 
00748 //.....................................................................
00749 
00750 DbuDaqFileSummary:: {
00751 //
00752 //
00753 //  Purpose:  
00754 //
00755 //  Arguments: 
00756 //    xxxxxxxxx    in    yyyyyy
00757 //
00758 //  Return:    
00759 //
00760 //  Contact:   R. Hatcher
00761 //
00762 //  Specification:-
00763 //  =============
00764 //
00765 //  o 
00766 
00767 //  Program Notes:-
00768 //  =============
00769 
00770 //  None.
00771 
00772 
00773 }
00774 
00775 */
00776 

Generated on Mon Feb 15 11:06:35 2010 for loon by  doxygen 1.3.9.1