Skip to content

Commit

Permalink
let StBTofSimResParams.h to use existed timestamp in bfc chain, inste…
Browse files Browse the repository at this point in the history
…ad of re-define a new timestamp (star-bnl#145)

* change void loadParams(const int date = 20160913, const int time = 175725, const char* Default_time ) to loadParm(const int runnumber)

* change 120, 192 to mNTray mNCellsPerTray

* loadParams(runnumber)

* Gene suggested use Previous year Oct 1st to be safe to grep the correct table

* modify double timeres_tof() itray-1, imodule-1, icell-1

* add call writePPPAHistogram from Bassam

* remove those tem debug lines

* update the loadParms() in StRoot/StBTofUtil/StBTofSimResParams.h for bfc.C mode, pickup existed timestamp

* add a few more comments

* comment line 80, because not used

Co-authored-by: Zaochen Ye <zye20@rcas6015.rcf.bnl.gov>
Co-authored-by: Zaochen Ye <zye20@rcas6006.rcf.bnl.gov>
  • Loading branch information
3 people authored and plexoos committed Sep 16, 2021
1 parent 0015b98 commit d874770
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions StRoot/StBTofUtil/StBTofSimResParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,26 @@ class StBTofSimResParams : public StMaker {
//void loadParams(const int date = 20160913, const int time = 175725, const char* Default_time = "2016-09-13 17:57:25")
void loadParams(const int runNumber = 20076002)
{
//--------------------------------------------------------------------------------------------------
//the following lines may be needed if not run with bfc.C, but run btof simulation individually,
//it will require you to set up a timestamp to pickup the table in DB, here below show an example to use
//runnumber to set the timestamp, you can also modify the function to pickup the timestamp you want
//const int yearNumber = runNumber/1000000 - 1 + 2000;
//const int date = (yearNumber-1)*1000*10 + 1001; // prior year + October 1st(Date)

//St_db_Maker *dbMk = new St_db_Maker("db", "MySQL:StarDb", "$STAR/StarDb");
//dbMk->SetDebug();
//dbMk->SetDateTime(date,1);
//dbMk->SetFlavor("ofl");
//dbMk->Init();
//dbMk->Make();

//TDataSet *DB = 0;
//DB = dbMk->GetDataBase("Calibrations/tof/tofSimResParams");
//--------------------------------------------------------------------------------------------------

const int yearNumber = runNumber/1000000 - 1 + 2000;
const int date = (yearNumber-1)*1000*10 + 1001; // prior year + October 1st(Date)

St_db_Maker *dbMk = new St_db_Maker("db", "MySQL:StarDb", "$STAR/StarDb");
dbMk->SetDebug();
dbMk->SetDateTime(date,1);
dbMk->SetFlavor("ofl");
dbMk->Init();
dbMk->Make();

TDataSet *DB = 0;
DB = dbMk->GetDataBase("Calibrations/tof/tofSimResParams");
DB = GetDataBase("Calibrations/tof/tofSimResParams");

if(!DB)
{
Expand All @@ -70,8 +77,8 @@ class StBTofSimResParams : public StMaker {

if(dataset)
{
TDatime val[2];
dbMk->GetValidity((TTable*)dataset,val);
//TDatime val[2];
//dbMk->GetValidity((TTable*)dataset,val);

tofSimResParams_st* tofTable = static_cast<tofSimResParams_st*>(dataset->GetTable());

Expand Down

0 comments on commit d874770

Please # to comment.