$treeview $search $mathjax $extrastylesheet
otsdaq
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #include <iostream> 00002 #include "otsdaq-core/ConfigurationPluginDataFormats/DetectorToFETable.h" 00003 #include "otsdaq-coreMacros/TablePluginMacros.h" 00004 00005 using namespace ots; 00006 00007 //============================================================================== 00008 DetectorToFEConfiguration::DetectorToFEConfiguration(void) 00009 : TableBase("DetectorToFEConfiguration") 00010 { 00012 // WARNING: the names and the order MUST match the ones in the enum // 00014 // DetectorToFEConfigurationInfo.xml 00015 //<?xml version="1.0" encoding="UTF-8" standalone="no" ?> 00016 //<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 00017 // xsi:noNamespaceSchemaLocation="TableInfo.xsd"> 00018 // <CONFIGURATION Name="DetectorToFEConfiguration"> 00019 // <VIEW Name="DETECTOR_TO_FE_CONFIGURATION" Type="File,Database,DatabaseTest"> 00020 // <COLUMN Name="DetectorID" StorageName="DETECTOR_ID" 00021 // DataType="VARCHAR2"/> <COLUMN Name="FEWriterID" 00022 // StorageName="FE_WRITER_ID" DataType="VARCHAR2"/> <COLUMN 00023 // Name="FEWriterChannel" StorageName="FE_WRITER_CHANNEL" 00024 // DataType="NUMBER" /> <COLUMN Name="FEWriterDetectorAddress" 00025 // StorageName="FE_WRITER_DETECTOR_ADDRESS" DataType="NUMBER" /> <COLUMN 00026 // Name="FEReaderID" StorageName="FE_READER_ID" 00027 // DataType="VARCHAR2"/> <COLUMN Name="FEReaderChannel" 00028 // StorageName="FE_READER_CHANNEL" DataType="NUMBER" /> <COLUMN 00029 // Name="FEReaderDetectorAddress" StorageName="FE_READER_DETECTOR_ADDRESS" 00030 // DataType="NUMBER" /> 00031 // </VIEW> 00032 // </CONFIGURATION> 00033 //</ROOT> 00034 } 00035 00036 //============================================================================== 00037 DetectorToFEConfiguration::~DetectorToFEConfiguration(void) {} 00038 00039 //============================================================================== 00040 void DetectorToFEConfiguration::init(ConfigurationManager* configManager) 00041 { 00042 std::string tmpDetectorName; 00043 for(unsigned int row = 0; row < TableBase::activeTableView_->getNumberOfRows(); row++) 00044 { 00045 TableBase::activeTableView_->getValue(tmpDetectorName, row, DetectorID); 00046 nameToInfoMap_[tmpDetectorName] = DetectorInfo(); 00047 DetectorInfo& aDetectorInfo = nameToInfoMap_[tmpDetectorName]; 00048 TableBase::activeTableView_->getValue( 00049 aDetectorInfo.theFEWriterID_, row, FEWriterID); 00050 TableBase::activeTableView_->getValue( 00051 aDetectorInfo.theFEWriterChannel_, row, FEWriterChannel); 00052 TableBase::activeTableView_->getValue( 00053 aDetectorInfo.theFEWriterDetectorAddress_, row, FEWriterDetectorAddress); 00054 TableBase::activeTableView_->getValue( 00055 aDetectorInfo.theFEReaderID_, row, FEReaderID); 00056 TableBase::activeTableView_->getValue( 00057 aDetectorInfo.theFEReaderChannel_, row, FEReaderChannel); 00058 TableBase::activeTableView_->getValue( 00059 aDetectorInfo.theFEReaderDetectorAddress_, row, FEReaderDetectorAddress); 00060 } 00061 } 00062 00063 //============================================================================== 00064 std::vector<std::string> DetectorToFEConfiguration::getFEWriterDetectorList( 00065 std::string interfaceID) const 00066 { 00067 std::string tmpDetectorID; 00068 std::string tmpFEWriterID; 00069 std::vector<std::string> list; 00070 for(unsigned int row = 0; row < TableBase::activeTableView_->getNumberOfRows(); row++) 00071 { 00072 TableBase::activeTableView_->getValue(tmpFEWriterID, row, FEWriterID); 00073 if(tmpFEWriterID == interfaceID) 00074 { 00075 TableBase::activeTableView_->getValue(tmpDetectorID, row, DetectorID); 00076 list.push_back(tmpDetectorID); 00077 } 00078 } 00079 return list; 00080 } 00081 00082 //============================================================================== 00083 std::vector<std::string> DetectorToFEConfiguration::getFEReaderDetectorList( 00084 std::string interfaceID) const 00085 { 00086 std::string tmpDetectorID; 00087 std::string tmpFEReaderID; 00088 std::vector<std::string> list; 00089 for(unsigned int row = 0; row < TableBase::activeTableView_->getNumberOfRows(); row++) 00090 { 00091 TableBase::activeTableView_->getValue(tmpFEReaderID, row, FEReaderID); 00092 if(tmpFEReaderID == interfaceID) 00093 { 00094 TableBase::activeTableView_->getValue(tmpDetectorID, row, DetectorID); 00095 list.push_back(tmpDetectorID); 00096 } 00097 } 00098 return list; 00099 } 00100 00101 //============================================================================== 00102 unsigned int DetectorToFEConfiguration::getFEWriterChannel( 00103 const std::string& detectorID) const 00104 { 00105 return nameToInfoMap_.find(detectorID)->second.theFEWriterChannel_; 00106 } 00107 00108 //============================================================================== 00109 unsigned int DetectorToFEConfiguration::getFEWriterDetectorAddress( 00110 const std::string& detectorID) const 00111 { 00112 return nameToInfoMap_.find(detectorID)->second.theFEWriterDetectorAddress_; 00113 } 00114 00115 //============================================================================== 00116 unsigned int DetectorToFEConfiguration::getFEReaderChannel( 00117 const std::string& detectorID) const 00118 { 00119 return nameToInfoMap_.find(detectorID)->second.theFEReaderChannel_; 00120 } 00121 00122 DEFINE_OTS_CONFIGURATION(DetectorToFEConfiguration)