otsdaq  v2_03_00
MaskConfiguration_configuration.cc
1 #include <iostream>
2 #include "otsdaq-core/ConfigurationPluginDataFormats/MaskTable.h"
3 #include "otsdaq-coreMacros/TablePluginMacros.h"
4 
5 using namespace ots;
6 
7 //==============================================================================
8 MaskConfiguration::MaskConfiguration(void) : TableBase("MaskConfiguration")
9 {
11  // WARNING: the names and the order MUST match the ones in the enum //
13  // MaskConfigurationInfo.xml
14  //<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
15  //<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
16  // xsi:noNamespaceSchemaLocation="TableInfo.xsd">
17  // <CONFIGURATION Name="MaskConfiguration">
18  // <VIEW Name="MASK_CONFIGURATION" Type="File,Database,DatabaseTest">
19  // <COLUMN Name="DetectorID" StorageName="DETECTOR_ID" DataType="VARCHAR2" />
20  // <COLUMN Name="KillMask" StorageName="KILL_MASK" DataType="VARCHAR2" />
21  // </VIEW>
22  // </CONFIGURATION>
23  //</ROOT>
24 }
25 
26 //==============================================================================
27 MaskConfiguration::~MaskConfiguration(void) {}
28 
29 //==============================================================================
30 void MaskConfiguration::init(ConfigurationManager* configManager)
31 {
32  std::string tmpDetectorID;
33  for(unsigned int row = 0; row < TableBase::activeTableView_->getNumberOfRows(); row++)
34  {
35  TableBase::activeTableView_->getValue(tmpDetectorID, row, DetectorID);
36  nameToRow_[tmpDetectorID] = row;
37  }
38 }
39 
40 //==============================================================================
41 const std::string& MaskConfiguration::getROCMask(std::string rocName) const
42 {
43  // FIXME This check should be removed when you are sure you don't have inconsistencies
44  // between configurations
45  if(nameToRow_.find(rocName) == nameToRow_.end())
46  {
47  std::cout << __COUT_HDR_FL__ << "ROC named " << rocName
48  << " doesn't exist in the mask configuration." << std::endl;
49  assert(0);
50  }
51  return TableBase::getView().getDataView()[nameToRow_.find(rocName)->second][KillMask];
52 }
53 
54 DEFINE_OTS_CONFIGURATION(MaskConfiguration)