#include #include #include using namespace std; //======================================================================== int codeAddress(int Branch, int FEC, int chip, int channel) { return ((Branch&1)<<11) + ((FEC&0xf)<<7) + ((chip&0x7)<<4) + (channel&0xf); } //======================================================================== //======================================================================== int main( int argc, char** argv ) { // // Create PedMem Dummy File // cout << "writing Pedestal mem File" << endl; ofstream *out = new ofstream(); out->open("tpcPedestalMem.data"); *out << "12" << endl; // PED MEM int chan_ctr = 0; for ( int fec = 12; fec >= 0; fec-- ) { for ( int chip = 7; chip >= 0; chip-- ) { for ( int chan = 15; chan >= 0; chan-- ) { // branch A float bl = rand()/(float)RAND_MAX*80; *out << chan_ctr++ << "\t" << 1 << "\t" << 13 << "\t" << 1 << "\t" << codeAddress(0, fec, chip, chan); for(int timebin = 0; timebin < 1024; timebin++){ *out << "\t" << bl + rand()/(float)RAND_MAX*2; } *out << endl; // branch B if ( fec == 12 ) continue; bl = rand()/(float)RAND_MAX*80; *out << chan_ctr++ << "\t" << 1 << "\t" << 13 << "\t" << 1 << "\t" << codeAddress(1, fec, chip, chan); for(int timebin = 0; timebin < 1024; timebin++){ *out << "\t" << bl + rand()/(float)RAND_MAX*2; } *out << endl; } } } out->close(); delete out; out = 0; return 0; }