CMS 3D CMS Logo

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