CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
L1GtPatternGenerator Class Reference

#include <L1GtPatternGenerator.h>

Inheritance diagram for L1GtPatternGenerator:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1GtPatternGenerator (const edm::ParameterSet &)
 
 ~L1GtPatternGenerator ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void extractGlobalTriggerData (const edm::Event &iEvent, L1GtPatternMap &patterns)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 analyze each event More...
 
virtual void beginJob ()
 analyze More...
 
virtual void endJob ()
 end of job More...
 
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 More...
 
edm::InputTag m_dtTag
 input tags for regional muon data More...
 
std::string m_fileName
 output file name More...
 
std::ofstream m_fileStream
 
std::string m_footer
 
edm::InputTag m_gctTag
 input tag for GCT data More...
 
edm::InputTag m_gmtTag
 input tag for GMT data More...
 
edm::InputTag m_gtTag
 input tag for GT data More...
 
std::string m_header
 formatting instructions More...
 
edm::InputTag m_rpcbTag
 
edm::InputTag m_rpcfTag
 
std::auto_ptr< L1GtPatternWriterm_writer
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Description: A generator of pattern files for L1 GT hardware testing.

Implementation: <TODO: enter implementation details>

Author
: Thomas Themel - HEPHY Vienna

Description: see header file.

Implementation: <TODO: enter implementation details>

Author
: Thomas Themel - HEPHY Vienna

Definition at line 37 of file L1GtPatternGenerator.h.

Constructor & Destructor Documentation

L1GtPatternGenerator::L1GtPatternGenerator ( const edm::ParameterSet parSet)
explicit

Definition at line 37 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, m_rpcfTag, and AlCaHLTBitMon_QueryRunRegistry::string.

38 {
39  // input tags for trigger records
40  m_gctTag = parSet.getParameter<edm::InputTag>("GctInputTag");
41  m_gmtTag = parSet.getParameter<edm::InputTag>("GmtInputTag");
42  m_gtTag = parSet.getParameter<edm::InputTag>("GtInputTag");
43  m_dtTag = parSet.getParameter<edm::InputTag>("DtInputTag");
44  m_cscTag = parSet.getParameter<edm::InputTag>("CscInputTag");
45  m_rpcbTag = parSet.getParameter<edm::InputTag>("RpcbInputTag");
46  m_rpcfTag = parSet.getParameter<edm::InputTag>("RpcfInputTag");
47 
48  // output formatting stuff
49  m_header = parSet.getParameter<std::string>("PatternFileHeader");
50  m_footer = parSet.getParameter<std::string>("PatternFileFooter");
51  m_columnNames = parSet.getParameter<std::vector<std::string> >("PatternFileColumns");
52  m_columnLengths = parSet.getParameter<std::vector<uint32_t> >("PatternFileLengths");
53  m_columnDefaults = parSet.getParameter<std::vector<uint32_t> >("PatternFileDefaultValues");
54  m_fileName = parSet.getParameter<std::string>("PatternFileName");
55  m_bx = parSet.getParameter<std::vector<int> >("bx");
56  m_debug = parSet.getParameter<bool>("DebugOutput");
57 
58 
59  if(m_columnLengths.size() != m_columnNames.size()) {
60  edm::LogWarning("L1GtPatternGenerator")
61  << "Length of PatternFileColumns does not match length of PatternFileLenghts, " <<
62  m_columnNames.size() << " vs " << m_columnLengths.size() << std::endl;
63  }
64 
65  LogDebug("L1GtPatternGenerator")
66  << "\nL1 GCT record: "
67  << m_gctTag
68  << "\nL1 GMT record: "
69  << m_gmtTag
70  << "\nL1 GT record: "
71  << m_gtTag << std::endl;
72 }
#define LogDebug(id)
T getParameter(std::string const &) const
edm::InputTag m_dtTag
input tags for regional muon data
std::vector< uint32_t > m_columnDefaults
std::vector< uint32_t > m_columnLengths
edm::InputTag m_gmtTag
input tag for GMT data
std::string m_header
formatting instructions
std::string m_fileName
output file name
edm::InputTag m_gctTag
input tag for GCT data
edm::InputTag m_gtTag
input tag for GT data
std::vector< int > m_bx
std::vector< std::string > m_columnNames
L1GtPatternGenerator::~L1GtPatternGenerator ( )

Definition at line 75 of file L1GtPatternGenerator.cc.

76 {}

Member Function Documentation

void L1GtPatternGenerator::analyze ( const edm::Event iEvent,
const edm::EventSetup evSetup 
)
privatevirtual

analyze each event

Analyze each event:

  • Extract the input records that interest us from the event
  • Split them into pattern file lines according to their bx number
  • Format the lines and write them to the file.

Implements edm::EDAnalyzer.

Definition at line 233 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(), L1GctEtMiss::phi(), L1GctEtHad::raw(), L1GctEtTotal::raw(), L1GctJetCand::raw(), L1GctHtMiss::raw(), L1GctEmCand::raw(), L1GctHFRingEtSums::raw(), L1GctHFBitCounts::raw(), edm::Event::run(), and convertSQLiteXML::runNumber.

234 {
235  // debug information
236  const unsigned int runNumber = iEvent.run();
237  const unsigned int lsNumber = iEvent.luminosityBlock();
238  const unsigned int eventNumber = iEvent.id().event();
239 
240  LogTrace("L1GtPatternGenerator") << "\n\nL1GtPatternGenerator::analyze: Run: " << runNumber << " LS: " << lsNumber << " Event: "
241  << eventNumber << "\n\n" << std::endl;
242 
243 
244  L1GtPatternMap allPatterns;
245 
246  // GMT muon candidates
247  extractRecordData(iEvent, allPatterns, m_gmtTag.label(), m_gmtTag.instance(), &L1MuGMTCand::getDataWord, "gmtMuon");
248 
249  // regional muon candidates
254 
255  // GCT objects
256  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "nonIsoEm", &L1GctEmCand::raw, "gctEm");
257  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "isoEm", &L1GctEmCand::raw, "gctIsoEm");
258  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtMiss::et, "etMiss");
259  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtMiss::phi, "etMissPhi");
260  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHtMiss::raw, "htMiss");
261  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtHad::raw, "etHad");
262  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtTotal::raw, "etTotal");
263  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "cenJets", &L1GctJetCand::raw, "cenJet");
264  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "forJets", &L1GctJetCand::raw, "forJet");
265  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "tauJets", &L1GctJetCand::raw, "tauJet");
266  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHFBitCounts::raw, "hfBitCounts");
267  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHFRingEtSums::raw, "hfRingEtSums");
268 
269  // Post processing:
270  // HFBitCounts/HFRingEtSums need to be mangled to PSB values
271  packHfRecords("hfPsbValue", allPatterns);
272 
273  // GT objects
274  extractGlobalTriggerData(iEvent, allPatterns);
275 
276  // Output
277  m_writer->writePatterns(allPatterns);
278 }
uint32_t raw() const
get the data
Definition: L1GctHtMiss.h:57
EventNumber_t event() const
Definition: EventID.h:44
uint16_t raw() const
get the data
Definition: L1GctEtHad.h:42
edm::InputTag m_dtTag
input tags for regional muon data
std::auto_ptr< L1GtPatternWriter > m_writer
uint16_t raw() const
get the raw data
Definition: L1GctEmCand.h:58
static void extractRecordData(const edm::Event &iEvent, L1GtPatternMap &allPatterns, const std::string &label, const std::string &instance, TResult(TRecord::*rawFunctionPtr)() const, const std::string &prefix, uint32_t(*packingFunction)(uint32_t)=NULL)
edm::LuminosityBlockNumber_t luminosityBlock() const
Definition: EventBase.h:59
unsigned phi() const
get the Et
Definition: L1GctEtMiss.h:64
edm::InputTag m_gmtTag
input tag for GMT data
void extractGlobalTriggerData(const edm::Event &iEvent, L1GtPatternMap &patterns)
unsigned getDataWord() const
get muon data word
Definition: L1MuGMTCand.h:67
unsigned getDataWord() const
return data word
edm::InputTag m_gctTag
input tag for GCT data
void packHfRecords(const std::string &resultName, L1GtPatternMap &allPatterns)
RunNumber_t run() const
Definition: Event.h:88
#define LogTrace(id)
unsigned et() const
get the magnitude
Definition: L1GctEtMiss.h:58
std::string const & label() const
Definition: InputTag.h:42
uint16_t raw() const
get the data
Definition: L1GctEtTotal.h:42
uint16_t raw() const
get the raw data
edm::EventID id() const
Definition: EventBase.h:56
uint16_t raw() const
the raw data
std::string const & instance() const
Definition: InputTag.h:43
static uint32_t packRegionalMuons(uint32_t rawValue)
uint16_t raw() const
get the raw data
Definition: L1GctJetCand.h:50
void L1GtPatternGenerator::beginJob ( void  )
privatevirtual

analyze

Method called once each job just before starting event loop.

  • Initialize the output file and the writer object.

Reimplemented from edm::EDAnalyzer.

Definition at line 283 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.

284 {
285  m_fileStream.open(m_fileName.c_str());
286 
287  if(!m_fileStream) {
288  edm::LogError("L1GtPatternGenerator") << "Failed to open output file " << m_fileName;
289  }
290 
292 }
std::auto_ptr< L1GtPatternWriter > m_writer
std::vector< uint32_t > m_columnDefaults
std::vector< uint32_t > m_columnLengths
std::string m_header
formatting instructions
std::string m_fileName
output file name
std::vector< int > m_bx
std::vector< std::string > m_columnNames
void L1GtPatternGenerator::endJob ( void  )
privatevirtual

end of job

Method called once each job just after ending the event loop.

  • Close the output file stream.

Reimplemented from edm::EDAnalyzer.

Definition at line 297 of file L1GtPatternGenerator.cc.

References m_fileStream, and m_writer.

298 {
299  m_writer->close();
300  m_fileStream.close();
301 }
std::auto_ptr< L1GtPatternWriter > m_writer
void L1GtPatternGenerator::extractGlobalTriggerData ( const edm::Event iEvent,
L1GtPatternMap patterns 
)
protected

Definition at line 170 of file L1GtPatternGenerator.cc.

References edm::EventID::event(), edm::hlt::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().

170  {
171 
172  // extract global trigger readout record
174  iEvent.getByLabel(m_gtTag, handle);
175 
176  // continue if it's present
177  if(!handle.isValid()) {
178  throw cms::Exception(__func__) << "Failed to extract GT readout record labeled "
179  << m_gtTag.label() << ", instance " << m_gtTag.instance();
180  }
181 
182  edm::EventNumber_t eventNr = iEvent.id().event();
183 
184  // for each FDL word...
185  const std::vector<L1GtFdlWord>& fdlWords = handle->gtFdlVector();
186  for(std::vector<L1GtFdlWord>::const_iterator it = fdlWords.begin();
187  it != fdlWords.end() ; ++it) {
188  // extract relevant data
189  int bx = it->bxInEvent();
190 
191  // find matching pattern file line
192  L1GtPatternLine& line = patterns.getLine(eventNr, bx);
193 
194  extractGlobalTriggerWord(it->gtDecisionWord(), line, "gtDecision");
195  extractGlobalTriggerWord(it->gtDecisionWordExtended(), line, "gtDecisionExt");
196  extractGlobalTriggerWord(it->gtTechnicalTriggerWord(), line, "gtTechTrigger");
197 
198  line.push("gtFinalOr", it->finalOR());
199  }
200 }
EventNumber_t event() const
Definition: EventID.h:44
L1GtPatternLine & getLine(int eventNr, int bxNr)
unsigned int EventNumber_t
Definition: EventID.h:30
static void extractGlobalTriggerWord(const std::vector< bool > input, L1GtPatternLine &line, const std::string &prefix)
tuple handle
Definition: patZpeak.py:22
edm::InputTag m_gtTag
input tag for GT data
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
void push(const std::string &prefix, boost::uint32_t value)
std::string const & label() const
Definition: InputTag.h:42
edm::EventID id() const
Definition: EventBase.h:56
std::string const & instance() const
Definition: InputTag.h:43
static uint32_t L1GtPatternGenerator::packEtMiss ( uint32_t  rawValue)
staticprivate

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 205 of file L1GtPatternGenerator.cc.

References L1GtPatternMap::begin(), and L1GtPatternMap::end().

Referenced by analyze().

206 {
207  // iterate over each pattern line
208  for(L1GtPatternMap::LineMap::iterator it = allPatterns.begin();
209  it != allPatterns.end(); ++it) {
210  // Get the HF bit counts and ring sums
211  uint32_t counts = it->second.get("hfBitCounts1");
212  uint32_t sums = it->second.get("hfRingEtSums1");
213 
214 
215  // Bits 0..11 -> 4 bit counts
216  uint32_t hfPsbValue = (counts & 0xFFF) |
217  // Bit 12..14 ring 1 pos. rap. HF Et sum
218  (sums & 0x7) << 12 |
219  // Bits 16.. rest of the ET sums
220  (sums >> 3) << 16;
221  // TODO: Spec states non-data values for Bits 15, 31, 47 and 63.
222 
223  // Export computed value to pattern writer. */
224  it->second.push(resultName, hfPsbValue);
225  }
226 }
LineMap::const_iterator begin() const
LineMap::const_iterator end() const
uint32_t L1GtPatternGenerator::packRegionalMuons ( uint32_t  rawData)
staticprivate

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 162 of file L1GtPatternGenerator.cc.

Referenced by analyze().

162  {
163  uint32_t invertMask = 0x0000FF00;
164  uint32_t toKeep = rawData & (~invertMask);
165  return toKeep | (~rawData & invertMask);
166 }

Member Data Documentation

std::vector<int> L1GtPatternGenerator::m_bx
private

Definition at line 95 of file L1GtPatternGenerator.h.

Referenced by beginJob(), and L1GtPatternGenerator().

std::vector<uint32_t> L1GtPatternGenerator::m_columnDefaults
private

Definition at line 96 of file L1GtPatternGenerator.h.

Referenced by beginJob(), and L1GtPatternGenerator().

std::vector<uint32_t> L1GtPatternGenerator::m_columnLengths
private

Definition at line 94 of file L1GtPatternGenerator.h.

Referenced by beginJob(), and L1GtPatternGenerator().

std::vector<std::string> L1GtPatternGenerator::m_columnNames
private

Definition at line 93 of file L1GtPatternGenerator.h.

Referenced by beginJob(), and L1GtPatternGenerator().

edm::InputTag L1GtPatternGenerator::m_cscTag
private

Definition at line 78 of file L1GtPatternGenerator.h.

Referenced by analyze(), and L1GtPatternGenerator().

bool L1GtPatternGenerator::m_debug
private

Definition at line 97 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 83 of file L1GtPatternGenerator.h.

edm::InputTag L1GtPatternGenerator::m_dtTag
private

input tags for regional muon data

Definition at line 77 of file L1GtPatternGenerator.h.

Referenced by analyze(), and L1GtPatternGenerator().

std::string L1GtPatternGenerator::m_fileName
private

output file name

Definition at line 86 of file L1GtPatternGenerator.h.

Referenced by beginJob(), and L1GtPatternGenerator().

std::ofstream L1GtPatternGenerator::m_fileStream
private

Definition at line 87 of file L1GtPatternGenerator.h.

Referenced by beginJob(), and endJob().

std::string L1GtPatternGenerator::m_footer
private

Definition at line 92 of file L1GtPatternGenerator.h.

Referenced by beginJob(), and L1GtPatternGenerator().

edm::InputTag L1GtPatternGenerator::m_gctTag
private

input tag for GCT data

Definition at line 68 of file L1GtPatternGenerator.h.

Referenced by analyze(), and L1GtPatternGenerator().

edm::InputTag L1GtPatternGenerator::m_gmtTag
private

input tag for GMT data

Definition at line 71 of file L1GtPatternGenerator.h.

Referenced by analyze(), and L1GtPatternGenerator().

edm::InputTag L1GtPatternGenerator::m_gtTag
private

input tag for GT data

Definition at line 74 of file L1GtPatternGenerator.h.

Referenced by extractGlobalTriggerData(), and L1GtPatternGenerator().

std::string L1GtPatternGenerator::m_header
private

formatting instructions

Definition at line 91 of file L1GtPatternGenerator.h.

Referenced by beginJob(), and L1GtPatternGenerator().

edm::InputTag L1GtPatternGenerator::m_rpcbTag
private

Definition at line 79 of file L1GtPatternGenerator.h.

Referenced by analyze(), and L1GtPatternGenerator().

edm::InputTag L1GtPatternGenerator::m_rpcfTag
private

Definition at line 80 of file L1GtPatternGenerator.h.

Referenced by analyze(), and L1GtPatternGenerator().

std::auto_ptr<L1GtPatternWriter> L1GtPatternGenerator::m_writer
private

Definition at line 99 of file L1GtPatternGenerator.h.

Referenced by analyze(), beginJob(), and endJob().