/* * PulserDetectorFCAL.cpp * * Implement the class for FCAL pulsers. * * Created on: Aug 14, 2015 * Author: Hovanes Egiyan */ #include "PulserDetectorFCAL.hh" #include "VioletFCALPulser.hh" #include "BlueFCALPulser.hh" #include "GreenFCALPulser.hh" #include "FCALTriggerPulser.hh" #include "FCALMORPulser.hh" using namespace std; // V1495 board location for the FCAL pulser std::string PulserDetectorFCAL::pdfBoardName = "D2-5-MID:9"; // Number of pulser channels on V1495 board unsigned PulserDetectorFCAL::pdfChannelNumber = 55; // Constructor fill the pulser map for this particular detector PulserDetectorFCAL::PulserDetectorFCAL() : PulserDetector( "FCAL" ) { // Add input PVs addPVs(); // Create the required pulsers pdPulserMap["VIOLET"] = new VioletFCALPulser( "VIOLET" ); pdPulserMap["BLUE"] = new BlueFCALPulser( "BLUE" ); pdPulserMap["GREEN"] = new GreenFCALPulser( "GREEN" ); pdPulserMap["TRIG"] = new FCALTriggerPulser( "TRIG" ); pdPulserMap["MOR"] = new FCALMORPulser( "MOR" ); return; } // Add board-related PVs to the PV map for the board int PulserDetectorFCAL::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 (FCAL needs only one V1495 board) pvKey = "STATUS" ; pvName = pdfBoardName+":status_h_r" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "SWITCH" ; pvName = pdfBoardName+":start_stop_w" ; pdPV->addPV( "short" , pvKey, pvName ); pvKey = "START_MASK_R" ; pvName = pdfBoardName+":start_mask_h_r" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "START_MASK_W" ; pvName = pdfBoardName+":start_mask_h_w" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "STOP_MASK_R" ; pvName = pdfBoardName+":stop_mask_h_r" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "STOP_MASK_W" ; pvName = pdfBoardName+":stop_mask_h_w" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "MOR_DELAY_R" ; pvName = pdfBoardName+":mor_delay_r" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "MOR_DELAY_W" ; pvName = pdfBoardName+":mor_delay_w" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "MOR_WIDTH_R" ; pvName = pdfBoardName+":mor_width_r" ; pdPV->addPV( "unsigned" , pvKey, pvName ); pvKey = "MOR_WIDTH_W" ; pvName = pdfBoardName+":mor_width_w" ; pdPV->addPV( "unsigned" , pvKey, pvName ); std::cout << "Number of channels for pulsers is " << pdfChannelNumber << endl; // Loop over all board pulser channels and assign PV names for (unsigned iChan = 0; iChan < pdfChannelNumber; iChan++) { stringstream ssAddr; ssAddr << iChan; std::string addr = ssAddr.str(); cout << "Address is " << addr << endl; pvKey = std::string("WIDTH_R:")+addr ; pvName = pdfBoardName + ":" + addr + "_width_r" ; pdPV->addPV("unsigned", pvKey, pvName); pvKey = std::string("WIDTH_W:")+addr ; pvName = pdfBoardName + ":" + addr + "_width_w" ; pdPV->addPV("unsigned", pvKey, pvName); pvKey = std::string("PERIOD_R:")+addr ; pvName = pdfBoardName + ":" + addr + "_period_r" ; pdPV->addPV("unsigned", pvKey, pvName); pvKey = std::string("PERIOD_W:")+addr ; pvName = pdfBoardName + ":" + addr + "_period_w" ; pdPV->addPV("unsigned", pvKey, pvName); pvKey = std::string("NPULSES_R:")+addr ; pvName = pdfBoardName + ":" + addr + "_npulses_r" ; pdPV->addPV("unsigned", pvKey, pvName); pvKey = std::string("NPULSES_W:")+addr ; pvName = pdfBoardName + ":" + addr + "_npulses_w" ; pdPV->addPV("unsigned", pvKey, pvName); } cout << "PVs have been added" << endl; return 0; }