StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StTpcDbSlowControl.cc
1 /***************************************************************************
2  *
3  * $Id: StTpcDbSlowControl.cc,v 1.5 2009/11/03 14:34:19 fisyak Exp $
4  *
5  * Authors: Manuel Calderon de la Barca Sanchez
6  * Brian Lasiuk
7  * Sept 13, 1999
8  ***************************************************************************
9  *
10  * Description: Class to hold Slow Control parameters for TRS taken
11  * from the STAR TPC DB. Class implemented as Singleton
12  *
13  ***************************************************************************
14  *
15  * $Log: StTpcDbSlowControl.cc,v $
16  * Revision 1.5 2009/11/03 14:34:19 fisyak
17  * Remove default in zFromTB
18  *
19  * Revision 1.4 2000/03/15 17:39:48 calderon
20  * Remove beeps
21  *
22  * Revision 1.3 2000/02/10 01:21:49 calderon
23  * Switch to use StTpcDb.
24  * Coordinates checked for consistency.
25  * Fixed problems with StTrsIstream & StTrsOstream.
26  *
27  * Revision 1.2 2000/01/10 23:14:29 lasiuk
28  * Include MACROS for compatiblity with SUN CC5
29  *
30  * Revision 1.1 1999/10/11 23:55:21 calderon
31  * Version with Database Access and persistent file.
32  * Not fully tested due to problems with cons, it
33  * doesn't find the local files at compile time.
34  * Yuri suggests forcing commit to work directly with
35  * files in repository.
36  *
37  *
38  **************************************************************************/
39 #include "StTpcDbSlowControl.hh"
40 
41 #ifndef ST_NO_EXCEPTIONS
42 # include <stdexcept>
43 # if !defined(ST_NO_NAMESPACES)
44  using std::invalid_argument;
45 # endif
46 #endif
47 
48 //#include "StUtilities/StMessMgr.h"
49 
50 
51 StTpcSlowControl* StTpcDbSlowControl::mInstance = 0;
52 
53 StTpcDbSlowControl::StTpcDbSlowControl() { /* nopt */}
54 
55 StTpcDbSlowControl::StTpcDbSlowControl(StTpcDb* globalDbPointer)
56 {
57 #ifndef ST_NO_NAMESPACES
58  using namespace units;
59 #endif
60  gTpcDbPtr = globalDbPointer;
61 
62 // mDriftVelocity = gTpcDbPtr->SlowControlSim()->driftVelocity();
63 // mDriftVoltage = gTpcDbPtr->SlowControlSim()->driftVoltage();
64 // mISAnodeVoltage = gTpcDbPtr->SlowControlSim()->innerSectorAnodeVoltage();
65 // mISGatingGridVoltage = gTpcDbPtr->SlowControlSim()->innerSectorGatingGridV();
66 // mOSAnodeVoltage = gTpcDbPtr->SlowControlSim()->outerSectorAnodeVoltage();
67 // mOSGatingGridVoltage = gTpcDbPtr->SlowControlSim()->outerSectorGatingGridV();
68 
69 // mISGasGain = gTpcDbPtr->SlowControlSim()->innerSectorGasGain();
70 // mISGasGainVzero = gTpcDbPtr->SlowControlSim()->innerSectorGasGainVzero();
71 // mISGasGainb = gTpcDbPtr->SlowControlSim()->innerSectorGasGainb();
72 
73 // mOSGasGain = gTpcDbPtr->SlowControlSim()->outerSectorGasGain();
74 // mOSGasGainVzero = gTpcDbPtr->SlowControlSim()->outerSectorGasGainVzero();
75 // mOSGasGainb = gTpcDbPtr->SlowControlSim()->outerSectorGasGainb();
76 
77 // mHallPressure = gTpcDbPtr->SlowControlSim()->hallPressure();
78 // mHallTemperature = gTpcDbPtr->SlowControlSim()->hallTemperature();
79 
80 // mDriftVelocity *= (centimeter/(microsecond));
81 // mDriftVoltage *= volt;
82 // mISAnodeVoltage *= volt;
83 // mISGatingGridVoltage *= volt;
84 // mOSAnodeVoltage *= volt;
85 // mOSGatingGridVoltage *= volt;
86 
87 
88 // mISGasGainVzero *= volt;
89 // mISGasGainb /= volt;
90 
91 
92 // mOSGasGainVzero *= volt;
93 // mOSGasGainb /= volt;
94 
95 // mHallPressure *= atmosphere;
96 
97 }
98 
99 StTpcSlowControl* StTpcDbSlowControl::instance()
100 {
101  if (!mInstance) {
102 #ifndef ST_NO_EXCEPTIONS
103  throw invalid_argument("StTpcDbSlowControl::getInstance(): Argument Missing!");
104 #else
105  std::cerr << "StTpcDbSlowControl::instance() " << endl;
106  std::cerr << "\tWARNING" << endl;
107  std::cerr << "\tNo arguments for instantiation of" << endl;
108  std::cerr << "Exiting..." << endl;
109 #endif
110  }
111  return mInstance;
112 }
113 
114 StTpcDbSlowControl::~StTpcDbSlowControl() {/* noop */}
115 
116 StTpcSlowControl* StTpcDbSlowControl::instance(StTpcDb* globalDbPointer)
117 {
118  if (!mInstance)
119  mInstance = new StTpcDbSlowControl(globalDbPointer);
120  else {
121  std::cerr << "StTpcDbSlowControl::instance() " << endl;
122  std::cerr << "\tWARNING" << endl;
123  std::cerr << "\tSingleton class is already instantiated." << endl;
124  std::cerr << "\tArgument (const char*) is ignored." << endl;
125  }
126  return mInstance;
127 }
128 
129 void StTpcDbSlowControl::print(ostream& os) const
130 {
131 #ifndef ST_NO_NAMESPACES
132  using namespace units;
133 #endif
134  os << "Slow Control Parameters:" << endl;
135  os << "========================" << endl;
136  os << "Drift Velocity: East " << driftVelocity(13)/(centimeter/(1.e-6*second))
137  << " West " << driftVelocity( 1)/(centimeter/(1.e-6*second))
138  << " cm/us" << endl;
139  os << "Drift Voltage: " << driftVoltage()/volt << " V" << endl;
140  os << endl;
141  os << "Hall Temperature: " << hallTemperature() << " C" << endl;
142  os << "Hall Pressure: " << hallPressure()/atmosphere << " atm" << endl;
143  os << endl;
144  os << "InnerSector:" << endl;
145  os << "Anode Voltage: " << innerSectorAnodeVoltage()/volt << " V" << endl;
146  os << "Gating Grid Voltage: " << innerSectorGatingGridVoltage()/volt << " V" << endl;
147  os << "Gas Gain: " << innerSectorGasGain() << endl;
148  os << "Gas Gain Vzero: " << innerSectorGasGainVzero()/volt << " V" << endl;
149  os << "Gas Gainb: " << innerSectorGasGainb()*volt << " /V" << endl;
150  os << "OuterSector:" << endl;
151  os << "Anode Voltage: " << outerSectorAnodeVoltage()/volt << " V" << endl;
152  os << "Gating Grid Voltage: " << outerSectorGatingGridVoltage()/volt << " V" << endl;
153  os << "Gas Gain: " << outerSectorGasGain() << endl;
154  os << "Gas Gain Vzero: " << outerSectorGasGainVzero()/volt << " V" << endl;
155  os << "Gas Gainb: " << outerSectorGasGainb()*volt << " /V" << endl;
156  os << endl;
157 }