StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StFttDbMaker.cxx
1 /***************************************************************************
2  * StFttDbMaker.cxx
3  * jdb
4  ***************************************************************************
5  * Description: This maker is the interface between FTT and the STAR database
6  ***************************************************************************/
7 
8 #include "StFttDbMaker.h"
9 #include "StFttDb.h"
10 #include "St_db_Maker/St_db_Maker.h"
11 #include "StMessMgr.h"
12 
13 ClassImp(StFttDbMaker)
14 
15 StFttDbMaker::StFttDbMaker(const char *name) : StMaker(name){
16  LOG_INFO << "******** StFttDbMaker::StFttDbMaker = "<<name<<endm;
17  mFttDb = new StFttDb("fttDb");
18  AddData(mFttDb,".const");
19 };
20 
21 StFttDbMaker::~StFttDbMaker() {
22  delete mFttDb;
23 }
24 
25 int StFttDbMaker::Init(){
26  mFttDb->Init();
27  return StMaker::Init();
28 }
29 
30 void StFttDbMaker::Clear(Option_t *option){
31  StMaker::Clear(option);
32 }
33 
35  return StMaker::Make();
36 }
37 
38 int StFttDbMaker::InitRun(int runNumber) {
39  LOG_INFO << "StFttDbMaker::InitRun - run = " << runNumber << endm;
40 
41 
42  std::ifstream file("vmm_map.dat");
43  if(file.is_open()){ // debugging / calibration only
44  file.close();
45  std::cout << "Loading Hardware Map from FILE!!" << std::endl;
46  std::cout << "Remove / rename file to load from DB" << std::endl;
47  mFttDb->loadHardwareMapFromFile( "vmm_map.dat" );
48  } else { // default
49 
50  TDataSet *mDbDataSet = GetDataBase("Geometry/ftt/fttHardwareMap");
51  if (mDbDataSet){
52  St_fttHardwareMap *dataset = (St_fttHardwareMap*) mDbDataSet->Find("fttHardwareMap");
53  mFttDb->loadHardwareMapFromDb( dataset );
54  } else {
55  LOG_WARN << "Cannot access `Geometry/ftt/fttHardwareMap` and no local `vmm_map.dat` file provided. Cannot load ftt hardware mapping" << endm;
56  }
57  }
58 
59 
60  TDataSet *mDbDataSetDW = GetDataBase("Calibrations/ftt/fttDataWindows");
61 
62  if ( mDbDataSetDW ) {
63  St_fttDataWindows *dataset = (St_fttDataWindows*) mDbDataSetDW->Find("fttDataWindows");
64  mFttDb->loadDataWindowsFromDb( dataset );
65  } else {
66  LOG_WARN << "Cannot access `Calibrations/ftt/fttDataWindows`" << endm;
67  }
68 
69 
70 
71  return kStOK;
72 }
virtual void Clear(Option_t *option="")
User defined functions.
Definition: StMaker.cxx:634
void Clear(Option_t *option)
User defined functions.
virtual Int_t Make()
Definition: StMaker.cxx:898
Definition: Stypes.h:40
virtual TDataSet * Find(const char *path) const
Definition: TDataSet.cxx:362