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