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

Public Member Functions

 L1GtPatternGenerator (const edm::ParameterSet &)
 
 ~L1GtPatternGenerator ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void extractGlobalTriggerData (const edm::Event &iEvent, L1GtPatternMap &patterns)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 

Detailed Description

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

Implementation: <TODO: enter implementation details>

Author
: Thomas Themel - HEPHY Vienna

$Date$ $Revision$

Description: see header file.

Implementation: <TODO: enter implementation details>

Author
: Thomas Themel - HEPHY Vienna

$Date$ $Revision$

Definition at line 39 of file L1GtPatternGenerator.h.

Constructor & Destructor Documentation

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.

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

78 {}

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

References L1GctEtMiss::et(), extractGlobalTriggerData(), extractRecordData(), L1MuGMTCand::getDataWord(), L1MuRegionalCand::getDataWord(), edm::InputTag::instance(), edm::InputTag::label(), 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(), and L1GctHFBitCounts::raw().

236 {
237  L1GtPatternMap allPatterns;
238 
239  // GMT muon candidates
240  extractRecordData(iEvent, allPatterns, m_gmtTag.label(), m_gmtTag.instance(), &L1MuGMTCand::getDataWord, "gmtMuon");
241 
242  // regional muon candidates
247 
248  // GCT objects
249  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "nonIsoEm", &L1GctEmCand::raw, "gctEm");
250  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "isoEm", &L1GctEmCand::raw, "gctIsoEm");
251  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtMiss::et, "etMiss");
252  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtMiss::phi, "etMissPhi");
253  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHtMiss::raw, "htMiss");
254  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtHad::raw, "etHad");
255  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctEtTotal::raw, "etTotal");
256  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "cenJets", &L1GctJetCand::raw, "cenJet");
257  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "forJets", &L1GctJetCand::raw, "forJet");
258  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "tauJets", &L1GctJetCand::raw, "tauJet");
259  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHFBitCounts::raw, "hfBitCounts");
260  extractRecordData(iEvent, allPatterns, m_gctTag.label(), "", &L1GctHFRingEtSums::raw, "hfRingEtSums");
261 
262  // Post processing:
263  // HFBitCounts/HFRingEtSums need to be mangled to PSB values
264  packHfRecords("hfPsbValue", allPatterns);
265 
266  // GT objects
267  extractGlobalTriggerData(iEvent, allPatterns);
268 
269  // Output
270  m_writer->writePatterns(allPatterns);
271 }
uint32_t raw() const
get the data
Definition: L1GctHtMiss.h:57
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)
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:69
unsigned getDataWord() const
return data word
edm::InputTag m_gctTag
input tag for GCT data
void packHfRecords(const std::string &resultName, L1GtPatternMap &allPatterns)
unsigned et() const
get the magnitude
Definition: L1GctEtMiss.h:58
std::string const & label() const
Definition: InputTag.h:25
uint16_t raw() const
get the data
Definition: L1GctEtTotal.h:42
uint16_t raw() const
get the raw data
uint16_t raw() const
the raw data
std::string const & instance() const
Definition: InputTag.h:26
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 276 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.

277 {
278  m_fileStream.open(m_fileName.c_str());
279 
280  if(!m_fileStream) {
281  edm::LogError("L1GtPatternGenerator") << "Failed to open output file " << m_fileName;
282  }
283 
285 }
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 290 of file L1GtPatternGenerator.cc.

References m_fileStream, and m_writer.

291 {
292  m_writer->close();
293  m_fileStream.close();
294 }
std::auto_ptr< L1GtPatternWriter > m_writer
void L1GtPatternGenerator::extractGlobalTriggerData ( const edm::Event iEvent,
L1GtPatternMap patterns 
)
protected

Definition at line 172 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().

172  {
173 
174  // extract global trigger readout record
176  iEvent.getByLabel(m_gtTag, handle);
177 
178  // continue if it's present
179  if(!handle.isValid()) {
180  throw cms::Exception(__func__) << "Failed to extract GT readout record labeled "
181  << m_gtTag.label() << ", instance " << m_gtTag.instance();
182  }
183 
184  edm::EventNumber_t eventNr = iEvent.id().event();
185 
186  // for each FDL word...
187  const std::vector<L1GtFdlWord>& fdlWords = handle->gtFdlVector();
188  for(std::vector<L1GtFdlWord>::const_iterator it = fdlWords.begin();
189  it != fdlWords.end() ; ++it) {
190  // extract relevant data
191  int bx = it->bxInEvent();
192 
193  // find matching pattern file line
194  L1GtPatternLine& line = patterns.getLine(eventNr, bx);
195 
196  extractGlobalTriggerWord(it->gtDecisionWord(), line, "gtDecision");
197  extractGlobalTriggerWord(it->gtDecisionWordExtended(), line, "gtDecisionExt");
198  extractGlobalTriggerWord(it->gtTechnicalTriggerWord(), line, "gtTechTrigger");
199 
200  line.push("gtFinalOr", it->finalOR());
201  }
202 }
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:359
void push(const std::string &prefix, boost::uint32_t value)
std::string const & label() const
Definition: InputTag.h:25
edm::EventID id() const
Definition: EventBase.h:56
std::string const & instance() const
Definition: InputTag.h:26
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 207 of file L1GtPatternGenerator.cc.

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

Referenced by analyze().

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

Referenced by analyze().

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

Member Data Documentation

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