131 #include "StFmsDbMaker.h"
132 #include "St_db_Maker/St_db_Maker.h"
133 #include "StMessMgr.h"
134 #include "tables/St_fmsDetectorPosition_Table.h"
135 #include "tables/St_fmsChannelGeometry_Table.h"
136 #include "tables/St_fmsMap_Table.h"
137 #include "tables/St_fmsPatchPanelMap_Table.h"
138 #include "tables/St_fmsQTMap_Table.h"
139 #include "tables/St_fmsGain_Table.h"
140 #include "tables/St_fmsGainCorrection_Table.h"
141 #include "tables/St_fmsBitShiftGain_Table.h"
142 #include "tables/St_fmsGainB_Table.h"
143 #include "tables/St_fmsGainCorrectionB_Table.h"
144 #include "tables/St_fmsBitShiftGainB_Table.h"
145 #include "tables/St_fmsTimeDepCorr_Table.h"
146 #include "tables/St_fmsRec_Table.h"
147 #include "tables/St_fmsPositionModel_Table.h"
148 #include "tables/St_fpsConstant_Table.h"
149 #include "tables/St_fpsChannelGeometry_Table.h"
150 #include "tables/St_fpsSlatId_Table.h"
151 #include "tables/St_fpsPosition_Table.h"
152 #include "tables/St_fpsMap_Table.h"
153 #include "tables/St_fpsGain_Table.h"
154 #include "tables/St_fpsStatus_Table.h"
155 #include "tables/St_fpostConstant_Table.h"
156 #include "tables/St_fpostChannelGeometry_Table.h"
157 #include "tables/St_fpostSlatId_Table.h"
158 #include "tables/St_fpostPosition_Table.h"
159 #include "tables/St_fpostMap_Table.h"
160 #include "tables/St_fpostGain_Table.h"
161 #include "tables/St_fpostStatus_Table.h"
162 #include "tables/St_vertexSeed_Table.h"
164 #include "getCellPosition2015pp.h"
165 #include "getCellPosition2015pA.h"
166 #include "getCellPosition2017.h"
168 #include "StEvent/StFmsHit.h"
169 #include "StEvent/StFmsPoint.h"
175 StFmsDbMaker::~StFmsDbMaker() {deleteArrays();}
176 Int_t StFmsDbMaker::Init(){LOG_DEBUG<<
"StFmsDbMaker Init Start"<<endm;
return StMaker::Init();}
178 void StFmsDbMaker::Clear(
const Char_t*){LOG_DEBUG<<
"StFmsDbMaker Clear"<<endm;
StMaker::Clear();}
182 LOG_DEBUG <<
"StFmsDbMaker::InitRun - run = " << runNumber << endm;
185 TString attr(SAttr(
"fmsGainCorr"));
187 LOG_INFO <<
"FmsGainCorrection Flavor = " << attr << endm;
188 SetFlavor(attr.Data(),
"fmsGainCorrectionB");
194 LOG_INFO <<
"StFmsDbMaker::InitRun - Date&time from St_db_Maker="<<dbmaker->GetDate()<<
","<< dbmaker->GetTime() << endm;
202 DBgeom = GetInputDB(
"Geometry/fms");
203 DBmapping = GetInputDB(
"Calibrations/fms/mapping");
204 DBcalibration= GetInputDB(
"Calibrations/fms");
205 DBFpsGeom = GetInputDB(
"Geometry/fps");
206 DBFpsCalibration= GetInputDB(
"Calibrations/fps");
207 if(!DBgeom) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fms"<<endm;
return kStFatal;}
208 if(!DBmapping) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fms/mapping"<<endm;
return kStFatal;}
209 if(!DBcalibration) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fms"<<endm;
return kStFatal;}
210 if(!DBFpsGeom) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fps"<<endm;
return kStFatal;}
211 if(!DBFpsCalibration){LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fps"<<endm;
return kStFatal;}
214 St_fmsChannelGeometry *dbChannelGeometry =0;
215 St_fmsDetectorPosition *dbDetectorPosition =0;
216 St_fmsPositionModel *dbPositionModel =0;
218 St_fmsPatchPanelMap *dbPatchPanelMap =0;
219 St_fmsQTMap *dbQTMap =0;
220 St_fmsGain *dbGain =0;
221 St_fmsGainCorrection *dbGainCorrection =0;
222 St_fmsBitShiftGain *dbBitShiftGain =0;
223 St_fmsGainB *dbGainB =0;
224 St_fmsGainCorrectionB *dbGainCorrectionB =0;
225 St_fmsBitShiftGainB *dbBitShiftGainB =0;
226 St_fmsTimeDepCorr *dbTimeDepCorr =0;
228 St_fpsConstant *dbFpsConstant =0;
229 St_fpsChannelGeometry *dbFpsChannelGeometry=0;
230 St_fpsSlatId *dbFpsSlatId =0;
231 St_fpsPosition *dbFpsPosition =0;
232 St_fpsMap *dbFpsMap =0;
233 St_fpsGain *dbFpsGain =0;
234 St_fpsStatus *dbFpsStatus =0;
235 St_fpostConstant *dbFpostConstant =0;
236 St_fpostChannelGeometry *dbFpostChannelGeometry=0;
237 St_fpostSlatId *dbFpostSlatId =0;
238 St_fpostPosition *dbFpostPosition =0;
239 St_fpostMap *dbFpostMap =0;
240 St_fpostGain *dbFpostGain =0;
241 St_fpostStatus *dbFpostStatus =0;
243 dbChannelGeometry = (St_fmsChannelGeometry*) DBgeom->
Find(
"fmsChannelGeometry");
244 dbDetectorPosition = (St_fmsDetectorPosition*)DBgeom->
Find(
"fmsDetectorPosition");
245 dbPositionModel = (St_fmsPositionModel*) DBgeom->
Find(
"fmsPositionModel");
246 dbMap = (St_fmsMap*) DBmapping->
Find(
"fmsMap");
247 dbPatchPanelMap = (St_fmsPatchPanelMap*) DBmapping->
Find(
"fmsPatchPanelMap");
248 dbQTMap = (St_fmsQTMap*) DBmapping->
Find(
"fmsQTMap");
249 dbGain = (St_fmsGain*) DBcalibration->
Find(
"fmsGain");
250 dbGainCorrection = (St_fmsGainCorrection*) DBcalibration->
Find(
"fmsGainCorrection");
251 dbBitShiftGain = (St_fmsBitShiftGain*) DBcalibration->
Find(
"fmsBitShiftGain");
252 dbGainB = (St_fmsGainB*) DBcalibration->
Find(
"fmsGainB");
253 dbGainCorrectionB = (St_fmsGainCorrectionB*) DBcalibration->
Find(
"fmsGainCorrectionB");
254 dbBitShiftGainB = (St_fmsBitShiftGainB*) DBcalibration->
Find(
"fmsBitShiftGainB");
255 dbTimeDepCorr = (St_fmsTimeDepCorr*) DBcalibration->
Find(
"fmsTimeDepCorr");
256 dbRec = (St_fmsRec*) DBcalibration->
Find(
"fmsRec");
257 dbFpsConstant = (St_fpsConstant*) DBFpsGeom->
Find(
"fpsConstant");
258 dbFpsChannelGeometry= (St_fpsChannelGeometry*) DBFpsGeom->
Find(
"fpsChannelGeometry");
259 dbFpsSlatId = (St_fpsSlatId*) DBFpsGeom->
Find(
"fpsSlatId");
260 dbFpsPosition = (St_fpsPosition*) DBFpsGeom->
Find(
"fpsPosition");
261 dbFpsMap = (St_fpsMap*) DBFpsGeom->
Find(
"fpsMap");
262 dbFpsGain = (St_fpsGain*) DBFpsCalibration->
Find(
"fpsGain");
263 dbFpsStatus = (St_fpsStatus*) DBFpsCalibration->
Find(
"fpsStatus");
264 dbFpostConstant = (St_fpostConstant*) DBFpsGeom->
Find(
"fpostConstant");
265 dbFpostChannelGeometry= (St_fpostChannelGeometry*) DBFpsGeom->
Find(
"fpostChannelGeometry");
266 dbFpostSlatId = (St_fpostSlatId*) DBFpsGeom->
Find(
"fpostSlatId");
267 dbFpostPosition = (St_fpostPosition*) DBFpsGeom->
Find(
"fpostPosition");
268 dbFpostMap = (St_fpostMap*) DBFpsGeom->
Find(
"fpostMap");
269 dbFpostGain = (St_fpostGain*) DBFpsCalibration->
Find(
"fpostGain");
270 dbFpostStatus = (St_fpostStatus*) DBFpsCalibration->
Find(
"fpostStatus");
272 if(!dbChannelGeometry) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fms/fmsChannelGeometry" <<endm;
return kStFatal;}
273 if(!dbDetectorPosition) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fms/fmsDetectorPosition" <<endm;
return kStFatal;}
274 if(!dbPositionModel) {LOG_INFO <<
"StFmsDbMaker::InitRun - No Geometry/fms/fmsPositionModel, using default" <<endm; }
275 if(!dbMap) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fms/mapping/fmsMap" <<endm;
return kStFatal;}
276 if(!dbPatchPanelMap) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fms/mapping/fmsPatchPanelMap"<<endm;
return kStFatal;}
277 if(!dbQTMap) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fms/mapping/fmsQTMap" <<endm;
return kStFatal;}
278 if(!dbGain && !dbGainB) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fms/fmsGain nor B" <<endm;
return kStFatal;}
279 if(!dbGainCorrection && !dbGainCorrectionB) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fms/fmsGainCorrection nor B"<<endm;
return kStFatal;}
280 if(!dbBitShiftGain && !dbBitShiftGainB) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fms/fmsBitShiftGain nor B" <<endm;}
281 if(!dbTimeDepCorr) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fms/fmsTimeDepCorr" <<endm;}
282 if(!dbRec) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fms/fmsRec" <<endm;
return kStFatal;}
284 if(!dbFpsConstant) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fps/fpsConstant" <<endm;}
285 if(!dbFpsChannelGeometry){LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fps/fpsChannelGeometry" <<endm;}
286 if(!dbFpsSlatId) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fps/fpsSlatId" <<endm;}
287 if(!dbFpsPosition) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fps/fpsPosition" <<endm;}
288 if(!dbFpsMap) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fps/fpsMap" <<endm;}
289 if(!dbFpsGain) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fps/fpsGain" <<endm;}
290 if(!dbFpsStatus) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fps/fpsStatus" <<endm;}
292 if(!dbFpostConstant) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fpost/fpostConstant" <<endm;}
293 if(!dbFpostChannelGeometry){LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fpost/fpostChannelGeometry" <<endm;}
294 if(!dbFpostSlatId) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fpost/fpostSlatId" <<endm;}
295 if(!dbFpostPosition) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fpost/fpostPosition" <<endm;}
296 if(!dbFpostMap) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Geometry/fpost/fpostMap" <<endm;}
297 if(!dbFpostGain) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fpost/fpostGain" <<endm;}
298 if(!dbFpostStatus) {LOG_ERROR <<
"StFmsDbMaker::InitRun - No Calibration/fpost/fpostStatus" <<endm;}
301 fmsChannelGeometry_st *tChannelGeometry = 0;
302 tChannelGeometry = (fmsChannelGeometry_st*) dbChannelGeometry->GetTable();
303 UShort_t max = dbChannelGeometry->GetNRows();
305 for(Int_t i=0; i<max; i++){
306 if(mMaxDetectorId < tChannelGeometry[i].
detectorId) mMaxDetectorId = tChannelGeometry[i].detectorId;
308 mChannelGeometry =
new fmsChannelGeometry_st[mMaxDetectorId+1]();
310 for(Int_t i=0; i<max; i++){
311 memcpy(&mChannelGeometry[tChannelGeometry[i].
detectorId], &tChannelGeometry[i],
sizeof(fmsChannelGeometry_st));
313 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fmsChannelGeometry with maxDetectorId = "<<mMaxDetectorId<< endm;
316 fmsDetectorPosition_st *tDetectorPosition = 0;
317 tDetectorPosition = (fmsDetectorPosition_st*) dbDetectorPosition->GetTable();
318 mDetectorPosition =
new fmsDetectorPosition_st[mMaxDetectorId+1]();
320 max = dbDetectorPosition->GetNRows();
321 for(Int_t i=0; i<max; i++){
322 memcpy(&mDetectorPosition[tDetectorPosition[i].
detectorId], &tDetectorPosition[i],
sizeof(fmsDetectorPosition_st));
324 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fmsDetectorPosition with "<<max<<
" detectors"<< endm;
329 fmsPositionModel_st *tPositionModel = 0;
330 tPositionModel = (fmsPositionModel_st*) dbPositionModel->GetTable();
331 mPositionModel= tPositionModel[0].model;
333 LOG_INFO <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fmsPositionModel = "<<mPositionModel<< endm;
336 mPatchPanelMap = (fmsPatchPanelMap_st*) dbPatchPanelMap->GetTable();
337 mMaxModule = dbPatchPanelMap->GetNRows();
339 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Calibration/fms/mapping/fmsPatchPanelMap with mMaxModule = "<<mMaxModule<< endm;
342 mQTMap = (fmsQTMap_st*) dbQTMap->GetTable();
343 mMaxNS = dbQTMap->GetNRows();
344 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Calibration/fms/mapping/fmsQTMap with mMaxNS = "<<mMaxNS<< endm;
347 mMap = (fmsMap_st*) dbMap->GetTable();
348 mMaxMap = dbMap->GetNRows();
349 mmMap =
new fmsMap_st* [mMaxDetectorId+1]();
351 memset(mReverseMapDetectorId,0,
sizeof(mReverseMapDetectorId));
352 memset(mReverseMapChannel,0,
sizeof(mReverseMapChannel));
353 for(Int_t i=0; i<mMaxMap; i++){
354 Int_t d=mMap[i].detectorId;
356 if(d<0 || d>mMaxDetectorId){
357 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/mapping/fmsMap detectorId="<<d<<
" exceed max="<<mMaxDetectorId<<endm;
361 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/mapping/fmsMap ch="<<c<<
" exceed max="<<
maxChannel(d)<<endm;
368 memcpy(&mmMap[d][c-1],&mMap[i],
sizeof(fmsMap_st));
371 getMap(d,c,&crt,&slot,&ch);
372 mReverseMapDetectorId[crt][slot][ch]=d;
373 mReverseMapChannel[crt][slot][ch]=c;
376 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/mapping/fmsMap with mMaxMap = "<<mMaxMap<< endm;
380 mGainB = (fmsGainB_st*) dbGainB->GetTable();
381 mMaxGain = dbGainB->GetNRows();
384 mmGain =
new fmsGain_st* [mMaxDetectorId+1]();
385 for(Int_t i=0; i<2500; i++){
386 Int_t d=mGainB[0].detectorId[i];
387 Int_t c=mGainB[0].ch[i];
388 if(d==0 && c==0)
continue;
389 if(d<0 || d>mMaxDetectorId){
390 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainB detectorId="<<d<<
" exceed max = "<<mMaxDetectorId<<endm;
394 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainB invalid max number of channel = "<<
maxChannel(d)
395 <<
"for det="<<d<<endm;
399 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainB detectorId="<<d<<
" ch="<<c<<
" exceed max = "<<
maxChannel(d)<<endm;
406 if(mmGain[d][c-1].ch==0){
408 mmGain[d][c-1].detectorId=d;
410 mmGain[d][c-1].gain=mGainB[0].gain[i];;
412 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainB detectorId="<<d<<
" ch="<<c<<
" double entry, skipping"<<endm;
414 if(mForceUniformGain>0.0){
417 LOG_INFO <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainB overwritten to uniform value="<<mForceUniformGain<<endm;
420 mmGain[d][c-1].gain=mForceUniformGain;
423 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Calibration/fms/fmsGainB with mMaxGain = "<<mMaxGain<< endm;
425 }
else if(!mmGain && dbGain){
426 mGain = (fmsGain_st*) dbGain->GetTable();
427 mMaxGain = dbGain->GetNRows();
428 mmGain =
new fmsGain_st* [mMaxDetectorId+1]();
429 for(Int_t i=0; i<mMaxGain; i++){
430 Int_t d=mGain[i].detectorId;
432 if(d<0 || d>mMaxDetectorId){
433 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGain detectorId="<<d<<
" exceed max = "<<mMaxDetectorId<<endm;
437 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGain invalid max number of channel = "<<
maxChannel(d)
438 <<
"for det="<<d<<endm;
442 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGain detectorId="<<d<<
" ch="<<c<<
" exceed max = "<<
maxChannel(d)<<endm;
449 if(mmGain[d][c-1].ch==0){
450 memcpy(&mmGain[d][c-1],&mGain[i],
sizeof(fmsGain_st));
452 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGain detectorId="<<d<<
" ch="<<c<<
" double entry, skipping"<<endm;
454 if(mForceUniformGain>0.0){
457 LOG_INFO <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGain overwritten to uniform value="<<mForceUniformGain<<endm;
460 mmGain[d][c-1].gain=mForceUniformGain;
463 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Calibration/fms/fmsGain with mMaxGain = "<<mMaxGain<< endm;
466 LOG_INFO <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGain or B will be overwritten by FmsGain.txt"<<endm;
467 FILE* f=fopen(
"FmsGain.txt",
"r");
469 LOG_INFO<<
"Failed to open FmsGain.txt"<<endm;
473 while(fscanf(f,
"%d %d %d %f",&ew,&nstb,&ch,&gain)!=EOF){
477 mmGain[dd][ch-1].gain=gain;
481 LOG_INFO <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGain was overwritten by FmsGain.txt"<<endm;
486 if(dbGainCorrectionB){
487 mGainCorrectionB = (fmsGainCorrectionB_st*) dbGainCorrectionB->GetTable();
488 mMaxGainCorrection = dbGainCorrectionB->GetNRows();
489 if(mMaxGainCorrection==1){
490 mMaxGainCorrection=0;
491 mmGainCorrection =
new fmsGainCorrection_st* [mMaxDetectorId+1]();
493 for(Int_t i=0; i<2500; i++){
494 Int_t d=mGainCorrectionB[0].detectorId[i];
495 Int_t c=mGainCorrectionB[0].ch[i];
496 if(d==0 && c==0)
continue;
497 if(d<0 || d>mMaxDetectorId){
498 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorrectionB detectorId="<<d<<
" exceed max="<<mMaxDetectorId<<endm;
502 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorrectionB invalid max number of channel = "<<
maxChannel(d)
503 <<
"for det="<<d<<endm;
507 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorrectionB ch="<<c<<
" exceed max="<<
maxChannel(d)<<endm;
510 if(mmGainCorrection[d]==0){
511 mmGainCorrection[d] =
new fmsGainCorrection_st [
maxChannel(d)]();
514 if(mmGainCorrection[d][c-1].ch==0){
515 mMaxGainCorrection++;
516 mmGainCorrection[d][c-1].detectorId=d;
517 mmGainCorrection[d][c-1].ch=c;
518 mmGainCorrection[d][c-1].corr=mGainCorrectionB[0].corr[i];;
520 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorrectionB detectorId="<<d<<
" ch="<<c<<
" double entry, skipping"<<endm;
522 if(mForceUniformGainCorrection>0.0){
525 LOG_INFO <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorrectionB overwritten to uniform value="<<mForceUniformGainCorrection<<endm;
528 mmGainCorrection[d][c-1].corr=mForceUniformGainCorrection;
531 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fmsGainCorrectionB with mMaxGainCorrection = "<<mMaxGainCorrection<< endm;
533 }
else if(dbGainCorrection && !mmGainCorrection){
534 mGainCorrection = (fmsGainCorrection_st*) dbGainCorrection->GetTable();
535 mMaxGainCorrection = dbGainCorrection->GetNRows();
536 mmGainCorrection =
new fmsGainCorrection_st* [mMaxDetectorId+1]();
538 for(Int_t i=0; i<mMaxGainCorrection; i++){
539 Int_t d=mGainCorrection[i].detectorId;
540 Int_t c=mGainCorrection[i].ch;
541 if(d<0 || d>mMaxDetectorId){
542 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorrection detectorId="<<d<<
" exceed max="<<mMaxDetectorId<<endm;
546 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorrection invalid max number of channel = "<<
maxChannel(d)
547 <<
"for det="<<d<<endm;
551 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorrection ch="<<c<<
" exceed max="<<
maxChannel(d)<<endm;
554 if(mmGainCorrection[d]==0){
555 mmGainCorrection[d] =
new fmsGainCorrection_st [
maxChannel(d)]();
558 if(mmGainCorrection[d][c-1].ch==0){
559 memcpy(&mmGainCorrection[d][c-1],&mGainCorrection[i],
sizeof(fmsGainCorrection_st));
561 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorr detectorId="<<d<<
" ch="<<c<<
" double entry, skipping"<<endm;
563 if(mForceUniformGainCorrection>0.0){
566 LOG_INFO <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorrection overwritten to uniform value="<<mForceUniformGainCorrection<<endm;
569 mmGainCorrection[d][c-1].corr=mForceUniformGainCorrection;
572 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fmsGainCorrection with mMaxGainCorrection = "<<mMaxGainCorrection<< endm;
574 if(mReadGainCorrFile){
575 LOG_INFO <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorr will be overwritten by FmsGainCorr.txt"<<endm;
576 FILE* f=fopen(
"FmsGainCorr.txt",
"r");
578 LOG_INFO<<
"Failed to open FmsGainCorr.txt"<<endm;
582 while(fscanf(f,
"%d %d %d %f",&ew,&nstb,&ch,&corr)!=EOF){
586 mmGainCorrection[dd][ch-1].corr=corr;
590 LOG_INFO <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsGainCorr was overwritten by FmsGainCorr.txt"<<endm;
595 mmBitShiftGain =
new fmsBitShiftGain_st* [mMaxDetectorId+1]();
596 if(dbBitShiftGainB!=0){
597 mBitShiftGainB = (fmsBitShiftGainB_st*) dbBitShiftGainB->GetTable();
598 mMaxBitShiftGain = dbBitShiftGainB->GetNRows();
599 if(mMaxBitShiftGain==1){
601 for(Int_t i=0; i<2500; i++){
602 Int_t d=mBitShiftGainB[0].detectorId[i];
603 Int_t c=mBitShiftGainB[0].ch[i];
604 if(d==0 && c==0)
continue;
605 if(d<0 || d>mMaxDetectorId){
606 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsBitShiftGainB detectorId="<<d<<
" exceed max = "<<mMaxDetectorId<<endm;
610 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsBitShiftGainB invalid max number of channel = "<<
maxChannel(d)
611 <<
"for det="<<d<<endm;
615 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsBitShiftGainB detectorId="<<d<<
" ch="<<c<<
" exceed max = "<<
maxChannel(d)<<endm;
618 if(mmBitShiftGain[d]==0){
619 mmBitShiftGain[d] =
new fmsBitShiftGain_st [
maxChannel(d)]();
622 if(mmBitShiftGain[d][c-1].ch==0){
624 mmBitShiftGain[d][c-1].detectorId=d;
625 mmBitShiftGain[d][c-1].ch=c;
626 mmBitShiftGain[d][c-1].bitshift=mBitShiftGainB[0].bitshift[i];;
628 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsBitShiftGainB detectorId="<<d<<
" ch="<<c<<
" double entry, skipping"<<endm;
630 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Calibration/fms/fmsBitShiftGainB with mMaxBitShiftGain = "<<mMaxBitShiftGain<< endm;
633 }
else if(!mmBitShiftGain && dbBitShiftGain){
634 mBitShiftGain = (fmsBitShiftGain_st*) dbBitShiftGain->GetTable();
635 mMaxBitShiftGain = dbBitShiftGain->GetNRows();
636 for(Int_t i=0; i<mMaxBitShiftGain; i++){
637 Int_t d=mBitShiftGain[i].detectorId;
638 Int_t c=mBitShiftGain[i].ch;
639 if(d<0 || d>mMaxDetectorId){
640 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsBitShiftGain detectorId="<<d<<
" exceed max = "<<mMaxDetectorId<<endm;
644 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsBitShiftGain invalid max number of channel = "<<
maxChannel(d)
645 <<
"for det="<<d<<endm;
649 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsBitShiftGain detectorId="<<d<<
" ch="<<c<<
" exceed max = "<<
maxChannel(d)<<endm;
652 if(mmBitShiftGain[d]==0){
653 mmBitShiftGain[d] =
new fmsBitShiftGain_st [
maxChannel(d)]();
656 if(mmBitShiftGain[d][c-1].ch==0){
657 memcpy(&mmBitShiftGain[d][c-1],&mBitShiftGain[i],
sizeof(fmsBitShiftGain_st));
659 LOG_ERROR <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsBitShiftGain detectorId="<<d<<
" ch="<<c<<
" double entry, skipping"<<endm;
662 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Calibration/fms/fmsBitShiftGain with mMaxBitShiftGain = "<<mMaxBitShiftGain<< endm;
665 mmBitShiftGain[d] =
new fmsBitShiftGain_st [
maxChannel(d)]();
667 mmBitShiftGain[d][c-1].detectorId=d;
668 mmBitShiftGain[d][c-1].ch=c;
669 mmBitShiftGain[d][c-1].bitshift=0;
672 LOG_INFO <<
"StFmsDbMaker::InitRun - Found no Calibration/fms/fmsBitShiftGain or B, defaulted to zero"<<endm;
674 if(mForceUniformGain>0.0){
679 LOG_INFO <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsBitShiftGain overwritten to uniform value="<<mForceUniformBitShiftGain<<endm;
682 mmBitShiftGain[d][c-1].bitshift=mForceUniformBitShiftGain;
686 if(mReadBitShiftGainFile){
687 LOG_INFO <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsBitShiftGain oe B will be overwritten by FmsBitShiftGain.txt"<<endm;
688 FILE* f=fopen(
"FmsBitShiftGain.txt",
"r");
690 LOG_INFO<<
"Failed to open FmsBitShiftGain.txt"<<endm;
693 while(fscanf(f,
"%d %d %d %d",&ew,&nstb,&ch,&gain)!=EOF){
697 mmBitShiftGain[dd][ch-1].bitshift=gain;
701 LOG_INFO <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsBitShiftGain or B was overwritten by FmsBitShiftGain.txt"<<endm;
707 fill_n(&mTimeDep[0][0][0],mFmsTimeDepMaxTimeSlice*mFmsTimeDepMaxDet*mFmsTimeDepMaxCh,1.0);
708 memset(mTimeDepEvt,0,
sizeof(mTimeDepEvt));
710 mTimeDepCorr = (fmsTimeDepCorr_st*) dbTimeDepCorr->GetTable();
712 int nrow = dbTimeDepCorr->GetNRows();
714 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Calibration/fms/fmsTimeDepCorr should have 1 row only, but found "
715 << nrow <<
" rows. No TimeDepCorr"<<endm;
717 int t=0, ndata=0, keepch=0, keept=0;
718 for(Int_t i=0; i<mFmsTimeDepMaxData; i++){
719 Int_t d=mTimeDepCorr[0].detectorId[i];
720 Int_t c=mTimeDepCorr[0].ch[i];
721 Int_t e=mTimeDepCorr[0].endEvent[i];
722 Float_t v=mTimeDepCorr[0].corr[i];
725 mTimeDep[t][d][c-1]=v;
728 }
else if(d==0 && c==0 && e==0){
731 if(c!=keepch) keept=0;
732 for(
int tt=keept; tt<mMaxTimeSlice; tt++){
733 if(e>=mTimeDepEvt[tt]) {mTimeDep[tt][d][c-1]=v;}
734 else {keept=tt;
break;}
740 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fmsTimeDepCorr with "<<ndata<<
" lines abd "<<mMaxTimeSlice<<
" timeslices"<<endm;
748 if(mReadRecParam==0){
749 mRecPar = (fmsRec_st*)dbRec->GetTable();
750 mRecConfig.readMap(*mRecPar);
751 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Calibration/fms/fmsRec "<< endm;
753 mRecConfig.fillMap(
"fmsrecpar.txt");
754 LOG_INFO <<
"StFmsDbMaker::InitRun - read fmsrecpar.txt for FmsRec table! "<< endm;
759 fpsConstant_st *tFpsConstant = 0;
760 tFpsConstant = (fpsConstant_st*) dbFpsConstant->GetTable();
761 mFpsConstant =
new fpsConstant_st;
762 memcpy(mFpsConstant,tFpsConstant,
sizeof(fpsConstant_st));
763 mFpsMaxSlatId=
fpsNQuad()*fpsNLayer()*fpsMaxSlat();
764 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fpsConstant maxSlatId="<<mFpsMaxSlatId<<endm;
767 int mI=0, mQ = 0, mL=0, mS=0;
769 if(dbFpsChannelGeometry){
770 fpsChannelGeometry_st *tFpsChannelGeometry = 0;
771 tFpsChannelGeometry = (fpsChannelGeometry_st*) dbFpsChannelGeometry->GetTable();
772 max = dbFpsChannelGeometry->GetNRows();
773 for(Int_t i=0; i<max; i++){
774 if(mQ < tFpsChannelGeometry[i].quad) mQ=tFpsChannelGeometry[i].quad;
775 if(mL < tFpsChannelGeometry[i].layer) mL=tFpsChannelGeometry[i].layer;
777 if(mQ>
fpsNQuad()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsChannelGeometry has more quad than fpsConstant"<<endm;
778 if(mL>fpsNLayer()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsChannelGeometry has more layer than fpsConstant"<<endm;
779 mFpsChannelGeometry =
new fpsChannelGeometry_st*[
fpsNQuad()]();
780 for(
int i=0; i<
fpsNQuad(); i++) mFpsChannelGeometry[i]=
new fpsChannelGeometry_st[fpsNLayer()]();
781 for(Int_t i=0; i<max; i++){
782 memcpy(&mFpsChannelGeometry[tFpsChannelGeometry[i].quad-1][tFpsChannelGeometry[i].layer-1],
783 &tFpsChannelGeometry[i],
sizeof(fpsChannelGeometry_st));
785 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fpsChannelGeometry with maxQuad="<<mQ<<
" and maxLayer="<<mL<<endm;
790 fpsSlatId_st *tFpsSlatId = 0;
791 tFpsSlatId = (fpsSlatId_st*) dbFpsSlatId->GetTable();
792 max = dbFpsSlatId->GetNRows();
793 mI=0; mQ=0; mL=0; mS=0;
794 for(Int_t i=0; i<max; i++){
795 if(mI < tFpsSlatId[i].slatid) mI=tFpsSlatId[i].slatid;
796 if(mQ < tFpsSlatId[i].quad) mQ=tFpsSlatId[i].quad;
797 if(mL < tFpsSlatId[i].layer) mL=tFpsSlatId[i].layer;
798 if(mS < tFpsSlatId[i].slat) mS=tFpsSlatId[i].slat;
800 if(max>fpsMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsSlatId has more row than fpsConstant"<<endm;
801 if(mI>fpsMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsSlatId has more slatId than fpsConstant"<<endm;
802 if(mQ>
fpsNQuad()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsSlatId has more quad than fpsConstant"<<endm;
803 if(mL>fpsNLayer()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsSlatId has more layer than fpsConstant"<<endm;
804 if(mS>fpsMaxSlat()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsSlatId has more slat than fpsConstant"<<endm;
805 mFpsSlatId =
new fpsSlatId_st[max];
806 mFpsReverseSlatId =
new int**[
fpsNQuad()]();
808 mFpsReverseSlatId[i] =
new int*[fpsNLayer()]();
809 for(
int j=0; j<fpsNLayer(); j++) {
810 mFpsReverseSlatId[i][j] =
new int[fpsMaxSlat()]();
811 for(
int k=0; k<fpsMaxSlat(); k++) mFpsReverseSlatId[i][j][k]=-1;
814 for(Int_t i=0; i<max; i++){
815 memcpy(&mFpsSlatId[tFpsSlatId[i].slatid],&tFpsSlatId[i],
sizeof(fpsSlatId_st));
816 if(tFpsSlatId[i].quad>0 && tFpsSlatId[i].layer>0 && tFpsSlatId[i].slat>0){
817 mFpsReverseSlatId[tFpsSlatId[i].quad-1][tFpsSlatId[i].layer-1][tFpsSlatId[i].slat-1]=tFpsSlatId[i].slatid;
820 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fpsSlatId with max slat Id="<<max<<endm;
825 fpsPosition_st *tFpsPosition = 0;
826 tFpsPosition = (fpsPosition_st*) dbFpsPosition->GetTable();
827 max = dbFpsPosition->GetNRows();
829 for(Int_t i=0; i<max; i++){
830 if(mI < tFpsPosition[i].slatid) mI=tFpsPosition[i].slatid;
832 if(max>fpsMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsPosition has more row than fpsConstant"<<endm;
833 if( mI>fpsMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsPosition has more slatId than fpsConstant"<<endm;
834 mFpsPosition =
new fpsPosition_st[max]();
836 for(Int_t i=0; i<max; i++){
837 if(tFpsPosition[i].slatid==0 && tFpsPosition[i].xoffset==0.0 && tFpsPosition[i].yoffset==0.0)
continue;
838 memcpy(&mFpsPosition[tFpsPosition[i].slatid],&tFpsPosition[i],
sizeof(fpsPosition_st));
840 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fpsPosition with max slat Id="<<max<<endm;
845 fpsMap_st *tFpsMap = 0;
846 tFpsMap = (fpsMap_st*) dbFpsMap->GetTable();
847 max = dbFpsMap->GetNRows();
848 if(max>fpsMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsMap has more slatId than fpsConstant"<<endm;
849 int mA = 0, mC=0; mI=0;
850 for(Int_t i=0; i<max; i++){
851 if(mI < tFpsMap[i].slatid) mI=tFpsMap[i].slatid;
852 if(mA < tFpsMap[i].QTaddr) mA=tFpsMap[i].QTaddr;
853 if(mC < tFpsMap[i].QTch) mC=tFpsMap[i].QTch;
855 if(max>fpsMaxSlat()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsMap has more row than fpsConstant"<<endm;
856 if(mI >fpsMaxSlat()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsMap has more slatid than fpsConstant"<<endm;
857 if(mA>=fpsMaxQTaddr()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsMap has more QTaddr"<<endm;
858 if(mC>=fpsMaxQTch()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsMap has more QTch"<<endm;
859 mFpsMap =
new fpsMap_st[max];
860 mFpsReverseMap =
new int*[fpsMaxQTaddr()]();
861 for(
int i=0; i<fpsMaxQTaddr(); i++) {
862 mFpsReverseMap[i] =
new int[fpsMaxQTch()];
863 for(
int j=0; j<fpsMaxQTch(); j++) mFpsReverseMap[i][j]=-1;
865 for(Int_t i=0; i<max; i++){
866 memcpy(&mFpsMap[tFpsMap[i].slatid],&tFpsMap[i],
sizeof(fpsMap_st));
867 if(tFpsMap[i].QTaddr>=0 && tFpsMap[i].QTch>=0)
868 mFpsReverseMap[tFpsMap[i].QTaddr][tFpsMap[i].QTch]=tFpsMap[i].slatid;
870 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fpsMap with max slat Id="<<max<<endm;
875 fpsGain_st *tFpsGain = 0;
876 tFpsGain = (fpsGain_st*) dbFpsGain->GetTable();
877 max = dbFpsGain->GetNRows();
879 for(Int_t i=0; i<max; i++){
880 if(mI < tFpsGain[i].slatid) mI=tFpsGain[i].slatid;
882 if(max>fpsMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsGain has more row than fpsConstant"<<endm;
883 if(mI >fpsMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsGain has more slatId than fpsConstant"<<endm;
884 mFpsGain =
new fpsGain_st[max]();
886 for(Int_t i=0; i<max; i++){
887 memcpy(&mFpsGain[tFpsGain[i].slatid],&tFpsGain[i],
sizeof(fpsGain_st));
889 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Calibration/fms/fpsGain with max slat Id="<<max<<endm;
894 fpsStatus_st *tFpsStatus = 0;
895 tFpsStatus = (fpsStatus_st*) dbFpsStatus->GetTable();
896 max = dbFpsStatus->GetNRows();
898 for(Int_t i=0; i<max; i++){
899 if(mI < tFpsStatus[i].slatid) mI=tFpsStatus[i].slatid;
901 if(max>fpsMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsStatus has more row than fpsConstant"<<endm;
902 if(mI >fpsMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpsStatus has more slatId than fpsConstant"<<endm;
903 mFpsStatus =
new fpsStatus_st[max]();
905 for(Int_t i=0; i<max; i++){
906 memcpy(&mFpsStatus[tFpsStatus[i].slatid],&tFpsStatus[i],
sizeof(fpsStatus_st));
908 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Calibration/fms/fpsStatus with max slat Id="<<max<<endm;
913 fpostConstant_st *tFpostConstant = 0;
914 tFpostConstant = (fpostConstant_st*) dbFpostConstant->GetTable();
915 mFpostConstant =
new fpostConstant_st;
916 memcpy(mFpostConstant,tFpostConstant,
sizeof(fpostConstant_st));
917 mFpostMaxSlatId=
fpostNQuad()*fpostNLayer()*fpostMaxSlat();
918 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fpostConstant maxSlatId="<<mFpostMaxSlatId<<endm;
921 mI=0; mQ=0; mL=0; mS=0;
923 if(dbFpostChannelGeometry){
924 fpostChannelGeometry_st *tFpostChannelGeometry = 0;
925 tFpostChannelGeometry = (fpostChannelGeometry_st*) dbFpostChannelGeometry->GetTable();
926 max = dbFpostChannelGeometry->GetNRows();
927 for(Int_t i=0; i<max; i++){
928 if(mQ < tFpostChannelGeometry[i].quad) mQ=tFpostChannelGeometry[i].quad;
929 if(mL < tFpostChannelGeometry[i].layer) mL=tFpostChannelGeometry[i].layer;
931 if(mQ>
fpostNQuad()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostChannelGeometry has more quad than fpostConstant"<<endm;
932 if(mL>fpostNLayer()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostChannelGeometry has more layer than fpostConstant"<<endm;
933 mFpostChannelGeometry =
new fpostChannelGeometry_st*[
fpostNQuad()]();
934 for(
int i=0; i<
fpostNQuad(); i++) mFpostChannelGeometry[i]=
new fpostChannelGeometry_st[fpostNLayer()]();
935 for(Int_t i=0; i<max; i++){
936 memcpy(&mFpostChannelGeometry[tFpostChannelGeometry[i].quad-1][tFpostChannelGeometry[i].layer-1],
937 &tFpostChannelGeometry[i],
sizeof(fpostChannelGeometry_st));
939 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fpostChannelGeometry with maxQuad="<<mQ<<
" and maxLayer="<<mL<<endm;
944 fpostSlatId_st *tFpostSlatId = 0;
945 tFpostSlatId = (fpostSlatId_st*) dbFpostSlatId->GetTable();
946 max = dbFpostSlatId->GetNRows();
947 mI=0; mQ=0; mL=0; mS=0;
948 for(Int_t i=0; i<max; i++){
949 if(mI < tFpostSlatId[i].slatid) mI=tFpostSlatId[i].slatid;
950 if(mQ < tFpostSlatId[i].quad) mQ=tFpostSlatId[i].quad;
951 if(mL < tFpostSlatId[i].layer) mL=tFpostSlatId[i].layer;
952 if(mS < tFpostSlatId[i].slat) mS=tFpostSlatId[i].slat;
954 if(max>fpostMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostSlatId has more row than fpostConstant"<<endm;
955 if(mI>fpostMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostSlatId has more slatId than fpostConstant"<<endm;
956 if(mQ>
fpostNQuad()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostSlatId has more quad than fpostConstant"<<endm;
957 if(mL>fpostNLayer()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostSlatId has more layer than fpostConstant"<<endm;
958 if(mS>fpostMaxSlat()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostSlatId has more slat than fpostConstant"<<endm;
959 mFpostSlatId =
new fpostSlatId_st[max];
960 mFpostReverseSlatId =
new int**[
fpostNQuad()]();
962 mFpostReverseSlatId[i] =
new int*[fpostNLayer()]();
963 for(
int j=0; j<fpostNLayer(); j++) {
964 mFpostReverseSlatId[i][j] =
new int[fpostMaxSlat()]();
965 for(
int k=0; k<fpostMaxSlat(); k++) mFpostReverseSlatId[i][j][k]=-1;
968 for(Int_t i=0; i<max; i++){
969 memcpy(&mFpostSlatId[tFpostSlatId[i].slatid],&tFpostSlatId[i],
sizeof(fpostSlatId_st));
970 if(tFpostSlatId[i].quad>0 && tFpostSlatId[i].layer>0 && tFpostSlatId[i].slat>0){
971 mFpostReverseSlatId[tFpostSlatId[i].quad-1][tFpostSlatId[i].layer-1][tFpostSlatId[i].slat-1]=tFpostSlatId[i].slatid;
974 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fpostSlatId with max slat Id="<<max<<endm;
979 fpostPosition_st *tFpostPosition = 0;
980 tFpostPosition = (fpostPosition_st*) dbFpostPosition->GetTable();
981 max = dbFpostPosition->GetNRows();
983 for(Int_t i=0; i<max; i++){
984 if(mI < tFpostPosition[i].slatid) mI=tFpostPosition[i].slatid;
986 if(max>fpostMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostPosition has more row than fpostConstant"<<endm;
987 if( mI>fpostMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostPosition has more slatId than fpostConstant"<<endm;
988 mFpostPosition =
new fpostPosition_st[max]();
990 for(Int_t i=0; i<max; i++){
991 if(tFpostPosition[i].slatid==0 && tFpostPosition[i].xoffset==0.0 && tFpostPosition[i].yoffset==0.0)
continue;
992 memcpy(&mFpostPosition[tFpostPosition[i].slatid],&tFpostPosition[i],
sizeof(fpostPosition_st));
994 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fpostPosition with max slat Id="<<max<<endm;
999 fpostMap_st *tFpostMap = 0;
1000 tFpostMap = (fpostMap_st*) dbFpostMap->GetTable();
1001 max = dbFpostMap->GetNRows();
1002 if(max>fpostMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostMap has more slatId than fpostConstant"<<endm;
1003 int mA = 0, mC=0; mI=0;
1004 for(Int_t i=0; i<max; i++){
1005 if(mI < tFpostMap[i].slatid) mI=tFpostMap[i].slatid;
1006 if(mA < tFpostMap[i].QTaddr) mA=tFpostMap[i].QTaddr;
1007 if(mC < tFpostMap[i].QTch) mC=tFpostMap[i].QTch;
1009 if(max>fpostMaxSlat()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostMap has more row than fpostConstant"<<endm;
1010 if(mI >fpostMaxSlat()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostMap has more slatid than fpostConstant"<<endm;
1011 if(mA>=fpostMaxQTaddr()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostMap has more QTaddr"<<endm;
1012 if(mC>=fpostMaxQTch()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostMap has more QTch"<<endm;
1013 mFpostMap =
new fpostMap_st[max];
1014 mFpostReverseMap =
new int*[fpostMaxQTaddr()]();
1015 for(
int i=0; i<fpostMaxQTaddr(); i++) {
1016 mFpostReverseMap[i] =
new int[fpostMaxQTch()];
1017 for(
int j=0; j<fpostMaxQTch(); j++) mFpostReverseMap[i][j]=-1;
1019 for(Int_t i=0; i<max; i++){
1020 memcpy(&mFpostMap[tFpostMap[i].slatid],&tFpostMap[i],
sizeof(fpostMap_st));
1021 if(tFpostMap[i].QTaddr>=0 && tFpostMap[i].QTch>=0)
1022 mFpostReverseMap[tFpostMap[i].QTaddr][tFpostMap[i].QTch]=tFpostMap[i].slatid;
1024 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Geometry/fms/fpostMap with max slat Id="<<max<<endm;
1029 fpostGain_st *tFpostGain = 0;
1030 tFpostGain = (fpostGain_st*) dbFpostGain->GetTable();
1031 max = dbFpostGain->GetNRows();
1033 for(Int_t i=0; i<max; i++){
1034 if(mI < tFpostGain[i].slatid) mI=tFpostGain[i].slatid;
1036 if(max>fpostMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostGain has more row than fpostConstant"<<endm;
1037 if(mI >fpostMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostGain has more slatId than fpostConstant"<<endm;
1038 mFpostGain =
new fpostGain_st[max]();
1040 for(Int_t i=0; i<max; i++){
1041 memcpy(&mFpostGain[tFpostGain[i].slatid],&tFpostGain[i],
sizeof(fpostGain_st));
1043 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Calibration/fms/fpostGain with max slat Id="<<max<<endm;
1048 fpostStatus_st *tFpostStatus = 0;
1049 tFpostStatus = (fpostStatus_st*) dbFpostStatus->GetTable();
1050 max = dbFpostStatus->GetNRows();
1052 for(Int_t i=0; i<max; i++){
1053 if(mI < tFpostStatus[i].slatid) mI=tFpostStatus[i].slatid;
1055 if(max>fpostMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostStatus has more row than fpostConstant"<<endm;
1056 if(mI >fpostMaxSlatId()) LOG_WARN <<
"StFmsDbMaker::InitRun - fpostStatus has more slatId than fpostConstant"<<endm;
1057 mFpostStatus =
new fpostStatus_st[max]();
1059 for(Int_t i=0; i<max; i++){
1060 memcpy(&mFpostStatus[tFpostStatus[i].slatid],&tFpostStatus[i],
sizeof(fpostStatus_st));
1062 LOG_DEBUG <<
"StFmsDbMaker::InitRun - Got Calibration/fms/fpostStatus with max slat Id="<<max<<endm;
1068 dumpFmsDetectorPosition();
1070 dumpFmsPatchPanelMap();
1073 dumpFmsGainCorrection();
1074 dumpFmsBitShiftGain();
1075 if(dbTimeDepCorr) dumpFmsTimeDepCorr();
1077 if(dbFpsConstant) dumpFpsConstant();
1078 if(dbFpsChannelGeometry) dumpFpsChannelGeometry();
1079 if(dbFpsSlatId) dumpFpsSlatId();
1080 if(dbFpsPosition) dumpFpsPosition();
1081 if(dbFpsMap) dumpFpsMap();
1082 if(dbFpsGain) dumpFpsGain();
1083 if(dbFpsStatus) dumpFpsStatus();
1084 if(dbFpostConstant) dumpFpostConstant();
1085 if(dbFpostChannelGeometry) dumpFpostChannelGeometry();
1086 if(dbFpostSlatId) dumpFpostSlatId();
1087 if(dbFpostPosition) dumpFpostPosition();
1088 if(dbFpostMap) dumpFpostMap();
1089 if(dbFpostGain) dumpFpostGain();
1090 if(dbFpostStatus) dumpFpostStatus();
1095 StFmsDbConfig& StFmsDbMaker::getRecConfig(){
return mRecConfig; }
1097 void StFmsDbMaker::deleteArrays(){
1098 if(mChannelGeometry)
delete [] mChannelGeometry;
1099 if(mDetectorPosition)
delete [] mDetectorPosition;
1101 for(Int_t d=0; d<=mMaxDetectorId; d++){
1102 if(mmMap[d])
delete [] mmMap[d];
1107 for(Int_t d=0; d<=mMaxDetectorId; d++){
1108 if(mmGain[d])
delete [] mmGain[d];
1112 if(mmGainCorrection){
1113 for(Int_t d=0; d<=mMaxDetectorId; d++){
1114 if(mmGainCorrection[d])
delete [] mmGainCorrection[d];
1116 delete [] mmGainCorrection;
1119 for(Int_t d=0; d<=mMaxDetectorId; d++){
1120 if(mmBitShiftGain[d])
delete [] mmBitShiftGain[d];
1122 delete [] mmBitShiftGain;
1125 if(mFpsGain)
delete [] mFpsGain;
1126 if(mFpsStatus)
delete [] mFpsStatus;
1129 if(mFpsReverseMap[i])
delete [] mFpsReverseMap[i];
1131 delete [] mFpsReverseMap;
1133 if(mFpsMap)
delete [] mFpsMap;
1134 if(mFpsPosition)
delete [] mFpsPosition;
1135 if(mFpsReverseSlatId){
1137 if(mFpsReverseSlatId[i]){
1138 for(Int_t j=0; j<fpsNLayer(); j++){
1139 if(mFpsReverseSlatId[i][j])
delete [] mFpsReverseSlatId[i][j];
1141 delete [] mFpsReverseSlatId[i];
1144 delete [] mFpsReverseSlatId;
1146 if(mFpsSlatId)
delete [] mFpsSlatId;
1147 if(mFpsChannelGeometry) {
1149 if(mFpsChannelGeometry[d])
delete [] mFpsChannelGeometry[d];
1151 delete [] mFpsChannelGeometry;
1153 if(mFpsConstant)
delete mFpsConstant;
1155 if(mFpostGain)
delete [] mFpostGain;
1156 if(mFpostStatus)
delete [] mFpostStatus;
1157 if(mFpostReverseMap){
1159 if(mFpostReverseMap[i])
delete [] mFpostReverseMap[i];
1161 delete [] mFpostReverseMap;
1163 if(mFpostMap)
delete [] mFpostMap;
1164 if(mFpostPosition)
delete [] mFpostPosition;
1165 if(mFpostReverseSlatId){
1167 if(mFpostReverseSlatId[i]){
1168 for(Int_t j=0; j<fpostNLayer(); j++){
1169 if(mFpostReverseSlatId[i][j])
delete [] mFpostReverseSlatId[i][j];
1171 delete [] mFpostReverseSlatId[i];
1174 delete [] mFpostReverseSlatId;
1176 if(mFpostSlatId)
delete [] mFpostSlatId;
1177 if(mFpostChannelGeometry) {
1179 if(mFpostChannelGeometry[d])
delete [] mFpostChannelGeometry[d];
1181 delete [] mFpostChannelGeometry;
1183 if(mFpostConstant)
delete mFpostConstant;
1204 return getStarXYZ(hit->detectorId(),hit->channel());
1209 return getStarXYZ(detectorId,
float(FmsX),
float(FmsY));
1214 Float_t x = 0.0, y=0.0, z=0.0;
1216 if(mPositionModel==0){
1219 x = mDetectorPosition[
detectorId].xoffset - FmsX;
1221 x = mDetectorPosition[
detectorId].xoffset + FmsX;
1223 y = FmsY - mDetectorPosition[
detectorId].yoffset;
1226 float x1=0.0,x2=0.0,y1=0.0,y2=0.0;
1233 float dy = 1.0-(ly-r);
1234 if(mPositionModel==1) {getCellPosition2015pp(detectorId-7,r,c,x1,y1,x2,y2,z);}
1235 else if(mPositionModel==2) {getCellPosition2015pA(detectorId-7,r,c,x1,y1,x2,y2,z);}
1236 else if(mPositionModel==3) {getCellPosition2017(detectorId-7,r,c,x1,y1,x2,y2,z);}
1237 else { LOG_ERROR << Form(
"mPositionModel=%d is not valid!",mPositionModel) <<endm;}
1238 x = x1*(1.0-dx) + x2*dx;
1239 y = y1*(1.0-dy) + y2*dy;
1241 if( ( detectorId<=9 && fabs(x)<40.0 && fabs(y)<40.0) ||
1242 ( detectorId>=10 && y>50.0) ){
1243 LOG_INFO << Form(
"Something wrong in getStarXYZ for det=%d",detectorId)<<endm;
1244 LOG_INFO << Form(
" getStarXYZ input XY=%f %f",FmsX,FmsY)<<endm;
1245 LOG_INFO << Form(
" getStarXYZ local XY=%f %f",lx,ly)<<endm;
1246 LOG_INFO << Form(
" getStarXYZ column/row=%d %d",c,r)<<endm;
1247 LOG_INFO << Form(
" getStarXYZ star XYZ=%f %f %f",x,y,z)<<endm;
1260 fmsMap_st* StFmsDbMaker::Map() {
return mMap;}
1261 fmsPatchPanelMap_st* StFmsDbMaker::PatchPanelMap() {
return mPatchPanelMap;}
1262 fmsQTMap_st* StFmsDbMaker::QTMap() {
return mQTMap;}
1263 fmsGain_st* StFmsDbMaker::Gain() {
return mGain;}
1264 fmsGainCorrection_st* StFmsDbMaker::GainCorrection() {
return mGainCorrection;}
1265 fmsRec_st* StFmsDbMaker::RecPar() {
return mRecPar;}
1266 fpsConstant_st* StFmsDbMaker::FpsConstant() {
return mFpsConstant;}
1267 fpsChannelGeometry_st** StFmsDbMaker::FpsChannelGeometry(){
return mFpsChannelGeometry;}
1268 fpsSlatId_st* StFmsDbMaker::FpsSlatId() {
return mFpsSlatId;}
1269 fpsPosition_st* StFmsDbMaker::FpsPosition() {
return mFpsPosition;}
1270 fpsMap_st* StFmsDbMaker::FpsMap() {
return mFpsMap;}
1271 fpsGain_st* StFmsDbMaker::FpsGain() {
return mFpsGain;}
1272 fpostConstant_st* StFmsDbMaker::FpostConstant() {
return mFpostConstant;}
1273 fpostChannelGeometry_st** StFmsDbMaker::FpostChannelGeometry(){
return mFpostChannelGeometry;}
1274 fpostSlatId_st* StFmsDbMaker::FpostSlatId() {
return mFpostSlatId;}
1275 fpostPosition_st* StFmsDbMaker::FpostPosition() {
return mFpostPosition;}
1276 fpostMap_st* StFmsDbMaker::FpostMap() {
return mFpostMap;}
1277 fpostGain_st* StFmsDbMaker::FpostGain() {
return mFpostGain;}
1282 if(detectorId>=0 && detectorId<=mMaxDetectorId &&
maxChannel(detectorId)>0)
return mChannelGeometry[
detectorId].ew;
1290 if(detectorId>=0 && detectorId<=mMaxDetectorId &&
maxChannel(detectorId)>0)
return mChannelGeometry[
detectorId].ns;
1298 if(detectorId>=kFmsNorthLargeDetId && detectorId<=kFmsSouthLargeDetId &&
maxChannel(detectorId)>0)
return 0;
1299 if(detectorId>=kFmsNorthSmallDetId && detectorId<=kFmsSouthSmallDetId &&
maxChannel(detectorId)>0)
return 1;
1305 if(detectorId>=0 && detectorId<=mMaxDetectorId &&
maxChannel(detectorId)>0)
return mChannelGeometry[
detectorId].type;
1313 if(detectorId>=0 && detectorId<=mMaxDetectorId &&
maxChannel(detectorId)>0)
return mChannelGeometry[
detectorId].nY;
1321 if(detectorId>=0 && detectorId<=mMaxDetectorId &&
maxChannel(detectorId)>0)
1330 if(detectorId>=0 && detectorId<=mMaxDetectorId &&
1331 mChannelGeometry[detectorId].nX>0 && mChannelGeometry[detectorId].nY>0)
1340 for(Int_t i=0; i<=mMaxDetectorId; i++)
1341 if((mChannelGeometry+i)){
1342 if(mChannelGeometry[i].ew == ew && mChannelGeometry[i].ns == ns && mChannelGeometry[i].type == type)
1343 return mChannelGeometry[i].detectorId;
1350 if(
maxChannel(detectorId)>0)
return mChannelGeometry[
detectorId].nY - (ch-1)/mChannelGeometry[detectorId].nX;
1365 if(detectorId>=0 && detectorId<=mMaxDetectorId &&
maxChannel(detectorId)>0)
1366 return StThreeVectorF(mDetectorPosition[detectorId].xoffset, mDetectorPosition[detectorId].yoffset, mDetectorPosition[detectorId].zoffset);
1371 if(detectorId>=0 && detectorId<=mMaxDetectorId)
1372 return mDetectorPosition[
detectorId].xwidth;
return -1;
1376 if(detectorId>=0 && detectorId<=mMaxDetectorId)
1377 return mDetectorPosition[
detectorId].ywidth;
return -1;
1382 void StFmsDbMaker::getMap(Int_t detectorId, Int_t ch, Int_t* qtCrate, Int_t* qtSlot, Int_t* qtChannel){
1383 if(detectorId<0 || detectorId>mMaxDetectorId || ch<1 || ch>
maxChannel(detectorId) || mmMap[detectorId]==0 ){
1384 *qtCrate=0; *qtSlot=0; *qtChannel=0;
1389 *qtChannel = mmMap[
detectorId][ch-1].qtChannel;
1392 void StFmsDbMaker::getReverseMap(Int_t qtCrate, Int_t qtSlot, Int_t qtChannel, Int_t* detectorId, Int_t* ch)
const
1394 if(qtCrate==0 && qtSlot==0 && qtChannel==0) {
1398 *detectorId = mReverseMapDetectorId[qtCrate][qtSlot][qtChannel];
1399 *ch = mReverseMapChannel[qtCrate][qtSlot][qtChannel];
1411 Int_t StFmsDbMaker::maxGainCorrection() {
return mMaxGainCorrection;}
1412 Int_t StFmsDbMaker::maxBitShiftGain() {
return mMaxBitShiftGain;}
1414 Float_t StFmsDbMaker::getGain(Int_t detectorId, Int_t ch)
const
1416 if(detectorId<0 || detectorId>mMaxDetectorId || ch<1 || ch>
maxChannel(detectorId) || mmGain[detectorId]==0)
return 0;
1422 if(detectorId<0 || detectorId>mMaxDetectorId || ch<1 || ch>
maxChannel(detectorId) || mmGainCorrection[detectorId]==0)
return 0;
1423 return mmGainCorrection[
detectorId][ch-1].corr;
1428 if(detectorId<0 || detectorId>mMaxDetectorId || ch<1 || ch>
maxChannel(detectorId) || mmBitShiftGain[detectorId]==0)
return 0;
1429 return mmBitShiftGain[
detectorId][ch-1].bitshift;
1436 return adc + (0x1<<bitshift);
1450 static int oldEvent=-1;
1451 static int timeslice=-1;
1452 if(mMaxTimeSlice<=0) {
1453 LOG_INFO <<
"getTimeDepCorr did not find time dependent correction, returning 1.0"<<endm;
1456 if(event!=oldEvent){
1457 for(
int i=0; i<mMaxTimeSlice; i++){
1458 if(event < mTimeDepEvt[i]) {timeslice=i;
break;}
1463 LOG_INFO << Form(
"getTimeDepCorr did not find time dependent correction for event=%d in %d time slices",event,mMaxTimeSlice)<<endm;
1466 return mTimeDep[timeslice][det][ch-1];
1473 LOG_INFO <<
"Writing "<<filename<<endm;
1474 if((fp=fopen(filename,
"w"))){
1476 fprintf(fp,
" i detiid ew ns type nRow nCol maxCh\n");
1477 for(Int_t i=0; i<mMaxDetectorId+1; i++){
1478 fprintf(fp,
"%5d%7d%4d%5d%5d%5d%5d%6d\n",
1482 for(Int_t i=0; i<mMaxDetectorId+1; i++){
1483 fprintf(fp,
"DetectorId=%d\n",i);
1484 fprintf(fp,
"detiid ch getCh getRow getCol\n");
1486 fprintf(fp,
"%6d%4d%8d%8d%7d\n",
1487 i,j,
getChannelNumber(i,
getRowNumber(i,j),
getColumnNumber(i,j)),
getRowNumber(i,j),
getColumnNumber(i,j));
1494 void StFmsDbMaker::dumpFmsDetectorPosition(
const Char_t* filename) {
1496 LOG_INFO <<
"Writing "<<filename<<endm;
1497 if((fp=fopen(filename,
"w"))){
1499 fprintf(fp,
" detiid zoffset xoffset yoffset xwidth ywidth\n");
1500 for(Int_t i=0; i<mMaxDetectorId+1; i++)
1501 if((mDetectorPosition+i))
1507 void StFmsDbMaker::dumpFmsMap(
const Char_t* filename) {
1509 LOG_INFO <<
"Writing "<<filename<<endm;
1510 if((fp=fopen(filename,
"w"))){
1511 fprintf(fp,
"maxMap = %d\n",
maxMap());
1512 fprintf(fp,
" i DetId ch crt slt qtch getmap() getReverseMap\n");
1513 for(Int_t i=0; i<mMaxMap; i++){
1514 Int_t d=mMap[i].detectorId;
1516 Int_t crt,slot,ch,dd,cc;
1517 getMap(d,c,&crt,&slot,&ch);
1518 getReverseMap(crt,slot,ch,&dd,&cc);
1519 fprintf(fp,
"%5d%6d%6d%5d%5d%5d%5d%5d%5d%5d%5d\n",
1520 i,d,c,mMap[i].qtCrate,mMap[i].qtSlot,mMap[i].qtChannel,crt,slot,ch,dd,cc);
1521 if(mMap[i].qtCrate>0 && (d-dd!=0 || c-cc!=0)) fprintf(fp,
"Problem in reverse map!\n");
1527 void StFmsDbMaker::dumpFmsPatchPanelMap(
const Char_t* filename) {
1529 LOG_INFO <<
"Writing "<<filename<<endm;
1530 if((fp=fopen(filename,
"w"))){
1531 fprintf(fp,
" mod channel ppPanel ppRow ppColumn\n");
1532 for(Int_t i=0; i<mMaxModule; i++)
1534 fprintf(fp,
"%5d%8d%8d%6d%9d\n",i+1,j+1,mPatchPanelMap[i].ppPanel[j],mPatchPanelMap[i].ppRow[j],mPatchPanelMap[i].ppColumn[j]);
1539 void StFmsDbMaker::dumpFmsQTMap(
const Char_t* filename) {
1541 LOG_INFO <<
"Writing "<<filename<<endm;
1542 if((fp=fopen(filename,
"w"))){
1543 fprintf(fp,
"ns ppPanel row column crate slot channel\n");
1544 for(Int_t ns=0; ns<2; ns++)
1545 for(Int_t pp=0; pp<2; pp++)
1546 for(Int_t row=0; row<20; row++)
1547 for(Int_t col=0; col<16; col++){
1548 if(mQTMap[ns].qtCrate[pp][row][col]==0 && mQTMap[ns].qtSlot[pp][row][col]==0 && mQTMap[ns].qtChannel[pp][row][col]==0)
1549 fprintf(fp,
"-1 -1 -1 -1 -1 -1 -1\n");
1551 fprintf(fp,
"%2d%8d%6d%7d%6d%5d%8d\n",ns+1, pp+1, row+1, col+1,mQTMap[ns].qtCrate[pp][row][col],mQTMap[ns].qtSlot[pp][row][col],
1552 mQTMap[ns].qtChannel[pp][row][col]);
1558 void StFmsDbMaker::dumpFmsGain(
const Char_t* filename) {
1560 LOG_INFO <<
"Writing "<<filename<<endm;
1561 if((fp=fopen(filename,
"w"))){
1562 fprintf(fp,
"maxGain = %d\n",
maxGain());
1563 fprintf(fp,
" i DetId ch gain\n");
1565 for(
int d=0; d<=mMaxDetectorId; d++){
1568 Int_t dd=mmGain[d][c].detectorId;
1569 Int_t cc=mmGain[d][c].ch;
1571 fprintf(fp,
"%5d%6d%6d%8.3f\n",
1572 i,dd,cc,getGain(d,cc));
1584 void StFmsDbMaker::dumpFmsGainCorrection(
const Char_t* filename) {
1586 LOG_INFO <<
"Writing "<<filename<<endm;
1587 if((fp=fopen(filename,
"w"))){
1588 fprintf(fp,
"maxGainCorrection = %d\n",maxGainCorrection());
1589 fprintf(fp,
" i DetId ch gain\n");
1591 for(
int d=0; d<=mMaxDetectorId; d++){
1592 if(mmGainCorrection[d]){
1594 Int_t dd=mmGainCorrection[d][c].detectorId;
1595 Int_t cc=mmGainCorrection[d][c].ch;
1597 fprintf(fp,
"%5d%6d%6d%8.3f\n",
1610 void StFmsDbMaker::dumpFmsBitShiftGain(
const Char_t* filename) {
1612 LOG_INFO <<
"Writing "<<filename<<endm;
1613 if((fp=fopen(filename,
"w"))){
1614 fprintf(fp,
"maxGain = %d\n",maxBitShiftGain());
1615 fprintf(fp,
" i DetId ch bitshiftgain\n");
1617 for(
int d=0; d<=mMaxDetectorId; d++){
1618 if(mmBitShiftGain[d]){
1620 Int_t dd=mmBitShiftGain[d][c].detectorId;
1621 Int_t cc=mmBitShiftGain[d][c].ch;
1623 fprintf(fp,
"%5d%6d%6d%4d\n",
1634 void StFmsDbMaker::dumpFmsTimeDepCorr(
const Char_t* filename) {
1636 LOG_INFO <<
"Writing "<<filename<<endm;
1637 if((fp=fopen(filename,
"w"))){
1638 fprintf(fp,
"maxTimeSlice = %d\n",mMaxTimeSlice);
1639 for(Int_t t=0; t<mMaxTimeSlice; t++){
1640 fprintf(fp,
"%3d %10d %6.3f\n",t,mTimeDepEvt[t],
getTimeDepCorr(mTimeDepEvt[t]-1,0,1));
1642 for(Int_t d=0; d<mFmsTimeDepMaxDet; d++){
1643 for(Int_t c=1; c<=mFmsTimeDepMaxCh; c++){
1644 fprintf(fp,
"%1d %3d :",d,c);
1645 for(Int_t t=0; t<mMaxTimeSlice; t++){
1646 fprintf(fp,
"%6.3f ",mTimeDep[t][d][c-1]);
1647 if(t%10==9) fprintf(fp,
"\n :");
1656 void StFmsDbMaker::dumpFmsRec(
const Char_t* filename) {
1657 LOG_INFO <<
"writing "<<filename<<endm;
1658 mRecConfig.writeMap(filename);
1663 Int_t StFmsDbMaker::fpsNLayer() {
if(mFpsConstant) {
return mFpsConstant->nLayer;}
else {
return 0;}}
1664 Int_t StFmsDbMaker::fpsMaxSlat() {
if(mFpsConstant) {
return mFpsConstant->maxSlat;}
else {
return 0;}}
1665 Int_t StFmsDbMaker::fpsMaxQTaddr() {
if(mFpsConstant) {
return mFpsConstant->maxQTaddr;}
else {
return 0;}}
1666 Int_t StFmsDbMaker::fpsMaxQTch() {
if(mFpsConstant) {
return mFpsConstant->maxQTch;}
else {
return 0;}}
1667 Int_t StFmsDbMaker::fpsMaxSlatId() {
if(mFpsConstant) {
return mFpsMaxSlatId;}
else {
return 0;}}
1669 Int_t StFmsDbMaker::fpsNSlat(
int quad,
int layer) {
1670 if(quad>0 && quad<=
fpsNQuad() && layer>0 && layer<=fpsNLayer())
return mFpsChannelGeometry[quad-1][layer-1].nslat;
1674 void StFmsDbMaker::fpsQLSfromSlatId(
int slatid,
int* quad,
int* layer,
int* slat){
1675 if(slatid>=0 && slatid<fpsMaxSlatId()){
1676 *quad =mFpsSlatId[slatid].quad;
1677 *layer=mFpsSlatId[slatid].layer;
1678 *slat =mFpsSlatId[slatid].slat;
1680 *quad=0; *layer=0; *slat=0;
1684 Int_t StFmsDbMaker::fpsSlatId(
int quad,
int layer,
int slat) {
1685 if(quad>0 && quad<=
fpsNQuad() && layer>0 && layer<=fpsNLayer() && slat>0 && slat<=fpsMaxSlat()){
1686 return mFpsReverseSlatId[quad-1][layer-1][slat-1];
1691 Int_t StFmsDbMaker::fpsSlatIdFromG2t(
int g2tvolid){
1692 int q = (g2tvolid/1000)%10;
1693 int l = (g2tvolid/100)%10;
1694 int s = g2tvolid%100;
1695 return fpsSlatId(q,l,s);
1698 void StFmsDbMaker::fpsPosition(
int slatid,
float xyz[3],
float dxyz[3]){
1699 if(slatid>=0 && slatid<fpsMaxSlatId()){
1700 xyz[0]=mFpsPosition[slatid].xoffset;
1701 xyz[1]=mFpsPosition[slatid].yoffset;
1702 xyz[2]=mFpsPosition[slatid].zoffset;
1703 dxyz[0]=mFpsPosition[slatid].xwidth;
1704 dxyz[1]=mFpsPosition[slatid].ywidth;
1705 dxyz[2]=mFpsPosition[slatid].zwidth;
1708 memset(xyz,0,
sizeof(*xyz));
1709 memset(dxyz,0,
sizeof(*dxyz));
1712 void StFmsDbMaker::fpsPosition(
int quad,
int layer,
int slat,
float xyz[3],
float dxyz[3]){
1713 fpsPosition(fpsSlatId(quad,layer,slat),xyz,dxyz);
1716 void StFmsDbMaker::fpsQTMap(
int slatid,
int* QTaddr,
int* QTch){
1717 if(slatid>=0 && slatid<fpsMaxSlatId()){
1718 *QTaddr=mFpsMap[slatid].QTaddr;
1719 *QTch=mFpsMap[slatid].QTch;
1726 Int_t StFmsDbMaker::fpsSlatidFromQT(
int QTaddr,
int QTch){
1727 if(QTaddr>=0 && QTaddr<fpsMaxQTaddr() && QTch>=0 && QTch<fpsMaxQTch()){
1728 return mFpsReverseMap[QTaddr][QTch];
1733 void StFmsDbMaker::fpsQLSFromQT(
int QTaddr,
int QTch,
int* quad,
int* layer,
int* slat){
1734 int slatid=fpsSlatidFromQT(QTaddr,QTch);
1735 fpsQLSfromSlatId(slatid,quad,layer,slat);
1738 Float_t StFmsDbMaker::fpsGain(
int slatid){
1739 if(slatid>=0 && slatid<fpsMaxSlatId())
return mFpsGain[slatid].MIP;
1743 Float_t StFmsDbMaker::fpsGain(
int quad,
int layer,
int slat){
1744 return fpsGain(fpsSlatId(quad,layer,slat));
1747 Float_t StFmsDbMaker::fpsMipSigma(
int slatid){
1748 if(slatid>=0 && slatid<fpsMaxSlatId())
return mFpsGain[slatid].Sigma;
1752 Float_t StFmsDbMaker::fpsMipSigma(
int quad,
int layer,
int slat){
1753 return fpsMipSigma(fpsSlatId(quad,layer,slat));
1756 Float_t StFmsDbMaker::fpsValley(
int slatid){
1757 if(slatid>=0 && slatid<fpsMaxSlatId())
return mFpsGain[slatid].Valley;
1761 Float_t StFmsDbMaker::fpsValley(
int quad,
int layer,
int slat){
1762 return fpsValley(fpsSlatId(quad,layer,slat));
1765 UShort_t StFmsDbMaker::fpsStatus(
int slatid){
1766 if(slatid>=0 && slatid<fpsMaxSlatId())
return mFpsStatus[slatid].status;
1770 UShort_t StFmsDbMaker::fpsStatus(
int quad,
int layer,
int slat){
1771 return fpsStatus(fpsSlatId(quad,layer,slat));
1774 void StFmsDbMaker::dumpFpsConstant(
const Char_t* filename){
1776 LOG_INFO <<
"Writing "<<filename<<endm;
1777 if((fp=fopen(filename,
"w"))){
1778 fprintf(fp,
"nQuad = %d\n",
fpsNQuad());
1779 fprintf(fp,
"nLayer = %d\n",fpsNLayer());
1780 fprintf(fp,
"maxSlat = %d\n",fpsMaxSlat());
1781 fprintf(fp,
"maxQTAddr = %d\n",fpsMaxQTaddr());
1782 fprintf(fp,
"maxQTch = %d\n",fpsMaxQTch());
1783 fprintf(fp,
"maxSlatId = %d\n",fpsMaxSlatId());
1788 void StFmsDbMaker::dumpFpsChannelGeometry (
const Char_t* filename){
1790 LOG_INFO <<
"Writing "<<filename<<endm;
1791 if((fp=fopen(filename,
"w"))){
1793 for(
int l=1; l<=fpsNLayer(); l++){
1794 fprintf(fp,
"Q=%1d L=%1d Nslat=%2d\n",q,l,fpsNSlat(q,l));
1801 void StFmsDbMaker::dumpFpsSlatId (
const Char_t* filename){
1803 LOG_INFO <<
"Writing "<<filename<<endm;
1804 if((fp=fopen(filename,
"w"))){
1805 for(
int i=0; i<fpsMaxSlatId(); i++){
1807 fpsQLSfromSlatId(i,&q,&l,&s);
1808 id=fpsSlatId(q,l,s);
1809 fprintf(fp,
"SlatId=%3d Q=%1d L=%1d S=%2d Reversemap=%3d\n",i,q,l,s,
id);
1810 if(i!=
id) fprintf(fp,
"Reversemap did not work!!!\n");
1816 void StFmsDbMaker::dumpFpsPosition(
const Char_t* filename){
1818 LOG_INFO <<
"Writing "<<filename<<endm;
1819 if((fp=fopen(filename,
"w"))){
1820 for(
int i=0; i<fpsMaxSlatId(); i++){
1823 fpsQLSfromSlatId(i,&q,&l,&s);
1824 fpsPosition(q,l,s,x,d);
1825 fprintf(fp,
"SlatId=%3d Q=%1d L=%1d S=%2d xyz=%8.3f %8.3f %8.3f dxyz=%8.3f %8.3f %8.3f\n",
1826 i,q,l,s,x[0],x[1],x[2],d[0],d[1],d[2]);
1832 void StFmsDbMaker::dumpFpsMap(
const Char_t* filename){
1834 LOG_INFO <<
"Writing "<<filename<<endm;
1835 if((fp=fopen(filename,
"w"))){
1836 fprintf(fp,
"SlatId ordered\n");
1837 for(
int i=0; i<fpsMaxSlatId(); i++){
1840 fpsQLSFromQT(a,c,&q,&l,&s);
1841 int id=fpsSlatId(q,l,s);
1842 fprintf(fp,
"SlatId=%3d Q=%1d L=%1d S=%2d QTAddr=%2d QTch=%2d\n",
1844 if(
id!=i) fprintf(fp,
"Reversemap did not work!!!\n");
1846 fprintf(fp,
"QT ordered\n");
1847 for(
int a=0; a<fpsMaxQTaddr(); a++){
1848 for(
int c=0; c<fpsMaxQTch(); c++){
1850 fpsQLSFromQT(a,c,&q,&l,&s);
1851 int id=fpsSlatId(q,l,s);
1852 fprintf(fp,
"QTAddr=%2d QTch=%2d SlatId=%3d Q=%1d L=%1d S=%2d\n",
1860 void StFmsDbMaker::dumpFpsGain(
const Char_t* filename){
1862 LOG_INFO <<
"Writing "<<filename<<endm;
1863 if((fp=fopen(filename,
"w"))){
1864 for(
int i=0; i<fpsMaxSlatId(); i++){
1866 fpsQLSfromSlatId(i,&q,&l,&s);
1867 float g = fpsGain(q,l,s);
1868 fprintf(fp,
"SlatId=%3d Q=%1d L=%1d S=%2d MIP=%8.3f\n",
1875 void StFmsDbMaker::dumpFpsStatus(
const Char_t* filename){
1877 LOG_INFO <<
"Writing "<<filename<<endm;
1878 if((fp=fopen(filename,
"w"))){
1879 for(
int i=0; i<fpsMaxSlatId(); i++){
1881 fpsQLSfromSlatId(i,&q,&l,&s);
1882 int g = fpsStatus(q,l,s);
1883 fprintf(fp,
"SlatId=%3d Q=%1d L=%1d S=%2d Status=%d\n",
1891 Int_t StFmsDbMaker::fpostNLayer() {
if(mFpostConstant) {
return mFpostConstant->nLayer;}
else {
return 0;}}
1892 Int_t StFmsDbMaker::fpostMaxSlat() {
if(mFpostConstant) {
return mFpostConstant->maxSlat;}
else {
return 0;}}
1893 Int_t StFmsDbMaker::fpostMaxQTaddr() {
if(mFpostConstant) {
return mFpostConstant->maxQTaddr;}
else {
return 0;}}
1894 Int_t StFmsDbMaker::fpostMaxQTch() {
if(mFpostConstant) {
return mFpostConstant->maxQTch;}
else {
return 0;}}
1895 Int_t StFmsDbMaker::fpostMaxSlatId() {
if(mFpostConstant) {
return mFpostMaxSlatId;}
else {
return 0;}}
1897 Int_t StFmsDbMaker::fpostNSlat(
int quad,
int layer) {
1898 if(quad>0 && quad<=
fpostNQuad() && layer>0 && layer<=fpostNLayer())
return mFpostChannelGeometry[quad-1][layer-1].nslat;
1902 void StFmsDbMaker::fpostQLSfromSlatId(
int slatid,
int* quad,
int* layer,
int* slat){
1903 if(slatid>=0 && slatid<fpostMaxSlatId()){
1904 *quad =mFpostSlatId[slatid].quad;
1905 *layer=mFpostSlatId[slatid].layer;
1906 *slat =mFpostSlatId[slatid].slat;
1908 *quad=0; *layer=0; *slat=0;
1912 Int_t StFmsDbMaker::fpostSlatId(
int quad,
int layer,
int slat) {
1913 if(quad>0 && quad<=
fpostNQuad() && layer>0 && layer<=fpostNLayer() && slat>0 && slat<=fpostMaxSlat()){
1914 return mFpostReverseSlatId[quad-1][layer-1][slat-1];
1919 Int_t StFmsDbMaker::fpostSlatIdFromG2t(
int g2tvolid){
1920 int q = (g2tvolid/1000)%10;
1921 int l = (g2tvolid/100)%10;
1922 int s = g2tvolid%100;
1923 return fpostSlatId(q,l,s);
1926 void StFmsDbMaker::fpostPosition(
int slatid,
float xyz[3],
float dxyz[3],
float *angle){
1927 if(slatid>=0 && slatid<fpostMaxSlatId()){
1928 xyz[0]=mFpostPosition[slatid].xoffset;
1929 xyz[1]=mFpostPosition[slatid].yoffset;
1930 xyz[2]=mFpostPosition[slatid].zoffset;
1931 dxyz[0]=mFpostPosition[slatid].length;
1932 dxyz[1]=mFpostPosition[slatid].width;
1933 dxyz[2]=mFpostPosition[slatid].thickness;
1934 *angle=mFpostPosition[slatid].angle_xy;
1937 memset(xyz,0,
sizeof(*xyz));
1938 memset(dxyz,0,
sizeof(*dxyz));
1942 void StFmsDbMaker::fpostPosition(
int quad,
int layer,
int slat,
float xyz[3],
float dxyz[3],
float* angle){
1943 fpostPosition(fpostSlatId(quad,layer,slat),xyz,dxyz,angle);
1946 void StFmsDbMaker::fpostQTMap(
int slatid,
int* QTaddr,
int* QTch){
1947 if(slatid>=0 && slatid<fpostMaxSlatId()){
1948 *QTaddr=mFpostMap[slatid].QTaddr;
1949 *QTch=mFpostMap[slatid].QTch;
1956 Int_t StFmsDbMaker::fpostSlatidFromQT(
int QTaddr,
int QTch){
1957 if(QTaddr>=0 && QTaddr<fpostMaxQTaddr() && QTch>=0 && QTch<fpostMaxQTch()){
1958 return mFpostReverseMap[QTaddr][QTch];
1963 void StFmsDbMaker::fpostQLSFromQT(
int QTaddr,
int QTch,
int* quad,
int* layer,
int* slat){
1964 int slatid=fpostSlatidFromQT(QTaddr,QTch);
1965 fpostQLSfromSlatId(slatid,quad,layer,slat);
1968 Float_t StFmsDbMaker::fpostGain(
int slatid){
1969 if(slatid>=0 && slatid<fpostMaxSlatId())
return mFpostGain[slatid].MIP;
1973 Float_t StFmsDbMaker::fpostGain(
int quad,
int layer,
int slat){
1974 return fpostGain(fpostSlatId(quad,layer,slat));
1977 Float_t StFmsDbMaker::fpostMipSigma(
int slatid){
1978 if(slatid>=0 && slatid<fpostMaxSlatId())
return mFpostGain[slatid].Sigma;
1982 Float_t StFmsDbMaker::fpostMipSigma(
int quad,
int layer,
int slat){
1983 return fpostMipSigma(fpostSlatId(quad,layer,slat));
1986 Float_t StFmsDbMaker::fpostValley(
int slatid){
1987 if(slatid>=0 && slatid<fpostMaxSlatId())
return mFpostGain[slatid].Valley;
1991 Float_t StFmsDbMaker::fpostValley(
int quad,
int layer,
int slat){
1992 return fpostValley(fpostSlatId(quad,layer,slat));
1995 UShort_t StFmsDbMaker::fpostStatus(
int slatid){
1996 if(slatid>=0 && slatid<fpostMaxSlatId())
return mFpostStatus[slatid].status;
2000 UShort_t StFmsDbMaker::fpostStatus(
int quad,
int layer,
int slat){
2001 return fpostStatus(fpostSlatId(quad,layer,slat));
2004 void StFmsDbMaker::dumpFpostConstant(
const Char_t* filename){
2006 LOG_INFO <<
"Writing "<<filename<<endm;
2007 if((fp=fopen(filename,
"w"))){
2009 fprintf(fp,
"nLayer = %d\n",fpostNLayer());
2010 fprintf(fp,
"maxSlat = %d\n",fpostMaxSlat());
2011 fprintf(fp,
"maxQTAddr = %d\n",fpostMaxQTaddr());
2012 fprintf(fp,
"maxQTch = %d\n",fpostMaxQTch());
2013 fprintf(fp,
"maxSlatId = %d\n",fpostMaxSlatId());
2018 void StFmsDbMaker::dumpFpostChannelGeometry (
const Char_t* filename){
2020 LOG_INFO <<
"Writing "<<filename<<endm;
2021 if((fp=fopen(filename,
"w"))){
2023 for(
int l=1; l<=fpostNLayer(); l++){
2024 fprintf(fp,
"Q=%1d L=%1d NSlat=%2d\n",q,l,fpostNSlat(q,l));
2031 void StFmsDbMaker::dumpFpostSlatId (
const Char_t* filename){
2033 LOG_INFO <<
"Writing "<<filename<<endm;
2034 if((fp=fopen(filename,
"w"))){
2035 for(
int i=0; i<fpostMaxSlatId(); i++){
2037 fpostQLSfromSlatId(i,&q,&l,&s);
2038 id=fpostSlatId(q,l,s);
2039 fprintf(fp,
"SlatId=%3d Q=%1d L=%1d S=%2d Reversemap=%3d\n",i,q,l,s,
id);
2040 if(i!=
id) fprintf(fp,
"Reversemap did not work!!!\n");
2046 void StFmsDbMaker::dumpFpostPosition(
const Char_t* filename){
2048 LOG_INFO <<
"Writing "<<filename<<endm;
2049 if((fp=fopen(filename,
"w"))){
2050 for(
int i=0; i<fpostMaxSlatId(); i++){
2052 float x[3],d[3],angle;
2053 fpostQLSfromSlatId(i,&q,&l,&s);
2054 fpostPosition(q,l,s,x,d,&angle);
2055 fprintf(fp,
"SlatId=%3d Q=%1d L=%1d S=%2d xyz=%8.3f %8.3f %8.3f dxyz=%8.3f %8.3f %8.3f Angle=%8.3f\n",
2056 i,q,l,s,x[0],x[1],x[2],d[0],d[1],d[2],angle);
2062 void StFmsDbMaker::dumpFpostMap(
const Char_t* filename){
2064 LOG_INFO <<
"Writing "<<filename<<endm;
2065 if((fp=fopen(filename,
"w"))){
2066 fprintf(fp,
"SlatId ordered\n");
2067 for(
int i=0; i<fpostMaxSlatId(); i++){
2069 fpostQTMap(i,&a,&c);
2070 fpostQLSFromQT(a,c,&q,&l,&s);
2071 int id=fpostSlatId(q,l,s);
2072 fprintf(fp,
"SlatId=%3d Q=%1d L=%1d S=%2d QTAddr=%2d QTch=%2d\n",
2074 if(
id!=i) fprintf(fp,
"Reversemap did not work!!!\n");
2076 fprintf(fp,
"QT ordered\n");
2077 for(
int a=0; a<fpostMaxQTaddr(); a++){
2078 for(
int c=0; c<fpostMaxQTch(); c++){
2080 fpostQLSFromQT(a,c,&q,&l,&s);
2081 int id=fpostSlatId(q,l,s);
2082 fprintf(fp,
"QTAddr=%2d QTch=%2d SlatId=%3d Q=%1d L=%1d S=%2d\n",
2090 void StFmsDbMaker::dumpFpostGain(
const Char_t* filename){
2092 LOG_INFO <<
"Writing "<<filename<<endm;
2093 if((fp=fopen(filename,
"w"))){
2094 for(
int i=0; i<fpostMaxSlatId(); i++){
2096 fpostQLSfromSlatId(i,&q,&l,&s);
2097 float g = fpostGain(q,l,s);
2098 fprintf(fp,
"SlatId=%3d Q=%1d L=%1d S=%2d MIP=%8.3f\n",
2105 void StFmsDbMaker::dumpFpostStatus(
const Char_t* filename){
2107 LOG_INFO <<
"Writing "<<filename<<endm;
2108 if((fp=fopen(filename,
"w"))){
2109 for(
int i=0; i<fpostMaxSlatId(); i++){
2111 fpostQLSfromSlatId(i,&q,&l,&s);
2112 int g = fpostStatus(q,l,s);
2113 fprintf(fp,
"SlatId=%3d Q=%1d L=%1d S=%2d Status=%d\n",
2120 Int_t StFmsDbMaker::nCellHole(Int_t det){
2122 case kFmsNorthLargeDetId:
2123 case kFmsSouthLargeDetId:
return 8;
2124 case kFmsNorthSmallDetId:
2125 case kFmsSouthSmallDetId:
return 5;
2130 Int_t StFmsDbMaker::nCellCorner(Int_t det){
2132 case kFmsNorthLargeDetId:
2133 case kFmsSouthLargeDetId:
return 7;
2151 if(det<kFmsNorthLargeDetId || det>kFmsSouthSmallDetId)
return -99.0;
2159 if(row>nCellHole(det) && row<
nRow(det)/2-1){
2163 if((row==nCellHole(det)) && ((yy-nCellHole(det))>xx) ){
2167 if( (row==(
nRow(det)/2-1)) && ((
nRow(det)/2-yy)>xx) ){
2172 if(row>=
nRow(det)/2-1.0){
2175 return yy -
nRow(det)/2;
2182 if(xx>yy && column<=nCellHole(det)){
2185 return nCellHole(det)-xx;
2187 if(xx<yy && row<=nCellHole(det)) {
2190 return nCellHole(det)-yy;
2196 return xx + yy - (
nRow(det)-nCellCorner(det)-1.0);
2206 TDataSet* dbDataSet = GetChain()->GetDataBase(
"Calibrations/rhic/vertexSeed");
2208 vertexSeed_st* vSeed = ((St_vertexSeed*) (dbDataSet->FindObject(
"vertexSeed")))->GetTable();
2210 double Vx = vSeed->x0;
2211 double Vy = vSeed->y0;
2212 double Vdxdz = vSeed->dxdz;
2213 double Vdydz = vSeed->dydz;
2216 double thetaX = TMath::ATan( Vdxdz );
2217 double thetaY = TMath::ATan( Vdydz );
2219 xyznew.rotateX(+thetaY);
2220 xyznew.rotateY(-thetaX);
Int_t detectorId(Int_t ew, Int_t ns, Int_t type)
maximum value of detector Id
Float_t getGainCorrection(Int_t detectorId, Int_t ch) const
get the gain for the channel
Int_t maxMap()
fmsMap related
UShort_t maxDetectorId()
Utility functions related to FMS ChannelGeometry.
Float_t getXWidth(Int_t detectorId)
get the offset of the detector
Int_t getChannelNumber(Int_t detectorId, Int_t row, Int_t column)
get the column number for the channel
Int_t maxNS()
fmsQTMap related
void setDebug(Int_t debug)
debug mode, 0 for minimal message, >0 for more debug messages
virtual void Clear(Option_t *option="")
User defined functions.
StThreeVectorF getStarXYZfromColumnRow(Int_t detectorId, Float_t column, Float_t row)
get the STAR frame coordinates from column/row
float getTimeDepCorr(int event, int det, int ch)
force bit shift to be read from FmsBitShiftGain.txt
StThreeVectorF getDetectorOffset(Int_t detectorId)
get the channel number
fmsDetectorPosition_st * DetectorPosition()
getting the whole table
Int_t type(Int_t detectorId)
large or small cells for FMS
StLorentzVectorF getLorentzVector(const StThreeVectorF &xyz, Float_t energy)
get the STAR frame pseudo rapidity from the vertex from local X/Y [cm]
Int_t largeSmall(Int_t detectorId)
north or south side
Int_t getRowNumber(Int_t detectorId, Int_t ch)
maximum number of channels
Int_t nRow(Int_t detectorId)
type of the detector
StThreeVectorF getStarXYZ(Int_t detectorId, Float_t FmsX, Float_t FmsY)
get the Y width of the cell
Int_t getColumnNumber(Int_t detectorId, Int_t ch)
get the row number for the channel
void dumpFmsChannelGeometry(const Char_t *filename="dumpFmsChannelGeometry.txt")
text dump for debugging
Float_t distanceFromEdge(Int_t det, Float_t x, Float_t y, int &edge)
get 4 vector assuing m=0 and taking beamline from DB
Int_t northSouth(Int_t detectorId)
east or west to the STAR IP
Int_t fpsNQuad()
FPS related.
Short_t getBitShiftGain(Int_t detectorId, Int_t ch) const
get the gain correction for the channel
unsigned short getCorrectedAdc(unsigned short detectorId, unsigned short ch, unsigned short adc) const
get the bit shift gain for the channel
UShort_t maxChannel(Int_t detectorId) const
number of column
Float_t getYWidth(Int_t detectorId)
get the X width of the cell
Int_t fpostNQuad()
FPost related.
Float_t getEta(Int_t detectorId, Float_t FmsX, Float_t FmsY, Float_t Vertex)
get the STAR frame phi angle from from local X/Y [cm]
Int_t eastWest(Int_t detectorId)
convert to detector Id
Int_t maxGain()
fmsGain/GainCorrection/Bitshift related
Float_t getPhi(Int_t detectorId, Float_t FmsX, Float_t FmsY)
get the STAR frame cooridnates for center of the cell
virtual Int_t InitRun(Int_t runNumber)
Int_t nColumn(Int_t detectorId)
number of rows
Int_t maxModule()
fmsPatchPanelMap related
virtual TDataSet * Find(const char *path) const
fmsChannelGeometry_st * ChannelGeometry()
getting the whole table