Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:39

0001 ///////////////////////////////////////////////////////////////
0002 //
0003 // SpinDBOutput class
0004 // Author      : D. Loomis, D. Neff (from Y. Fukao PHENIX class)
0005 // Description : Utility to read data from spin database
0006 // Created     : 2024-05-12
0007 //
0008 //
0009 ///////////////////////////////////////////////////////////////
0010 
0011 #ifndef USPIN_SPINDBOUTPUT_H
0012 #define USPIN_SPINDBOUTPUT_H
0013 
0014 #include "SpinDBContent.h"
0015 
0016 #include <map>
0017 #include <string>
0018 #include <vector>
0019 
0020 #define QA_ERROR_VALUE -999
0021 
0022 namespace odbc
0023 {
0024   class Connection;
0025   class Statement;
0026   class ResultSet;
0027 };  // namespace odbc
0028 
0029 class SpinDBOutput
0030 {
0031  public:
0032   SpinDBOutput() { Initialize(); }
0033   SpinDBOutput(const char *user)
0034   {
0035     Initialize();
0036     SetUserName(user);
0037   }
0038   virtual ~SpinDBOutput() = default;
0039   void Initialize();
0040   void SetUserName(const char *user)
0041   {
0042     user_name = user;
0043     return;
0044   }
0045   void SetDBName(const char *dbname);
0046   void SetTableName(const char *tname);
0047   int PrintDBColumn();
0048   int PrintDBRawContent(int runnum);
0049   int PrintDBRawContent(int runnum, int qa_level);
0050   int CheckRunRow(int runnum);
0051   int CheckRunRow(int runnum, int qa_level);
0052   int CheckRunRowStore(int runnum);
0053   int StoreDBContent(int run1, int run2);
0054   int StoreDBContent(int run1, int run2, int qa_level);
0055   void ClearDBContent();
0056   int GetDBContent(SpinDBContent &spin_cont, int runnum);
0057   int GetDBContent(SpinDBContent &spin_cont, int runnum, int qa_level);
0058   int GetDBContentStore(SpinDBContent &spin_cont, int runnum);
0059   int GetDefaultQA(int runnum);
0060   void Verbosity(int verbose = 0){verbosity=verbose;}
0061 
0062  private:
0063   static const int ERROR_VALUE;
0064 
0065   int verbosity = 0;
0066 
0067   std::string db_name;
0068   std::string user_name;
0069   std::string table_name;
0070 
0071   SpinDBContent spin_cont_store1;
0072   std::map<int, SpinDBContent> spin_cont_store;
0073 
0074   odbc::Connection *ConnectDB(void);
0075   int GetDBContent(SpinDBContent &spin_cont, odbc::ResultSet *rs);
0076   int GetArray(odbc::ResultSet *rs, const char *name, std::vector<std::string> &value);
0077   int GetArray(odbc::ResultSet *rs, const char *name, float *value, int nvalue);
0078   int GetArray(odbc::ResultSet *rs, const char *name, unsigned int *value, int nvalue);
0079   int GetArray(odbc::ResultSet *rs, const char *name, int *value, int nvalue);
0080   int GetArray(odbc::ResultSet *rs, const char *name, long long *value, int nvalue);
0081 
0082   
0083 };
0084 
0085 #endif /* USPIN_SPINDBOUTPUT_H */