CMS 3D CMS Logo

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
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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.

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

231 {
232  // debug information
233  const unsigned int runNumber = iEvent.run();
234  const unsigned int lsNumber = iEvent.luminosityBlock();
235  const unsigned int eventNumber = iEvent.id().event();
236 
237  LogTrace("L1GtPatternGenerator") << "\n\nL1GtPatternGenerator::analyze: Run: " << runNumber << " LS: " << lsNumber << " Event: "
238  << eventNumber << "\n\n" << std::endl;
239 
240 
241  L1GtPatternMap allPatterns;
242 
243  // GMT muon candidates
244  extractRecordData(iEvent, allPatterns, m_gmtTag.label(), m_gmtTag.instance(), &L1MuGMTCand::getDataWord, "gmtMuon");
245 
246  // regional muon candidates
251 
252  // GCT objects
253  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "nonIsoEm", &L1GctEmCand::raw, "gctEm");
254  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "isoEm", &L1GctEmCand::raw, "gctIsoEm");
255  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtMiss::et, "etMiss");
256  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtMiss::phi, "etMissPhi");
257  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHtMiss::raw, "htMiss");
258  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtHad::raw, "etHad");
259  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtTotal::raw, "etTotal");
260  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "cenJets", &L1GctJetCand::raw, "cenJet");
261  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "forJets", &L1GctJetCand::raw, "forJet");
262  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "tauJets", &L1GctJetCand::raw, "tauJet");
263  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHFBitCounts::raw, "hfBitCounts");
264  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHFRingEtSums::raw, "hfRingEtSums");
265 
266  // Post processing:
267  // HFBitCounts/HFRingEtSums need to be mangled to PSB values
268  packHfRecords("hfPsbValue", allPatterns);
269 
270  // GT objects
271  extractGlobalTriggerData(iEvent, allPatterns);
272 
273  // Output
274  m_writer->writePatterns(allPatterns);
275 }
uint32_t raw() const
get the data
Definition: L1GctHtMiss.h:57
EventNumber_t event() const
Definition: EventID.h:41
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:61
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:94
#define LogTrace(id)
unsigned et() const
get the magnitude
Definition: L1GctEtMiss.h:58
std::string const & label() const
Definition: InputTag.h:36
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:58
uint16_t raw() const
the raw data
std::string const & instance() const
Definition: InputTag.h:37
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 280 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.

281 {
282  m_fileStream.open(m_fileName.c_str());
283 
284  if(!m_fileStream) {
285  edm::LogError("L1GtPatternGenerator") << "Failed to open output file " << m_fileName;
286  }
287 
289 }
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 294 of file L1GtPatternGenerator.cc.

References m_fileStream, and m_writer.

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

Definition at line 167 of file L1GtPatternGenerator.cc.

References edm::EventID::event(), Exception, extractGlobalTriggerWord(), edm::Event::getByLabel(), L1GtPatternMap::getLine(), L1GlobalTriggerReadoutRecord::gtFdlVector(), cmsBatch::handle, edm::EventBase::id(), edm::InputTag::instance(), edm::HandleBase::isValid(), edm::InputTag::label(), geometryCSVtoXML::line, m_gtTag, and L1GtPatternLine::push().

Referenced by analyze().

167  {
168 
169  // extract global trigger readout record
171  iEvent.getByLabel(m_gtTag, handle);
172 
173  // continue if it's present
174  if(!handle.isValid()) {
175  throw cms::Exception(__func__) << "Failed to extract GT readout record labeled "
176  << m_gtTag.label() << ", instance " << m_gtTag.instance();
177  }
178 
179  edm::EventNumber_t eventNr = iEvent.id().event();
180 
181  // for each FDL word...
182  const std::vector<L1GtFdlWord>& fdlWords = handle->gtFdlVector();
183  for(std::vector<L1GtFdlWord>::const_iterator it = fdlWords.begin();
184  it != fdlWords.end() ; ++it) {
185  // extract relevant data
186  int bx = it->bxInEvent();
187 
188  // find matching pattern file line
189  L1GtPatternLine& line = patterns.getLine(eventNr, bx);
190 
191  extractGlobalTriggerWord(it->gtDecisionWord(), line, "gtDecision");
192  extractGlobalTriggerWord(it->gtDecisionWordExtended(), line, "gtDecisionExt");
193  extractGlobalTriggerWord(it->gtTechnicalTriggerWord(), line, "gtTechTrigger");
194 
195  line.push("gtFinalOr", it->finalOR());
196  }
197 }
EventNumber_t event() const
Definition: EventID.h:41
L1GtPatternLine & getLine(int eventNr, int bxNr)
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
unsigned long long EventNumber_t
static void extractGlobalTriggerWord(const std::vector< bool > input, L1GtPatternLine &line, const std::string &prefix)
edm::InputTag m_gtTag
input tag for GT data
bool isValid() const
Definition: HandleBase.h:75
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
void push(const std::string &prefix, boost::uint32_t value)
std::string const & label() const
Definition: InputTag.h:36
edm::EventID id() const
Definition: EventBase.h:58
std::string const & instance() const
Definition: InputTag.h:37
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 202 of file L1GtPatternGenerator.cc.

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

Referenced by analyze().

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

Referenced by analyze().

159  {
160  uint32_t invertMask = 0x0000FF00;
161  uint32_t toKeep = rawData & (~invertMask);
162  return toKeep | (~rawData & invertMask);
163 }

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().