StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
trsDataBase.cc
1 //*******************************************************/
2 // $Id: trsDataBase.cc,v 1.3 2003/09/02 17:59:15 perev Exp $
3 //
4 // Author: brian, October 1998
5 //
6 // Purpose: Illustrates the proper way to call
7 // a data base and reference its components.
8 //
9 // $Log: trsDataBase.cc,v $
10 // Revision 1.3 2003/09/02 17:59:15 perev
11 // gcc 3.2 updates + WarnOff
12 //
13 // Revision 1.2 1999/01/26 20:40:08 lasiuk
14 // magnetic field db
15 //
16 // Revision 1.1 1998/11/10 17:11:59 fisyak
17 // Put Brian trs versin into StRoot
18 //
19 // Revision 1.1 1998/11/08 17:44:56 lasiuk
20 // Initial Revision
21 //
22 /********************************************************/
23 #include <Stiostream.h>
24 #include <unistd.h> // needed for access()
25 
26 #include <string>
27 
28 #include "StTpcSimpleGeometry.hh"
29 #include "StTpcSimpleSlowControl.hh"
30 #include "StTpcSimpleElectronics.hh"
31 #include "StSimpleMagneticField.hh"
32 #include "StTrsDeDx.hh"
33 
34 int main (int argc,char* argv[])
35 {
36  //
37  // Make the DataBase
38  //
39  // Check File access
40  //
41  string geoFile("../run/TPCgeo.conf");
42  if (access(geoFile.c_str(),R_OK)) {
43  cerr << "ERROR:\n" << geoFile << " cannot be opened" << endl;
44  //shell(pwd);
45  cerr << "Exitting..." << endl;
46  exit(1);
47  }
48 
49  string scFile("../run/sc.conf");
50  if (access(scFile.c_str(),R_OK)) {
51  cerr << "ERROR:\n" << scFile << " cannot be opened" << endl;
52  //shell(pwd);
53  cerr << "Exitting..." << endl;
54  exit(1);
55  }
56 
57  string magFile("../run/example.conf");
58  if (access(magFile.c_str(),R_OK)) {
59  cerr << "ERROR:\n" << magFile << " cannot be opened" << endl;
60  cerr << "Exitting..." << endl;
61  exit(1);
62  }
63 
64  string electronicsFile("../run/electronics.conf");
65  if (access(electronicsFile.c_str(),R_OK)) {
66  cerr << "ERROR:\n" << electronicsFile << " cannot be opened" << endl;
67  cerr << "Exitting..." << endl;
68  exit(1);
69  }
70 
71  //
72  // The DataBases
73  //
74 
75  StTpcGeometry *geomDb =
76  StTpcSimpleGeometry::instance(geoFile.c_str());
77  geomDb->print();
78 
79  StTpcElectronics *electronicsDb =
80  StTpcSimpleElectronics::instance(electronicsFile.c_str());
81  electronicsDb->print();
82 
83  StTpcSlowControl *scDb =
84  StTpcSimpleSlowControl::instance(scFile.c_str());
85  scDb->print();
86 
87  StMagneticField *magDb =
88  StSimpleMagneticField::instance(magFile.c_str());
89 
90 // string gas("Ar");
91 // StTrsDeDx myEloss(gas);
92 
93 
94 //
95 
96 
97  return 0;
98 }