CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EventRecords.cc
Go to the documentation of this file.
6 
7 
8 using namespace rpcrawtodigi;
9 using std::vector;
10 
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 }
20 
21 
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 }
48 
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 }
60 
61 vector<EventRecords> EventRecords::mergeRecords(const vector<EventRecords> & data)
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 }
82 
84 {
85  std::ostringstream str;
86  str <<" ==>";
87  if (type == DataRecord::StartOfBXData && theValidBX) str << theRecordBX.print();
89  if (type == DataRecord::ChamberData && theValidCD) str << theRecordCD.print();
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:22
std::string print(const DataRecord::DataRecordType &type) const
Definition: EventRecords.cc:83
JetCorrectorParameters::Record record
Definition: classes.h:11
const RecordSLD & recordSLD() const
Definition: EventRecords.h:38
int dataToTriggerDelay() const
Definition: EventRecords.cc:11
void add(const DataRecord &record)
Definition: EventRecords.cc:22
const RecordCD & recordCD() const
Definition: EventRecords.h:39
std::string print() const
Definition: RecordCD.cc:65
const Data & data() const
Definition: DataRecord.h:32
tuple result
Definition: query.py:137
std::string print() const
Definition: ErrorRDDM.cc:21
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
static std::vector< EventRecords > mergeRecords(const std::vector< EventRecords > &r)
Definition: EventRecords.cc:61
std::string print() const
Definition: RecordBX.cc:10
std::vector< DataRecord > theErrors
Definition: EventRecords.h:52
const RecordBX & recordBX() const
Definition: EventRecords.h:37
std::string print() const
Definition: RecordSLD.cc:4
std::string print() const
Definition: ErrorRCDM.cc:21
std::string print() const
Definition: ErrorSDDM.h:16
bool samePartition(const EventRecords &r) const
Definition: EventRecords.cc:49
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int bx() const
Definition: RecordBX.h:30
DataRecordType type() const
Definition: DataRecord.cc:13
std::string print() const
Definition: ErrorRDM.cc:15