FillSpillServerMon Class Reference

#include <FillSpillServerMon.h>

Inheritance diagram for FillSpillServerMon:
JobCModule

List of all members.

Public Member Functions

 FillSpillServerMon ()
 ~FillSpillServerMon ()
void BeginJob ()
JobCResult Get (MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
void HandleCommand (JobCommand *command)
void EndJob ()

Private Member Functions

void ClearVectors ()
void PrintResults ()
void ProcessBlock (TObject *obj)
void WriteToDatabase ()
void ReadFromDatabase ()
void WriteOutResults (Int_t source)

Private Attributes

Int_t fRecord
Int_t fCounter
Int_t fTime
Int_t fBegTime
Int_t fEndTime
Int_t fWriteToDatabase
Int_t fReadFromDatabase
Int_t fWriteOutResults
Int_t fWriteReportedSpills
Int_t fWritePredictedSpills
Int_t fWriteFakeSpills
Int_t fWriteLocalSpills
TFile * fSpillFile
TTree * fSpillTree
Int_t Source
Int_t TimeStamp
Int_t SpillStatus
Int_t SpillType
Int_t SpillTimeND_sec
Int_t SpillTimeND_nsec
Int_t SpillTimeFD_sec
Int_t SpillTimeFD_nsec
Int_t SpillTimeError
Int_t Request_sec
Int_t WindowOpen_nsec
Int_t WindowClose_nsec
vector< int > vecTimeStamp
vector< int > vecSpillStatus
vector< int > vecSpillType
vector< int > vecSpillTimeNDsec
vector< int > vecSpillTimeNDnanosec
vector< int > vecSpillTimeFDsec
vector< int > vecSpillTimeFDnanosec
vector< int > vecSpillTimeError
vector< int > vecRequestSec
vector< int > vecWindowOpen
vector< int > vecWindowClose
Detector::Detector_t fDetector

Detailed Description

Definition at line 16 of file FillSpillServerMon.h.


Constructor & Destructor Documentation

FillSpillServerMon::FillSpillServerMon (  ) 

Definition at line 38 of file FillSpillServerMon.cxx.

References Msg::kDebug, Detector::kUnknown, and MSG.

00038                                        :
00039   fRecord(0),
00040   fCounter(0),
00041   fTime(0),
00042   fBegTime(-1),
00043   fEndTime(-1),
00044   fWriteToDatabase(0),
00045   fReadFromDatabase(0),
00046   fWriteOutResults(0),
00047   fWriteReportedSpills(1),
00048   fWritePredictedSpills(1),
00049   fWriteFakeSpills(0),
00050   fWriteLocalSpills(0),
00051   fSpillFile(0),
00052   fSpillTree(0)
00053 {
00054   MSG("SpillServerMon",Msg::kDebug) << " *** FillSpillServerMon::FillSpillServerMon() *** " << endl;
00055 
00056  fDetector = Detector::kUnknown;
00057 
00058 }

FillSpillServerMon::~FillSpillServerMon (  ) 

Definition at line 60 of file FillSpillServerMon.cxx.

References Msg::kDebug, and MSG.

00061 {
00062   MSG("SpillServerMon",Msg::kDebug) << " *** FillSpillServerMon::~FillSpillServerMon() *** " << endl;
00063 
00064 }


Member Function Documentation

void FillSpillServerMon::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 66 of file FillSpillServerMon.cxx.

References Msg::kInfo, and MSG.

00067 {
00068   MSG("SpillServerMon",Msg::kInfo) << " *** FillSpillServerMon::BeginJob() *** " << endl;
00069  
00070 }

void FillSpillServerMon::ClearVectors (  )  [private]

Definition at line 226 of file FillSpillServerMon.cxx.

References Msg::kDebug, MSG, vecRequestSec, vecSpillStatus, vecSpillTimeError, vecSpillTimeFDnanosec, vecSpillTimeFDsec, vecSpillTimeNDnanosec, vecSpillTimeNDsec, vecSpillType, vecTimeStamp, vecWindowClose, and vecWindowOpen.

Referenced by EndJob().

00227 {
00228   MSG("SpillServerMon",Msg::kDebug) << " *** FillSpillServerMon::ClearVectors() *** " << endl;
00229 
00230   vecTimeStamp.clear();
00231   vecSpillStatus.clear();
00232   vecSpillType.clear();
00233   vecSpillTimeNDsec.clear();
00234   vecSpillTimeNDnanosec.clear();
00235   vecSpillTimeFDsec.clear();
00236   vecSpillTimeFDnanosec.clear();
00237   vecSpillTimeError.clear();
00238   vecRequestSec.clear();
00239   vecWindowOpen.clear();
00240   vecWindowClose.clear();
00241 }

void FillSpillServerMon::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 144 of file FillSpillServerMon.cxx.

References fReadFromDatabase, fWriteFakeSpills, fWriteLocalSpills, fWriteOutResults, fWritePredictedSpills, fWriteReportedSpills, fWriteToDatabase, Registry::Get(), Msg::kDebug, and MSG.

00145 {
00146   MSG("SpillServerMon",Msg::kDebug) << " *** FillSpillServerMon::Config() *** " << endl;
00147 
00148   Int_t tmpint;
00149 
00150   if(r.Get("WriteToDatabase",tmpint)) fWriteToDatabase = tmpint;
00151   if(r.Get("ReadFromDatabase",tmpint)) fReadFromDatabase = tmpint;
00152   if(r.Get("WriteOutResults",tmpint)) fWriteOutResults = tmpint;
00153   if(r.Get("WriteReportedSpills",tmpint)) fWriteReportedSpills = tmpint;
00154   if(r.Get("WritePredictedSpills",tmpint)) fWritePredictedSpills = tmpint;
00155   if(r.Get("WriteFakeSpills",tmpint)) fWriteFakeSpills = tmpint;
00156   if(r.Get("WriteLocalSpills",tmpint)) fWriteLocalSpills = tmpint;
00157 
00158   MSG("SpillServerMon",Msg::kDebug)
00159     << "  configuration: " << endl
00160     << "     WriteToDatabase=" << fWriteToDatabase << endl
00161     << "     ReadFromDatabase=" << fReadFromDatabase << endl
00162     << "     WriteOutResults=" << fWriteOutResults << endl
00163     << "     WriteReportedSpills=" << fWriteReportedSpills << endl
00164     << "     WritePredictedSpills=" << fWritePredictedSpills << endl
00165     << "     WriteFakeSpills=" << fWriteFakeSpills << endl
00166     << "     WriteLocalSpills=" << fWriteLocalSpills << endl;
00167 
00168   return;
00169 }

const Registry & FillSpillServerMon::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 125 of file FillSpillServerMon.cxx.

References fReadFromDatabase, fWriteFakeSpills, fWriteLocalSpills, fWriteOutResults, fWritePredictedSpills, fWriteReportedSpills, fWriteToDatabase, Msg::kDebug, Registry::LockValues(), MSG, Registry::Set(), and Registry::UnLockValues().

00126 {
00127   MSG("SpillServerMon",Msg::kDebug) << " *** FillSpillServerMon::DefaultConfig() *** " << endl;
00128  
00129   static Registry r;
00130   r.SetName("SpillServerMon.config.default");
00131   r.UnLockValues();
00132   r.Set("WriteToDatabase",fWriteToDatabase);
00133   r.Set("ReadFromDatabase",fReadFromDatabase);
00134   r.Set("WriteOutResults",fWriteOutResults);
00135   r.Set("WriteReportedSpills",fWriteReportedSpills);
00136   r.Set("WritePredictedSpills",fWritePredictedSpills);
00137   r.Set("WriteFakeSpills",fWriteFakeSpills);
00138   r.Set("WriteLocalSpills",fWriteLocalSpills);
00139   r.LockValues();
00140                     
00141   return r;
00142 }

void FillSpillServerMon::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 182 of file FillSpillServerMon.cxx.

References ClearVectors(), fBegTime, fEndTime, fReadFromDatabase, fSpillFile, fSpillTree, fWriteOutResults, fWriteToDatabase, Msg::kDebug, Msg::kInfo, MSG, ReadFromDatabase(), WriteOutResults(), and WriteToDatabase().

00183 {
00184   MSG("SpillServerMon",Msg::kInfo) << " *** FillSpillServerMon::EndJob() *** " << endl;
00185 
00186   MSG("SpillServerMon",Msg::kDebug) << " BegTime=" << fBegTime << " EndTime=" << fEndTime << endl;
00187  
00188   // write results to file
00189   if(fWriteOutResults){
00190     this->WriteOutResults(0);
00191   }
00192 
00193   // write results to database
00194   if( fWriteToDatabase ){
00195     this->WriteToDatabase();
00196     if(fWriteOutResults){
00197       this->WriteOutResults(1);
00198     }
00199   }
00200 
00201   // clear vectors
00202   this->ClearVectors();
00203 
00204   // read results from database
00205   if( fReadFromDatabase ){
00206     this->ReadFromDatabase();
00207     if( fWriteOutResults ){
00208       this->WriteOutResults(2);
00209     }
00210   }
00211 
00212   // clear vectors
00213   this->ClearVectors();
00214 
00215   if(fSpillFile){
00216     MSG("SpillServerMon",Msg::kInfo) << " *** saving info to file ... " << endl;
00217     TDirectory* tmpd = gDirectory;
00218     fSpillFile->cd();
00219     fSpillTree->Write();
00220     fSpillFile->Close();
00221     gDirectory = tmpd;
00222     MSG("SpillServerMon",Msg::kInfo) << "      ... info saved to file *** " << endl;
00223   }
00224 }

JobCResult FillSpillServerMon::Get ( MomNavigator mom  )  [virtual]

Implement if your module needs to read data from some external source and fill mom

Reimplemented from JobCModule.

Definition at line 72 of file FillSpillServerMon.cxx.

References fCounter, fDetector, MomNavigator::FragmentIter(), fRecord, VldContext::GetDetector(), RecMinos::GetHeader(), RawRecord::GetRawBlockIter(), RecMinosHdr::GetVldContext(), Msg::kDebug, Msg::kInfo, JobCResult::kPassed, Detector::kUnknown, Msg::kWarning, MSG, ProcessBlock(), and JobCResult::SetFailed().

00073 {
00074   MSG("SpillServerMon",Msg::kInfo) << " *** FillSpillServerMon::Get(...) *** " << endl;
00075   
00076   JobCResult result(JobCResult::kPassed);
00077 
00078   TObject* momobject = 0;
00079   fRecord=0;
00080 
00081   // search through mon for the RawRecord
00082   TIter momitr(mom->FragmentIter());
00083   while((momobject = momitr())){
00084     if(momobject->InheritsFrom("RawRecord")){
00085       RawRecord* rawrec = dynamic_cast<RawRecord*>(momobject);
00086       fRecord=1; fCounter++;
00087       MSG("SpillServerMon",Msg::kInfo) << "  *** RAW RECORD [" << fCounter << "] ***  " << endl;
00088       
00089       // set the detector type
00090       if(fDetector==Detector::kUnknown){
00091         fDetector=rawrec->GetHeader()->GetVldContext().GetDetector();
00092         MSG("SpillServerMon",Msg::kDebug) << " Detector = " << fDetector << endl;
00093       }
00094 
00095       // process raw blocks
00096       TIter rawrecitr = rawrec->GetRawBlockIter();
00097       TObject* tob = 0;
00098       while((tob = rawrecitr())){
00099         MSG("SpillServerMon",Msg::kDebug) << " " << tob->GetName() << endl;
00100         this->ProcessBlock(tob);
00101       }
00102 
00103     }
00104   }
00105 
00106   if( !fRecord ){
00107     MSG("SpillServerMon",Msg::kWarning) << "  *** FAILED TO FIND RAW RECORD ***  " << endl;
00108     return result.SetFailed();
00109   }
00110 
00111   return result;
00112 }

void FillSpillServerMon::HandleCommand ( JobCommand command  )  [virtual]

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 171 of file FillSpillServerMon.cxx.

References JobCommand::PopCmd(), and JobCommand::PopOpt().

00172 {
00173   TString cmd = command->PopCmd();
00174   if(cmd=="Set"){
00175     TString opt = command->PopOpt();
00176 
00177   }
00178 
00179   return;
00180 }

void FillSpillServerMon::PrintResults (  )  [private]

Definition at line 243 of file FillSpillServerMon.cxx.

References Msg::kDebug, and MSG.

00244 {
00245   MSG("SpillServerMon",Msg::kDebug) << " *** FillSpillServerMon::PrintResults() *** " << endl;
00246 }

void FillSpillServerMon::ProcessBlock ( TObject *  obj  )  [private]

Definition at line 248 of file FillSpillServerMon.cxx.

References fBegTime, fEndTime, fTime, fWriteFakeSpills, fWriteLocalSpills, fWritePredictedSpills, fWriteReportedSpills, VldTimeStamp::GetSec(), RawSpillServerMonitorBlock::GetSpillData(), RawSpillServerMonitorBlock::GetTimeStamp(), mdSpillData_t::isKnown, mdSpillData_t::isSpill, Msg::kDebug, kSpillType_Fake, kSpillType_Local, kSpillType_None, kSpillType_Predicted, kSpillType_Reported, MSG, mdTimeStamp_t::nsec, mdSpillData_t::request_sec, mdTimeStamp_t::sec, mdSpillData_t::spillTimeError_nsec, mdSpillData_t::spillTimeFD, mdSpillData_t::spillTimeND, vecRequestSec, vecSpillStatus, vecSpillTimeError, vecSpillTimeFDnanosec, vecSpillTimeFDsec, vecSpillTimeNDnanosec, vecSpillTimeNDsec, vecSpillType, vecTimeStamp, vecWindowClose, vecWindowOpen, mdSpillData_t::windowClose_nsec, and mdSpillData_t::windowOpen_nsec.

Referenced by Get().

00249 {
00250 
00251   if(obj->InheritsFrom("RawSpillServerMonitorBlock")){
00252     MSG("SpillServerMon",Msg::kDebug) << " ... found RawSpillServerMonitorBlock " << endl;
00253     RawSpillServerMonitorBlock* rdb = (RawSpillServerMonitorBlock*)(obj);
00254 
00255     fTime = rdb->GetTimeStamp().GetSec();
00256     if( fBegTime<0 ) fBegTime=fTime;
00257     if( fTime>fEndTime ) fEndTime=fTime;
00258 
00259     const mdSpillData_t& spilldata = rdb->GetSpillData();
00260     Int_t timestamp = fTime;
00261     Int_t spillstatus = spilldata.isKnown;
00262     Int_t spilltype = spilldata.isSpill;
00263     Int_t spilltimeND_sec = spilldata.spillTimeND.sec;
00264     Int_t spilltimeND_nsec = spilldata.spillTimeND.nsec;
00265     Int_t spilltimeFD_sec = spilldata.spillTimeFD.sec;
00266     Int_t spilltimeFD_nsec = spilldata.spillTimeFD.nsec;
00267     Int_t request_sec = spilldata.request_sec;
00268     Int_t windowopen_nsec = spilldata.windowOpen_nsec;
00269     Int_t windowclose_nsec = spilldata.windowClose_nsec;
00270 
00271     Double_t spilltimeerror_temp = spilldata.spillTimeError_nsec;
00272     if( spilltimeerror_temp>2000000000.0 ) spilltimeerror_temp = 2000000000.0;
00273     if( spilltimeerror_temp<0 ) spilltimeerror_temp = -99999.0;
00274     Int_t spilltimeerror_nsec = (Int_t)(spilltimeerror_temp);
00275 
00276     MSG("SpillServerMon",Msg::kDebug) << " SPILL INFO: " << endl
00277       << " timestamp=" << timestamp << endl
00278       << " spillstatus=" << spillstatus << endl
00279       << " spilltype=" << spilltype << endl
00280       << " spilltimeND_sec=" << spilltimeND_sec << endl
00281       << " spilltimeND_nsec=" << spilltimeND_nsec << endl
00282       << " spilltimeFD_sec=" << spilltimeFD_sec << endl
00283       << " spilltimeFD_nsec=" << spilltimeFD_nsec << endl
00284       << " spilltimeerror_nsec=" << spilltimeerror_nsec << endl
00285       << " request_sec=" << request_sec << endl
00286       << " windowopen_nsec=" << windowopen_nsec << endl
00287       << " windowclose_nsec=" << windowclose_nsec << endl;
00288     
00289     Int_t writeme=0;
00290     if( ( spilltype == kSpillType_None && 0 ) 
00291      || ( spilltype == kSpillType_Reported && fWriteReportedSpills )
00292      || ( spilltype == kSpillType_Predicted && fWritePredictedSpills )
00293      || ( spilltype == kSpillType_Fake && fWriteFakeSpills )
00294      || ( spilltype == kSpillType_Local && fWriteLocalSpills ) ) writeme=1;
00295 
00296     if( writeme ){
00297       MSG("SpillServerMon",Msg::kDebug) << " STORING SPILL... " << endl;
00298       vecTimeStamp.push_back(timestamp);
00299       vecSpillStatus.push_back(spillstatus);
00300       vecSpillType.push_back(spilltype);
00301       vecSpillTimeNDsec.push_back(spilltimeND_sec);
00302       vecSpillTimeNDnanosec.push_back(spilltimeND_nsec);
00303       vecSpillTimeFDsec.push_back(spilltimeFD_sec);
00304       vecSpillTimeFDnanosec.push_back(spilltimeFD_nsec);
00305       vecSpillTimeError.push_back(spilltimeerror_nsec);
00306       vecRequestSec.push_back(request_sec);
00307       vecWindowOpen.push_back(windowopen_nsec);
00308       vecWindowClose.push_back(windowclose_nsec);
00309     }
00310   }
00311 
00312 }

void FillSpillServerMon::ReadFromDatabase (  )  [private]

Definition at line 365 of file FillSpillServerMon.cxx.

References fBegTime, fDetector, DbiTableProxyRegistry::GetCascader(), DbiResultPtr< T >::GetNumRows(), SpillServerMon::GetRequest_sec(), DbiResultPtr< T >::GetRow(), SpillServerMon::GetSpillStatus(), SpillServerMon::GetSpillTimeError(), SpillServerMon::GetSpillTimeFD_nsec(), SpillServerMon::GetSpillTimeFD_sec(), SpillServerMon::GetSpillTimeND_nsec(), SpillServerMon::GetSpillTimeND_sec(), SpillServerMon::GetSpillType(), SpillServerMon::GetTimeStamp(), SpillServerMon::GetWindowClose_nsec(), SpillServerMon::GetWindowOpen_nsec(), DbiTableProxyRegistry::Instance(), SimFlag::kData, Msg::kDebug, MSG, DbiCascader::TableExists(), vecRequestSec, vecSpillStatus, vecSpillTimeError, vecSpillTimeFDnanosec, vecSpillTimeFDsec, vecSpillTimeNDnanosec, vecSpillTimeNDsec, vecSpillType, vecTimeStamp, vecWindowClose, and vecWindowOpen.

Referenced by EndJob().

00366 {
00367   MSG("SpillServerMon",Msg::kDebug) << " *** FillSpillServerMon::ReadFromDatabase() *** " << endl;
00368 
00369   DbiCascader& cascader = DbiTableProxyRegistry::Instance().GetCascader();
00370 
00371   if( cascader.TableExists("SPILLSERVERMON") ){
00372     if( vecTimeStamp.size()==0 ){
00373       MSG("SpillServerMon",Msg::kDebug) << "    Reading from SPILLSERVERMON Table... " << endl;
00374 
00375       //VldTimeStamp tsStart(time-10,0);
00376       //VldTimeStamp tsEnd(time+10,0);
00377       //DbiSqlContext econtext(DbiSqlContext::kStarts,tsStart,tsEnd,Detector::kFar,SimFlag::kData);
00378       //DbiResultPtr<SpillServerMon> resptr("SPILLSERVERMON",econtext);
00379 
00380       VldTimeStamp timestamp(fBegTime,0);
00381       VldContext vldc(fDetector,SimFlag::kData,timestamp);
00382       DbiResultPtr<SpillServerMon> resptr("SPILLSERVERMON",vldc,0);
00383 
00384       MSG("SpillServerMon",Msg::kDebug) << "    Number Of Rows = " << resptr.GetNumRows() << endl;
00385 
00386       for( unsigned int i=0; i<resptr.GetNumRows();i++ ){
00387         const SpillServerMon* myspill = resptr.GetRow(i);
00388         vecTimeStamp.push_back(myspill->GetTimeStamp());
00389         vecSpillStatus.push_back(myspill->GetSpillStatus());
00390         vecSpillType.push_back(myspill->GetSpillType());
00391         vecSpillTimeNDsec.push_back(myspill->GetSpillTimeND_sec());
00392         vecSpillTimeNDnanosec.push_back(myspill->GetSpillTimeND_nsec());
00393         vecSpillTimeFDsec.push_back(myspill->GetSpillTimeFD_sec());
00394         vecSpillTimeFDnanosec.push_back(myspill->GetSpillTimeFD_nsec());
00395         vecSpillTimeError.push_back(myspill->GetSpillTimeError());
00396         vecRequestSec.push_back(myspill->GetRequest_sec());
00397         vecWindowOpen.push_back(myspill->GetWindowOpen_nsec());
00398         vecWindowClose.push_back(myspill->GetWindowClose_nsec());
00399       }
00400     }
00401   }
00402 
00403   return;
00404 }

void FillSpillServerMon::WriteOutResults ( Int_t  source  )  [private]

Definition at line 406 of file FillSpillServerMon.cxx.

References fSpillFile, fSpillTree, Msg::kVerbose, MSG, Request_sec, Source, SpillStatus, SpillTimeError, SpillTimeFD_nsec, SpillTimeFD_sec, SpillTimeND_nsec, SpillTimeND_sec, SpillType, TimeStamp, vecRequestSec, vecSpillStatus, vecSpillTimeError, vecSpillTimeFDnanosec, vecSpillTimeFDsec, vecSpillTimeNDnanosec, vecSpillTimeNDsec, vecSpillType, vecTimeStamp, vecWindowClose, vecWindowOpen, WindowClose_nsec, and WindowOpen_nsec.

Referenced by EndJob().

00407 {
00408   MSG("SpillServerMon",Msg::kVerbose) << " *** FillSpillServerMon::WriteOutResults() *** " << endl;
00409  
00410   if(!fSpillFile){
00411     TString mystring("spillservermonitor.root");
00412     TDirectory* tmpd = gDirectory;
00413     fSpillFile = new TFile(mystring.Data(),"RECREATE");
00414     fSpillTree = new TTree("SpillServerMonitor","SpillServerMonitor");
00415     fSpillTree->SetAutoSave(300);
00416     fSpillTree->Branch("Source",&Source,"Source/I");
00417     fSpillTree->Branch("TimeStamp",&TimeStamp,"TimeStamp/I");
00418     fSpillTree->Branch("SpillStatus",&SpillStatus,"SpillStatus/I");
00419     fSpillTree->Branch("SpillType",&SpillType,"SpillType/I");
00420     fSpillTree->Branch("SpillTimeND_sec",&SpillTimeND_sec,"SpillTimeND_sec/I");
00421     fSpillTree->Branch("SpillTimeND_nsec",&SpillTimeND_nsec,"SpillTimeND_nsec/I");
00422     fSpillTree->Branch("SpillTimeFD_sec",&SpillTimeFD_sec,"SpillTimeFD_sec/I");
00423     fSpillTree->Branch("SpillTimeFD_sec",&SpillTimeFD_sec,"SpillTimeFD_sec/I");
00424     fSpillTree->Branch("SpillTimeFD_nsec",&SpillTimeFD_nsec,"SpillTimeFD_nsec/I");
00425     fSpillTree->Branch("SpillTimeError",&SpillTimeError,"SpillTimeError/I");
00426     fSpillTree->Branch("Request_sec",&Request_sec,"Request_sec/I");
00427     fSpillTree->Branch("WindowOpen_nsec",&WindowOpen_nsec,"WindowOpen_nsec/I");
00428     fSpillTree->Branch("WindowClose_nsec",&WindowClose_nsec,"WindowClose_nsec/I");
00429     gDirectory = tmpd;
00430   }
00431 
00432   for( unsigned int i=0; i<vecTimeStamp.size(); i++){
00433     Source=source;
00434     TimeStamp=vecTimeStamp[i];
00435     SpillStatus=vecSpillStatus[i];
00436     SpillType=vecSpillType[i];
00437     SpillTimeND_sec=vecSpillTimeNDsec[i];
00438     SpillTimeND_nsec=vecSpillTimeNDnanosec[i];
00439     SpillTimeFD_sec=vecSpillTimeFDsec[i];
00440     SpillTimeFD_nsec=vecSpillTimeFDnanosec[i];
00441     SpillTimeError=vecSpillTimeError[i];
00442     Request_sec=vecRequestSec[i];
00443     WindowOpen_nsec=vecWindowOpen[i];
00444     WindowClose_nsec=vecWindowClose[i];
00445 
00446     if(fSpillFile){
00447       TDirectory* tmpd = gDirectory;
00448       fSpillFile->cd();
00449       fSpillTree->Fill();
00450       gDirectory = tmpd;
00451     }
00452   }
00453 
00454 }

void FillSpillServerMon::WriteToDatabase (  )  [private]

Definition at line 314 of file FillSpillServerMon.cxx.

References VldTimeStamp::AsString(), DbiCascader::CreateTemporaryTable(), fBegTime, fDetector, fEndTime, DbiTableProxyRegistry::GetCascader(), DbiTableProxyRegistry::Instance(), SimFlag::kData, Msg::kDebug, Msg::kVerbose, MSG, DbiCascader::TableExists(), vecRequestSec, vecSpillStatus, vecSpillTimeError, vecSpillTimeFDnanosec, vecSpillTimeFDsec, vecSpillTimeNDnanosec, vecSpillTimeNDsec, vecSpillType, vecTimeStamp, vecWindowClose, and vecWindowOpen.

Referenced by EndJob().

00315 {
00316   MSG("SpillServerMon",Msg::kDebug) << " *** FillSpillServerMon::WriteToDatabase() *** " << endl;
00317 
00318   DbiCascader& cascader = DbiTableProxyRegistry::Instance().GetCascader();
00319 
00320   if( !cascader.TableExists("SPILLSERVERMON") ){
00321     MSG("SpillServerMon",Msg::kDebug) << "    Creating temporary SPILLSERVERMON table " << endl;
00322 
00323     string tableDescr = "(SEQNO int, TIMESTAMP int, SPILLSTATUS int, SPILLTYPE int, SPILLTIMEND_SEC int, SPILLTIMEND_NANOSEC int, SPILLTIMEFD_SEC int, SPILLTIMEFD_NANOSEC int, SPILLTIMEERROR int, REQUEST_SEC int, WINDOWOPEN_NANOSEC int, WINDOWCLOSE_NANOSEC int)";
00324 
00325     Int_t dbNoTempSpillServerMon = cascader.CreateTemporaryTable("SPILLSERVERMON",tableDescr);
00326 
00327     MSG("SpillServerMon",Msg::kDebug) << "    DbNoTempSpillServerMon=" << dbNoTempSpillServerMon << endl;
00328   }  
00329 
00330   if( cascader.TableExists("SPILLSERVERMON") ){
00331     if( vecTimeStamp.size()>0 ){
00332       MSG("SpillServerMon",Msg::kDebug) << "    Writing to SPILLSERVERMON Table... " << endl;
00333 
00334       VldTimeStamp start(fBegTime,0);
00335       VldTimeStamp finish(fEndTime+1,0);
00336       TString logentry("spillserver monitoring (");
00337       logentry.Append(start.AsString("s"));
00338       logentry.Append(" to ");
00339       logentry.Append(finish.AsString("s"));
00340       logentry.Append(")");
00341 
00342       VldRange range(fDetector,SimFlag::kData,start,finish,logentry.Data());
00343       
00344       Int_t aggNo = -1;
00345       Dbi::Task task = 0;
00346       VldTimeStamp creationDate;
00347 
00348       DbiWriter<SpillServerMon> writer(range,aggNo,task,creationDate,0,logentry.Data());
00349 
00350       for( unsigned int i=0; i<vecTimeStamp.size(); i++){
00351         SpillServerMon row(vecTimeStamp[i],vecSpillStatus[i],vecSpillType[i],vecSpillTimeNDsec[i],vecSpillTimeNDnanosec[i],vecSpillTimeFDsec[i],vecSpillTimeFDnanosec[i],vecSpillTimeError[i],vecRequestSec[i],vecWindowOpen[i],vecWindowClose[i]);
00352         writer << row;
00353       }
00354 
00355       writer.Close();
00356 
00357       MSG("SpillServerMon",Msg::kVerbose) << "     " << logentry.Data() << endl;
00358       MSG("SpillServerMon",Msg::kVerbose) << "     " << "Number Of Rows = " << vecTimeStamp.size() << endl;
00359     }
00360   }
00361 
00362   return;
00363 }


Member Data Documentation

Definition at line 36 of file FillSpillServerMon.h.

Referenced by EndJob(), ProcessBlock(), ReadFromDatabase(), and WriteToDatabase().

Definition at line 34 of file FillSpillServerMon.h.

Referenced by Get().

Definition at line 75 of file FillSpillServerMon.h.

Referenced by Get(), ReadFromDatabase(), and WriteToDatabase().

Definition at line 37 of file FillSpillServerMon.h.

Referenced by EndJob(), ProcessBlock(), and WriteToDatabase().

Definition at line 40 of file FillSpillServerMon.h.

Referenced by Config(), DefaultConfig(), and EndJob().

Int_t FillSpillServerMon::fRecord [private]

Definition at line 33 of file FillSpillServerMon.h.

Referenced by Get().

Definition at line 48 of file FillSpillServerMon.h.

Referenced by EndJob(), and WriteOutResults().

Definition at line 49 of file FillSpillServerMon.h.

Referenced by EndJob(), and WriteOutResults().

Int_t FillSpillServerMon::fTime [private]

Definition at line 35 of file FillSpillServerMon.h.

Referenced by ProcessBlock().

Definition at line 45 of file FillSpillServerMon.h.

Referenced by Config(), DefaultConfig(), and ProcessBlock().

Definition at line 46 of file FillSpillServerMon.h.

Referenced by Config(), DefaultConfig(), and ProcessBlock().

Definition at line 41 of file FillSpillServerMon.h.

Referenced by Config(), DefaultConfig(), and EndJob().

Definition at line 44 of file FillSpillServerMon.h.

Referenced by Config(), DefaultConfig(), and ProcessBlock().

Definition at line 43 of file FillSpillServerMon.h.

Referenced by Config(), DefaultConfig(), and ProcessBlock().

Definition at line 39 of file FillSpillServerMon.h.

Referenced by Config(), DefaultConfig(), and EndJob().

Definition at line 60 of file FillSpillServerMon.h.

Referenced by WriteOutResults().

Int_t FillSpillServerMon::Source [private]

Definition at line 51 of file FillSpillServerMon.h.

Referenced by WriteOutResults().

Definition at line 53 of file FillSpillServerMon.h.

Referenced by WriteOutResults().

Definition at line 59 of file FillSpillServerMon.h.

Referenced by WriteOutResults().

Definition at line 58 of file FillSpillServerMon.h.

Referenced by WriteOutResults().

Definition at line 57 of file FillSpillServerMon.h.

Referenced by WriteOutResults().

Definition at line 56 of file FillSpillServerMon.h.

Referenced by WriteOutResults().

Definition at line 55 of file FillSpillServerMon.h.

Referenced by WriteOutResults().

Definition at line 54 of file FillSpillServerMon.h.

Referenced by WriteOutResults().

Definition at line 52 of file FillSpillServerMon.h.

Referenced by WriteOutResults().

vector<int> FillSpillServerMon::vecRequestSec [private]
vector<int> FillSpillServerMon::vecSpillStatus [private]
vector<int> FillSpillServerMon::vecSpillType [private]
vector<int> FillSpillServerMon::vecTimeStamp [private]
vector<int> FillSpillServerMon::vecWindowClose [private]
vector<int> FillSpillServerMon::vecWindowOpen [private]

Definition at line 62 of file FillSpillServerMon.h.

Referenced by WriteOutResults().

Definition at line 61 of file FillSpillServerMon.h.

Referenced by WriteOutResults().


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1