CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2/src/L1TriggerConfig/L1GtConfigProducers/src/L1GtTriggerMaskVetoTechTrigConfigOnlineProd.cc

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