Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:57

0001 #ifndef EventFilter_RPCRawToDigi_EventRecords_H
0002 #define EventFilter_RPCRawToDigi_EventRecords_H
0003 
0004 #include "DataFormats/RPCDigi/interface/DataRecord.h"
0005 #include "DataFormats/RPCDigi/interface/RecordBX.h"
0006 #include "DataFormats/RPCDigi/interface/RecordCD.h"
0007 #include "DataFormats/RPCDigi/interface/RecordSLD.h"
0008 #include <vector>
0009 
0010 namespace rpcrawtodigi {
0011   class EventRecords {
0012   public:
0013     EventRecords(int triggerbx = 0)
0014         : theTriggerBX(triggerbx), theValidBX(false), theValidLN(false), theValidCD(false) {}
0015 
0016     EventRecords(int bx, const RecordBX& bxr, const RecordSLD& tbr, const RecordCD& lbr)
0017         : theTriggerBX(bx),
0018           theValidBX(true),
0019           theValidLN(true),
0020           theValidCD(true),
0021           theRecordBX(bxr),
0022           theRecordSLD(tbr),
0023           theRecordCD(lbr) {}
0024 
0025     void add(const DataRecord& record);
0026 
0027     int triggerBx() const { return theTriggerBX; }
0028 
0029     int dataToTriggerDelay() const;
0030 
0031     bool complete() const { return theValidBX && theValidLN && theValidCD; }
0032 
0033     bool hasErrors() const { return (!theErrors.empty()); }
0034 
0035     bool samePartition(const EventRecords& r) const;
0036 
0037     const RecordBX& recordBX() const { return theRecordBX; }
0038     const RecordSLD& recordSLD() const { return theRecordSLD; }
0039     const RecordCD& recordCD() const { return theRecordCD; }
0040     const std::vector<DataRecord>& errors() const { return theErrors; }
0041 
0042     static std::vector<EventRecords> mergeRecords(const std::vector<EventRecords>& r);
0043 
0044     std::string print(const DataRecord::DataRecordType& type) const;
0045 
0046   private:
0047     int theTriggerBX;
0048     bool theValidBX, theValidLN, theValidCD;
0049     RecordBX theRecordBX;
0050     RecordSLD theRecordSLD;
0051     RecordCD theRecordCD;
0052     std::vector<DataRecord> theErrors;
0053   };
0054 }  // namespace rpcrawtodigi
0055 #endif