AbsCache.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \brief Look up absolute attenuation constants
3 /// \author Christopher Backhouse - bckhouse@caltech.edu
4 ////////////////////////////////////////////////////////////////////////
5 #ifndef CALIB_ABSCACHE_H
6 #define CALIB_ABSCACHE_H
7 
8 #include "NovaDAQConventions/DAQConventions.h"
9 
10 #include <map>
11 #include <string>
12 
13 namespace calib
14 {
15  /// \brief Look up absolute attenuation constants
16  class AbsCache
17  {
18  public:
19  AbsCache();
20  virtual ~AbsCache();
21 
23  int diblock,
24  bool isData);
25 
26  void SetCSVSource(const std::string& src){fCSVSource = src;}
27 
28  void UseCSVsFromUPS(bool use = true){fUseCSVsFromUPS = use;}
29 
30  void SetTag(const std::string& tag){fTag = tag;}
31 
32  void SetGainSetting(int g) {fGainSetting = g;}
33  int GainSetting() {return fGainSetting;}
34 
35  void Reinit()
36  {
37  fRecordsData.clear();
38  fInitializedData = false;
39  fRecordsMC.clear();
40  fInitializedMC = false;
41  }
42 
43  void SetUseEpochs(bool b) { fUseEpochs = b; }
44 
45  bool UseEpochs() {return fUseEpochs;}
46 
47  void SetEpoch(const std::string& epoch) {fEpoch = epoch;}
49 
50  std::string Epoch() {return fEpoch;}
52 
53  void GetEpochFromDB(int idet, bool isData);
54 
55  void ReadEpochsFromCSV(bool readEpochs=true) {fReadEpochsFromCSV=readEpochs;}
56 
57  void SetRun(int run) { fRun = run; }
58  int Run() { return fRun; }
59 
60  protected:
61  struct Record
62  {
63  Record() : meu(0), meuErr(0), meuGeV(0) {}
64  // The values from the DB
65  double meu, meuErr, meuGeV;
66  };
67 
68  void LoadFromVldDatabase(novadaq::cnv::DetId det, bool isData);
69 
70  bool fUseEpochs;
71  int fRun;
78 
79  bool fReadEpochsFromCSV; //Needs to have fRun set
80 
81 
82  /// Whether we have (attempted to) read from db or csv yet
85 
86  std::map<int, Record> fRecordsData; ///< Map is from diblock number
87  std::map<int, Record> fRecordsMC; ///< Map is from diblock number
88  };
89 
90 } // end namespace calib
91 
92 #endif
93 ////////////////////////////////////////////////////////////////////////
void GetEpochFromDB(int idet, bool isData)
Definition: AbsCache.cxx:155
void SetGainSetting(int g)
Definition: AbsCache.h:32
diblock
print "ROW IS " print row
Definition: geo2elec.py:31
void SetUseEpochs(bool b)
Definition: AbsCache.h:43
std::string EpochTag()
Definition: AbsCache.h:51
void SetCSVSource(const std::string &src)
Definition: AbsCache.h:26
void SetEpoch(const std::string &epoch)
Definition: AbsCache.h:47
void UseCSVsFromUPS(bool use=true)
Definition: AbsCache.h:28
bool fReadEpochsFromCSV
Definition: AbsCache.h:79
void LoadFromVldDatabase(novadaq::cnv::DetId det, bool isData)
Definition: AbsCache.cxx:49
int GainSetting()
Definition: AbsCache.h:33
std::string Epoch()
Definition: AbsCache.h:50
void SetEpochTag(const std::string &tag)
Definition: AbsCache.h:48
void SetRun(int run)
Definition: AbsCache.h:57
CDPStorage service.
std::string fCSVSource
Definition: AbsCache.h:72
bool fUseEpochs
Definition: AbsCache.h:70
void SetTag(const std::string &tag)
Definition: AbsCache.h:30
bool UseEpochs()
Definition: AbsCache.h:45
void Reinit()
Definition: AbsCache.h:35
Look up absolute attenuation constants.
Definition: AbsCache.h:16
Definition: run.py:1
void ReadEpochsFromCSV(bool readEpochs=true)
Definition: AbsCache.h:55
std::string fTag
Definition: AbsCache.h:75
double GetPECorrToGeVScale(novadaq::cnv::DetId det, int diblock, bool isData)
Definition: AbsCache.cxx:34
std::map< int, Record > fRecordsData
Map is from diblock number.
Definition: AbsCache.h:86
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
std::string fEpoch
Definition: AbsCache.h:76
bool fInitializedMC
Definition: AbsCache.h:84
virtual ~AbsCache()
Definition: AbsCache.cxx:29
int fGainSetting
Definition: AbsCache.h:74
const hit & b
Definition: hits.cxx:21
bool fUseCSVsFromUPS
Definition: AbsCache.h:73
std::map< int, Record > fRecordsMC
Map is from diblock number.
Definition: AbsCache.h:87
std::string fEpochTag
Definition: AbsCache.h:77
bool fInitializedData
Whether we have (attempted to) read from db or csv yet.
Definition: AbsCache.h:83