Public Member Functions | |
L1CaloHcalScaleConfigOnlineProd (const edm::ParameterSet &iConfig) | |
virtual boost::shared_ptr < L1CaloHcalScale > | newObject (const std::string &objectKey) |
~L1CaloHcalScaleConfigOnlineProd () | |
Private Types | |
typedef std::vector< double > | RCTdecompression |
Private Attributes | |
CaloTPGTranscoderULUT * | caloTPG |
L1CaloHcalScale * | hcalScale |
std::vector< RCTdecompression > | hcaluncomp |
HcalTrigTowerGeometry | theTrigTowerGeometry |
HcalTrigTowerDetId * | ttDetId |
Definition at line 39 of file L1CaloHcalScaleConfigOnlineProd.cc.
typedef std::vector<double> L1CaloHcalScaleConfigOnlineProd::RCTdecompression [private] |
Definition at line 54 of file L1CaloHcalScaleConfigOnlineProd.cc.
L1CaloHcalScaleConfigOnlineProd::L1CaloHcalScaleConfigOnlineProd | ( | const edm::ParameterSet & | iConfig | ) |
Definition at line 76 of file L1CaloHcalScaleConfigOnlineProd.cc.
References caloTPG, and hcalScale.
: L1ConfigOnlineProdBase< L1CaloHcalScaleRcd, L1CaloHcalScale >( iConfig ) { hcalScale = new L1CaloHcalScale(0); caloTPG = new CaloTPGTranscoderULUT(); }
L1CaloHcalScaleConfigOnlineProd::~L1CaloHcalScaleConfigOnlineProd | ( | ) |
Definition at line 85 of file L1CaloHcalScaleConfigOnlineProd.cc.
References caloTPG.
boost::shared_ptr< L1CaloHcalScale > L1CaloHcalScaleConfigOnlineProd::newObject | ( | const std::string & | objectKey | ) | [virtual] |
Implements L1ConfigOnlineProdBase< L1CaloHcalScaleRcd, L1CaloHcalScale >.
Definition at line 102 of file L1CaloHcalScaleConfigOnlineProd.cc.
References abs, l1t::OMDSReader::QueryResults::attributeLists(), l1t::OMDSReader::basicQuery(), l1t::OMDSReader::basicQueryView(), caloTPG, gather_cfg::cout, l1t::DataManager::dbSession(), end, l1t::OMDSReader::QueryResults::fillVariableFromRow(), HcalTrigTowerGeometry::firstHFTower(), CaloTPGTranscoderULUT::getOutputLUTId(), hcalScale, hcaluncomp, CaloTPGTranscoderULUT::HTvalid(), i, gen::k, funct::log(), L1ConfigOnlineProdBase< L1CaloHcalScaleRcd, L1CaloHcalScale >::m_omdsReader, min, L1CaloHcalScale::nBinEta, L1CaloHcalScale::nBinRank, l1t::OMDSReader::QueryResults::numberRows(), summarizeEdmComparisonLogfiles::objectName, pos, funct::pow(), L1CaloHcalScale::print(), o2o::query, l1t::OMDSReader::QueryResults::queryFailed(), cond::DbSession::schema(), python::IdGenerator::schema, L1CaloHcalScale::setBin(), l1t::OMDSReader::singleAttribute(), mathSSE::sqrt(), theTrigTowerGeometry, dtT0WireCalibration_cfg::threshold, and HcalTrigTowerGeometry::towerEtaBounds().
{ using namespace edm::es; std:: cout << "object Key " << objectKey <<std::endl <<std::flush; if(objectKey == "NULL" || objectKey == "") // return default blank ecal scale return boost::shared_ptr< L1CaloHcalScale >( hcalScale ); if(objectKey == "IDENTITY"){ // return identity ecal scale delete hcalScale; hcalScale = new L1CaloHcalScale(1); return boost::shared_ptr< L1CaloHcalScale >( hcalScale); } std::vector<unsigned int> analyticalLUT(1024, 0); std::vector<unsigned int> identityLUT(1024, 0); // Compute compression LUT for (unsigned int i=0; i < 1024; i++) { analyticalLUT[i] = (unsigned int)(sqrt(14.94*log(1.+i/14.94)*i) + 0.5); identityLUT[i] = std::min(i,0xffu); } hcaluncomp.clear(); for (int i = 0; i < 4176; i++){ RCTdecompression decompressionTable(256,0); hcaluncomp.push_back(decompressionTable); } std::vector < std::string > mainStrings; mainStrings.push_back("HCAL_LUT_METADATA"); mainStrings.push_back("HCAL_LUT_CHAN_DATA"); // ~~~~~~~~~ Cut values ~~~~~~~~~ std::vector< std::string > metaStrings ; metaStrings.push_back("RCTLSB"); metaStrings.push_back("NOMINAL_GAIN"); l1t::OMDSReader::QueryResults paramResults = m_omdsReader.basicQueryView( metaStrings, "CMS_HCL_HCAL_COND", "V_HCAL_LUT_METADATA_V1", "V_HCAL_LUT_METADATA_V1.TAG_NAME", m_omdsReader.basicQuery( "HCAL_LUT_METADATA", "CMS_RCT", "HCAL_SCALE_KEY", "HCAL_SCALE_KEY.HCAL_TAG", m_omdsReader.singleAttribute(objectKey))); if( paramResults.queryFailed() || (paramResults.numberRows()!=1) ) // check query successful { edm::LogError( "L1-O2O" ) << "Problem with L1CaloHcalScale key. Unable to find lutparam dat table" ; return boost::shared_ptr< L1CaloHcalScale >() ; } double hcalLSB, nominal_gain; paramResults.fillVariable("RCTLSB",hcalLSB); paramResults.fillVariable("NOMINAL_GAIN",nominal_gain); float rctlsb = hcalLSB == 0.25 ? 1./4 : 1./8; l1t::OMDSReader::QueryResults chanKey =m_omdsReader.basicQuery( "HCAL_LUT_CHAN_DATA", "CMS_RCT", "HCAL_SCALE_KEY", "HCAL_SCALE_KEY.HCAL_TAG", m_omdsReader.singleAttribute(objectKey)); //coral::AttributeList myresult; // myresult.extend( std::string schemaName("CMS_HCL_HCAL_COND"); coral::ISchema& schema = m_omdsReader.dbSession()->schema( schemaName ) ; coral::IQuery* query = schema.newQuery(); ; std::vector< std::string > channelStrings; channelStrings.push_back("IPHI"); channelStrings.push_back("IETA"); channelStrings.push_back("LUT_GRANULARITY"); channelStrings.push_back("OUTPUT_LUT_THRESHOLD"); channelStrings.push_back("OBJECTNAME"); std::vector< std::string >::const_iterator it = channelStrings.begin() ; std::vector< std::string >::const_iterator end = channelStrings.end() ; for( ; it != end ; ++it ) { query->addToOutputList( *it ) ; } std::string ob = "OBJECTNAME"; coral::AttributeList myresult; myresult.extend("IPHI", typeid(int)); myresult.extend("IETA", typeid(int)); myresult.extend("LUT_GRANULARITY", typeid(int)); myresult.extend("OUTPUT_LUT_THRESHOLD", typeid(int)); myresult.extend( ob,typeid(std::string));//, typeid(std::string)); query->defineOutput( myresult ); query->addToTableList( "V_HCAL_LUT_CHAN_DATA_V1"); query->setCondition( "V_HCAL_LUT_CHAN_DATA_V1.TAG_NAME = :" + chanKey.columnNames().front(), chanKey.attributeLists().front()); coral::ICursor& cursor = query->execute(); // when the query goes out of scope. std::vector<coral::AttributeList> atts; while (cursor.next()) { atts.push_back(cursor.currentRow()); }; delete query; l1t::OMDSReader::QueryResults chanResults(channelStrings,atts); if( chanResults.queryFailed() || (chanResults.numberRows()==0) ) // check query successful { edm::LogError( "L1-O2O" ) << "Problem with L1CaloHcalScale key. Unable to find lutparam dat table nrows" << chanResults.numberRows() ; return boost::shared_ptr< L1CaloHcalScale >() ; } chanResults.attributeLists(); for(int i = 0; i < chanResults.numberRows() ; ++i){ std::string objectName; chanResults.fillVariableFromRow("OBJECTNAME",i, objectName); // int if(objectName == "HcalTrigTowerDetId") { //trig tower int ieta, iphi, lutGranularity, threshold; chanResults.fillVariableFromRow("LUT_GRANULARITY",i,lutGranularity); chanResults.fillVariableFromRow("IPHI",i,iphi); chanResults.fillVariableFromRow("IETA",i,ieta); chanResults.fillVariableFromRow("OUTPUT_LUT_THRESHOLD",i,threshold); unsigned int outputLut[1024]; uint32_t lutId = caloTPG->getOutputLUTId(ieta,iphi); double eta_low = 0., eta_high = 0.; theTrigTowerGeometry.towerEtaBounds(ieta,eta_low,eta_high); double cosh_ieta = fabs(cosh((eta_low + eta_high)/2.)); if (!caloTPG->HTvalid(ieta, iphi)) continue; double factor = 0.; if (abs(ieta) >= theTrigTowerGeometry.firstHFTower()) factor = rctlsb; else factor = nominal_gain / cosh_ieta * lutGranularity; for (int k = 0; k < threshold; ++k) outputLut[k] = 0; for (unsigned int k = threshold; k < 1024; ++k) outputLut[k] = (abs(ieta) < theTrigTowerGeometry.firstHFTower()) ? analyticalLUT[k] : identityLUT[k]; // tpg - compressed value unsigned int tpg = outputLut[0]; int low = 0; for (unsigned int k = 0; k < 1024; ++k){ if (outputLut[k] != tpg){ unsigned int mid = (low + k)/2; hcaluncomp[lutId][tpg] = (tpg == 0 ? low : factor * mid); low = k; tpg = outputLut[k]; } } hcaluncomp[lutId][tpg] = factor * low; } } for( unsigned short ieta = 1 ; ieta <= L1CaloHcalScale::nBinEta; ++ieta ){ for(int pos = 0; pos <=1; pos++){ for( unsigned short irank = 0 ; irank < L1CaloHcalScale::nBinRank; ++irank ){ int zside = (int) pow(-1,pos); int nphi = 0; double etvalue = 0.; for(int iphi = 1; iphi<=72; iphi++){ if(!caloTPG->HTvalid(ieta, iphi)) continue; uint32_t lutId = caloTPG->getOutputLUTId(ieta,iphi); nphi++; etvalue += (double) hcaluncomp[lutId][irank]; } // phi if (nphi > 0) etvalue /= nphi; hcalScale->setBin(irank, ieta, zside, etvalue); } // rank } // zside }// eta std::cout << std::setprecision(10); hcalScale->print(std::cout); // ------------ method called to produce the data ------------ return boost::shared_ptr< L1CaloHcalScale >( hcalScale ); }
Definition at line 53 of file L1CaloHcalScaleConfigOnlineProd.cc.
Referenced by L1CaloHcalScaleConfigOnlineProd(), newObject(), and ~L1CaloHcalScaleConfigOnlineProd().
Definition at line 51 of file L1CaloHcalScaleConfigOnlineProd.cc.
Referenced by L1CaloHcalScaleConfigOnlineProd(), and newObject().
std::vector<RCTdecompression> L1CaloHcalScaleConfigOnlineProd::hcaluncomp [private] |
Definition at line 55 of file L1CaloHcalScaleConfigOnlineProd.cc.
Referenced by newObject().
Definition at line 52 of file L1CaloHcalScaleConfigOnlineProd.cc.
Referenced by newObject().
Definition at line 60 of file L1CaloHcalScaleConfigOnlineProd.cc.