00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include <Stiostream.h>
00026 #include <unistd.h>
00027
00028 #include <string>
00029
00030 #include "SystemOfUnits.h"
00031 #include "StHbook.hh"
00032
00033 #include "StTpcSimpleGeometry.hh"
00034 #include "StTpcSimpleSlowControl.hh"
00035 #include "StTpcSimpleElectronics.hh"
00036 #include "StSimpleMagneticField.hh"
00037 #include "StTrsDeDx.hh"
00038
00039 #include "StTrsFastChargeTransporter.hh"
00040
00041 int main ()
00042 {
00043
00044 const int tupleSize = 2;
00045 StHbookFile hbookFile("hbook");
00046 StHbookTuple theTuple("gating grid", tupleSize);
00047 float tuple[tupleSize];
00048 theTuple << "v" << "t" << book;
00049
00050
00051
00052
00053 string geoFile("../run/TPCgeo.conf");
00054 if (access(geoFile.c_str(),R_OK)) {
00055 cerr << "ERROR:\n" << geoFile << " cannot be opened" << endl;
00056
00057 cerr << "Exitting..." << endl;
00058 exit(1);
00059 }
00060
00061 string scFile("../run/sc.conf");
00062 if (access(scFile.c_str(),R_OK)) {
00063 cerr << "ERROR:\n" << scFile << " cannot be opened" << endl;
00064
00065 cerr << "Exitting..." << endl;
00066 exit(1);
00067 }
00068
00069 string magFile("../run/example.conf");
00070 if (access(magFile.c_str(),R_OK)) {
00071 cerr << "ERROR:\n" << magFile << " cannot be opened" << endl;
00072 cerr << "Exitting..." << endl;
00073 exit(1);
00074 }
00075
00076 string electronicsFile("../run/electronics.conf");
00077 if (access(electronicsFile.c_str(),R_OK)) {
00078 cerr << "ERROR:\n" << electronicsFile << " cannot be opened" << endl;
00079 cerr << "Exitting..." << endl;
00080 exit(1);
00081 }
00082
00083
00084
00085
00086
00087 StTpcGeometry *geomDb =
00088 StTpcSimpleGeometry::instance(geoFile.c_str());
00089
00090 StTpcElectronics *electronicsDb =
00091 StTpcSimpleElectronics::instance(electronicsFile.c_str());
00092
00093 StTpcSlowControl *scDb =
00094 StTpcSimpleSlowControl::instance(scFile.c_str());
00095
00096 StMagneticField *magDb =
00097 StSimpleMagneticField::instance(scFile.c_str());
00098
00099 string gas("Ar");
00100 StTrsDeDx gasDb(gas);
00101
00102
00103
00104
00105
00106 StTrsChargeTransporter* trsTransporter =
00107 StTrsFastChargeTransporter::instance(geomDb, scDb, &gasDb, magDb);
00108
00109 trsTransporter->setGatingGridTransparency(true);
00110
00111 #ifndef ST_NO_NAMESPACES
00112 using namespace units;
00113 #endif
00114 float voltage = -140.*volt;
00115 do {
00116 voltage += (1.*volt);
00117 trsTransporter->setGatingGridVoltage(voltage);
00118 double value = trsTransporter->transparencyCalculation();
00119
00120 tuple[0] = static_cast<float>(voltage/volt);
00121 tuple[1] = static_cast<float>(value);
00122
00123 theTuple.fill(tuple);
00124
00125 } while (voltage <= (10.*volt));
00126
00127 hbookFile.saveAndClose();
00128
00129 return 0;
00130 }