JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwParityDB.h
Go to the documentation of this file.
1/*!
2 * \file QwDatabase.h
3 * \brief A class for handling connections to the Qweak database.
4 *
5 * \author Damon Spayde
6 * \date 2010-01-07
7 */
8
9#pragma once
10
11#ifdef __USE_DATABASE__
12
13// System headers
14#include <map>
15#include <vector>
16#include <string>
17#include <typeinfo>
18
19// ROOT headers
20#include "TString.h"
21
22// Qweak headers
23#include "QwTypes.h"
24#include "QwLog.h"
25#include "QwColor.h"
26#include "QwOptions.h"
27#include "QwDatabase.h"
29#include "QwDBInterface.h"
30
31// Forward declarations
32class QwEventBuffer;
33
34/**
35 * \class QwDatabase
36 * \ingroup QwAnalysis
37 * \brief A database interface class
38 *
39 * This class provides the connection to the Qweak database to other objects
40 * in the Qweak analyzer. A static global object gQwDatabase is used to
41 * provide these services.
42 *
43 */
44
45/**
46 * \class QwParityDB
47 * \ingroup QwAnalysis_BL
48 * \brief Database interface specialized for parity analysis metadata
49 *
50 * Extends QwDatabase to provide convenience getters for detector IDs,
51 * run/runlet/analysis identifiers, and to populate parameter files
52 * for the parity analyzer subsystems.
53 */
54class QwParityDB: public QwDatabase {
55 public:
56
57 QwParityDB(); //!< Simple constructor
58 QwParityDB(QwOptions &options); //!< Constructor with QwOptions object
59
60 virtual ~QwParityDB(); //!< Destructor
61
62 void SetupOneRun(QwEventBuffer& qwevt); //<! Initialize run ID, runlet ID, and analysis ID using data from CODA event buffer
63 void FillParameterFiles(QwSubsystemArrayParity& subsys);
64
65 UInt_t GetMonitorID(const string& name, Bool_t zero_id_is_error=kTRUE); //<! Get monitor_id for beam monitor name
66 UInt_t GetMainDetectorID(const string& name, Bool_t zero_id_is_error=kTRUE); //<! Get main_detector_id for main detector name
67 UInt_t GetLumiDetectorID(const string& name, Bool_t zero_id_is_error=kTRUE); //<! Get lumi_detector_id for lumi detector name
68 const string GetMeasurementID(const Int_t index);
69 UInt_t GetSlowControlDetectorID(const string& name); //<! Get slow_controls_data_id for epics name
70 UInt_t GetErrorCodeID(const string& name); //<! Get error_code_id for error code name
71
72 UInt_t GetRunNumber() {return fRunNumber;} //<! Run number getter
73 UInt_t GetSegmentNumber() {return fSegmentNumber;} //<! CODA File segment number getter
74 UInt_t GetRunID() {return fRunID;} //<! Run ID getter
75 UInt_t GetRunletID() {return fRunletID;} //<! Runlet ID getter
76 UInt_t GetAnalysisID() {return fAnalysisID;}; //<! Get analysis ID
77
78
79 UInt_t GetRunID(QwEventBuffer& qwevt); //<! Get run ID using data from CODA event buffer
80 UInt_t GetRunletID(QwEventBuffer& qwevt); //<! Get runlet ID using data from CODA event buffer
81 UInt_t GetAnalysisID(QwEventBuffer& qwevt); //<! Get analysis ID using data from CODA event buffer
82 Bool_t SetRunNumber(const UInt_t runnum); //<! Run number setter
83 Bool_t SetSegmentNumber(const UInt_t segment); //<! CODA file segment number setter
84 static void DefineAdditionalOptions(QwOptions& options); //!< Defines QwParityDB-specific class options for QwOptions
85 void ProcessAdditionalOptions(QwOptions &options); //!< Processes the options contained in the QwOptions object.
86
87 private:
88
89 UInt_t SetRunID(QwEventBuffer& qwevt); //<! Set fRunID using data from CODA event buffer
90 UInt_t SetRunletID(QwEventBuffer& qwevt); //<! Set fRunletID using data from CODA event buffer
91 UInt_t SetAnalysisID(QwEventBuffer& qwevt); //<! Set fAnalysisID using data from CODA event buffer
92 void StoreMonitorIDs(); //<! Retrieve monitor IDs from database and populate fMonitorIDs
93 void StoreMainDetectorIDs(); //<! Retrieve main detector IDs from database and populate fMainDetectorIDs
94 void StoreLumiDetectorIDs(); //<! Retrieve LUMI monitor IDs from database and populate fLumiDetectorIDs
95 void StoreMeasurementIDs();
96 void StoreSlowControlDetectorIDs(); //<! Retrieve slow controls data IDs from database and populate fSlow_Controls_DataIDs
97 void StoreErrorCodeIDs(); //<! Retrieve error code IDs from database and populate fErrorCodeIDs
98
99 UInt_t fRunNumber; //!< Run number of current run
100 Int_t fSegmentNumber; //!< CODA file segment number of current run
101 UInt_t fRunID; //!< run_id of current run
102 UInt_t fRunletID; //!< runlet_id of current run
103 UInt_t fAnalysisID; //!< analysis_id of current analysis pass
104 bool fDisableAnalysisCheck; //!< Flag to disable pre-existing analysis_id check
105
106 static std::map<string, unsigned int> fMonitorIDs; //!< Associative array of beam monitor IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously.
107 static std::map<string, unsigned int> fMainDetectorIDs; //!< Associative array of main detector IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously.
108 static std::map<string, unsigned int> fLumiDetectorIDs; //!< Associative array of LUMI detector IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously.
109 static std::map<string, unsigned int> fSlowControlDetectorIDs; //!< Associative array of slow controls data IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously.
110 static std::map<string, unsigned char> fErrorCodeIDs; //!< Associative array of error code IDs. This declaration will be a problem if QwDatabase is used to connect to two databases simultaneously.
111 static std::vector<string> fMeasurementIDs;
112
113 friend class StoreMonitorID;
114 friend class StoreMainDetectorID;
115 friend class StoreLumiDetectorID;
116 friend class StoreMeasurementID;
117 friend class StoreSlowControlDetectorID;
118 friend class StoreErrorCodeID;
119};
120
121#endif // #ifdef __USE_DATABASE__
ANSI color codes and color management for terminal output.
A class for handling connections to the Qweak database.
An options class which parses command line, config file and environment.
A logfile class, based on an identical class in the Hermes analyzer.
Basic data types and constants used throughout the Qweak analysis framework.
Database interface for QwIntegrationPMT and subsystems.
Subsystem array container for parity analysis with asymmetry calculations.
A database interface class.
Definition QwDatabase.h:121
Event buffer management for reading and processing CODA data.