CMS 3D CMS Logo

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