#include <L1Trigger/L1GlobalCaloTrigger/plugins/L1GctPrintLuts.cc>
Public Types | |
typedef L1GlobalCaloTrigger::lutPtr | lutPtr |
typedefs | |
typedef L1GlobalCaloTrigger::lutPtrVector | lutPtrVector |
Public Member Functions | |
L1GctPrintLuts (const edm::ParameterSet &) | |
~L1GctPrintLuts () | |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob () |
int | configureGct (const edm::EventSetup &c) |
virtual void | endJob () |
Private Attributes | |
L1GlobalCaloTrigger * | m_gct |
std::string | m_hfSumLutOutFileName |
std::string | m_htMissLutOutFileName |
lutPtrVector | m_jetEtCalibLuts |
std::string | m_jetRanksOutFileName |
Description: print Gct lookup table contents to a file
Definition at line 39 of file L1GctPrintLuts.h.
typedefs
Definition at line 43 of file L1GctPrintLuts.h.
Definition at line 44 of file L1GctPrintLuts.h.
L1GctPrintLuts::L1GctPrintLuts | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 34 of file L1GctPrintLuts.cc.
References L1GctJetFinderBase::COL_OFFSET, and m_jetEtCalibLuts.
: m_jetRanksOutFileName (iConfig.getUntrackedParameter<std::string>("jetRanksFilename", "gctJetRanksContents.txt" )), m_hfSumLutOutFileName (iConfig.getUntrackedParameter<std::string>("hfSumLutFilename", "gctHfSumLutContents.txt" )), m_htMissLutOutFileName(iConfig.getUntrackedParameter<std::string>("htMissLutFilename","gctHtMissLutContents.txt")), m_gct(new L1GlobalCaloTrigger(L1GctJetLeafCard::hardwareJetFinder)), m_jetEtCalibLuts() { // Fill the jetEtCalibLuts vector lutPtr nextLut( new L1GctJetEtCalibrationLut() ); for (unsigned ieta=0; ieta<L1GctJetFinderBase::COL_OFFSET; ieta++) { nextLut->setEtaBin(ieta); m_jetEtCalibLuts.push_back(nextLut); nextLut.reset ( new L1GctJetEtCalibrationLut() ); } }
L1GctPrintLuts::~L1GctPrintLuts | ( | ) |
Definition at line 52 of file L1GctPrintLuts.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void L1GctPrintLuts::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 67 of file L1GctPrintLuts.cc.
References L1GctHfEtSumsLut::bitCountNegEtaRing1, L1GctHfEtSumsLut::bitCountNegEtaRing2, L1GctHfEtSumsLut::bitCountPosEtaRing1, L1GctHfEtSumsLut::bitCountPosEtaRing2, configureGct(), L1GctHfEtSumsLut::etSumNegEtaRing1, L1GctHfEtSumsLut::etSumNegEtaRing2, L1GctHfEtSumsLut::etSumPosEtaRing1, L1GctHfEtSumsLut::etSumPosEtaRing2, mergeVDriftHistosByStation::file, L1GctGlobalHfSumAlgos::getBCLut(), L1GlobalCaloTrigger::getEnergyFinalStage(), L1GctGlobalHfSumAlgos::getESLut(), L1GctGlobalEnergyAlgos::getHfSumProcessor(), L1GctGlobalEnergyAlgos::getHtMissLut(), m_gct, m_hfSumLutOutFileName, m_htMissLutOutFileName, m_jetEtCalibLuts, and m_jetRanksOutFileName.
{ // get config data from EventSetup // check this has been done successfully before proceeding if (configureGct(iSetup) == 0) { // Write to a new file struct stat buffer ; if ( !stat( m_jetRanksOutFileName.c_str(), &buffer ) ) { edm::LogWarning("LutFileExists") << "File " << m_jetRanksOutFileName << " already exists. It will not be overwritten." << std::endl; } else { std::ofstream file; file.open( m_jetRanksOutFileName.c_str() ); if (file.good()) { // Print the calibration lut contents file << " Gct lookup table printout \n" << "===========================\n\n" << "Jet Et Calibration lut contents\n" << std::endl; for (unsigned ieta=0; ieta<m_jetEtCalibLuts.size(); ieta++) { file << *m_jetEtCalibLuts.at(ieta) << std::endl; } } else { edm::LogWarning("LutFileError") << "Error opening file " << m_jetRanksOutFileName << ". No lookup tables written." << std::endl; } file.close(); } if ( !stat( m_hfSumLutOutFileName.c_str(), &buffer ) ) { edm::LogWarning("LutFileExists") << "File " << m_hfSumLutOutFileName << " already exists. It will not be overwritten." << std::endl; } else { std::ofstream file; file.open( m_hfSumLutOutFileName.c_str() ); if (file.good()) { // Print the Hf luts file << "\n\n Hf ring jet bit count luts:" << std::endl; file << "\n Positive eta, ring1" << std::endl; file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getBCLut(L1GctHfEtSumsLut::bitCountPosEtaRing1) << std::endl; file << "\n Positive eta, ring2" << std::endl; file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getBCLut(L1GctHfEtSumsLut::bitCountPosEtaRing2) << std::endl; file << "\n Negative eta, ring1" << std::endl; file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getBCLut(L1GctHfEtSumsLut::bitCountNegEtaRing1) << std::endl; file << "\n Negative eta, ring2" << std::endl; file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getBCLut(L1GctHfEtSumsLut::bitCountNegEtaRing2) << std::endl; file << "\n\n Hf Et sum luts:" << std::endl; file << "\n Positive eta, ring1" << std::endl; file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getESLut(L1GctHfEtSumsLut::etSumPosEtaRing1) << std::endl; file << "\n Positive eta, ring2" << std::endl; file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getESLut(L1GctHfEtSumsLut::etSumPosEtaRing2) << std::endl; file << "\n Negative eta, ring1" << std::endl; file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getESLut(L1GctHfEtSumsLut::etSumNegEtaRing1) << std::endl; file << "\n Negative eta, ring2" << std::endl; file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getESLut(L1GctHfEtSumsLut::etSumNegEtaRing2) << std::endl; } else { edm::LogWarning("LutFileError") << "Error opening file " << m_hfSumLutOutFileName << ". No lookup tables written." << std::endl; } file.close(); } if ( !stat( m_htMissLutOutFileName.c_str(), &buffer ) ) { edm::LogWarning("LutFileExists") << "File " << m_htMissLutOutFileName << " already exists. It will not be overwritten." << std::endl; } else { std::ofstream file; file.open( m_htMissLutOutFileName.c_str() ); if (file.good()) { // Print the HtMiss luts file << "\n\n missing Ht lut:" << std::endl; file << *m_gct->getEnergyFinalStage()->getHtMissLut() << std::endl; } else { edm::LogWarning("LutFileError") << "Error opening file " << m_hfSumLutOutFileName << ". No lookup tables written." << std::endl; } file.close(); } } }
void L1GctPrintLuts::beginJob | ( | void | ) | [private, virtual] |
int L1GctPrintLuts::configureGct | ( | const edm::EventSetup & | c | ) | [private] |
Definition at line 156 of file L1GctPrintLuts.cc.
References edm::EventSetup::get(), m_gct, m_jetEtCalibLuts, edm::ESHandle< T >::product(), L1GlobalCaloTrigger::setHtMissScale(), L1GlobalCaloTrigger::setJetEtCalibrationLuts(), L1GlobalCaloTrigger::setJetFinderParams(), L1GlobalCaloTrigger::setupHfSumLuts(), and summarizeEdmComparisonLogfiles::success.
Referenced by analyze().
{ int success = 0; if (&c==0) { success = -1; edm::LogWarning("L1GctConfigFailure") << "Cannot find EventSetup information." << std::endl; } if (success == 0) { // get data from EventSetup edm::ESHandle< L1GctJetFinderParams > jfPars ; c.get< L1GctJetFinderParamsRcd >().get( jfPars ) ; // which record? edm::ESHandle< L1CaloEtScale > hfRingEtScale ; c.get< L1HfRingEtScaleRcd >().get( hfRingEtScale ) ; // which record? edm::ESHandle< L1CaloEtScale > htMissScale ; c.get< L1HtMissScaleRcd >().get( htMissScale ) ; // which record? // edm::ESHandle< L1GctChannelMask > chanMask ; // c.get< L1GctChannelMaskRcd >().get( chanMask ) ; // which record? edm::ESHandle< L1CaloEtScale > etScale ; c.get< L1JetEtScaleRcd >().get( etScale ) ; // which record? if (jfPars.product() == 0) { success = -1; edm::LogWarning("L1GctConfigFailure") << "Failed to find a L1GctJetFinderParamsRcd:L1GctJetFinderParams in EventSetup!" << std::endl; } if (hfRingEtScale.product() == 0) { success = -1; edm::LogWarning("L1GctConfigFailure") << "Failed to find a L1HfRingEtScaleRcd:L1CaloEtScale in EventSetup!" << std::endl; } if (htMissScale.product() == 0) { success = -1; edm::LogWarning("L1GctConfigFailure") << "Failed to find a L1HtMissScaleRcd:L1CaloEtScale in EventSetup!" << std::endl; } // if (chanMask.product() == 0) { // success = -1; // edm::LogWarning("L1GctConfigFailure") // << "Failed to find a L1GctChannelMaskRcd:L1GctChannelMask in EventSetup!" << std::endl; // } if (success==0) { // tell the jet Et Luts about the scales for (unsigned ieta=0; ieta<m_jetEtCalibLuts.size(); ieta++) { m_jetEtCalibLuts.at(ieta)->setFunction(jfPars.product()); m_jetEtCalibLuts.at(ieta)->setOutputEtScale(etScale.product()); } // pass all the setup info to the gct m_gct->setJetEtCalibrationLuts(m_jetEtCalibLuts); m_gct->setJetFinderParams(jfPars.product()); m_gct->setHtMissScale(htMissScale.product()); m_gct->setupHfSumLuts(hfRingEtScale.product()); // m_gct->setChannelMask(chanMask.product()); } } if (success != 0) { edm::LogError("L1GctConfigError") << "Configuration failed - GCT emulator will not be run" << std::endl; } return success; }
void L1GctPrintLuts::endJob | ( | void | ) | [private, virtual] |
L1GlobalCaloTrigger* L1GctPrintLuts::m_gct [private] |
Definition at line 65 of file L1GctPrintLuts.h.
Referenced by analyze(), and configureGct().
std::string L1GctPrintLuts::m_hfSumLutOutFileName [private] |
Definition at line 61 of file L1GctPrintLuts.h.
Referenced by analyze().
std::string L1GctPrintLuts::m_htMissLutOutFileName [private] |
Definition at line 62 of file L1GctPrintLuts.h.
Referenced by analyze().
lutPtrVector L1GctPrintLuts::m_jetEtCalibLuts [private] |
Definition at line 68 of file L1GctPrintLuts.h.
Referenced by analyze(), configureGct(), and L1GctPrintLuts().
std::string L1GctPrintLuts::m_jetRanksOutFileName [private] |
Definition at line 60 of file L1GctPrintLuts.h.
Referenced by analyze().