#ifndef TCDFORACLE_HH #define TCDFORACLE_HH #include "TObjString.h" #include "TObjArray.h" #include "TSQLResult.h" #include "TSQLRow.h" #include "OracleRow.h" #include "OracleServer.h" class TStnTriggerTable; class TStnTrigger; class TStnRunSummary; class TCdf2RunSections; class TCdf2Files; class TCdf2Filesets; class TSetRunMaps; class TCalibRunLists; class TOffscl; class TStnBeamPos; class TStnBeamPosBlock ; class TCdfOracle: public TObject { //----------------------------------------------------------------------------- // data members //----------------------------------------------------------------------------- protected: TOracleServer* fDb; TString fDbName; TString fDbFullName; Int_t fVerbose; Int_t fLevel; TString fQueryString; Int_t fForceDisconnect; //----------------------------------------------------------------------------- // functions //----------------------------------------------------------------------------- public: TCdfOracle(const char* name = "cdfrep01"); ~TCdfOracle(); //----------------------------------------------------------------------------- // accessors //----------------------------------------------------------------------------- Int_t Verbose () { return fVerbose; } Int_t Level () { return fLevel; } Int_t ForceDisconnect() { return fForceDisconnect; } //----------------------------------------------------------------------------- // modifiers //----------------------------------------------------------------------------- void SetVerbose (Int_t Verbose ) { fVerbose = Verbose; } void SetForceDisconnect(Int_t Flag ) { fForceDisconnect = Flag; } void SetQueryString (const char* Data) { fQueryString = Data; } // generic functionality void Connect (); void Disconnect (); void ListTables (const char* list); void DescribeTable (const char* table); void Query (const char* Query); void Query (const char* Query, TSQLResult*& res, Int_t Debug = 0); void ParseDatasetName(const char* Dataset, char* DsName, char* Book); void PrintResult (TSQLResult* Result); char* Strip (char* Text, const char* TrailingChars = " "); //----------------------------------------------------------------------------- // specialized queries returning TSQLResult's //----------------------------------------------------------------------------- Int_t QueryBeamConditions(TSQLResult*& Result, int RunMin = -1, int RunMax = 10000000); void QueryListOfRuns(const char* Date1, const char* Date2, Int_t GoodRunsOnly, TSQLResult*& Result); void QueryListOfRuns(Int_t Run1, Int_t Run2, Int_t GoodRunsOnly, TSQLResult*& Result); Int_t QueryListOfRunSections(Int_t RMin, Int_t RMax, TSQLResult*& Result); Int_t QueryListOfSetRunMaps (Int_t Jobset, TSQLResult*& Result); void QueryTapeContents (const char* TapeName, TSQLResult*& Result, const char* Dataset="\%"); Int_t QueryTriggerConditions(Int_t Bit, Int_t Level, TSQLResult*& Result, int RunMin = -1, int RunMax = 10000000); // need Bit because of the Level3 Int_t QueryTrigger (const char* Name, Int_t Level, int RunNumber, TSQLResult*& Result, Int_t& Bit); Int_t QueryTriggerTable (int RunNumber, TSQLResult*& Result); void QueryUsedSets (const char* ProcessName, const char* Passname, TSQLResult*& Result, int RMin = -1, int RMax = 100000000, int All = 0); // 1: include retired used sets void QueryCalibTable (Int_t RunNumber , const char* Table , const char* ProcessName, const char* PassName , TSQLResult*& Result ); void QueryCslSummary (int RunNumber, TSQLResult*& Result); void QueryRunSummary (int RunNumber, TSQLResult*& Result); void QueryDatasets (int RunNumber, TSQLResult*& Result); void QueryListOfFiles (const char* Dataset, const char* Fileset, TSQLResult*& Result); void QueryListOfFiles (const char* Book, const char* Dataset, const char* Fileset, TSQLResult*& Result); void QueryListOfFiles (const char* Dataset, int Run1, // run >= Run1 int Run2, // run <= Run2 TSQLResult*& Result); void QueryFilesets (const char* Dataset, TSQLResult*& Result); void QueryL123 (int RunNumber, TSQLResult*& Result); void QueryListOfOpenSessions(TSQLResult*& Result); void QueryTriggerPaths (int RunNumber, TSQLResult*& Result); void QueryTriggers (int RunNumber, TSQLResult*& Result); void QueryTriggerBits (int RunNumber, TSQLResult*& Result); void QueryTriggerTableName (int RunNumber, TSQLResult*& Result); //----------------------------------------------------------------------------- // accessors returning numbers/objects as opposite to queries //----------------------------------------------------------------------------- Int_t GetCalibRunLists(Int_t Cid , TCalibRunLists* CalibRunLists); Int_t GetCid (const char* Table, Int_t Jobset); Int_t GetBeamConditions(TObjArray*& List, int RMin = -1, int RMax = 100000000); Int_t GetBeamPosition (Int_t Cid, const char* CotSvx, TStnBeamPos* BeamPos); Int_t GetBeamPositions (Int_t Cid, const char* CotSvx, int iRun, TStnBeamPosBlock* b); Int_t GetFile (const char* Filename, const char* Book, TCdf2Files* File); Int_t GetFile (const char* Dataset, int Run, int Event, TCdf2Files* File); Int_t GetFile (const char* Book, const char* Dataset, int Run, int Event, TCdf2Files* File); Int_t GetFileset (const char* Book, const char* FilesetName, TCdf2Filesets* Fileset); Int_t GetListOfFiles (TObjArray* List, const char* Dataset, Int_t Run1, Int_t Run2); Int_t GetListOfFiles (TObjArray* List, const char* Dataset, const char* Fileset); Int_t GetListOfFiles (TObjArray* List, const char* Book, const char* Dataset, const char* Fileset); // all runs Int_t GetListOfRuns (TObjArray* List, Int_t Run1, Int_t Run2); Int_t GetListOfRuns (TObjArray* List, const char* Date1, const char* Date2); // good runs only Int_t GetListOfGoodRuns(TObjArray* List, Int_t Run1, Int_t Run2); Int_t GetListOfGoodRuns(TObjArray* List, const char* Date1, const char* Date2); void GetMyronMode (int RunNumber); Int_t GetOffscl (Int_t RunNumber, const char* ProcessName, const char* PassName, const char* Component, TOffscl* Offscl); Int_t GetOnlineLuminosity(Int_t RunNumber, Float_t& LumiTev, Float_t& LumiLive); Int_t GetRunSection (Int_t RunNumber, Int_t EventNumber, TCdf2RunSections* RunSection); Int_t GetRunSummary (Int_t RunNumber, TStnRunSummary* Rs); Int_t GetTriggerTable (Int_t RunNumber, TStnTriggerTable* Table); Int_t GetTriggerTableName(Int_t RunNumber, TString& Name); Int_t GetTrigger (const char* Name, Int_t Level, int RunNumber, TStnTrigger* Trigger); Int_t GetListOfOpenSessions(TObjArray* List); Int_t GetListOfFilesets (const char* Dataset, Int_t Run1, Int_t Run2, TObjArray* List); void GetListOfRunSections (Int_t RMin, Int_t RMax, TObjArray* List); Int_t GetListOfSetRunMaps (Int_t Jobset, TObjArray* List); Int_t GetFileLuminosity(const char* Filename, Float_t& LumAverageOnline , Float_t& LumIntegralOnline , Float_t& LumAverageOffline , Float_t& LumIntegralOffline); void GetListOfUsedSets(const char* ProcessName, const char* PassName, TObjArray* List, int RMin = -1, int RMax = 100000000, int All = 0); void GetTriggerConditions (const char* TriggerName, Int_t Level, TObjArray*& List, int RMin = -1, int RMax = 100000000); void PrintUsedSets (const char* ProcessName, const char* PassName, int RMin = -1, int RMax = 100000000, int All = 0); //----------------------------------------------------------------------------- // print methods //----------------------------------------------------------------------------- void PrintBeamConditions(Int_t Run1, Int_t Run2 = -1); void PrintCalibRuns (const char* Table, const char* Status="COMPLETE"); void PrintCalibTable (Int_t RunNumber, const char* Table, const char* ProcessName="PROD_PHYSICS_CDF", const char* PassName="17"); void PrintCslSummary (int RunNumber); void PrintDatasets (int RunNumber); void FindFile (const char* Book , const char* Dataset , int Run , int Event , TCdf2Files* File = 0); void PrintFiles (const char* Dataset = "\%" , int Run1 = 168899, int Run2 = -1 ); void PrintCatalog (const char* Book, const char* Dataset, int Run1=1, int Run2=999999); void PrintFileset (const char* Book, const char* Fileset); void PrintFilesets (const char* Dataset, Int_t Run1, Int_t Run2); void PrintL123 (int RunNumber); void PrintListOfRuns (const char* Date1, const char* Date2="2100.01.01"); void PrintListOfRuns (Int_t Run1, Int_t Run2=-1); void PrintListOfGoodRuns(const char* Date1, const char* Date2="2100.01.01"); void PrintListOfGoodRuns (Int_t Run1, Int_t Run2=-1); void PrintListOfRunSections(Int_t RunNumber); void PrintListOfSetRunMaps (Int_t Jobset); void PrintOpenSessions (); void PrintOnlineLuminosity(Int_t RunMin, Int_t RunMax = -1); void PrintRunSection (Int_t RunNumber, Int_t EventNumber); void PrintTapeContents (const char* TapeName, const char* Dataset="\%"); void PrintTriggerPaths (int RunNumber); void PrintTrigger (const char* Name, Int_t Level, int RunNumber); void PrintTriggers (int RunNumber); void PrintTriggerBits (int RunNumber); void PrintTriggerTable (int RunNumber); // TriggerName includes trigger level void PrintTriggerConditions(const char* TriggerName, Int_t Level, Int_t Run1, Int_t Run2 = -1); //----------------------------------------------------------------------------- // plot methods //----------------------------------------------------------------------------- void PlotTriggerRate(const char* TriggerName, Int_t Level, Int_t Run1, Int_t Run2 = -1, Int_t Mode = 1); //----------------------------------------------------------------------------- // other methods //----------------------------------------------------------------------------- void CalculateOfflineLuminosity(Int_t Run1, Int_t Run2, Float_t MinLum); ClassDef(TCdfOracle,0) }; #endif