|
//____________________________________________________________________ // // // // $Id: BrRunInfoManager.cxx,v 1.3 2002/03/21 23:42:15 cholm Exp $ // $Author: cholm $ // $Date: 2002/03/21 23:42:15 $ // $Copyright: 2000 BRAHMS Collaboration <brahmlib@rhic.bnl.gov> #include "BrRunInfoManager.h" #ifndef WIN32 #include <iostream> #include <iomanip> #else #include <iostream.h> #include <iomanip.h> #endif //____________________________________________________________________ ClassImp(BrRunInfoManager); //____________________________________________________________________ BrRunInfoManager* BrRunInfoManager::fgInstance = 0; //____________________________________________________ BrRunInfoManager* BrRunInfoManager::Instance(){ if( fgInstance == 0) fgInstance = new BrRunInfoManager; return fgInstance; } //____________________________________________________________________ BrRunInfoManager::BrRunInfoManager() { fSize = 10; fNumberOfRuns = 0; fRunNumbers = new Int_t[fSize]; fCurrent = -1; fDebugLevel = 0; } //____________________________________________________________________ void BrRunInfoManager::Init() { // Initialise the manager fStatus = kInit; fCurrentRun.Init(); if (DebugLevel() > 2) { cout << "Requsted runs: " << flush; for (Int_t i = 0; i < fNumberOfRuns; i++) cout << setw(4) << fRunNumbers[i] << " " << flush; cout << endl; } } //____________________________________________________________________ BrRunInfoManager::~BrRunInfoManager() { if (fRunNumbers) delete [] fRunNumbers; } //____________________________________________________________________ BrRunInfo* BrRunInfoManager::Register(Int_t runNo) { if (kInit) { Warning("Register", "must be sent before Init"); return &fCurrentRun; } if (fNumberOfRuns > fSize - 1) { fSize = Int_t(1.5 * fSize); Int_t* tmp = new Int_t[fSize]; for (Int_t i = 0; i < fNumberOfRuns; i++) tmp[i] = fRunNumbers[i]; delete [] fRunNumbers; fRunNumbers = tmp; } fRunNumbers[fNumberOfRuns++] = runNo; return &fCurrentRun; } //____________________________________________________________________ void BrRunInfoManager::Update(Int_t runNo) { fCurrentRun.Update(runNo); } //____________________________________________________________________ void BrRunInfoManager::Update() { if (++fCurrent >= fNumberOfRuns) return; if (DebugLevel() > 3) cout << "Trying to update information for # " << fCurrent << " run " << fRunNumbers[fCurrent] << endl; fCurrentRun.Update(fRunNumbers[fCurrent]); } // // $Log: BrRunInfoManager.cxx,v $ // Revision 1.3 2002/03/21 23:42:15 cholm // Added code in Update, so that as soon as the connection to the // DB server isn't needed anymore from this Update step, we // disconnect our clients. This is done, so we may keep as many free // slots on the server as possible. MySQL, in it's current setup has a // limit of 1000 simultaneous connections, and so disconnecting from the // server may allow more jobs to run. This `Disconnect ASAP' policy is // conditional on the preprocessor flag BRAT_USE_DISCONNECT, defined in // `db/abc/BrDb.h'. // // Revision 1.2 2001/08/10 13:48:56 ouerdane // Added 2 methods in BrRunInfoManager: // Int_t* GetRunNumbers -> returns the array of registered runs // Int_t GetNumberOfRuns -> returns the number of runs registered // // Added a check in BrDbUpdateModule::Event: // if the user has not registered initially the run number // returned by the event header, then the job will abort. // It forces the user to know exactly which runs he wants // to analyze at registration time (brRunInfoManager::Register(runNo)) // // Removed in the same class a reference to BrMainModule in Begin since // BrDbUpdateModule might be used in another context (if possible). // // Revision 1.1.1.1 2001/06/21 14:55:18 hagel // Initial revision of brat2 // // Revision 1.5 2001/02/06 15:37:01 cholm // Bug fix to Update(void) method // // Revision 1.4 2001/01/29 20:02:36 cholm // Corrected a few bugs // // Revision 1.3 2001/01/20 19:12:06 videbaek // Added Instance stuff // // Revision 1.2 2001/01/19 19:10:40 cholm // Small bug correction in Update() // // Revision 1.1 2001/01/19 18:40:54 cholm // Added the classes BrRunInfo and BrRunInfoManager for user space application // access to the run database. They are not fully tested yet. I'll do that, // modify as need and then write to brahms-dev-l explaing what I did and usage. // // |
||||||
This page automatically generated by script docBrat by Christian Holm |
Copyright ; 2002 BRAHMS Collaboration
<brahmlib@rcf.rhic.bnl.gov>
|