#include <L1GtPatternGenerator.h>
Public Member Functions | |
L1GtPatternGenerator (const edm::ParameterSet &) | |
~L1GtPatternGenerator () | |
Protected Member Functions | |
void | extractGlobalTriggerData (const edm::Event &iEvent, L1GtPatternMap &patterns) |
Private Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
analyze each event | |
virtual void | beginJob () |
analyze | |
virtual void | endJob () |
end of job | |
void | packHfRecords (const std::string &resultName, L1GtPatternMap &allPatterns) |
Static Private Member Functions | |
static uint32_t | packEtMiss (uint32_t rawValue) |
static uint32_t | packRegionalMuons (uint32_t rawValue) |
Private Attributes | |
std::vector< int > | m_bx |
std::vector< uint32_t > | m_columnDefaults |
std::vector< uint32_t > | m_columnLengths |
std::vector< std::string > | m_columnNames |
edm::InputTag | m_cscTag |
bool | m_debug |
std::string | m_destPath |
an algorithm and a condition in that algorithm to test the object maps | |
edm::InputTag | m_dtTag |
input tags for regional muon data | |
std::string | m_fileName |
output file name | |
std::ofstream | m_fileStream |
std::string | m_footer |
edm::InputTag | m_gctTag |
input tag for GCT data | |
edm::InputTag | m_gmtTag |
input tag for GMT data | |
edm::InputTag | m_gtTag |
input tag for GT data | |
std::string | m_header |
formatting instructions | |
edm::InputTag | m_rpcbTag |
edm::InputTag | m_rpcfTag |
std::auto_ptr< L1GtPatternWriter > | m_writer |
Description: A generator of pattern files for L1 GT hardware testing.
Implementation: <TODO: enter implementation details>
$Date$ $Revision$
Description: see header file.
Implementation: <TODO: enter implementation details>
$Date$ $Revision$
Definition at line 39 of file L1GtPatternGenerator.h.
L1GtPatternGenerator::L1GtPatternGenerator | ( | const edm::ParameterSet & | parSet | ) | [explicit] |
Definition at line 39 of file L1GtPatternGenerator.cc.
References edm::ParameterSet::getParameter(), LogDebug, m_bx, m_columnDefaults, m_columnLengths, m_columnNames, m_cscTag, m_debug, m_dtTag, m_fileName, m_footer, m_gctTag, m_gmtTag, m_gtTag, m_header, m_rpcbTag, and m_rpcfTag.
{ // input tags for trigger records m_gctTag = parSet.getParameter<edm::InputTag>("GctInputTag"); m_gmtTag = parSet.getParameter<edm::InputTag>("GmtInputTag"); m_gtTag = parSet.getParameter<edm::InputTag>("GtInputTag"); m_dtTag = parSet.getParameter<edm::InputTag>("DtInputTag"); m_cscTag = parSet.getParameter<edm::InputTag>("CscInputTag"); m_rpcbTag = parSet.getParameter<edm::InputTag>("RpcbInputTag"); m_rpcfTag = parSet.getParameter<edm::InputTag>("RpcfInputTag"); // output formatting stuff m_header = parSet.getParameter<std::string>("PatternFileHeader"); m_footer = parSet.getParameter<std::string>("PatternFileFooter"); m_columnNames = parSet.getParameter<std::vector<std::string> >("PatternFileColumns"); m_columnLengths = parSet.getParameter<std::vector<uint32_t> >("PatternFileLengths"); m_columnDefaults = parSet.getParameter<std::vector<uint32_t> >("PatternFileDefaultValues"); m_fileName = parSet.getParameter<std::string>("PatternFileName"); m_bx = parSet.getParameter<std::vector<int> >("bx"); m_debug = parSet.getParameter<bool>("DebugOutput"); if(m_columnLengths.size() != m_columnNames.size()) { edm::LogWarning("L1GtPatternGenerator") << "Length of PatternFileColumns does not match length of PatternFileLenghts, " << m_columnNames.size() << " vs " << m_columnLengths.size() << std::endl; } LogDebug("L1GtPatternGenerator") << "\nL1 GCT record: " << m_gctTag << "\nL1 GMT record: " << m_gmtTag << "\nL1 GT record: " << m_gtTag << std::endl; }
L1GtPatternGenerator::~L1GtPatternGenerator | ( | ) |
Definition at line 77 of file L1GtPatternGenerator.cc.
{}
void L1GtPatternGenerator::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | evSetup | ||
) | [private, virtual] |
analyze each event
Analyze each event:
Implements edm::EDAnalyzer.
Definition at line 235 of file L1GtPatternGenerator.cc.
References L1GctEtMiss::et(), edm::EventID::event(), extractGlobalTriggerData(), extractRecordData(), L1MuGMTCand::getDataWord(), L1MuRegionalCand::getDataWord(), edm::EventBase::id(), edm::InputTag::instance(), edm::InputTag::label(), LogTrace, edm::EventBase::luminosityBlock(), m_cscTag, m_dtTag, m_gctTag, m_gmtTag, m_rpcbTag, m_rpcfTag, m_writer, packHfRecords(), packRegionalMuons(), phi, L1GctHFBitCounts::raw(), L1GctEtHad::raw(), L1GctJetCand::raw(), L1GctEmCand::raw(), L1GctHFRingEtSums::raw(), L1GctEtTotal::raw(), L1GctHtMiss::raw(), edm::Event::run(), and convertSQLiteXML::runNumber.
{ // debug information const unsigned int runNumber = iEvent.run(); const unsigned int lsNumber = iEvent.luminosityBlock(); const unsigned int eventNumber = iEvent.id().event(); LogTrace("L1GtPatternGenerator") << "\n\nL1GtPatternGenerator::analyze: Run: " << runNumber << " LS: " << lsNumber << " Event: " << eventNumber << "\n\n" << std::endl; L1GtPatternMap allPatterns; // GMT muon candidates extractRecordData(iEvent, allPatterns, m_gmtTag.label(), m_gmtTag.instance(), &L1MuGMTCand::getDataWord, "gmtMuon"); // regional muon candidates extractRecordData(iEvent, allPatterns, m_cscTag.label(), m_cscTag.instance(), &L1MuRegionalCand::getDataWord, "cscMuon", packRegionalMuons); extractRecordData(iEvent, allPatterns, m_dtTag.label(), m_dtTag.instance(), &L1MuRegionalCand::getDataWord, "dtMuon", packRegionalMuons); extractRecordData(iEvent, allPatterns, m_rpcfTag.label(), m_rpcfTag.instance(), &L1MuRegionalCand::getDataWord, "fwdMuon", packRegionalMuons); extractRecordData(iEvent, allPatterns, m_rpcbTag.label(), m_rpcbTag.instance(), &L1MuRegionalCand::getDataWord, "brlMuon", packRegionalMuons); // GCT objects extractRecordData(iEvent, allPatterns, m_gctTag.label(), "nonIsoEm", &L1GctEmCand::raw, "gctEm"); extractRecordData(iEvent, allPatterns, m_gctTag.label(), "isoEm", &L1GctEmCand::raw, "gctIsoEm"); extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtMiss::et, "etMiss"); extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtMiss::phi, "etMissPhi"); extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHtMiss::raw, "htMiss"); extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtHad::raw, "etHad"); extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtTotal::raw, "etTotal"); extractRecordData(iEvent, allPatterns, m_gctTag.label(), "cenJets", &L1GctJetCand::raw, "cenJet"); extractRecordData(iEvent, allPatterns, m_gctTag.label(), "forJets", &L1GctJetCand::raw, "forJet"); extractRecordData(iEvent, allPatterns, m_gctTag.label(), "tauJets", &L1GctJetCand::raw, "tauJet"); extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHFBitCounts::raw, "hfBitCounts"); extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHFRingEtSums::raw, "hfRingEtSums"); // Post processing: // HFBitCounts/HFRingEtSums need to be mangled to PSB values packHfRecords("hfPsbValue", allPatterns); // GT objects extractGlobalTriggerData(iEvent, allPatterns); // Output m_writer->writePatterns(allPatterns); }
void L1GtPatternGenerator::beginJob | ( | void | ) | [private, virtual] |
analyze
Method called once each job just before starting event loop.
Reimplemented from edm::EDAnalyzer.
Definition at line 285 of file L1GtPatternGenerator.cc.
References m_bx, m_columnDefaults, m_columnLengths, m_columnNames, m_debug, m_fileName, m_fileStream, m_footer, m_header, and m_writer.
{ m_fileStream.open(m_fileName.c_str()); if(!m_fileStream) { edm::LogError("L1GtPatternGenerator") << "Failed to open output file " << m_fileName; } m_writer = std::auto_ptr<L1GtPatternWriter>(new L1GtPatternWriter(m_fileStream, m_header, m_footer, m_columnNames, m_columnLengths, m_columnDefaults, m_bx, m_debug)); }
void L1GtPatternGenerator::endJob | ( | void | ) | [private, virtual] |
end of job
Method called once each job just after ending the event loop.
Reimplemented from edm::EDAnalyzer.
Definition at line 299 of file L1GtPatternGenerator.cc.
References m_fileStream, and m_writer.
{ m_writer->close(); m_fileStream.close(); }
void L1GtPatternGenerator::extractGlobalTriggerData | ( | const edm::Event & | iEvent, |
L1GtPatternMap & | patterns | ||
) | [protected] |
Definition at line 172 of file L1GtPatternGenerator.cc.
References edm::EventID::event(), Exception, extractGlobalTriggerWord(), edm::Event::getByLabel(), L1GtPatternMap::getLine(), patZpeak::handle, edm::EventBase::id(), edm::InputTag::instance(), edm::HandleBase::isValid(), edm::InputTag::label(), geometryCSVtoXML::line, m_gtTag, and L1GtPatternLine::push().
Referenced by analyze().
{ // extract global trigger readout record edm::Handle<L1GlobalTriggerReadoutRecord> handle; iEvent.getByLabel(m_gtTag, handle); // continue if it's present if(!handle.isValid()) { throw cms::Exception(__func__) << "Failed to extract GT readout record labeled " << m_gtTag.label() << ", instance " << m_gtTag.instance(); } edm::EventNumber_t eventNr = iEvent.id().event(); // for each FDL word... const std::vector<L1GtFdlWord>& fdlWords = handle->gtFdlVector(); for(std::vector<L1GtFdlWord>::const_iterator it = fdlWords.begin(); it != fdlWords.end() ; ++it) { // extract relevant data int bx = it->bxInEvent(); // find matching pattern file line L1GtPatternLine& line = patterns.getLine(eventNr, bx); extractGlobalTriggerWord(it->gtDecisionWord(), line, "gtDecision"); extractGlobalTriggerWord(it->gtDecisionWordExtended(), line, "gtDecisionExt"); extractGlobalTriggerWord(it->gtTechnicalTriggerWord(), line, "gtTechTrigger"); line.push("gtFinalOr", it->finalOR()); } }
static uint32_t L1GtPatternGenerator::packEtMiss | ( | uint32_t | rawValue | ) | [static, private] |
Post-processing for etMissing
void L1GtPatternGenerator::packHfRecords | ( | const std::string & | resultName, |
L1GtPatternMap & | allPatterns | ||
) | [private] |
Post-processing for complex mapping of HF records to PSB values
The mapping from hfBitCounts/hfRingEtSums raw data to the PSBs is non-trivial, see http://wwwhephy.oeaw.ac.at/p3w/electronic1/GlobalTrigger/doc/InterfaceDesc/update_CMS_NOTE_2002_069.pdf
Definition at line 207 of file L1GtPatternGenerator.cc.
References L1GtPatternMap::begin(), and L1GtPatternMap::end().
Referenced by analyze().
{ // iterate over each pattern line for(L1GtPatternMap::LineMap::iterator it = allPatterns.begin(); it != allPatterns.end(); ++it) { // Get the HF bit counts and ring sums uint32_t counts = it->second.get("hfBitCounts1"); uint32_t sums = it->second.get("hfRingEtSums1"); // Bits 0..11 -> 4 bit counts uint32_t hfPsbValue = (counts & 0xFFF) | // Bit 12..14 ring 1 pos. rap. HF Et sum (sums & 0x7) << 12 | // Bits 16.. rest of the ET sums (sums >> 3) << 16; // TODO: Spec states non-data values for Bits 15, 31, 47 and 63. // Export computed value to pattern writer. */ it->second.push(resultName, hfPsbValue); } }
uint32_t L1GtPatternGenerator::packRegionalMuons | ( | uint32_t | rawData | ) | [static, private] |
Post-processing for regional muon trigger inputs
Bits 8..15 (5 bits Pt, 3 bits quality) need to be inverted on the GMT inputs. See http://wwwhephy.oeaw.ac.at/p3w/cms/trigger/globalMuonTrigger/notes/in04_022.pdf
Definition at line 164 of file L1GtPatternGenerator.cc.
Referenced by analyze().
{
uint32_t invertMask = 0x0000FF00;
uint32_t toKeep = rawData & (~invertMask);
return toKeep | (~rawData & invertMask);
}
std::vector<int> L1GtPatternGenerator::m_bx [private] |
Definition at line 97 of file L1GtPatternGenerator.h.
Referenced by beginJob(), and L1GtPatternGenerator().
std::vector<uint32_t> L1GtPatternGenerator::m_columnDefaults [private] |
Definition at line 98 of file L1GtPatternGenerator.h.
Referenced by beginJob(), and L1GtPatternGenerator().
std::vector<uint32_t> L1GtPatternGenerator::m_columnLengths [private] |
Definition at line 96 of file L1GtPatternGenerator.h.
Referenced by beginJob(), and L1GtPatternGenerator().
std::vector<std::string> L1GtPatternGenerator::m_columnNames [private] |
Definition at line 95 of file L1GtPatternGenerator.h.
Referenced by beginJob(), and L1GtPatternGenerator().
edm::InputTag L1GtPatternGenerator::m_cscTag [private] |
Definition at line 80 of file L1GtPatternGenerator.h.
Referenced by analyze(), and L1GtPatternGenerator().
bool L1GtPatternGenerator::m_debug [private] |
Definition at line 99 of file L1GtPatternGenerator.h.
Referenced by beginJob(), and L1GtPatternGenerator().
std::string L1GtPatternGenerator::m_destPath [private] |
an algorithm and a condition in that algorithm to test the object maps
Definition at line 85 of file L1GtPatternGenerator.h.
edm::InputTag L1GtPatternGenerator::m_dtTag [private] |
input tags for regional muon data
Definition at line 79 of file L1GtPatternGenerator.h.
Referenced by analyze(), and L1GtPatternGenerator().
std::string L1GtPatternGenerator::m_fileName [private] |
output file name
Definition at line 88 of file L1GtPatternGenerator.h.
Referenced by beginJob(), and L1GtPatternGenerator().
std::ofstream L1GtPatternGenerator::m_fileStream [private] |
Definition at line 89 of file L1GtPatternGenerator.h.
Referenced by beginJob(), and endJob().
std::string L1GtPatternGenerator::m_footer [private] |
Definition at line 94 of file L1GtPatternGenerator.h.
Referenced by beginJob(), and L1GtPatternGenerator().
edm::InputTag L1GtPatternGenerator::m_gctTag [private] |
input tag for GCT data
Definition at line 70 of file L1GtPatternGenerator.h.
Referenced by analyze(), and L1GtPatternGenerator().
edm::InputTag L1GtPatternGenerator::m_gmtTag [private] |
input tag for GMT data
Definition at line 73 of file L1GtPatternGenerator.h.
Referenced by analyze(), and L1GtPatternGenerator().
edm::InputTag L1GtPatternGenerator::m_gtTag [private] |
input tag for GT data
Definition at line 76 of file L1GtPatternGenerator.h.
Referenced by extractGlobalTriggerData(), and L1GtPatternGenerator().
std::string L1GtPatternGenerator::m_header [private] |
formatting instructions
Definition at line 93 of file L1GtPatternGenerator.h.
Referenced by beginJob(), and L1GtPatternGenerator().
edm::InputTag L1GtPatternGenerator::m_rpcbTag [private] |
Definition at line 81 of file L1GtPatternGenerator.h.
Referenced by analyze(), and L1GtPatternGenerator().
edm::InputTag L1GtPatternGenerator::m_rpcfTag [private] |
Definition at line 82 of file L1GtPatternGenerator.h.
Referenced by analyze(), and L1GtPatternGenerator().
std::auto_ptr<L1GtPatternWriter> L1GtPatternGenerator::m_writer [private] |
Definition at line 101 of file L1GtPatternGenerator.h.
Referenced by analyze(), beginJob(), and endJob().