30 #include "Randomize.h"
34 #include "StCoordinates.hh"
35 #include "StTpcCoordinateTransform.hh"
39 #include "StTpcSimpleGeometry.hh"
40 #include "StTpcSimpleSlowControl.hh"
41 #include "StTpcSimpleElectronics.hh"
42 #include "StSimpleMagneticField.hh"
43 #include "StTrsDeDx.hh"
46 #include "StTrsFastChargeTransporter.hh"
47 #include "StTrsSlowAnalogSignalGenerator.hh"
48 #include "StTrsFastDigitalSignalGenerator.hh"
51 #include "StTrsAnalogSignal.hh"
52 #include "StTrsWireBinEntry.hh"
53 #include "StTrsWireHistogram.hh"
55 #include "StTrsSector.hh"
59 #define ivb if(VERBOSE)
61 void printPad(tpcSector& a)
63 ostream_iterator<StTrsAnalogSignal> out(cout,
",");
65 for(
int irow=0; irow<a.size(); irow++)
66 cout << irow <<
" " <<
"<" << a[irow].size() <<
"> ";
88 int main (
int argc,
char* argv[])
90 const int tupleSize = 4;
91 StHbookFile hbookFile(
"hbook");
92 StHbookTuple theTuple(
"Transport", tupleSize);
93 float tuple[tupleSize];
94 theTuple <<
"x" <<
"y" <<
"z" <<
"amp" << book;
96 const int tupleSize2 = 5;
97 StHbookTuple secTuple(
"WireHistogram", tupleSize2);
98 float tuple2[tupleSize2];
99 secTuple <<
"x" <<
"y" <<
"z" <<
"wire" <<
"amp" << book;
101 int irow, ipad, itbin;
108 string geoFile(
"../run/TPCgeo.conf");
109 if (access(geoFile.c_str(),R_OK)) {
110 cerr <<
"ERROR:\n" << geoFile <<
" cannot be opened" << endl;
112 cerr <<
"Exitting..." << endl;
116 string scFile(
"../run/sc.conf");
117 if (access(scFile.c_str(),R_OK)) {
118 cerr <<
"ERROR:\n" << scFile <<
" cannot be opened" << endl;
119 cerr <<
"Exitting..." << endl;
123 string magFile(
"../run/example.conf");
124 if (access(magFile.c_str(),R_OK)) {
125 cerr <<
"ERROR:\n" << scFile <<
" cannot be opened" << endl;
126 cerr <<
"Exitting..." << endl;
130 string electronicsFile(
"../run/electronics.conf");
131 if (access(electronicsFile.c_str(),R_OK)) {
132 cerr <<
"ERROR:\n" << electronicsFile <<
" cannot be opened" << endl;
133 cerr <<
"Exitting..." << endl;
141 StTpcSimpleGeometry::instance(geoFile.c_str());
144 StTpcSimpleSlowControl::instance(scFile.c_str());
147 StSimpleMagneticField::instance(magFile.c_str());
150 StTpcSimpleElectronics::instance(electronicsFile.c_str());
166 StTrsFastChargeTransporter::instance(geomDb, scDb, &myEloss, magDb);
170 trsTransporter->setTransverseDiffusion(
true);
171 trsTransporter->setLongitudinalDiffusion(
true);
175 StTrsWireHistogram::instance(geomDb, scDb);
181 StTrsSlowAnalogSignalGenerator::instance(geomDb, scDb, electronicsDb, sector);
189 StTrsFastDigitalSignalGenerator::instance(electronicsDb, sector);
195 float maxDistance = geomDb->lastOuterSectorAnodeWire();
197 float zPosition = 1.*meter;
198 float position = 52.*centimeter;
201 dS = 5.*myEloss.nextInteraction();
205 if(position>maxDistance)
break;
207 double primaryEnergyDistribution;
208 int totalElectrons = myEloss.secondary(&primaryEnergyDistribution) + 1;
221 trsTransporter->transportToWire(aMiniSegment);
224 tuple[0] =
static_cast<float>(aMiniSegment.position().x());
225 tuple[1] =
static_cast<float>(aMiniSegment.position().y());
226 tuple[2] =
static_cast<float>(aMiniSegment.position().z());
227 tuple[3] =
static_cast<float>(aMiniSegment.charge());
229 theTuple.fill(tuple);
236 myWireHistogram->addEntry(anEntry);
238 cout <<
"okay..." << endl;
239 cout << myWireHistogram->lastEntry() << endl;
241 if(myWireHistogram->lastEntry() != 0) {
242 tuple2[0] =
static_cast<float>(myWireHistogram->lastEntry()->position().x());
243 tuple2[1] =
static_cast<float>(myWireHistogram->lastEntry()->position().y());
244 tuple2[2] =
static_cast<float>(myWireHistogram->lastEntry()->position().z());
245 tuple2[3] =
static_cast<float>(myWireHistogram->lastWire());
246 tuple2[4] =
static_cast<float>(myWireHistogram->lastEntry()->numberOfElectrons());
248 secTuple.fill(tuple2);
251 cout <<
"*********" << endl;
254 hbookFile.saveAndClose();