CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
rpcrawtodigi::EventRecords Class Reference

#include <EventRecords.h>

Public Member Functions

void add (const DataRecord &record)
 
bool complete () const
 
int dataToTriggerDelay () const
 
const std::vector< DataRecord > & errors () const
 
 EventRecords (int triggerbx=0)
 
 EventRecords (int bx, const RecordBX &bxr, const RecordSLD &tbr, const RecordCD &lbr)
 
bool hasErrors () const
 
std::string print (const DataRecord::DataRecordType &type) const
 
const RecordBXrecordBX () const
 
const RecordCDrecordCD () const
 
const RecordSLDrecordSLD () const
 
bool samePartition (const EventRecords &r) const
 
int triggerBx () const
 

Static Public Member Functions

static std::vector< EventRecordsmergeRecords (const std::vector< EventRecords > &r)
 

Private Attributes

std::vector< DataRecordtheErrors
 
RecordBX theRecordBX
 
RecordCD theRecordCD
 
RecordSLD theRecordSLD
 
int theTriggerBX
 
bool theValidBX
 
bool theValidCD
 
bool theValidLN
 

Detailed Description

Definition at line 11 of file EventRecords.h.

Constructor & Destructor Documentation

rpcrawtodigi::EventRecords::EventRecords ( int  triggerbx = 0)
inline

Definition at line 14 of file EventRecords.h.

rpcrawtodigi::EventRecords::EventRecords ( int  bx,
const RecordBX bxr,
const RecordSLD tbr,
const RecordCD lbr 
)
inline

Definition at line 19 of file EventRecords.h.

References add(), and record.

Member Function Documentation

void EventRecords::add ( const DataRecord record)

Definition at line 22 of file EventRecords.cc.

References rpcrawtodigi::DataRecord::ChamberData, rpcrawtodigi::DataRecord::Empty, rpcrawtodigi::DataRecord::StartOfBXData, rpcrawtodigi::DataRecord::StartOfTbLinkInputNumberData, theErrors, theRecordBX, theRecordCD, theRecordSLD, theValidBX, theValidCD, theValidLN, and rpcrawtodigi::DataRecord::type().

Referenced by EventRecords(), counter.Counter::register(), SequenceTypes.Task::remove(), and SequenceTypes.Task::replace().

23 {
24 
25  if (record.type() == DataRecord::StartOfBXData) {
26  theRecordBX = RecordBX(record);
27  theValidBX = true;
28  theValidLN = false;
29  theValidCD = false;
30  theErrors.clear();
31  }
32  else if (record.type() == DataRecord::StartOfTbLinkInputNumberData) {
33  theRecordSLD = RecordSLD(record);
34  theValidLN = true;
35  theValidCD = false;
36  }
37  else if (record.type() == DataRecord::ChamberData) {
38  theRecordCD = RecordCD(record);
39  theValidCD = true;
40  }
41  else {
42 // theValidBX = false;
43 // theValidLN = false;
44  theValidCD = false;
45  if ( record.type() > DataRecord::Empty) theErrors.push_back(record);
46  }
47 }
std::vector< DataRecord > theErrors
Definition: EventRecords.h:52
DataRecordType type() const
Definition: DataRecord.cc:13
bool rpcrawtodigi::EventRecords::complete ( ) const
inline
int EventRecords::dataToTriggerDelay ( ) const

Definition at line 11 of file EventRecords.cc.

References rpcrawtodigi::RecordBX::bx(), complete(), diffTreeTool::diff, recordBX(), and triggerBx().

Referenced by RPCRecordFormatter::recordUnpack(), and triggerBx().

12 {
13  static const int nOrbits = 3564;
14  if (!complete()) return nOrbits;
15  int diff = recordBX().bx() - triggerBx() + 3;
16  if (diff > nOrbits/2) diff -= nOrbits;
17  if (diff < -nOrbits/2) diff += nOrbits;
18  return diff;
19 }
const RecordBX & recordBX() const
Definition: EventRecords.h:37
int bx() const
Definition: RecordBX.h:28
const std::vector<DataRecord>& rpcrawtodigi::EventRecords::errors ( void  ) const
inline

Definition at line 40 of file EventRecords.h.

References mergeRecords(), print(), AlCaHLTBitMon_QueryRunRegistry::string, and theErrors.

40 { return theErrors; }
std::vector< DataRecord > theErrors
Definition: EventRecords.h:52
bool rpcrawtodigi::EventRecords::hasErrors ( ) const
inline

Definition at line 33 of file EventRecords.h.

References alignCSCRings::r, samePartition(), and theErrors.

33 { return (!theErrors.empty()); }
std::vector< DataRecord > theErrors
Definition: EventRecords.h:52
vector< EventRecords > EventRecords::mergeRecords ( const std::vector< EventRecords > &  r)
static

Definition at line 61 of file EventRecords.cc.

References rpcrawtodigi::DataRecord::data(), triggerObjects_cff::id, recordCD(), and mps_fire::result.

Referenced by errors().

62 {
63  std::vector<EventRecords> result;
64  typedef vector<EventRecords>::const_iterator ICR;
65  typedef vector<EventRecords>::iterator IR;
66  for (ICR id= data.begin(), idEnd = data.end(); id != idEnd; ++id) {
67  bool merged = false;
68  for (IR ir = result.begin(), irEnd = result.end(); ir != irEnd; ++ir) {
69  EventRecords & event = *ir;
70  if (id->samePartition( event)) {
71  DataRecord::Data lbd = event.recordCD().data();
72  lbd |= id->recordCD().data();
73  event.add( RecordCD(lbd) );
74  merged = true;
75  }
76  }
77  if (!merged) result.push_back(*id);
78  }
79  return result;
80 
81 }
const RecordCD & recordCD() const
Definition: EventRecords.h:39
const Data & data() const
Definition: DataRecord.h:31
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Definition: event.py:1
std::string EventRecords::print ( const DataRecord::DataRecordType type) const

Definition at line 83 of file EventRecords.cc.

References rpcrawtodigi::DataRecord::ChamberData, rpcrawtodigi::DataRecord::Empty, rpcrawtodigi::ErrorRDDM::print(), rpcrawtodigi::ErrorRCDM::print(), rpcrawtodigi::ErrorRDM::print(), rpcrawtodigi::ErrorSDDM::print(), rpcrawtodigi::RecordBX::print(), rpcrawtodigi::RecordSLD::print(), rpcrawtodigi::RecordCD::print(), rpcrawtodigi::DataRecord::RCDM, rpcrawtodigi::DataRecord::RDDM, rpcrawtodigi::DataRecord::RDM, rpcrawtodigi::DataRecord::SDDM, rpcrawtodigi::DataRecord::StartOfBXData, rpcrawtodigi::DataRecord::StartOfTbLinkInputNumberData, str, theErrors, theRecordBX, theRecordCD, theRecordSLD, theValidBX, theValidCD, and theValidLN.

Referenced by errors().

84 {
85  std::ostringstream str;
86  str <<" ==>";
90  if (type == DataRecord::Empty) str <<" EPMTY";
91  for (vector<DataRecord>::const_iterator ie=theErrors.begin(); ie < theErrors.end(); ++ie) {
92  if (type == DataRecord::RDDM) str << ErrorRDDM(*ie).print();
93  if (type == DataRecord::SDDM) str << ErrorSDDM(*ie).print();
94  if (type == DataRecord::RCDM) str << ErrorRCDM(*ie).print();
95  if (type == DataRecord::RDM) str << ErrorRDM(*ie).print();
96  }
97  return str.str();
98 }
type
Definition: HCALResponse.h:21
std::string print() const
Definition: RecordCD.cc:49
std::string print() const
Definition: ErrorRDDM.cc:13
std::string print() const
Definition: RecordBX.cc:6
std::vector< DataRecord > theErrors
Definition: EventRecords.h:52
std::string print() const
Definition: RecordSLD.cc:4
std::string print() const
Definition: ErrorRCDM.cc:13
std::string print() const
Definition: ErrorSDDM.h:16
#define str(s)
std::string print() const
Definition: ErrorRDM.cc:11
const RecordBX& rpcrawtodigi::EventRecords::recordBX ( ) const
inline

Definition at line 37 of file EventRecords.h.

References theRecordBX.

Referenced by dataToTriggerDelay(), and samePartition().

37 { return theRecordBX; }
const RecordCD& rpcrawtodigi::EventRecords::recordCD ( ) const
inline

Definition at line 39 of file EventRecords.h.

References theRecordCD.

Referenced by mergeRecords(), RPCRecordFormatter::recordUnpack(), and samePartition().

39 { return theRecordCD; }
const RecordSLD& rpcrawtodigi::EventRecords::recordSLD ( ) const
inline

Definition at line 38 of file EventRecords.h.

References theRecordSLD.

Referenced by samePartition().

38 { return theRecordSLD; }
bool EventRecords::samePartition ( const EventRecords r) const

Definition at line 49 of file EventRecords.cc.

References rpcrawtodigi::DataRecord::data(), data, RecoTauDiscriminantConfiguration::mask, recordBX(), recordCD(), and recordSLD().

Referenced by hasErrors().

50 {
51  if (this->recordBX().data() != r.recordBX().data() ) return false;
52  if (this->recordSLD().data() != r.recordSLD().data() ) return false;
53  typedef DataRecord::Data Record;
54  Record mask = 0xFF << 8;
55  Record lb1 = this->recordCD().data() & mask;
56  Record lb2 = r.recordCD().data() & mask;
57  if (lb1 != lb2) return false;
58  return true;
59 }
const RecordSLD & recordSLD() const
Definition: EventRecords.h:38
const RecordCD & recordCD() const
Definition: EventRecords.h:39
const Data & data() const
Definition: DataRecord.h:31
const RecordBX & recordBX() const
Definition: EventRecords.h:37
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int rpcrawtodigi::EventRecords::triggerBx ( ) const
inline

Definition at line 27 of file EventRecords.h.

References dataToTriggerDelay(), and theTriggerBX.

Referenced by dataToTriggerDelay().

Member Data Documentation

std::vector<DataRecord> rpcrawtodigi::EventRecords::theErrors
private

Definition at line 52 of file EventRecords.h.

Referenced by add(), errors(), hasErrors(), and print().

RecordBX rpcrawtodigi::EventRecords::theRecordBX
private

Definition at line 49 of file EventRecords.h.

Referenced by add(), print(), and recordBX().

RecordCD rpcrawtodigi::EventRecords::theRecordCD
private

Definition at line 51 of file EventRecords.h.

Referenced by add(), print(), and recordCD().

RecordSLD rpcrawtodigi::EventRecords::theRecordSLD
private

Definition at line 50 of file EventRecords.h.

Referenced by add(), print(), and recordSLD().

int rpcrawtodigi::EventRecords::theTriggerBX
private

Definition at line 47 of file EventRecords.h.

Referenced by triggerBx().

bool rpcrawtodigi::EventRecords::theValidBX
private

Definition at line 48 of file EventRecords.h.

Referenced by add(), complete(), and print().

bool rpcrawtodigi::EventRecords::theValidCD
private

Definition at line 48 of file EventRecords.h.

Referenced by add(), complete(), and print().

bool rpcrawtodigi::EventRecords::theValidLN
private

Definition at line 48 of file EventRecords.h.

Referenced by add(), complete(), and print().