CMS 3D CMS Logo

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