Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:47

0001 #include <iomanip>
0002 
0003 #include "DataFormats/FEDRawData/interface/FEDHeader.h"
0004 #include "DataFormats/TCDS/interface/TCDSRecord.h"
0005 #include "DataFormats/TCDS/interface/TCDSRaw.h"
0006 
0007 TCDSRecord::TCDSRecord()
0008     : orbitNr_(0),
0009       triggerCount_(0),
0010       eventNumber_(0),
0011       macAddress_(0),
0012       swVersion_(0),
0013       fwVersion_(0),
0014       recordVersion_(0),
0015       runNumber_(0),
0016       bstReceptionStatus_(0),
0017       nibble_(0),
0018       lumiSection_(0),
0019       nibblesPerLumiSection_(0),
0020       eventType_(0),
0021       triggerTypeFlags_(0),
0022       inputs_(0),
0023       bxid_(0) {}
0024 
0025 TCDSRecord::TCDSRecord(const unsigned char* rawData) {
0026   tcds::Raw_v1 const* tcdsRaw = reinterpret_cast<tcds::Raw_v1 const*>(rawData + FEDHeader::length);
0027   const FEDHeader fedHeader(rawData);
0028 
0029   orbitNr_ = (tcdsRaw->header.orbitHigh << 16) | tcdsRaw->header.orbitLow;
0030   triggerCount_ = tcdsRaw->header.triggerCount;
0031   eventNumber_ = tcdsRaw->header.eventNumber;
0032   macAddress_ = tcdsRaw->header.macAddress;
0033   swVersion_ = tcdsRaw->header.swVersion;
0034   fwVersion_ = tcdsRaw->header.fwVersion;
0035   recordVersion_ = tcdsRaw->header.recordVersion;
0036   runNumber_ = tcdsRaw->header.runNumber;
0037   bstReceptionStatus_ = tcdsRaw->header.bstReceptionStatus;
0038   nibble_ = tcdsRaw->header.nibble;
0039   lumiSection_ = tcdsRaw->header.lumiSection;
0040   nibblesPerLumiSection_ = tcdsRaw->header.nibblesPerLumiSection;
0041   eventType_ = fedHeader.triggerType();
0042   triggerTypeFlags_ = tcdsRaw->header.triggerTypeFlags;
0043   inputs_ = tcdsRaw->header.inputs;
0044   bxid_ = tcdsRaw->header.bxid;
0045   sourceid_ = fedHeader.sourceID();
0046 
0047   activePartitions_ = ActivePartitions(tcdsRaw->header.activePartitions0);
0048   activePartitions_ |= ActivePartitions(tcdsRaw->header.activePartitions1) << 32;
0049   activePartitions_ |= ActivePartitions(tcdsRaw->header.activePartitions2) << 64;
0050 
0051   bst_ = BSTRecord(tcdsRaw->bst);
0052 
0053   for (auto i = 0; i < tcds::l1aHistoryDepth_v1; ++i) {
0054     l1aHistory_.emplace_back(L1aInfo(tcdsRaw->l1aHistory.l1aInfo[i]));
0055   }
0056 
0057   for (auto i = 0; i < tcds::bgoCount_v1; ++i) {
0058     lastBgos_.emplace_back(((uint64_t)(tcdsRaw->bgoHistory.lastBGo[i].orbithigh) << 32) |
0059                            tcdsRaw->bgoHistory.lastBGo[i].orbitlow);
0060   }
0061 }
0062 
0063 TCDSRecord::~TCDSRecord() {}
0064 
0065 std::ostream& operator<<(std::ostream& s, const TCDSRecord& record) {
0066   s << "MacAddress:            0x" << std::hex << record.getMacAddress() << std::dec << std::endl;
0067   s << "SwVersion:             0x" << std::hex << record.getSwVersion() << std::dec << std::endl;
0068   s << "FwVersion:             0x" << std::hex << record.getFwVersion() << std::dec << std::endl;
0069   s << "RecordVersion:         " << record.getRecordVersion() << std::endl;
0070   s << "RunNumber:             " << record.getRunNumber() << std::endl;
0071   s << "BstReceptionStatus:    0x" << std::hex << record.getBstReceptionStatus() << std::dec << std::endl;
0072   s << "Nibble:                " << record.getNibble() << std::endl;
0073   s << "LumiSection:           " << record.getLumiSection() << std::endl;
0074   s << "NibblesPerLumiSection: " << record.getNibblesPerLumiSection() << std::endl;
0075   s << "EventType:             " << record.getEventType() << std::endl;
0076   s << "TriggerTypeFlags:      0x" << std::hex << record.getTriggerTypeFlags() << std::dec << std::endl;
0077   s << "Inputs:                " << record.getInputs() << std::endl;
0078   s << "OrbitNr:               " << record.getOrbitNr() << std::endl;
0079   s << "BXID:                  " << record.getBXID() << std::endl;
0080   s << "TriggerCount:          " << record.getTriggerCount() << std::endl;
0081   s << "EventNumber:           " << record.getEventNumber() << std::endl;
0082   s << "ActivePartitions:      " << record.getActivePartitions() << std::endl;
0083   s << std::endl;
0084 
0085   s << "L1aHistory:" << std::endl;
0086   for (auto l1Info : record.getFullL1aHistory())
0087     s << l1Info;
0088   s << std::endl;
0089 
0090   s << record.getBST() << std::endl;
0091   s << "LastOrbitCounter0:     " << record.getLastOrbitCounter0() << std::endl;
0092   s << "LastTestEnable:        " << record.getLastTestEnable() << std::endl;
0093   s << "LastResync:            " << record.getLastResync() << std::endl;
0094   s << "LastStart:             " << record.getLastStart() << std::endl;
0095   s << "LastEventCounter0:     " << record.getLastEventCounter0() << std::endl;
0096   s << "LastHardReset:         " << record.getLastHardReset() << std::endl;
0097 
0098   for (auto i = 0; i < tcds::bgoCount_v1; ++i)
0099     s << "Last BGo " << std::setw(2) << i << ": " << record.getOrbitOfLastBgo(i) << std::endl;
0100 
0101   return s;
0102 }