StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFstDbMaker.cxx
1 #include "StFstDbMaker/StFstDbMaker.h"
2 #include "StFstDbMaker/StFstDb.h"
3 #include "St_base/StMessMgr.h"
4 #include "St_db_Maker/St_db_Maker.h"
5 
6 #include "tables/St_Survey_Table.h"
7 #include "tables/St_fstPedNoise_Table.h"
8 #include "tables/St_fstGain_Table.h"
9 #include "tables/St_fstMapping_Table.h"
10 #include "tables/St_fstControl_Table.h"
11 #include "tables/St_fstChipConfig_Table.h"
12 
13 ClassImp(StFstDbMaker)
14 
15 
16 
20 StFstDbMaker::StFstDbMaker(const char *name) : StMaker(name), mFstDb(new StFstDb()), mReady(kStErr)
21 {
22 }
23 
24 
25 Int_t StFstDbMaker::Init()
26 {
27  ToWhiteConst("fst_db", mFstDb);
28 
29  return kStOk;
30 }
31 
32 
33 Int_t StFstDbMaker::InitRun(Int_t runNumber)
34 {
35  mReady = kStFatal;
36 
37  LOG_DEBUG << "StFstDbMaker::InitRun() - Access data from database" << endm;
38 
39  // Get FST positionment relative to TPC
40  St_Survey *st_fstOnTpc = (St_Survey *) GetDataBase("Geometry/fst/fstOnTpc");
41 
42  if (!st_fstOnTpc) {
43  LOG_ERROR << "No relevant entry found in 'Geometry/fst/fstOnTpc' table."
44  " StFstDb object will not be created" << endm;
45  return kStErr;
46  }
47  st_fstOnTpc->Print(0,1);
48 
49  // Get half of the support structure (HSS) positionments relative to FST
50  St_Survey *st_fstHssOnFst = (St_Survey *) GetDataBase("Geometry/fst/hssOnFst");
51 
52  if (!st_fstHssOnFst) {
53  LOG_ERROR << "No relevant entry found in 'Geometry/fst/hssOnFst' table."
54  " StFstDb object will not be created" << endm;
55  return kStErr;
56  }
57  st_fstHssOnFst->Print(0,1);
58 
59  // Get wedge positionments relative to HSS
60  St_Survey *st_fstWedgeOnHss = (St_Survey *) GetDataBase("Geometry/fst/fstWedgeOnHss");
61 
62  if (!st_fstWedgeOnHss) {
63  LOG_ERROR << "No relevant entry found in 'Geometry/fst/fstWedgeOnHss' table."
64  " StFstDb object will not be created" << endm;
65  return kStErr;
66  }
67  st_fstWedgeOnHss->Print(0,1);
68 
69  // Get sensor positionments relative to wedge
70  St_Survey *st_fstSensorOnWedge = (St_Survey *) GetDataBase("Geometry/fst/fstSensorOnWedge");
71 
72  if (!st_fstSensorOnWedge) {
73  LOG_ERROR << "No relevant entry found in 'Geometry/fst/fstSensorOnWedge' table."
74  " StFstDb object will not be created" << endm;
75  return kStErr;
76  }
77  st_fstSensorOnWedge->Print(0,1);
78 
79  Survey_st *tables[4] = {st_fstOnTpc->GetTable(), st_fstHssOnFst->GetTable(),
80  st_fstWedgeOnHss->GetTable(), st_fstSensorOnWedge->GetTable()
81  };
82  mFstDb->setGeoHMatrices(tables);
83 
84  // Now access FST pedestal and noise tables
85  St_fstPedNoise *mPedNoise = (St_fstPedNoise *) GetDataBase("Calibrations/fst/fstPedNoise");
86 
87  if (!mPedNoise) {
88  LOG_ERROR << "No relevant entry found in 'Calibrations/fst/fstPedNoise' table."
89  " StFstDb object will not be created" << endm;
90  return kStErr;
91  }
92 
93  mFstDb->setPedNoise(mPedNoise->GetTable());
94  if(Debug()) mPedNoise->Print(0,1);
95 
96  // Access FST gain table
97  St_fstGain *mGain = (St_fstGain *) GetDataBase("Calibrations/fst/fstGain");
98 
99  if (!mGain) {
100  LOG_ERROR << "No relevant entry found in 'Calibrations/fst/fstGain' table."
101  " StFstDb object will not be created" << endm;
102  return kStErr;
103  }
104 
105  mFstDb->setGain(mGain->GetTable());
106  if(Debug()) mGain->Print(0,1);
107 
108  St_fstMapping *mMapping = (St_fstMapping *) GetDataBase("Calibrations/fst/fstMapping");
109 
110  if (!mMapping) {
111  LOG_ERROR << "No relevant entry found in 'Calibrations/fst/fstMapping' table."
112  " StFstDb object will not be created" << endm;
113  return kStErr;
114  }
115 
116  mFstDb->setMapping(mMapping->GetTable());
117  if(Debug()) mMapping->Print(0,1);
118 
119  // Access FST control table
120  St_fstControl *mControl = (St_fstControl *) GetDataBase("Calibrations/fst/fstControl");
121 
122  if (!mControl) {
123  LOG_ERROR << "No relevant entry found in 'Calibrations/fst/fstControl' table."
124  " StFstDb object will not be created" << endm;
125  return kStErr;
126  }
127 
128  mFstDb->setControl(mControl->GetTable());
129  mControl->Print(0,1);
130 
131  // Access FST chip status table
132  St_fstChipConfig *mChipConfig = (St_fstChipConfig *) GetDataBase("Calibrations/fst/fstChipConfig");
133 
134  if (!mChipConfig) {
135  LOG_ERROR << "No relevant entry found in 'Calibrations/fst/fstChipConfig' table."
136  " StFstDb object will not be created" << endm;
137  return kStErr;
138  }
139 
140  mFstDb->setChipStatus(mChipConfig->GetTable());
141  mChipConfig->Print(0,1);
142 
143  if ( GetDebug() >= 2)
144  mFstDb->Print();
145 
146  mReady = kStOK;
147 
148  return kStOK;
149 }
150 
151 
153 {
154  return mReady;
155 }
Definition: Stypes.h:40
Definition: Stypes.h:44
Definition: Stypes.h:41