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