CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1GtTriggerMaskVetoTechTrigConfigOnlineProd.cc
Go to the documentation of this file.
1 
15 // this class header
17 
18 // user include files
20 
21 // constructor
24  m_partitionNumber(parSet.getParameter<int>("PartitionNumber")) {
25  // empty
26 }
27 
28 // destructor
30  // empty
31 }
32 
33 // public methods
34 
35 std::unique_ptr<L1GtTriggerMask> L1GtTriggerMaskVetoTechTrigConfigOnlineProd::newObject(const std::string& objectKey) {
36  auto pL1GtTriggerMask = std::make_unique<L1GtTriggerMask>();
37 
38  // l1GtTriggerMaskVetoTechTrig: VETO_TT_FK key in GT_PARTITION_VETO_TT
39 
40  const std::string gtSchema = "CMS_GT";
41 
42  // SQL query:
43  //
44  // select * from CMS_GT.GT_PARTITION_VETO_TT WHERE GT_PARTITION_VETO_TT.ID = objectKey
45 
46  const std::vector<std::string>& columns = m_omdsReader.columnNames(gtSchema, "GT_PARTITION_VETO_TT");
47 
48  if (edm::isDebugEnabled()) {
49  for (std::vector<std::string>::const_iterator iter = columns.begin(); iter != columns.end(); iter++) {
50  LogTrace("L1GtTriggerMaskVetoTechTrigConfigOnlineProd") << (*iter) << std::endl;
51  }
52  }
53 
55  columns, gtSchema, "GT_PARTITION_VETO_TT", "GT_PARTITION_VETO_TT.ID", m_omdsReader.singleAttribute(objectKey));
56 
57  // check if query was successful
58  if (results.queryFailed()) {
59  edm::LogError("L1-O2O") << "Problem with L1GtTriggerMaskVetoTechTrigRcd key:" << objectKey;
60  return pL1GtTriggerMask;
61  }
62 
63  // mask for other partitions than m_partitionNumber set to 1 (algorithm masked)
64  int maskSize = columns.size() - 1; // table ID is also in columns
65  std::vector<bool> trigMaskBool(maskSize, false);
66  std::vector<unsigned int> trigMask(maskSize, 0);
67 
68  for (int i = 0; i < maskSize; i++) {
69  bool tMask = trigMaskBool[i];
70  results.fillVariable(columns[i + 1], tMask);
71  trigMask[i] = 0xFF & (~(static_cast<unsigned int>(tMask) << m_partitionNumber));
72  }
73 
74  // fill the record
75  pL1GtTriggerMask->setGtTriggerMask(trigMask);
76 
77  if (edm::isDebugEnabled()) {
78  std::ostringstream myCoutStream;
79  pL1GtTriggerMask->print(myCoutStream);
80  LogTrace("L1GtTriggerMaskVetoTechTrigConfigOnlineProd")
81  << "\nThe following L1GtTriggerMaskVetoTechTrigRcd record was read from OMDS: \n"
82  << myCoutStream.str() << "\n"
83  << std::endl;
84  }
85 
86  return pL1GtTriggerMask;
87 }
88 
bool isDebugEnabled()
bool fillVariable(const std::string &columnName, T &outputVariable) const
Definition: OMDSReader.h:274
const QueryResults singleAttribute(const T &data) const
Definition: OMDSReader.h:259
dictionary results
Log< level::Error, false > LogError
#define LogTrace(id)
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:138
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:75
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
L1GtTriggerMaskVetoTechTrigConfigOnlineProd(const edm::ParameterSet &)
constructor
tuple columns
Definition: mps_check.py:244