StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
storevpdDelay.C
1 // macro to upload pvpd delay
2 //
3 
4 #include <iostream>
5 #include <fstream>
6 #include <string>
7 #include <iomanip>
8 using namespace std;
9 
10 
11 void storevpdDelay(const Bool_t mTest = 1)
12 {
13  const Int_t NVPD=38;
14 
15 //----- default delays before Run-9 500GeV finished (run<10107025)
16 // float delay[NVPD];
17 // memset(delay,0,sizeof(delay));
18 // TString ZStoreTime = "2009-01-01 00:00:00"; // start of Run-9
19 //------
20 
21 
22 //----- default delays for run9 200 GeV
23 // float delay[NVPD]={
24 // 0,-0.564753,-4.62291,-4.84402,-4.05943,6.32389,-9.4035,-10.3113,-17.0374,-17.3734,-6.04608,-11.9614,-12.7579,8.79609,3.8467,-17.2994,-17.6424,-21.4749,-22.9736,
25 // 0,-2.1707, -4.8195, -6.5161, -4.3109, 6.3116, -8.8655,-10.1037,-16.5970,-17.9588,-5.2079, -12.1249,-12.2412,8.4001, 5.5702,-16.5936,-16.4152,-21.3076,-21.1452
26 // };
27 
28 //----- Run 9: 1st set adjusted delay due to trigger timing drift in some boards
29 //----- runs 10107025 - 10154044
30 // delay[6] -= 25.0;
31 // delay[7] -= 25.0;
32 // delay[17] -= 25.0;
33 // delay[18] -= 25.0;
34 // delay[25] -= 25.0;
35 // delay[26] -= 25.0;
36 // delay[36] -= 25.0;
37 // delay[37] -= 25.0;
38 // TString ZStoreTime = "2009-04-17 22:30:00"; // start of run 10107025
39 //------
40 
41 //----- Run-9: 2nd set, back to default delays
42 //----- runs 10154045 - 10313999
43 // TString ZStoreTime = "2009-06-03 16:47:00"; // start of run 10154045
44 //------
45 
46 
47 //----- Run 10 (valid for all energies, based on 39GeV)
48  float delay[NVPD]={
49  0.0, -1.201867, -0.531776, -5.477558, -6.167743, -5.575552, -9.801250, -10.958965, -10.591384, -4.773926,
50  -10.268874, -14.588154, -4.931171, -4.488882, -9.838172, -10.241304, -9.646428, -19.994028, -14.213135,
51  0.0, -0.668213, -0.479492, -4.870962, -6.054838, -5.567796, -10.370061, -10.805627, -11.034330, -3.716928,
52  -10.197979, -15.191838, -5.421011, -5.035720, -10.611328, -10.291655, -10.088323, -20.136475, -14.605093
53  };
54  TString ZStoreTime = "2009-12-14 00:00:00"; // Run-10 official start of run timestamp
55 //-----
56 
57 //---------------------------------------------------------------------------------------------
58 
59  //-- load dBase and Table definition libraries
60  gSystem->Load("St_base");
61  gSystem->Load("StChain");
62  gSystem->Load("StUtilities");
63  gSystem->Load("St_Tables.so");
64  gSystem->Load("StDbLib.so");
65  gSystem->Load("libStDb_Tables.so");
66 
67  //-- get the singleton manager
68  StDbManager* dbManager = StDbManager::Instance();
69 
70  //-- connect to the db & get an empty container
71  StDbConfigNode* configNode = dbManager->initConfig("Calibrations_tof");
72 
73  //-- add table to the container with descriptor given by Database
74  StDbTable* vpdDelayTable = configNode->addDbTable("vpdDelay");
75 
76  //-- fill structures & store times
77  vpdDelay_st vpddelay;
78 
79  for(int i=0;i<NVPD;i++) {
80  vpddelay.delay[i] = delay[i];
81  cout << " tubeId = " << i+1 << " delay = " << vpddelay.delay[i] << endl;
82  }
83 
84 if (!mTest){
85  //- store data in table
86  vpdDelayTable->SetTable((char*)&vpddelay, 1);
87  //- set store time
88  dbManager->setStoreTime(ZStoreTime.Data());
89  //- store table in dBase
90  cout<<" here "<<endl;
91  dbManager->storeDbTable(vpdDelayTable);
92  cout<<"uploaded"<<endl;
93  }
94 }
virtual void SetTable(char *data, int nrows, int *idList=0)
calloc&#39;d version of data for StRoot
Definition: StDbTable.cc:550
static StDbManager * Instance()
strdup(..) is not ANSI
Definition: StDbManager.cc:155