StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StBemcTables.h
1 /***************************************************************************
2  *
3  * $Id: StBemcTables.h,v 1.9 2015/03/02 20:26:09 jkadkins Exp $
4  * Author: Alexandre A. P. Suaide
5  * Maintainer: Adam Kocoloski, MIT, kocolosk@mit.edu
6  *
7  ***************************************************************************/
8 
9 #ifndef STAR_StBemcTables
10 #define STAR_StBemcTables
11 
12 #include <string>
13 using std::string;
14 
15 #include <map>
16 using std::map;
17 
18 #include <utility>
19 using std::pair;
20 
21 #include "TObject.h"
22 
23 #include "tables/St_emcPed_Table.h"
24 #include "tables/St_smdPed_Table.h"
25 #include "tables/St_emcStatus_Table.h"
26 #include "tables/St_smdStatus_Table.h"
27 #include "tables/St_emcCalib_Table.h"
28 #include "tables/St_smdCalib_Table.h"
29 #include "tables/St_emcGain_Table.h"
30 #include "tables/St_smdGain_Table.h"
31 #include "tables/St_emcTriggerStatus_Table.h"
32 #include "tables/St_emcTriggerPed_Table.h"
33 #include "tables/St_bemcTriggerPed4_Table.h"
34 #include "tables/St_emcTriggerLUT_Table.h"
35 
36 class StMaker;
37 class StEmcDecoder;
38 
45 class StBemcTables : public TObject
46 {
47 protected:
48  emcPed_st* mBtowP;
49  emcPed_st* mBprsP;
50  smdPed_st* mSmdeP;
51  smdPed_st* mSmdpP;
52  emcStatus_st* mBtowS;
53  emcStatus_st* mBprsS;
54  smdStatus_st* mSmdeS;
55  smdStatus_st* mSmdpS;
56  emcCalib_st* mBtowC;
57  emcCalib_st* mBprsC;
58  smdCalib_st* mSmdeC;
59  smdCalib_st* mSmdpC;
60  emcGain_st* mBtowG;
61  emcGain_st* mBprsG;
62  smdGain_st* mSmdeG;
63  smdGain_st* mSmdpG;
64  emcTriggerStatus_st* mTrigS;
65  emcTriggerPed_st* mTrigP;
66  emcTriggerLUT_st* mTrigL;
67  bemcTriggerPed4_st* mTrigP4;
68 
69  StEmcDecoder* mDecoder;
70  Bool_t mBtowMapFix;
71  Bool_t mBprsMapFix;
72  Int_t getOldId(int det, Int_t newId) const;
73 
74  map<string, pair<string, string> > mValidRanges;
75  void updateValidity(StMaker* dbMaker, TTable* table);
76 
77 public:
78  StBemcTables(Bool_t btowMapFix = kFALSE, Bool_t bprsMapFix = kFALSE);
79  virtual ~StBemcTables();
80 
81  void loadTables(StMaker* anyMaker);
82 
83  const char* beginTime(const char * tableName) const;
84  const char* endTime(const char * tableName) const;
85 
86  //the following methods are simple wrappers around the original "get" methods for those who
87  //prefer a return value instead of passing a parameter
88  //detector numbering uses StEmcRawMaker/defines
89  //BTOW == 1, BPRS == 2, BSMDE == 3, BSMDP == 4
90  float calib(int det, int softId, int power=1) const;
91  float pedestal(int det, int softId, int cap=0) const;
92  float pedestalRMS(int det, int softId, int cap=0) const;
93  float gain(int det, int softId) const;
94 
97  int status(int det, int softId, const char *option = "") const;
98 
99  int triggerPatchStatus(int triggerPatch) const;
100  int triggerHighTowerStatus(int triggerPatch) const;
101  int triggerTowerStatus(int crate, int sequence) const;
102  float triggerPedestal(int crate, int sequence) const;
103  int triggerPedestalShift() const;
104  int triggerBitConversion(int crate, int patchSequence) const;
105  short triggerPed4(int softId) const;
106  int triggerFormulaTag(int crate, int patchSequence) const;
107  int* triggerFormulaParameters(int crate, int patchSequence) const;
108 
109  //these methods allow the user to access the same trigger info via softId.
110  int triggerPatchStatusByID(int softId) const;
111  int triggerHighTowerStatusByID(int softId) const;
112  int triggerTowerStatusByID(int softId) const;
113  float triggerPedestalByID(int softId) const;
114  int triggerBitConversionByID(int softId) const;
115  int triggerFormulaTagByID(int softId) const;
116  int* triggerFormulaParametersByID(int softId) const;
117 
118  //-----------------------------------------------------------------------------
119 
120  // These are methods to get offline database values, like pedestals, gains, status
121  void getPedestal(Int_t det, Int_t softId, Int_t cap, Float_t& ped, Float_t& rms) const;
122  void getStatus(Int_t det, Int_t softId, Int_t& status, const char *option = "") const;
123  void getGain(Int_t det, Int_t softId, Float_t& gain) const;
124  void getCalib(Int_t det, Int_t softId, Int_t power, Float_t& calib) const;
125 
126  // These get trigger information, like masks, trigger pedestals and bit conversion mode
127  void getTriggerPatchStatus(Int_t patch, Int_t& status) const;
128  void getTriggerHighTowerStatus(Int_t hightower, Int_t& status) const;
129  void getTriggerTowerStatus(Int_t crate, Int_t index, Int_t& status) const;
130  void getTriggerPedestal(Int_t crate, Int_t index, Float_t& pedestal) const;
131  void getTriggerBitConv(Int_t crate, Int_t patch, Int_t& bit) const;
132  void getTriggerPedestalShift(Int_t& pedestalShift) const;
133  void getTriggerPed4(Int_t softId, Short_t& PED4) const; // Return Ped4 value
134  void getTriggerFormulaTag(Int_t crate, Int_t index, Int_t& formula) const;
135  void getTriggerFormulaParameters(Int_t crate, Int_t index, Int_t* parameters) const;
136 
137  StEmcDecoder* getDecoder() {return mDecoder;}
138 
139  ClassDef(StBemcTables, 1)
140 };
141 
142 #endif
143 
144 /***************************************************************************
145  *
146  * $Log: StBemcTables.h,v $
147  * Revision 1.9 2015/03/02 20:26:09 jkadkins
148  * Updates to hold values for bemcTriggerPed4
149  *
150  * Revision 1.8 2009/09/25 15:50:29 mattheww
151  * added getter to StBemcTable for StEmcDecoder used
152  *
153  * Revision 1.7 2007/09/18 19:41:47 kocolosk
154  * added an optional argument to status methods to get status for calib, pedestal, and gain tables
155  *
156  * Revision 1.6 2007/09/10 21:23:23 kocolosk
157  * specify kTRUE as 2nd ctor argument to implement swapping corrections for 06/07 BPRS DB
158  *
159  * Revision 1.5 2007/08/21 18:39:23 kocolosk
160  * added methods to get beginTime / endTime of a given DB table
161  *
162  *
163  **************************************************************************/
void getTriggerFormulaParameters(Int_t crate, Int_t index, Int_t *parameters) const
Return LUT formula parameters.
StBemcTables(Bool_t btowMapFix=kFALSE, Bool_t bprsMapFix=kFALSE)
StBemcTables constructor.
int status(int det, int softId, const char *option="") const
void getTriggerBitConv(Int_t crate, Int_t patch, Int_t &bit) const
Return 6 bits conversion mode.
void getGain(Int_t det, Int_t softId, Float_t &gain) const
Return gain correction factor.
void getTriggerTowerStatus(Int_t crate, Int_t index, Int_t &status) const
Return trigger single tower status.
virtual ~StBemcTables()
StBemcTables destructor.
void getPedestal(Int_t det, Int_t softId, Int_t cap, Float_t &ped, Float_t &rms) const
Return pedestal mean and rms.
void getTriggerPatchStatus(Int_t patch, Int_t &status) const
Return trigger patch status.
void loadTables(StMaker *anyMaker)
load tables.
void getTriggerFormulaTag(Int_t crate, Int_t index, Int_t &formula) const
Return LUT formula.
void getCalib(Int_t det, Int_t softId, Int_t power, Float_t &calib) const
Return calibration constant.
void getTriggerHighTowerStatus(Int_t hightower, Int_t &status) const
Return trigger highTower status.
void getTriggerPedestal(Int_t crate, Int_t index, Float_t &pedestal) const
Return tower pedestal loaded in trigger.
void getTriggerPedestalShift(Int_t &pedestalShift) const
Return target pedestal shift.
Definition: TTable.h:48
void getStatus(Int_t det, Int_t softId, Int_t &status, const char *option="") const
Return status.
StEmcDecoder * getDecoder()
Return pointer to decoder.
Definition: StBemcTables.h:137