StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFcsDbMaker.cxx
1 /***************************************************************************
2  * $id: StFcsDbMaker.cxx,v 1.22 2020/12/17 21:01:04 akio Exp $
3  * \author: akio ogawa
4  ***************************************************************************
5  *
6  * Description: This maker is the interface between FCS and the STAR database
7  *
8  ***************************************************************************
9  *
10  * $Log: StFcsDbMaker.cxx,v $
11  * Revision 1.2 2021/05/27 14:02:24 akio
12  * clean up Clear and fixGain/corr
13  *
14  * Revision 1.1 2021/03/30 13:40:07 akio
15  * FCS code after peer review and moved from $CVSROOT/offline/upgrades/akio
16  *
17  * Revision 1.32 2021/02/25 21:53:50 akio
18  * Int_t -> int
19  *
20  * Revision 1.31 2021/02/24 22:56:19 akio
21  * Modified for STAR code review (Dmitry)
22  *
23  * Revision 1.30 2021/02/23 22:18:23 akio
24  * Modified for STAr code review (Jason)
25  *
26  * Revision 1.29 2021/02/12 20:09:50 akio
27  * Adding getIdfromSCmap()
28  *
29  * Revision 1.28 2021/02/09 21:54:23 akio
30  * Using StEnumeration
31  *
32  * Revision 1.27 2021/02/05 17:23:25 akio
33  * Adding access to STAR offline DB tables.
34  * Adding getFromName/getDetFromName from David.
35  *
36  * Revision 1.26 2021/01/05 18:15:01 akio
37  * added setPedestal()
38  *
39  * Revision 1.25 2020/12/30 20:45:20 akio
40  * fix format
41  *
42  * Revision 1.24 2020/12/30 20:34:38 akio
43  * also modify getName for DEP
44  *
45  * Revision 1.23 2020/12/30 20:17:55 akio
46  * adding SC map access
47  *
48  * Revision 1.22 2020/12/17 21:01:04 akio
49  * fix slt problem in sc map
50  *
51  * Revision 1.21 2020/09/03 19:43:20 akio
52  * Updating SC map and adding patchpanel & cable color map
53  *
54  * Revision 1.20 2020/07/24 17:23:31 akio
55  * EPD mip value from 1.6MeV to 2.0MeV
56  *
57  * Revision 1.19 2020/05/29 18:53:40 akio
58  * Adding EPD as PRES maps, STAR coordinate for 4x4 trigger patch, renming map files to be used for DAQ as Tonko specifies
59  *
60  * Revision 1.18 2020/05/04 15:49:39 akio
61  * adding gain for EPD as PRES
62  *
63  * Revision 1.17 2020/05/04 15:48:22 akio
64  * adding input file for DAQ
65  *
66  * Revision 1.16 2019/10/23 20:05:39 akio
67  * bug fixed for getOffset for det=1
68  *
69  * Revision 1.15 2019/10/23 19:20:10 akio
70  * fix det=0 bug for getGain/gaincorr
71  *
72  * Revision 1.14 2019/10/23 13:34:38 akio
73  * Adding getZDepth, and take out Ecal front space (for SiPM/Fee) from offsets
74  * so that x/z offsets are now pointing to actual ecal tower front & near beam corner.
75  *
76  * Revision 1.13 2019/08/01 18:36:06 akio
77  * Bug fix which was causing id=0 to get gain=1.0 always
78  *
79  * Revision 1.12 2019/07/10 06:13:34 akio
80  * Adding reading of gains from text files
81  *
82  * Revision 1.11 2019/07/08 15:53:28 akio
83  * updating sampling fraction number by Ting & Liu's study
84  *
85  * Revision 1.10 2019/06/27 16:10:32 akio
86  * adding getLocalXYinCell
87  *
88  * Revision 1.9 2019/06/25 16:38:59 akio
89  * Fixed y offset for run19
90  * Added setting run# and time dependent (for preshower yoffset only for now)
91  *
92  * Revision 1.8 2019/06/21 17:28:47 akio
93  * dealing with 5cm offsent when leakyHcal
94  *
95  * Revision 1.7 2019/06/07 18:16:54 akio
96  * *** empty log message ***
97  *
98  * Revision 1.6 2019/05/16 16:08:32 akio
99  * going back to 2019 to full gepmetry
100  *
101  * Revision 1.5 2019/03/22 14:28:35 akio
102  * adding map for 2019
103  *
104  * Revision 1.4 2019/03/13 20:46:19 akio
105  * formatting
106  *
107  * Revision 1.3 2019/03/13 20:29:30 akio
108  * update for run19
109  *
110  * Revision 1.2 2019/02/05 22:00:18 akio
111  * fix NorthSouth()
112  *
113  * Revision 1.1 2018/11/14 16:50:13 akio
114  * FCS codes in offline/upgrade/akio
115  *
116  *
117  **************************************************************************/
118 
119 #include "StFcsDbMaker.h"
120 #include "StFcsDb.h"
121 #include "StFcsDbPulse.h"
122 #include "St_db_Maker/St_db_Maker.h"
123 #include "StMessMgr.h"
124 
125 #include "tables/St_fcsDetectorPosition_Table.h"
126 #include "tables/St_fcsEcalGain_Table.h"
127 #include "tables/St_fcsHcalGain_Table.h"
128 #include "tables/St_fcsPresGain_Table.h"
129 #include "tables/St_fcsEcalGainCorr_Table.h"
130 #include "tables/St_fcsHcalGainCorr_Table.h"
131 #include "tables/St_fcsPresValley_Table.h"
132 #include "tables/St_fcsEcalGainOnline_Table.h"
133 #include "tables/St_fcsHcalGainOnline_Table.h"
134 #include "tables/St_fcsPresThreshold_Table.h"
135 #include "tables/St_vertexSeed_Table.h"
136 
137 ClassImp(StFcsDbMaker)
138 
139 StFcsDbMaker::StFcsDbMaker(const char *name) : StMaker(name){
140  LOG_INFO << "******** StFcsDbMaker::StFcsDbMaker = "<<name<<endm;
141  mFcsDb = new StFcsDb("fcsDb");
142  AddData(mFcsDb,".const");
143  mFcsDbPulse = new StFcsDbPulse("fcsPulse");
144  AddData(mFcsDbPulse,".const");
145 };
146 
147 StFcsDbMaker::~StFcsDbMaker() {
148  //delete mFcsDb; //already deleted by chain because AddData in constructor
149  //delete mFcsDbPulse; //already deleted by chain because AddData in constructor
150 }
151 
152 int StFcsDbMaker::Init(){
153  mFcsDb->Init();
154  mFcsDbPulse->Init();
155  return kStOK;
156  return StMaker::Init();
157 }
158 
159 void StFcsDbMaker::Clear(Option_t *option){
160  StMaker::Clear(option);
161 }
162 
164  return StMaker::Make();
165 }
166 
167 int StFcsDbMaker::InitRun(int runNumber) {
168  LOG_INFO << "StFcsDbMaker::InitRun - run = " << runNumber << endm;
169 
170  if(mDbAccess){
171  St_db_Maker* dbmaker = (St_db_Maker*)GetMaker("db");
172  if(dbmaker){
173  LOG_INFO << "StFcsDbMaker::InitRun - Date&time from St_db_Maker="<<dbmaker->GetDate()<<","<< dbmaker->GetTime() << endm;
174  }else{
175  LOG_ERROR << "StFcsDbMaker::InitRun - No St_db_Maker"<<endm; return kStFatal;
176  }
177 
178  //Get to Geometry/fcs
179  TDataSet *DBgeom = 0;
180  St_fcsDetectorPosition *dbFcsDetPos=0;
181  DBgeom = GetInputDB("Geometry/fcs");
182  if(!DBgeom){
183  LOG_ERROR << "StFcsDbMaker::InitRun - No Geometry/fcs"<<endm;
184  }else{
185  dbFcsDetPos = (St_fcsDetectorPosition*)DBgeom ->Find("fcsDetectorPosition");
186  }
187  if(!dbFcsDetPos){
188  LOG_ERROR << "StFcsDbMaker::InitRun - No Geometry/fcs/fcsDetectorPosition"<<endm;
189  mFcsDb->setFcsDetectorPosition(0);
190  }else{
191  mFcsDb->setFcsDetectorPosition((fcsDetectorPosition_st*) dbFcsDetPos->GetTable());
192  }
193 
194  //Get to Calibrations/fcs
195  TDataSet *DBcalib = 0;
196  St_fcsEcalGain *dbFcsEcalGain =0;
197  St_fcsHcalGain *dbFcsHcalGain =0;
198  St_fcsPresGain *dbFcsPresGain =0;
199  St_fcsEcalGainCorr *dbFcsEcalGainCorr =0;
200  St_fcsHcalGainCorr *dbFcsHcalGainCorr =0;
201  St_fcsPresValley *dbFcsPresValley =0;
202  St_fcsEcalGainOnline *dbFcsEcalGainOnline =0;
203  St_fcsHcalGainOnline *dbFcsHcalGainOnline =0;
204  St_fcsPresThreshold *dbFcsPresThreshold =0;
205  DBcalib = GetInputDB("Calibrations/fcs");
206  if(!DBcalib){
207  LOG_ERROR << "StFcsDbMaker::InitRun - No Calibration/fcs"<<endm;
208  }else{
209  dbFcsEcalGain = (St_fcsEcalGain*) DBcalib->Find("fcsEcalGain");
210  dbFcsHcalGain = (St_fcsHcalGain*) DBcalib->Find("fcsHcalGain");
211  dbFcsPresGain = (St_fcsPresGain*) DBcalib->Find("fcsPresGain");
212  dbFcsEcalGainCorr = (St_fcsEcalGainCorr*) DBcalib->Find("fcsEcalGainCorr");
213  dbFcsHcalGainCorr = (St_fcsHcalGainCorr*) DBcalib->Find("fcsHcalGainCorr");
214  dbFcsPresValley = (St_fcsPresValley*) DBcalib->Find("fcsPresValley");
215  dbFcsEcalGainOnline = (St_fcsEcalGainOnline*)DBcalib->Find("fcsEcalGainOnline");
216  dbFcsHcalGainOnline = (St_fcsHcalGainOnline*)DBcalib->Find("fcsHcalGainOnline");
217  dbFcsPresThreshold = (St_fcsPresThreshold*) DBcalib->Find("fcsPresThreshold");
218  }
219 
220  //Ecal Gain
221  if(!dbFcsEcalGain) {
222  LOG_ERROR << "StFcsDbMaker::InitRun - No Calibration/fcs/fcsEcalGain"<<endm;
223  mFcsDb->setFcsEcalGain(0);
224  }else{
225  mFcsDb->setFcsEcalGain((fcsEcalGain_st*) dbFcsEcalGain->GetTable());
226  }
227  //Hcal Gain
228  if(!dbFcsHcalGain) {
229  LOG_ERROR << "StFcsDbMaker::InitRun - No Calibration/fcs/fcsHcalGain"<<endm;
230  mFcsDb->setFcsHcalGain(0);
231  }else{
232  mFcsDb->setFcsHcalGain((fcsHcalGain_st*) dbFcsHcalGain->GetTable());
233  }
234  //Pres Gain
235  if(!dbFcsPresGain) {
236  LOG_ERROR << "StFcsDbMaker::InitRun - No Calibration/fcs/fcsPresGain"<<endm;
237  mFcsDb->setFcsPresGain(0);
238  }else{
239  mFcsDb->setFcsPresGain((fcsPresGain_st*) dbFcsPresGain->GetTable());
240  }
241  //Ecal GainCorr
242  if(!dbFcsEcalGainCorr) {
243  LOG_ERROR << "StFcsDbMaker::InitRun - No Calibration/fcs/fcsEcalGainCorr"<<endm;
244  mFcsDb->setFcsEcalGainCorr(0);
245  }else{
246  mFcsDb->setFcsEcalGainCorr((fcsEcalGainCorr_st*) dbFcsEcalGainCorr->GetTable());
247  }
248  //Hcal GainCorr
249  if(!dbFcsHcalGainCorr) {
250  LOG_ERROR << "StFcsDbMaker::InitRun - No Calibration/fcs/fcsHcalGainCorr"<<endm;
251  mFcsDb->setFcsHcalGainCorr(0);
252  }else{
253  mFcsDb->setFcsHcalGainCorr((fcsHcalGainCorr_st*) dbFcsHcalGainCorr->GetTable());
254  }
255  //Pres Valley
256  if(!dbFcsPresValley) {
257  LOG_ERROR << "StFcsDbMaker::InitRun - No Calibration/fcs/fcsPresValley"<<endm;
258  mFcsDb->setFcsPresValley(0);
259  }else{
260  mFcsDb->setFcsPresValley((fcsPresValley_st*) dbFcsPresValley->GetTable());
261  }
262 
263  //Ecal GainOnline
264  if(!dbFcsEcalGainOnline) {
265  LOG_ERROR << "StFcsDbMaker::InitRun - No Calibration/fcs/fcsEcalGainOnline"<<endm;
266  mFcsDb->setFcsEcalGainOnline(0);
267  }else{
268  mFcsDb->setFcsEcalGainOnline((fcsEcalGainOnline_st*) dbFcsEcalGainOnline->GetTable());
269  }
270  //Hcal GainOnline
271  if(!dbFcsHcalGainOnline) {
272  LOG_ERROR << "StFcsDbMaker::InitRun - No Calibration/fcs/fcsHcalGainOnline"<<endm;
273  mFcsDb->setFcsHcalGainOnline(0);
274  }else{
275  mFcsDb->setFcsHcalGainOnline((fcsHcalGainOnline_st*) dbFcsHcalGainOnline->GetTable());
276  }
277  //Pres Threshold
278  if(!dbFcsPresThreshold) {
279  LOG_ERROR << "StFcsDbMaker::InitRun - No Calibration/fcs/fcsPresThreshold"<<endm;
280  mFcsDb->setFcsPresThreshold(0);
281  }else{
282  mFcsDb->setFcsPresThreshold((fcsPresThreshold_st*) dbFcsPresThreshold->GetTable());
283  }
284  }
285 
286  mFcsDb->InitRun(runNumber);
287  return kStOK;
288 }
void setFcsEcalGainOnline(fcsEcalGainOnline_st *)
set fcsPresValley_st*
Definition: StFcsDb.cxx:290
void setFcsPresGain(fcsPresGain_st *)
set fcsHcalGain_st*
Definition: StFcsDb.cxx:270
void setFcsPresValley(fcsPresValley_st *)
set fcsHcalGainCorr_st*
Definition: StFcsDb.cxx:285
void setFcsHcalGain(fcsHcalGain_st *)
set fcsEcalGain_st*
Definition: StFcsDb.cxx:265
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StMaker.cxx:634
int Init()
Initialize object.
void setFcsHcalGainOnline(fcsHcalGainOnline_st *)
set fcsEcalGainOnline_st*
Definition: StFcsDb.cxx:295
void setFcsEcalGainCorr(fcsEcalGainCorr_st *)
set fcsPresGain_st*
Definition: StFcsDb.cxx:275
void Clear(Option_t *option)
User defined functions.
virtual Int_t Make()
Definition: StMaker.cxx:898
void setFcsEcalGain(fcsEcalGain_st *)
set fcsDetectorPosition_st*
Definition: StFcsDb.cxx:260
Definition: Stypes.h:40
void setFcsPresThreshold(fcsPresThreshold_st *)
set fcsHcalGainOnline_st*
Definition: StFcsDb.cxx:300
void setFcsDetectorPosition(fcsDetectorPosition_st *t)
set Et Gain Setting 0=Auto from run#, 1=Old, 2=New(23027048)
Definition: StFcsDb.cxx:255
void setFcsHcalGainCorr(fcsHcalGainCorr_st *)
set fcsEcalGainCorr_st*
Definition: StFcsDb.cxx:280
virtual TDataSet * Find(const char *path) const
Definition: TDataSet.cxx:362