00001 #include "ROsFeeAdcMultiTool.h"
00002
00003 #include "Conventions/Electronics.h"
00004
00005 #include <vector>
00006 #include <map>
00007
00008 ROsFeeAdcMultiTool::ROsFeeAdcMultiTool(const std::string& type,
00009 const std::string& name,
00010 const IInterface* parent)
00011 : GaudiTool(type,name,parent)
00012 {
00013 declareInterface< IROsFeeWaveformTool >(this) ;
00014
00015 m_roCycles.push_back(0);
00016 m_roCycles.push_back(2);
00017 m_roCycles.push_back(3);
00018 m_roCycles.push_back(4);
00019 m_roCycles.push_back(6);
00020 m_roCycles.push_back(8);
00021 m_roCycles.push_back(10);
00022 m_roCycles.push_back(12);
00023 m_roCycles.push_back(14);
00024 m_roCycles.push_back(16);
00025 m_roCycles.push_back(18);
00026 declareProperty("ReadoutCycles",m_roCycles,
00027 "Clock Cycles to readout relative to reference");
00028 }
00029
00030 ROsFeeAdcMultiTool::~ROsFeeAdcMultiTool(){}
00031
00032 StatusCode ROsFeeAdcMultiTool::initialize()
00033 {
00034 debug() << "Reading Out [" ;
00035 std::vector<int>::iterator it;
00036 for(it=m_roCycles.begin();it!=m_roCycles.end();++it){
00037 debug() << " " << *it << " " ;
00038 }
00039 debug() << "]" << endreq;
00040 return StatusCode::SUCCESS;
00041 }
00042
00043 StatusCode ROsFeeAdcMultiTool::finalize()
00044 {
00045 return StatusCode::SUCCESS;
00046 }
00047
00048 StatusCode ROsFeeAdcMultiTool::readoutWaveform(const std::vector<int>& adc_in,
00049 unsigned int first_cycle,
00050 unsigned int last_cycle,
00051 unsigned int stop_cycle,
00052 std::vector<int>& adc_out,
00053 std::vector<int>& adcCycle_out)
00054 {
00055
00056 verbose() << "reading out adc window [ "
00057 << first_cycle << "," << last_cycle << ")" << endreq;
00058
00059 std::vector<int>::iterator roIt = m_roCycles.begin();
00060 verbose() << "Adding: ";
00061 for(;roIt != m_roCycles.end();++roIt){
00062 int point = (int)first_cycle + *roIt;
00063 if(point >= (int)first_cycle && point < (int)last_cycle){
00064
00065 adc_out.push_back(adc_in.at(point));
00066 adcCycle_out.push_back(stop_cycle - point);
00067 verbose() << " [" << int(stop_cycle)-point << " , "
00068 << adc_in.at(point) << "]";
00069 }
00070 }
00071 verbose() << " To Readout." << endreq;
00072
00073 return StatusCode::SUCCESS;
00074 }
00075