Go to the documentation of this file.00001
00017
00018 #include "L1TriggerConfig/L1GtConfigProducers/interface/L1GtTriggerMaskAlgoTrigConfigOnlineProd.h"
00019
00020
00021 #include <vector>
00022
00023 #include "boost/lexical_cast.hpp"
00024
00025
00026 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00027
00028
00029 L1GtTriggerMaskAlgoTrigConfigOnlineProd::L1GtTriggerMaskAlgoTrigConfigOnlineProd(
00030 const edm::ParameterSet& parSet) :
00031 L1ConfigOnlineProdBase<L1GtTriggerMaskAlgoTrigRcd, L1GtTriggerMask> (parSet),
00032 m_partitionNumber(parSet.getParameter<int> ("PartitionNumber")) {
00033
00034
00035
00036 }
00037
00038
00039 L1GtTriggerMaskAlgoTrigConfigOnlineProd::~L1GtTriggerMaskAlgoTrigConfigOnlineProd() {
00040
00041
00042
00043 }
00044
00045
00046
00047 boost::shared_ptr<L1GtTriggerMask> L1GtTriggerMaskAlgoTrigConfigOnlineProd::newObject(
00048 const std::string& objectKey) {
00049
00050
00051 boost::shared_ptr<L1GtTriggerMask> pL1GtTriggerMask = boost::shared_ptr<L1GtTriggerMask>(
00052 new L1GtTriggerMask());
00053
00054
00055
00056 const std::string gtSchema = "CMS_GT";
00057
00058
00059
00060
00061 const std::vector<std::string>& columns = m_omdsReader.columnNames(
00062 gtSchema, "GT_PARTITION_FINOR_ALGO");
00063
00064 if (edm::isDebugEnabled()) {
00065 for (std::vector<std::string>::const_iterator iter = columns.begin(); iter != columns.end(); iter++) {
00066 LogTrace("L1GtTriggerMaskAlgoTrigConfigOnlineProd") << ( *iter ) << std::endl;
00067
00068 }
00069 }
00070
00071 l1t::OMDSReader::QueryResults results = m_omdsReader.basicQuery(
00072 columns, gtSchema, "GT_PARTITION_FINOR_ALGO", "GT_PARTITION_FINOR_ALGO.ID",
00073 m_omdsReader.singleAttribute(objectKey));
00074
00075
00076 if (results.queryFailed()) {
00077 edm::LogError("L1-O2O") << "Problem with L1GtTriggerMaskAlgoTrigRcd key:" << objectKey;
00078 return pL1GtTriggerMask;
00079 }
00080
00081
00082 int maskSize = columns.size() - 1;
00083 std::vector<bool> trigMaskBool(maskSize, false);
00084 std::vector<unsigned int> trigMask(maskSize, 0);
00085
00086 for (int i = 0; i < maskSize; i++) {
00087 bool tMask = trigMaskBool[i];
00088 results.fillVariable(columns[i + 1], tMask);
00089 trigMask[i] = 0xFF & (~( static_cast<unsigned int> (tMask) << m_partitionNumber ));
00090 }
00091
00092
00093 pL1GtTriggerMask->setGtTriggerMask(trigMask);
00094
00095 if (edm::isDebugEnabled()) {
00096 std::ostringstream myCoutStream;
00097 pL1GtTriggerMask->print(myCoutStream);
00098 LogTrace("L1GtTriggerMaskAlgoTrigConfigOnlineProd")
00099 << "\nThe following L1GtTriggerMaskAlgoTrigRcd record was read from OMDS: \n"
00100 << myCoutStream.str() << "\n" << std::endl;
00101 }
00102
00103 return pL1GtTriggerMask;
00104 }
00105
00106 DEFINE_FWK_EVENTSETUP_MODULE( L1GtTriggerMaskAlgoTrigConfigOnlineProd);