Hall-D Software  alpha
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DEventSourceEventStore.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // File: DEventSourceEventStore.h
4 // Creator: sdobbs
5 //
6 
7 #ifndef _DEventSourceEventStore_
8 #define _DEventSourceEventStore_
9 
10 #include <JANA/jerror.h>
11 #include <JANA/JEventSource.h>
12 #include <JANA/JEvent.h>
13 
14 #include <vector>
15 #include <string>
16 #include <map>
17 #include <utility>
18 
19 #include "DESDBProvider.h"
20 #include "DESDBProviderMySQL.h"
21 
22 using namespace jana;
23 using namespace std;
24 
25 
26 class DEventSourceEventStore : public JEventSource {
27  public:
28  DEventSourceEventStore(const char* source_name);
29  virtual ~DEventSourceEventStore();
30  const char* className(void){return "DEventSourceEventStore";}
31 
32  jerror_t GetEvent(JEvent &event);
33  void FreeEvent(JEvent &event);
34  jerror_t GetObjects(JEvent &event, JFactory_base *factory);
35 
36 
37  protected:
38  // reporting functions
39  void PrintGrades();
40  void PrintRunPeriods();
41  void PrintSkims(string timestamp, string grade);
42  //void PrintActualDate();
43 
44  // utility functions
45  jerror_t MoveToNextEvent();
46  jerror_t OpenNextFile();
47 
48 
49  private:
50 
51  JEventSource *event_source; // the source we are actually reading from
52  string esdb_connection; // connection string for database
53  DESDBProvider *esdb; // the database connection
55 
56  // We tag which skims JEvents belong to using JEvent::SetStatusBit()
57  // We can get away with this now, since no one else is using fields above 16 yet
58  // Probably the scheme needs to change or we need our own fields
59  int BASE_SKIM_INDEX; // the first status bit that we use for EventStore
60  int MAX_SKIM_INDEX; // we can store 64 bits in the JEvent, so 64 - MAX_SKIM_INDEX
61 
63  vector<string> skim_list;
64 
65  string timestamp;
66  string grade;
67  int min_run, max_run;
70 
71  map< string, pair<int,int> > run_period_map;
72 
73  // file information - deprecated
74  vector<string> data_files; // store list of file names
75  vector<string>::iterator current_file_itr;
76 
77  // store list of runs - EventStore information is keyed off runs
78  vector<int> run_numbers;
79  vector<int>::iterator current_run_itr;
80 
81 };
82 
83 
84 #endif // _DEventSourceEventStore_
85 
map< string, pair< int, int > > run_period_map
vector< string >::iterator current_file_itr
const char * className(void)
vector< int >::iterator current_run_itr