/* * PulserDetectorPS.cpp * * Implement the class for PS pulsers. * * Created on: Aug 14, 2015 * Author: Hovanes Egiyan */ #include "PulserDetectorPS.hh" #include "WhitePSPulser.hh" #include "FCALTriggerPulser.hh" #include "FCALMORPulser.hh" using namespace std; //// V1495 board location for the PS pulser //std::string PulserDetectorPS::pdpBoardName = "U1-1-TOP:4"; // Number of pulser channels on V1495 board unsigned PulserDetectorPS::pdpChannelNumber = 55; // Constructor fill the pulser map for this particular detector PulserDetectorPS::PulserDetectorPS( const std::string boardName ) : PulserDetector( "PS" ) , pdpBoardName(boardName) { // Add input PVs addPVs(); // Create the required pulsers pdPulserMap["WHITE"] = new WhitePSPulser( "WHITE" ); pdPulserMap["TRIG"] = new FCALTriggerPulser( "TRIG" ); pdPulserMap["MOR"] = new FCALMORPulser( "MOR" ); return; } // Add board-related PVs to the PV map for the board int PulserDetectorPS::addPVs() { MtxLock obLock(pdMutex); std::string pvKey, pvName; cout << "Current index is " << pdPV->getCurrentIndex() << endl; cout << "Adding PVs " << endl; // Add PVs needed for the whole board (PS needs only one V1495 board) pvKey = "STATUS" ; pvName = pdpBoardName+":status_h_r" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "SWITCH" ; pvName = pdpBoardName+":start_stop_w" ; pdPV->addPV( "short" , pvKey, pvName ); pvKey = "START_MASK_R" ; pvName = pdpBoardName+":start_mask_h_r" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "START_MASK_W" ; pvName = pdpBoardName+":start_mask_h_w" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "STOP_MASK_R" ; pvName = pdpBoardName+":stop_mask_h_r" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "STOP_MASK_W" ; pvName = pdpBoardName+":stop_mask_h_w" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "MOR_DELAY_R" ; pvName = pdpBoardName+":mor_delay_r" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "MOR_DELAY_W" ; pvName = pdpBoardName+":mor_delay_w" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "MOR_WIDTH_R" ; pvName = pdpBoardName+":mor_width_r" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "MOR_WIDTH_W" ; pvName = pdpBoardName+":mor_width_w" ; pdPV->addPV( "unsigned" , pvKey, pvName ); std::cout << "Number of channels for pulsers is " << pdpChannelNumber << endl; // Loop over all board pulser channels and assign PV names for (unsigned iChan = 0; iChan < pdpChannelNumber; iChan++) { stringstream ssAddr; ssAddr << iChan; std::string addr = ssAddr.str(); cout << "Address is " << addr << endl; pvKey = std::string("WIDTH_R:")+addr ; pvName = pdpBoardName + ":" + addr + "_width_r" ; pdPV->addPV("unsigned", pvKey, pvName); pvKey = std::string("WIDTH_W:")+addr ; pvName = pdpBoardName + ":" + addr + "_width_w" ; pdPV->addPV("unsigned", pvKey, pvName); pvKey = std::string("PERIOD_R:")+addr ; pvName = pdpBoardName + ":" + addr + "_period_r" ; pdPV->addPV("unsigned", pvKey, pvName); pvKey = std::string("PERIOD_W:")+addr ; pvName = pdpBoardName + ":" + addr + "_period_w" ; pdPV->addPV("unsigned", pvKey, pvName); pvKey = std::string("NPULSES_R:")+addr ; pvName = pdpBoardName + ":" + addr + "_npulses_r" ; pdPV->addPV("unsigned", pvKey, pvName); pvKey = std::string("NPULSES_W:")+addr ; pvName = pdpBoardName + ":" + addr + "_npulses_w" ; pdPV->addPV("unsigned", pvKey, pvName); } cout << "OK, PVs have been added" << endl; return 0; }