Robert Michaels, rom@jlab.org, Jefferson
Lab Hall A, May 2001
//-------------------------------------------------------- // tscalfile_main.C // // Test of scaler class, for reading a CODA file // // R. Michaels, May 2001 //-------------------------------------------------------- #include < iostream > #include < string > #include "THaScaler.h" #include "THaCodaFile.h" int main(int argc, char* argv[]) { THaScaler *scaler; scaler = new THaScaler; TString filename = "run.dat"; if (argc < 2) { cout << "Usage: " << argv[0] << " bank" << endl; cout << "where bank = 'Right', 'Left', or 'RCS'" << endl; return 1; } string bank = argv[1]; cout << "Bank = " << bank << endl << flush; if (scaler->Init("7-4-1999",bank) == -1) { // Init MUST be done once cout << "Error initializing scaler " << endl; return 1; } int status = 1; while (status) { status = scaler->LoadDataCodaFile(filename); // load data for 'filename' if (!status) break; scaler->Print(); // raw diagnostic printout cout << "\n-------------------------------------------------\n" << endl; cout << "Time bcm_u3 bcm_d3 bcm_u10 bcm_d10 "; cout << " trigger-1 trigger-3 trigger-5" << endl; cout << "(sec) (arb) (arb) (arb) (arb) "; cout << " counts Hz counts Hz counts Hz" << endl; Double_t time = scaler->GetPulser("clock")/1024; cout << time << " " <GetBcm("bcm_u3") << " " << scaler->GetBcm("bcm_d3"); cout << " " << scaler->GetBcm("bcm_u10") << " " << scaler->GetBcm("bcm_d10"); cout << " " << scaler->GetTrig(1) << " " << scaler->GetTrigRate(1); cout << " " << scaler->GetTrig(3) << " " << scaler->GetTrigRate(3); cout << " " << scaler->GetTrig(5) << " " << scaler->GetTrigRate(5) << endl; } return 0; }