CMS 3D CMS Logo

L1GtTriggerMaskVetoTechTrigConfigOnlineProd.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // system include files
19 #include "boost/lexical_cast.hpp"
20 
21 // user include files
23 
24 // constructor
26  const edm::ParameterSet& parSet) :
28  m_partitionNumber(parSet.getParameter<int> ("PartitionNumber")) {
29 
30  // empty
31 
32 }
33 
34 // destructor
36 
37  // empty
38 
39 }
40 
41 // public methods
42 
44  const std::string& objectKey) {
45 
46  auto pL1GtTriggerMask = std::make_unique<L1GtTriggerMask>();
47 
48  // l1GtTriggerMaskVetoTechTrig: VETO_TT_FK key in GT_PARTITION_VETO_TT
49 
50  const std::string gtSchema = "CMS_GT";
51 
52  // SQL query:
53  //
54  // select * from CMS_GT.GT_PARTITION_VETO_TT WHERE GT_PARTITION_VETO_TT.ID = objectKey
55 
56  const std::vector<std::string>& columns = m_omdsReader.columnNames(
57  gtSchema, "GT_PARTITION_VETO_TT");
58 
59  if (edm::isDebugEnabled()) {
60  for (std::vector<std::string>::const_iterator iter = columns.begin(); iter != columns.end(); iter++) {
61  LogTrace("L1GtTriggerMaskVetoTechTrigConfigOnlineProd") << ( *iter ) << std::endl;
62 
63  }
64  }
65 
67  columns, gtSchema, "GT_PARTITION_VETO_TT", "GT_PARTITION_VETO_TT.ID",
68  m_omdsReader.singleAttribute(objectKey));
69 
70  // check if query was successful
71  if (results.queryFailed()) {
72  edm::LogError("L1-O2O") << "Problem with L1GtTriggerMaskVetoTechTrigRcd key:" << objectKey;
73  return pL1GtTriggerMask;
74  }
75 
76  // mask for other partitions than m_partitionNumber set to 1 (algorithm masked)
77  int maskSize = columns.size() - 1; // table ID is also in columns
78  std::vector<bool> trigMaskBool(maskSize, false);
79  std::vector<unsigned int> trigMask(maskSize, 0);
80 
81  for (int i = 0; i < maskSize; i++) {
82  bool tMask = trigMaskBool[i];
83  results.fillVariable(columns[i + 1], tMask);
84  trigMask[i] = 0xFF & (~( static_cast<unsigned int> (tMask) << m_partitionNumber ));
85  }
86 
87  // fill the record
88  pL1GtTriggerMask->setGtTriggerMask(trigMask);
89 
90  if (edm::isDebugEnabled()) {
91  std::ostringstream myCoutStream;
92  pL1GtTriggerMask->print(myCoutStream);
93  LogTrace("L1GtTriggerMaskVetoTechTrigConfigOnlineProd")
94  << "\nThe following L1GtTriggerMaskVetoTechTrigRcd record was read from OMDS: \n"
95  << myCoutStream.str() << "\n" << std::endl;
96  }
97 
98  return pL1GtTriggerMask;
99 }
100 
bool isDebugEnabled()
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:311
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:295
std::unique_ptr< L1GtTriggerMask > newObject(const std::string &objectKey) override
public methods
std::vector< std::string > columnNames(const std::string &schemaName, const std::string &tableName)
Definition: OMDSReader.cc:165
const QueryResults basicQuery(const std::vector< std::string > &columnNames, const std::string &schemaName, const std::string &tableName, const std::string &conditionLHS="", const QueryResults conditionRHS=QueryResults(), const std::string &conditionRHSName="")
Definition: OMDSReader.cc:86
#define LogTrace(id)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
L1GtTriggerMaskVetoTechTrigConfigOnlineProd(const edm::ParameterSet &)
constructor