void phatten_volts(const Char_t* inFN, const Char_t* outFN, const Int_t ncont=2) { /* inFN and outFN and input and output file names ncont indicates the type of file to read: =1 for file with PCAL-N only =2 for file with PCAL-P with only 2 cards and PCAL-N */ const UInt_t NCHANS_N = 96; Int_t drvs[NCHANS_N] = { 6, 6, 6, 6, 6, 6, 6, 6, // row 0 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, // 5 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, // 10 0, 1, 0, 0, 0, 0, 1, 0 // col 0 -> 7 }; Int_t chns[NCHANS_N] = { 1, 2, 3, 4, 25, 26, 27, 28, // row 0 5, 6, 7, 8, 21, 22, 23, 24, 9, 10, 11, 12, 17, 18, 19, 20, 1, 2, 3, 4, 25, 26, 27, 28, 5, 6, 7, 8, 21, 22, 23, 24, 9, 10, 11, 12, 17, 18, 19, 20, // 5 1, 2, 3, 4, 25, 26, 27, 28, 5, 6, 7, 8, 21, 22, 23, 24, 9, 10, 11, 12, 17, 18, 19, 20, 1, 2, 3, 4, 25, 26, 27, 28, 5, 6, 7, 8, 21, 22, 23, 0, // 10 0, 10, 0, 0, 0, 0, 19, 0 // col 0 -> 7 }; const UInt_t NCHANS_P = 4; Int_t pdrvs[NCHANS_P] = { 6, 6, 6, 6 }; Int_t pchns[NCHANS_P] = { 4, 1, 20, 17 }; Int_t tdrvs[6] = { 6, 5, 6, 5, 3, 3 }; Int_t tchns[6] = { 14, 14, 13, 13, 15, 13 }; // Open IO Files ifstream infile(inFN); ofstream outfile(outFN); if (infile.good() && outfile.good()) { UChar_t line=0, ch=0; for (line=0; line<4; line++) { //Drop the first 4 lines of the file infile.ignore(80,'\n'); } Int_t nlines=0, stn=0, drv=0, chn=0; Float_t v0=0.0, v1=0.0, v2=0.0; // Set number of lines to read depending on how many controllers if(ncont==1){ nlines=128; } elseif(ncont==2){ nlines=192; } else { cerr << "Controller number out of range, assuming it is 2!!" << endl; nlines=192; } for (line=0; line> stn >> drv >> chn >> v0 >> v1 >> v2; if (stn==1) { // station number 1 is PCAL-N for (ch=0; ch(ch / 8) << "\t" << static_cast(ch % 8) << "\t" << v2 << endl; break; } } // End of loop over PCAL-N channels if (ch==NCHANS_N) { // No match found so must be trigger counter, loop over those for (ch=0; ch<6; ch++) { if ((drv==tdrvs[ch]) && (chn==tchns[ch])) { outfile << "PCAL_NZ_TRG \t" << static_cast(ch / 2) << "\t" << static_cast(ch % 2) << "\t" << v2 << endl; } } } // End of PCAL_N trigger check } else if (stn==2) { // station number 2 is PCAL-P for (ch=0; ch(ch / 2) << "\t" << static_cast(ch % 2) << "\t" << v2 << endl; break; } } // End of loop over PCAL-P channels } else { // Unrecognized station found cerr << "Station not either 1 or 2???" << endl; } // End of checks for different stations } // End of loop over lines outfile << "!END" << endl; outfile.close(); infile.close(); } // End of good file check }