LasersOff.cxx

00001 #include <iostream>
00002 using namespace std;
00003 
00004 #include <ctype.h>
00005 
00006 #include <unistd.h>
00007 
00008 #include "RodModule.h"
00009 #include "BocCard.h"
00010 
00011 #include "RCCVmeInterface.h"
00012 
00013 using namespace SctPixelRod;
00014 
00015 int main(int argc, char **argv) {
00016   const unsigned long mapSize=0xc00040;         // Map size
00017   const long numSlaves=4;                       // Number of slaves
00018 
00019   int slot = -1;
00020   unsigned long baseAddress;
00021 
00022   if (argc > 1) {
00023     for (int i=1; i<argc; i++) {
00024       string option;
00025       option = argv[i];
00026       if (option[0] != '-') break;
00027       switch (option[1]) {
00028         case 's': {
00029           slot = atoi(option.substr(2).c_str());
00030           break;
00031         }
00032         default: {
00033           break;
00034         }
00035       }
00036     }
00037   }
00038 
00039 // Prompt for slot number
00040   if (slot < 0) {
00041     cout << "Enter slot number (decimal):"; 
00042     cin >> slot;
00043     while ((slot < 1) || (slot > 21)) {
00044       cout << "Slot number out or range [1:21], re-enter: ";
00045       cin >> slot;
00046     }
00047   }
00048   baseAddress = slot << 24;
00049   
00050 // Create VME interface
00051   RCCVmeInterface *vme1 = new RCCVmeInterface();
00052   
00053 // Create RodModule
00054   RodModule* rod0 = new RodModule(baseAddress, mapSize, *vme1, numSlaves);
00055 
00056   rod0->initialize(false);
00057 
00058   BocCard* boc = rod0->getBocCard();
00059 
00060   if(!boc) {
00061     cout << "No BOC object found aborting\n";
00062     return 1;
00063   }
00064 
00065   boc->initialize();
00066 
00067   cout << "Turning off all lasers ...\n";
00068   for(int ch=0; ch<48; ch++) {
00069     boc->setLaserCurrent(ch, 0);
00070   }
00071   cout << " ... done\n";
00072 
00073 // Clean up before exiting
00074   delete rod0;
00075   delete vme1;
00076 
00077   return 0;  
00078 }
00079 
00080 

Generated on Mon Feb 6 14:01:22 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6