/* jlabVMEBoardMain.cpp */ /* Author: Marty Kraimer Date: 17MAR2000 */ #include #include #include #include #include #include #include "jlabBoard.hh" #include "jlabDiscBoard.hh" #include "jlabFADC250Board.hh" #include "jlabSSPDIRCBoard.hh" #include "vmeChassis.hh" int main(int argc, char *argv[]) { bool locOutputInHzFlag = false; if(argc > 1) locOutputInHzFlag = bool(atoi(argv[1])); bool locDebugFlag = false; if(argc > 2) locDebugFlag = bool(atoi(argv[2])); cout << "OK, Creating chassis " << endl; vmeChassis* locChassis = new vmeChassis(locDebugFlag); vmeChassis* locChassisDisc = new vmeChassis(locDebugFlag); vmeChassis* locChassisFADC = new vmeChassis(locDebugFlag); vmeChassis* locChassisSSP = new vmeChassis(locDebugFlag); //Boards: cout << "Num slots = " << locChassis->GetNumberOfSlots() << endl; for(uint32_t locSlot = 1; locSlot <= locChassis->GetNumberOfSlots(); ++locSlot) { if( locDebugFlag ) cout << "Looking at slot " << locSlot << endl; jlabBoard* locBoard = locChassis->GetBoard(locSlot); if(locBoard == NULL) { if( locDebugFlag > 0 ) { cout << "Skipping board in slot " << dec << locSlot << endl; } continue; } jlabDiscBoard* locDiscBoard = dynamic_cast(locBoard); jlabFADC250Board* locFADC250Board = dynamic_cast(locBoard); jlabSSPDIRCBoard* locSSPDIRCBoard = dynamic_cast(locBoard); if(locDiscBoard != NULL) cout << "Slot " << locSlot << ": Discriminator Board" << endl; else if(locFADC250Board != NULL) cout << "Slot " << locSlot << ": FADC250 Board" << endl; else if(locSSPDIRCBoard != NULL) cout << "Slot " << locSlot << ": SSPDIRC Board" << endl; } map locDiscriminatorBoardMap = locChassisDisc->GetBoardMap(); map locFADC250BoardMap = locChassisFADC->GetBoardMap(); map locSSPDIRCBoardMap = locChassisSSP->GetBoardMap(); map locFullBoardMap = locChassis->GetBoardMap(); cout << "Map Sizes = " << locFullBoardMap.size() << ", " << locDiscriminatorBoardMap.size() << ", " << locFADC250BoardMap.size() << ", " << locSSPDIRCBoardMap.size() << endl; cout << "Get Sizes = " << locChassis->GetNumberOfBoards() << ", " << locChassisDisc->GetNumberOfBoards() << ", " << locChassisFADC->GetNumberOfBoards() << ", " << locChassisSSP->GetNumberOfBoards() << endl; while(true) { map::iterator locDiscriminatorIterator = locDiscriminatorBoardMap.begin(); for(; locDiscriminatorIterator != locDiscriminatorBoardMap.end(); ++locDiscriminatorIterator) { jlabDiscBoard* locDiscBoard = locDiscriminatorIterator->second; for(uint32_t locChannel = 0; locChannel < locDiscBoard->GetNumberOfChannels(); ++locChannel) { vector locTimes; vector locScalars = locDiscBoard->GetScalers(locChannel, "Readout1", locTimes, locOutputInHzFlag); if(locTimes.empty() || locScalars.empty()) continue; double locThreshold = locDiscBoard->GetThreshold(locChannel, "Readout1"); if(locDebugFlag) cout << "Discriminator Readout 1: Slot, channel, time, threshold, scalar = " << locDiscriminatorIterator->first << ", " << locChannel << ", " << locTimes[0] << ", " << locThreshold << ", " << locScalars[0] << endl; vector locTriggerScalars = locDiscBoard->GetScalers(locChannel, "Trigger1", locTimes, locOutputInHzFlag); if(locTriggerScalars.empty()) continue; locThreshold = locDiscBoard->GetThreshold(locChannel, "Trigger1"); if(locDebugFlag) cout << "Discriminator Trigger 1: Slot, channel, time, threshold, scalar = " << locDiscriminatorIterator->first << ", " << locChannel << ", " << locTimes[0] << ", " << locThreshold << ", " << locTriggerScalars[0] << endl; } } map::iterator locFADC250Iterator = locFADC250BoardMap.begin(); for(; locFADC250Iterator != locFADC250BoardMap.end(); ++locFADC250Iterator) { jlabFADC250Board* locFADC250Board = locFADC250Iterator->second; for(uint32_t locChannel = 0; locChannel < locFADC250Board->GetNumberOfChannels(); ++locChannel) { vector locTimes; vector locScalars = locFADC250Board->GetScalers(locChannel, "Readout1", locTimes, locOutputInHzFlag); if(locTimes.empty() || locScalars.empty()) continue; if(locDebugFlag) cout << "FADC250: Slot, channel, time, scalars = " << locFADC250Iterator->first << ", " << locChannel << ", " << locTimes[0] << ", " << locScalars[0] << endl; } } cout << "Doing SSP" << endl; map::iterator locSSPDIRCIterator = locSSPDIRCBoardMap.begin(); for(; locSSPDIRCIterator != locSSPDIRCBoardMap.end(); ++locSSPDIRCIterator) { jlabSSPDIRCBoard* locSSPDIRCBoard = locSSPDIRCIterator->second; for(uint32_t locChannel = 0; locChannel < locSSPDIRCBoard->GetNumberOfChannels(); ++locChannel) { vector locTimes; vector locScalars = locSSPDIRCBoard->GetScalers(locChannel, "Readout1", locTimes, locOutputInHzFlag); if(locTimes.empty() || locScalars.empty()) continue; if(locDebugFlag) cout << "SSPDIRC: Slot, channel, time, scalars = " << locSSPDIRCIterator->first << ", " << locChannel << ", " << locTimes[0] << ", " << locScalars[0] << endl; } for(uint32_t fiberNumber = 0; fiberNumber < locSSPDIRCBoard->GetNumberOfFibers(); ++fiberNumber) for( unsigned tempTypeNumber = 0; tempTypeNumber < jlabSSPDIRCBoard::GetTempNames().size(); tempTypeNumber++ ) { if(locDebugFlag) cout << "SSPDIRC: Slot, fiber, temps = " << locSSPDIRCIterator->first << ", " << fiberNumber<< ", " << locSSPDIRCBoard->GetTemperature( fiberNumber, tempTypeNumber)<< ", " << endl; } } } return(0); }