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