// // Main program for measuring isotopes in the IMS-4f // in non-imaging mode. // // AUTHOR: A. J. Fahey Oct, 1995 // NIST, Gaithersburg // #include #include #include #include #include #include #include #include #include #include #include #include "3f_io.h" #include "3f_ctrl.h" #include "ims-3f.h" #include "FileIO.h" #include "utils.h" #include "Display.h" #include "FastTmr.h" // Function Prototypes void FinishUp(void); int AbortRun(void); void Ignore(int *a); void CleanUp(int *a); typedef void (*fptr)(int); // Function to speed up the system timer #pragma startup InstallFastTmr // Turbo C++ pragma executed before main #pragma exit FinishUp // Turbo C++ pragma executed after main int verbose=TRUE; void main(int argc, char *argv[]) { // Flags extern int verbose; int Ccycle = FALSE; int EScycle = FALSE; int FinishedHere; // Indices register i, j, c, m; unsigned int run; // Control Parameters unsigned int HystCycles = HYST_CYCLES; int MassRange = LOWMASS; unsigned int PreCycles = PRE_CYCLES; // Constants const int PreCycleDelay = 2.0; // Temporary variables with short names unsigned long B, dB; double M, dM; float StartingMass; float E; int p1, p2; int BRef, ERef; float RefHVO; unsigned long RefField; double RefMass; char dummy[20]; // Strings char response[10]; char *StartupFile="No File Specified"; // Structures struct CycleParam Cycle; struct MeasParam Measurement; struct RawData **data; struct Peak *Peaks; struct EnergyDist *EDist; time_t StartTime, TimeNow; // Classes ofstream RawDataFile; // Turn on control-break watching! //ctrlbrk(AbortRun); signal(SIGFPE,(fptr)Ignore); // ignore floating point errors! signal(SIGINT,(fptr)CleanUp); // Parse the command line args for(i=1;i 10) // loops. { PreCycles = 10; } } else if(strnicmp(argv[i],"-hys",4) == 0) // No. of Hyst. cycles { i++; HystCycles = atoi(argv[i]); if(HystCycles > 10) { HystCycles = 10; } } else // startup data file name { if(access(argv[i],04)!=0) // check to see that the { // file exists. fprintf(stderr, "Cannot access startup data file: %s\n", argv[i]); exit(0); } else { StartupFile = argv[i]; } } } // Read the startup data file, initialize the machine // and the appropriate variables. This function also // allocates memory for the structures "Cycle" and "Measurement" if(!ReadStartupData(StartupFile,&Cycle,&Measurement)) { cerr << "Error Reading file: " << StartupFile << endl; exit(0); } StartingMass = Cycle.thisMass[0].Mass - 0.5; // Where all cycles start! // Allocate memory for the peak parameters Peaks = (struct Peak *)malloc(Cycle.NMasses*sizeof(struct Peak)); // Allocate memory for energy distributions parameters EDist = (struct EnergyDist *)malloc(Cycle.NMasses*sizeof(struct EnergyDist)); for(i=0;i