/* * ProfilerBPU.cpp * * Created on: Sep 29, 2015 * Author: Hovanes Egiyan */ #include "ProfilerBPU.hh" #include "ProfilerPlaneV.hh" #include "ProfilerPlane.hh" using namespace std; char ProfilerBPU::pbPlaneNameX[] = "x"; char ProfilerBPU::pbPlaneNameY[] = "y"; // Assumption id the the center of the profiler is at (x,y) (0,0) position, that is // the ideal beam line psotion. Any offset would need to be added to these. // Define the width of the fibers for BPU and the position of the center in mm. double ProfilerBPU::pbFiberWidth = 2.00; // in mm double ProfilerBPU::pbPositionX = 32.0 * ProfilerBPU::pbFiberWidth; // in mm double ProfilerBPU::pbPositionY = 32.0 * ProfilerBPU::pbFiberWidth; // in mm ProfilerBPU::ProfilerBPU() : MutexedClass(), ProfilerDetector( "bpu" ) { cout << " Entering " << __FUNCTION__ << endl; // Populate the map of planes pdPlaneMap[pbPlaneNameX] = new ProfilerPlane( this, pbPositionX, pbFiberWidth, true ); // cout << "X-Planes pointer is " << hex << showbase << pdPlaneMap["x"] << dec << endl; pdPlaneMap[pbPlaneNameY] = new ProfilerPlane( this, pbPositionY, pbFiberWidth, false ); pdPlaneMap[pbPlaneNameX]->setSimulation( false ); pdPlaneMap[pbPlaneNameY]->setSimulation( false ); pdSimMap[pbPlaneNameX] = new ProfilerPlaneSimulator( this, pbPositionX, true ); pdSimMap[pbPlaneNameY] = new ProfilerPlaneSimulator( this, pbPositionY, false ); // Add PVs for this detector addPVs(); return; } // Add board-related PVs to the PV map for the board int ProfilerBPU::addPVs() { MtxLock obLock(mcMutex); std::string pvKey, pvName; cout << "Adding BPU PVs " << endl; // // Add PVs for acquire completion pvKey = "acqcmp_x" ; pvName = pdName+":x:AcquireComplete" ; pdPV->addPV( "short" , pvKey, pvName ); pvKey = "acqcmp_y" ; pvName = pdName+":y:AcquireComplete" ; pdPV->addPV( "short" , pvKey, pvName ); // Add PVs for erasing the scalers pvKey = "erase_x" ; pvName = pdName+":x:EraseSeq" ; pdPV->addPV( "short" , pvKey, pvName ); pvKey = "erase_y" ; pvName = pdName+":y:EraseSeq" ; pdPV->addPV( "short" , pvKey, pvName ); // Add PVs for starting scalers pvKey = "start_x" ; pvName = pdName+":x:StartSeq" ; pdPV->addPV( "short" , pvKey, pvName ); pvKey = "start_y" ; pvName = pdName+":y:StartSeq" ; pdPV->addPV( "short" , pvKey, pvName ); // Add PVs for dwell time pvKey = "dwell_x" ; pvName = pdName+":x:ComDwel" ; pdPV->addPV( "double" , pvKey, pvName ); pvKey = "dwell_y" ; pvName = pdName+":y:ComDwel" ; pdPV->addPV( "double" , pvKey, pvName ); // Add PVs for efficiencies (they get multiplied by) pvKey = "effc_x" ; pvName = pdName+":x:gain" ; pdPV->addPV( "wave" , pvKey, pvName ); pvKey = "effc_y" ; pvName = pdName+":y:gain" ; pdPV->addPV( "wave" , pvKey, pvName ); // Add PVs for disabling pvKey = "disable_x" ; pvName = pdName+":x:disable" ; pdPV->addPV( "wave" , pvKey, pvName ); pvKey = "disable_y" ; pvName = pdName+":y:disable" ; pdPV->addPV( "wave" , pvKey, pvName ); // Loop over all profiler channel names // First add x-plane PVs for (unsigned iFibr = 1; iFibr <= pdPlaneMap["x"]->getChanNumber(); iFibr++) { stringstream ssFibr; ssFibr << iFibr; std::string sFibr = ssFibr.str(); pvKey = std::string("mca_x:")+sFibr ; pvName = pdName + ":x:mca:" + sFibr ; pdPV->addPV("wave" , pvKey, pvName); pvKey = std::string("sim_x:")+sFibr ; pvName = pdName + ":x:sim:" + sFibr ; pdPV->addPV("wave" , pvKey, pvName); } // Then add y-plane PVs for (unsigned iFibr = 1; iFibr <= pdPlaneMap["y"]->getChanNumber(); iFibr++) { stringstream ssFibr; ssFibr << iFibr; std::string sFibr = ssFibr.str(); pvKey = std::string("mca_y:")+sFibr ; pvName = pdName + ":y:mca:" + sFibr ; pdPV->addPV("wave", pvKey, pvName); pvKey = std::string("sim_y:")+sFibr ; pvName = pdName + ":y:sim:" + sFibr ; pdPV->addPV("wave", pvKey, pvName); } cout << "BPU PVs have been added" << endl; return 0; }