StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Db_LoadDriftMaps.C
1 void Db_LoadDriftMaps(char* dirname, char* timestamp, char* flavor){
2 
3 // Use this macro to load the 5 sets of the 4 FTPC "flavored" drift map tables
4 // (ftpcDeflection,ftpcVDrift,ftpcdDeflectiondP,ftpcdVDriftdP)
5 // to the Calibrations_ftpc database
6 //
7 // There should be 5 sub-directories in your working directory, one for each of the 5 flavors.
8 // The drift map tables are produced by the StFtpcDriftMapMaker
9 // flavor sub-directory
10 // ------ -------------
11 // ffp10kv FullFieldPositive
12 // hfp10kv HalfFieldPositive
13 // zf10kv ZeroField
14 // hfn10kv HalfFieldNegative
15 // ffn10kv FullFieldNegative
16 //
17 // Don't forget to
18 //
19 // setenv DB_ACCESS_MODE write
20 //
21 // To load the complete set of drift maps for a specific timestamp run the following 5 jobs.
22 // The timestamp in this example is for the 50% Ar,50% CO2 drift maps which should be
23 // used again starting with the 2007/2008 dAu run
24 // The timestamp used here is "2007-11-01 00:00:00"
25 //
26 // root4star -b -q 'Db_LoadDriftMaps.C("FullFieldPositive","2007-11-01 00:00:00","ffp10kv")'
27 // root4star -b -q 'Db_LoadDriftMaps.C("HalfFieldPositive","2007-11-01 00:00:00","hfp10kv")'
28 // root4star -b -q 'Db_LoadDriftMaps.C("ZeroFieldPositive","2007-11-01 00:00:00","zf10kv")'
29 // root4star -b -q 'Db_LoadDriftMaps.C("HalfFieldNegative","2007-11-01 00:00:00","hfn10kv")'
30 // root4star -b -q 'Db_LoadDriftMaps.C("FullFieldNegative","2007-11-01 00:00:00","ffn10kv")'
31 
32 
33  gSystem->Load("St_base"); // needed for StDbModifier
34  gSystem->Load("StChain");
35 
36  // DB-specific libs
37  gSystem->Load("libStDb_Tables");
38  gSystem->Load("StUtilities"); // probably don't need this
39  gSystem->Load("StDbLib");
41  StDbModifier* modify=new StDbModifier();
42  modify->SetDbName("Calibrations_ftpc");
43  modify->SetDateTime(timestamp);
44  modify->SetFlavor(flavor);
45 
46  char* tableNames[4]= { "ftpcdVDriftdP","ftpcDeflection","ftpcVDrift","ftpcdDeflectiondP" };
47 
48  for(int i=0; i<4; i++){
49  TString fname(dirname);
50  fname+="/";
51  fname+=tableNames[i];
52  fname+=".C";
53 
54  modify->SetTableName(tableNames[i]);
55 
56  modify->SetInputFileName(fname.Data());
57  modify->WriteDataToDB();
58 
59  cout<<"Loaded "<<fname.Data()<<" to database"<<endl;
60  }
61 
62 }
63 
static StDbManager * Instance()
strdup(..) is not ANSI
Definition: StDbManager.cc:155