27 #include "Randomize.h"
31 #include "StCoordinates.hh"
32 #include "StTpcCoordinateTransform.hh"
36 #include "StTpcSimpleGeometry.hh"
37 #include "StTpcSimpleSlowControl.hh"
38 #include "StTpcSimpleElectronics.hh"
39 #include "StSimpleMagneticField.hh"
40 #include "StTrsDeDx.hh"
43 #include "StTrsFastChargeTransporter.hh"
44 #include "StTrsSlowAnalogSignalGenerator.hh"
45 #include "StTrsFastDigitalSignalGenerator.hh"
48 #include "StTrsAnalogSignal.hh"
49 #include "StTrsWireBinEntry.hh"
50 #include "StTrsWireHistogram.hh"
52 #include "StTrsSector.hh"
56 #define ivb if(VERBOSE)
69 ostream_iterator<StTrsAnalogSignal> out(cout,
",");
71 for(
int irow=0; irow<a->size(); irow++)
72 cout << irow <<
" " <<
"<" << a[irow].size() <<
"> ";
94 int main (
int argc,
char* argv[])
96 const int tupleSize = 4;
97 StHbookFile hbookFile(
"hbook");
98 StHbookTuple theTuple(
"signal", tupleSize);
99 float tuple[tupleSize];
100 theTuple <<
"row" <<
"pad" <<
"time" <<
"sig" << book;
103 int irow, ipad, itbin;
111 string geoFile(
"../run/TPCgeo.conf");
112 if (access(geoFile.c_str(),R_OK)) {
113 cerr <<
"ERROR:\n" << geoFile <<
" cannot be opened" << endl;
115 cerr <<
"Exitting..." << endl;
119 string scFile(
"../run/sc.conf");
120 if (access(scFile.c_str(),R_OK)) {
121 cerr <<
"ERROR:\n" << scFile <<
" cannot be opened" << endl;
122 cerr <<
"Exitting..." << endl;
126 string electronicsFile(
"../run/electronics.conf");
127 if (access(electronicsFile.c_str(),R_OK)) {
128 cerr <<
"ERROR:\n" << electronicsFile <<
" cannot be opened" << endl;
129 cerr <<
"Exitting..." << endl;
137 StTpcSimpleGeometry::instance(geoFile.c_str());
140 StTpcSimpleSlowControl::instance(scFile.c_str());
144 StSimpleMagneticField::instance(scFile.c_str());
147 StTpcSimpleElectronics::instance(electronicsFile.c_str());
163 StTrsFastChargeTransporter::instance(geomDb, scDb, &myEloss, magDb);
172 StTrsWireHistogram::instance(geomDb, scDb);
178 StTrsSlowAnalogSignalGenerator::instance(geomDb, scDb, electronicsDb, sector);
186 StTrsFastDigitalSignalGenerator::instance(electronicsDb, sector);
192 float maxDistance = geomDb->lastOuterSectorAnodeWire();
194 float zPosition = 1.*meter;
195 float position = 52.*centimeter;
198 dS = 500.*myEloss.nextInteraction();
202 if(position>maxDistance)
break;
204 double primaryEnergyDistribution;
205 int totalElectrons = myEloss.secondary(&primaryEnergyDistribution) + 1;
218 trsTransporter->transportToWire(aMiniSegment);
226 myWireHistogram->addEntry(anEntry);
230 cout <<
"\a***************************\a\n" << endl;
235 trsAnalogSignalGenerator->inducedChargeOnPad(myWireHistogram);
237 trsAnalogSignalGenerator->sampleAnalogSignal();
243 trsDigitalSignalGenerator->digitizeSignal();
249 cout <<
"Write out the Sector " << endl;
250 for(irow=0; irow<sector->numberOfRows(); irow++) {
252 for(ipad=0; ipad<sector->numberOfPadsInRow(irow); ipad++) {
253 tpcTimeBins currentTimeBins = sector->timeBinsOfRowAndPad(irow, ipad);
254 for(itbin=0; itbin<currentTimeBins.size(); itbin++) {
255 if(currentTimeBins[itbin].amplitude() > 1.)
256 PR(currentTimeBins[itbin]);