Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:07

0001 #include "Gl1Packetv2.h"
0002 
0003 #include <phool/phool.h>
0004 
0005 #include <iomanip>
0006 
0007 void Gl1Packetv2::Reset()
0008 {
0009   OfflinePacketv1::Reset();
0010   packet_nr = 0;
0011   BunchNumber = std::numeric_limits<uint64_t>::max();
0012   TriggerInput = 0;
0013   LiveVector = 0;
0014   ScaledVector = 0;
0015   GTMBusyVector = 0;
0016   for (auto &row : scaler)
0017   {
0018     row.fill(0);
0019   }
0020   return;
0021 }
0022 
0023 void Gl1Packetv2::identify(std::ostream &os) const
0024 {
0025   os << "Gl1Packetv2: " << std::endl;
0026   OfflinePacketv1::identify(os);
0027   os << "bunch number: " << BunchNumber << std::endl;
0028   return;
0029 }
0030 
0031 void Gl1Packetv2::FillFrom(const Gl1Packet *pkt)
0032 {
0033   setBunchNumber(pkt->getBunchNumber());
0034   setPacketNumber(pkt->getPacketNumber());
0035   setTriggerInput(pkt->getTriggerInput());
0036   setLiveVector(pkt->getLiveVector());
0037   setScaledVector(pkt->getScaledVector());
0038   setGTMBusyVector(pkt->getGTMBusyVector());
0039   for (int i = 0; i < 64; i++)
0040   {
0041     for (int j = 0; j < 3; j++)
0042     {
0043       setScaler(i, j, pkt->lValue(i, j));
0044     }
0045   }
0046   std::string gl1p_names[3]{"GL1PRAW", "GL1PLIVE", "GL1PSCALED"};
0047   for (int i = 0; i < 16; i++)
0048   {
0049     for (int j = 0; j < 3; j++)
0050     {
0051       setGl1pScaler(i, j, pkt->lValue(i, gl1p_names[j]));
0052     }
0053   }
0054   OfflinePacketv1::FillFrom(pkt);
0055 }
0056 
0057 void Gl1Packetv2::dump(std::ostream &os) const
0058 {
0059   os << "packet nr:       " << iValue(0) << std::endl;
0060   os << "Beam Clock:      "
0061      << "0x" << std::hex << lValue(0, "BCO") << std::dec << "   " << lValue(0, "BCO") << std::endl;
0062   os << "Trigger Input:   "
0063      << "0x" << std::hex << lValue(0, "TriggerInput") << std::dec << "   " << lValue(0, "TriggerInput") << std::endl;
0064   os << "Live Vector:     "
0065      << "0x" << std::hex << lValue(0, "LiveVector") << std::dec << "   " << lValue(0, "LiveVector") << std::endl;
0066   os << "Scaled Vector:   "
0067      << "0x" << std::hex << lValue(0, "ScaledVector") << std::dec << "   " << lValue(0, "ScaledVector") << std::endl;
0068   os << "GTM Busy Vector: "
0069      << "0x" << std::hex << lValue(0, "GTMBusyVector") << std::dec << "   " << lValue(0, "GTMBusyVector") << std::endl;
0070   os << "Bunch Number:    " << lValue(0, "BunchNumber") << std::endl
0071      << std::endl;
0072   os << "Trg #                  raw              live              scaled" << std::endl;
0073   os << "----------------------------------------------------------------" << std::endl;
0074 
0075   int i;
0076 
0077   for (i = 0; i < 64; i++)
0078   {
0079     if (lValue(i, 0) || lValue(i, 1) || lValue(i, 2))
0080     {
0081       os << std::setw(3) << i << "    ";
0082       os << " " << std::setw(18) << lValue(i, 0)
0083          << " " << std::setw(18) << lValue(i, 1)
0084          << " " << std::setw(18) << lValue(i, 2)
0085          << std::endl;
0086     }
0087   }
0088   os << std::endl;
0089   os << "Gl1P #                raw              live              scaled" << std::endl;
0090   os << "----------------------------------------------------------------" << std::endl;
0091 
0092   for (i = 0; i < 16; i++)
0093   {
0094     if (lValue(i, "GL1PRAW") || lValue(i, "GL1PLIVE") || lValue(i, "GL1PSCALED"))
0095     {
0096       os << std::setw(3) << i << "    ";
0097       os << " " << std::setw(18) << lValue(i, "GL1PRAW")
0098          << " " << std::setw(18) << lValue(i, "GL1PLIVE")
0099          << " " << std::setw(18) << lValue(i, "GL1PSCALED")
0100          << std::endl;
0101     }
0102   }
0103   os << std::endl;
0104 }