#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 (const edm::EventSetup &) |
int | configureGct (const edm::EventSetup &c) |
virtual void | endJob () |
Private Attributes | |
L1GlobalCaloTrigger * | m_gct |
std::string | m_hfSumLutOutFileName |
std::string | m_jetCountOutFileName |
lutPtrVector | m_jetEtCalibLuts |
std::string | m_jetRanksOutFileName |
Definition at line 39 of file L1GctPrintLuts.h.
Definition at line 44 of file L1GctPrintLuts.h.
L1GctPrintLuts::L1GctPrintLuts | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 37 of file L1GctPrintLuts.cc.
References L1GctJetFinderBase::COL_OFFSET, and m_jetEtCalibLuts.
00037 : 00038 m_jetRanksOutFileName(iConfig.getUntrackedParameter<std::string>("jetRanksFilename","gctJetRanksContents.txt")), 00039 m_jetCountOutFileName(iConfig.getUntrackedParameter<std::string>("jetCountFilename","gctJetCountContents.txt")), 00040 m_hfSumLutOutFileName(iConfig.getUntrackedParameter<std::string>("hfSumLutFilename","gctHfSumLutContents.txt")), 00041 m_gct(new L1GlobalCaloTrigger(L1GctJetLeafCard::hardwareJetFinder)), 00042 m_jetEtCalibLuts() 00043 { 00044 // Fill the jetEtCalibLuts vector 00045 lutPtr nextLut( new L1GctJetEtCalibrationLut() ); 00046 00047 for (unsigned ieta=0; ieta<L1GctJetFinderBase::COL_OFFSET; ieta++) { 00048 nextLut->setEtaBin(ieta); 00049 m_jetEtCalibLuts.push_back(nextLut); 00050 nextLut.reset ( new L1GctJetEtCalibrationLut() ); 00051 } 00052 00053 }
L1GctPrintLuts::~L1GctPrintLuts | ( | ) |
Definition at line 55 of file L1GctPrintLuts.cc.
00056 { 00057 00058 // do anything here that needs to be done at desctruction time 00059 // (e.g. close files, deallocate resources etc.) 00060 00061 }
void L1GctPrintLuts::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
void L1GctPrintLuts::beginJob | ( | const edm::EventSetup & | c | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 77 of file L1GctPrintLuts.cc.
References L1GctHfLutSetup::bitCountNegEtaRing1, L1GctHfLutSetup::bitCountNegEtaRing2, L1GctHfLutSetup::bitCountPosEtaRing1, L1GctHfLutSetup::bitCountPosEtaRing2, configureGct(), lat::endl(), L1GctHfLutSetup::etSumNegEtaRing1, L1GctHfLutSetup::etSumNegEtaRing2, L1GctHfLutSetup::etSumPosEtaRing1, L1GctHfLutSetup::etSumPosEtaRing2, file, L1GctGlobalHfSumAlgos::getBCLut(), L1GlobalCaloTrigger::getEnergyFinalStage(), L1GctGlobalHfSumAlgos::getESLut(), L1GctGlobalEnergyAlgos::getHfSumProcessor(), L1GlobalCaloTrigger::getWheelJetFpgas(), m_gct, m_hfSumLutOutFileName, m_jetCountOutFileName, m_jetEtCalibLuts, m_jetRanksOutFileName, L1GlobalCaloTrigger::N_WHEEL_CARDS, and muonGeometry::wheel.
00078 { 00079 // get config data from EventSetup 00080 // check this has been done successfully before proceeding 00081 if (configureGct(c) == 0) { 00082 00083 // Write to a new file 00084 struct stat buffer ; 00085 if ( !stat( m_jetRanksOutFileName.c_str(), &buffer ) ) { 00086 edm::LogWarning("LutFileExists") << "File " << m_jetRanksOutFileName << " already exists. It will not be overwritten." << std::endl; 00087 } else { 00088 00089 std::ofstream file; 00090 file.open( m_jetRanksOutFileName.c_str() ); 00091 00092 if (file.good()) { 00093 // Print the calibration lut contents 00094 file << " Gct lookup table printout \n" 00095 << "===========================\n\n" 00096 << "Jet Et Calibration lut contents\n" << std::endl; 00097 for (unsigned ieta=0; ieta<m_jetEtCalibLuts.size(); ieta++) { 00098 file << *m_jetEtCalibLuts.at(ieta) << std::endl; 00099 } 00100 } else { 00101 edm::LogWarning("LutFileError") << "Error opening file " << m_jetRanksOutFileName << ". No lookup tables written." << std::endl; 00102 } 00103 file.close(); 00104 } 00105 00106 if ( !stat( m_jetCountOutFileName.c_str(), &buffer ) ) { 00107 edm::LogWarning("LutFileExists") << "File " << m_jetCountOutFileName << " already exists. It will not be overwritten." << std::endl; 00108 } else { 00109 00110 std::ofstream file; 00111 file.open( m_jetCountOutFileName.c_str() ); 00112 00113 if (file.good()) { 00114 // Print the jet counter luts 00115 for (int wheel=0; wheel<m_gct->N_WHEEL_CARDS; wheel++) { 00116 // Could get the actual number of filled counters from the 00117 // L1GctJetCounterSetup records. 00118 // Just a constant for now though. 00119 int nCounters = m_gct->getWheelJetFpgas().at(wheel)->N_JET_COUNTERS; 00120 file << "\n\n" << (wheel==0 ? "Positive " : "Negative ") << "wheel has " 00121 << nCounters << " jet counters" << std::endl; 00122 for (int ctr=0; ctr<nCounters; ctr++) { 00123 file << "\nJet counter number " << ctr << " lookup table contents \n" << std::endl; 00124 file << *m_gct->getWheelJetFpgas().at(wheel)->getJetCounter(ctr)->getJetCounterLut() << std::endl; 00125 } 00126 } 00127 } else { 00128 edm::LogWarning("LutFileError") << "Error opening file " << m_jetCountOutFileName << ". No lookup tables written." << std::endl; 00129 } 00130 file.close(); 00131 } 00132 00133 if ( !stat( m_hfSumLutOutFileName.c_str(), &buffer ) ) { 00134 edm::LogWarning("LutFileExists") << "File " << m_hfSumLutOutFileName << " already exists. It will not be overwritten." << std::endl; 00135 } else { 00136 00137 std::ofstream file; 00138 file.open( m_hfSumLutOutFileName.c_str() ); 00139 00140 if (file.good()) { 00141 // Print the Hf luts 00142 file << "\n\n Hf ring jet bit count luts:" << std::endl; 00143 file << "\n Positive eta, ring1" << std::endl; 00144 file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getBCLut(L1GctHfLutSetup::bitCountPosEtaRing1) << std::endl; 00145 file << "\n Positive eta, ring2" << std::endl; 00146 file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getBCLut(L1GctHfLutSetup::bitCountPosEtaRing2) << std::endl; 00147 file << "\n Negative eta, ring1" << std::endl; 00148 file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getBCLut(L1GctHfLutSetup::bitCountNegEtaRing1) << std::endl; 00149 file << "\n Negative eta, ring2" << std::endl; 00150 file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getBCLut(L1GctHfLutSetup::bitCountNegEtaRing2) << std::endl; 00151 file << "\n\n Hf Et sum luts:" << std::endl; 00152 file << "\n Positive eta, ring1" << std::endl; 00153 file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getESLut(L1GctHfLutSetup::etSumPosEtaRing1) << std::endl; 00154 file << "\n Positive eta, ring2" << std::endl; 00155 file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getESLut(L1GctHfLutSetup::etSumPosEtaRing2) << std::endl; 00156 file << "\n Negative eta, ring1" << std::endl; 00157 file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getESLut(L1GctHfLutSetup::etSumNegEtaRing1) << std::endl; 00158 file << "\n Negative eta, ring2" << std::endl; 00159 file << *m_gct->getEnergyFinalStage()->getHfSumProcessor()->getESLut(L1GctHfLutSetup::etSumNegEtaRing2) << std::endl; 00160 } else { 00161 edm::LogWarning("LutFileError") << "Error opening file " << m_hfSumLutOutFileName << ". No lookup tables written." << std::endl; 00162 } 00163 file.close(); 00164 } 00165 } 00166 }
int L1GctPrintLuts::configureGct | ( | const edm::EventSetup & | c | ) | [private] |
Definition at line 169 of file L1GctPrintLuts.cc.
References lat::endl(), edm::EventSetup::get(), m_gct, m_jetEtCalibLuts, edm::ESHandle< T >::product(), L1GlobalCaloTrigger::setChannelMask(), L1GlobalCaloTrigger::setJetEtCalibrationLuts(), L1GlobalCaloTrigger::setJetFinderParams(), L1GlobalCaloTrigger::setupHfSumLuts(), and L1GlobalCaloTrigger::setupJetCounterLuts().
Referenced by beginJob().
00170 { 00171 int success = 0; 00172 if (&c==0) { 00173 success = -1; 00174 edm::LogWarning("L1GctConfigFailure") << "Cannot find EventSetup information." << std::endl; 00175 } 00176 00177 if (success == 0) { 00178 // get data from EventSetup 00179 edm::ESHandle< L1GctJetFinderParams > jfPars ; 00180 c.get< L1GctJetFinderParamsRcd >().get( jfPars ) ; // which record? 00181 edm::ESHandle< L1GctJetCounterSetup > jcPosPars ; 00182 c.get< L1GctJetCounterPositiveEtaRcd >().get( jcPosPars ) ; // which record? 00183 edm::ESHandle< L1GctJetCounterSetup > jcNegPars ; 00184 c.get< L1GctJetCounterNegativeEtaRcd >().get( jcNegPars ) ; // which record? 00185 edm::ESHandle< L1GctJetEtCalibrationFunction > calibFun ; 00186 c.get< L1GctJetCalibFunRcd >().get( calibFun ) ; // which record? 00187 edm::ESHandle< L1GctHfLutSetup > hfLSetup ; 00188 c.get< L1GctHfLutSetupRcd >().get( hfLSetup ) ; // which record? 00189 edm::ESHandle< L1GctChannelMask > chanMask ; 00190 c.get< L1GctChannelMaskRcd >().get( chanMask ) ; // which record? 00191 edm::ESHandle< L1CaloEtScale > etScale ; 00192 c.get< L1JetEtScaleRcd >().get( etScale ) ; // which record? 00193 00194 if (jfPars.product() == 0) { 00195 success = -1; 00196 edm::LogWarning("L1GctConfigFailure") 00197 << "Failed to find a L1GctJetFinderParamsRcd:L1GctJetFinderParams in EventSetup!" << std::endl; 00198 } 00199 00200 if (calibFun.product() == 0) { 00201 success = -1; 00202 edm::LogWarning("L1GctConfigFailure") 00203 << "Failed to find a L1GctJetCalibFunRcd:L1GctJetEtCalibrationFunction in EventSetup!" << std::endl; 00204 } 00205 00206 if (hfLSetup.product() == 0) { 00207 success = -1; 00208 edm::LogWarning("L1GctConfigFailure") 00209 << "Failed to find a L1GctHfLutSetupRcd:L1GctHfLutSetup in EventSetup!" << std::endl; 00210 } 00211 00212 if (chanMask.product() == 0) { 00213 success = -1; 00214 edm::LogWarning("L1GctConfigFailure") 00215 << "Failed to find a L1GctChannelMaskRcd:L1GctChannelMask in EventSetup!" << std::endl; 00216 } 00217 00218 if (success==0) { 00219 // tell the jet Et Luts about the scales 00220 for (unsigned ieta=0; ieta<m_jetEtCalibLuts.size(); ieta++) { 00221 m_jetEtCalibLuts.at(ieta)->setFunction(calibFun.product()); 00222 m_jetEtCalibLuts.at(ieta)->setOutputEtScale(etScale.product()); 00223 } 00224 00225 00226 // pass all the setup info to the gct 00227 m_gct->setJetEtCalibrationLuts(m_jetEtCalibLuts); 00228 m_gct->setJetFinderParams(jfPars.product()); 00229 m_gct->setupJetCounterLuts(jcPosPars.product(), jcNegPars.product()); 00230 m_gct->setupHfSumLuts(hfLSetup.product()); 00231 m_gct->setChannelMask(chanMask.product()); 00232 00233 } 00234 } 00235 00236 if (success != 0) { 00237 edm::LogError("L1GctConfigError") 00238 << "Configuration failed - GCT emulator will not be run" << std::endl; 00239 } 00240 return success; 00241 }
L1GlobalCaloTrigger* L1GctPrintLuts::m_gct [private] |
std::string L1GctPrintLuts::m_hfSumLutOutFileName [private] |
std::string L1GctPrintLuts::m_jetCountOutFileName [private] |
lutPtrVector L1GctPrintLuts::m_jetEtCalibLuts [private] |
Definition at line 68 of file L1GctPrintLuts.h.
Referenced by beginJob(), configureGct(), and L1GctPrintLuts().
std::string L1GctPrintLuts::m_jetRanksOutFileName [private] |