CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1GtTriggerMaskVetoTechTrigConfigOnlineProd.cc
Go to the documentation of this file.
1 
17 // this class header
19 
20 // system include files
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> L1GtTriggerMaskVetoTechTrigConfigOnlineProd::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  // l1GtTriggerMaskVetoTechTrig: VETO_TT_FK key in GT_PARTITION_VETO_TT
53 
54  const std::string gtSchema = "CMS_GT";
55 
56  // SQL query:
57  //
58  // select * from CMS_GT.GT_PARTITION_VETO_TT WHERE GT_PARTITION_VETO_TT.ID = objectKey
59 
60  const std::vector<std::string>& columns = m_omdsReader.columnNames(
61  gtSchema, "GT_PARTITION_VETO_TT");
62 
63  if (edm::isDebugEnabled()) {
64  for (std::vector<std::string>::const_iterator iter = columns.begin(); iter != columns.end(); iter++) {
65  LogTrace("L1GtTriggerMaskVetoTechTrigConfigOnlineProd") << ( *iter ) << std::endl;
66 
67  }
68  }
69 
71  columns, gtSchema, "GT_PARTITION_VETO_TT", "GT_PARTITION_VETO_TT.ID",
72  m_omdsReader.singleAttribute(objectKey));
73 
74  // check if query was successful
75  if (results.queryFailed()) {
76  edm::LogError("L1-O2O") << "Problem with L1GtTriggerMaskVetoTechTrigRcd key:" << objectKey;
77  return pL1GtTriggerMask;
78  }
79 
80  // mask for other partitions than m_partitionNumber set to 1 (algorithm masked)
81  int maskSize = columns.size() - 1; // table ID is also in columns
82  std::vector<bool> trigMaskBool(maskSize, false);
83  std::vector<unsigned int> trigMask(maskSize, 0);
84 
85  for (int i = 0; i < maskSize; i++) {
86  bool tMask = trigMaskBool[i];
87  results.fillVariable(columns[i + 1], tMask);
88  trigMask[i] = 0xFF & (~( static_cast<unsigned int> (tMask) << m_partitionNumber ));
89  }
90 
91  // fill the record
92  pL1GtTriggerMask->setGtTriggerMask(trigMask);
93 
94  if (edm::isDebugEnabled()) {
95  std::ostringstream myCoutStream;
96  pL1GtTriggerMask->print(myCoutStream);
97  LogTrace("L1GtTriggerMaskVetoTechTrigConfigOnlineProd")
98  << "\nThe following L1GtTriggerMaskVetoTechTrigRcd record was read from OMDS: \n"
99  << myCoutStream.str() << "\n" << std::endl;
100  }
101 
102  return pL1GtTriggerMask;
103 }
104 
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
virtual boost::shared_ptr< L1GtTriggerMask > newObject(const std::string &objectKey)
public methods
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)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:48
L1GtTriggerMaskVetoTechTrigConfigOnlineProd(const edm::ParameterSet &)
constructor
std::vector< std::string > columnNames(const std::string &schemaName, const std::string &tableName) const
Definition: OMDSReader.cc:165