Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:10

0001 /**
0002  * @file trackbase/TpcTpotEventInfov1.cc
0003  * @author Thomas Marshall
0004  * @date September 2023
0005  * @brief Implementation of TpcTpotEventInfov1
0006  */
0007 #include "TpcTpotEventInfov1.h"
0008 
0009 #include <cassert>
0010 #include <cmath>
0011 #include <utility>  // for swap
0012 
0013 TpcTpotEventInfov1::TpcTpotEventInfov1()
0014 {
0015   std::fill_n(&m_bco[0][0][0], 100, UINT64_MAX);
0016   std::fill_n(&m_lvl1_count[0][0][0], 100, UINT32_MAX);
0017   std::fill_n(&m_endat_count[0][0][0], 100, UINT32_MAX);
0018   std::fill_n(&m_last_bco[0][0][0], 100, UINT64_MAX);
0019   std::fill_n(&m_modebits[0][0][0], 100, UINT8_MAX);
0020 }
0021 
0022 void TpcTpotEventInfov1::identify(std::ostream& os) const
0023 {
0024   os << "---TpcTpotEventInfov1--------------------" << std::endl;
0025 
0026   for (int i = 0; i < 25; i++)
0027   {
0028     os << "Sector " << i << ": (PCIe 0 lvl1, PCIe 0 EnDat, PCIe 1 lvl1, PCIe 1 EnDat)" << std::endl;
0029     os << "BCO - " << m_bco[i][0][0] << ", " << m_bco[i][0][1] << ", " << m_bco[i][1][0] << ", " << m_bco[i][1][1] << std::endl;
0030     os << "Level 1 Count - " << m_lvl1_count[i][0][0] << ", " << m_lvl1_count[i][0][1] << ", " << m_lvl1_count[i][1][0] << ", " << m_lvl1_count[i][1][1] << std::endl;
0031     os << "EnDat Count - " << m_endat_count[i][0][0] << ", " << m_endat_count[i][0][1] << ", " << m_endat_count[i][1][0] << ", " << m_endat_count[i][1][1] << std::endl;
0032     os << "Last BCO - " << m_last_bco[i][0][0] << ", " << m_last_bco[i][0][1] << ", " << m_last_bco[i][1][0] << ", " << m_last_bco[i][1][1] << std::endl;
0033     os << "Modebits - " << m_modebits[i][0][0] << ", " << m_modebits[i][0][1] << ", " << m_modebits[i][1][0] << ", " << m_modebits[i][1][1] << std::endl;
0034   }
0035 
0036   os << std::endl;
0037   os << "-----------------------------------------------" << std::endl;
0038 
0039   return;
0040 }
0041 
0042 int TpcTpotEventInfov1::isValid() const
0043 {
0044   return 1;
0045 }
0046 
0047 void TpcTpotEventInfov1::CopyFrom(const TpcTpotEventInfo& source)
0048 {
0049   // do nothing if copying onto oneself
0050   if (this == &source)
0051   {
0052     return;
0053   }
0054 
0055   // parent class method
0056   TpcTpotEventInfo::CopyFrom(source);
0057 
0058   for (int i = 0; i < 25; i++)
0059   {
0060     for (int j = 0; j < 2; j++)
0061     {
0062       for (int k = 0; k < 2; k++)
0063       {
0064         setBCO(source.getBCO(static_cast<SectorID>(i), static_cast<PCIeEndPointID>(j), static_cast<TaggerID>(k)), static_cast<SectorID>(i), static_cast<PCIeEndPointID>(j), static_cast<TaggerID>(k));
0065         setLevel1Count(source.getLevel1Count(static_cast<SectorID>(i), static_cast<PCIeEndPointID>(j), static_cast<TaggerID>(k)), static_cast<SectorID>(i), static_cast<PCIeEndPointID>(j), static_cast<TaggerID>(k));
0066         setEnDatCount(source.getEnDatCount(static_cast<SectorID>(i), static_cast<PCIeEndPointID>(j), static_cast<TaggerID>(k)), static_cast<SectorID>(i), static_cast<PCIeEndPointID>(j), static_cast<TaggerID>(k));
0067         setLastBCO(source.getLastBCO(static_cast<SectorID>(i), static_cast<PCIeEndPointID>(j), static_cast<TaggerID>(k)), static_cast<SectorID>(i), static_cast<PCIeEndPointID>(j), static_cast<TaggerID>(k));
0068         setModebits(source.getModebits(static_cast<SectorID>(i), static_cast<PCIeEndPointID>(j), static_cast<TaggerID>(k)), static_cast<SectorID>(i), static_cast<PCIeEndPointID>(j), static_cast<TaggerID>(k));
0069       }
0070     }
0071   }
0072 }
0073 
0074 void TpcTpotEventInfov1::checkIndexes(SectorID sector, PCIeEndPointID PCIe, TaggerID tagger)
0075 {
0076   assert(sector >= kTPCSector0);
0077   assert(sector <= kTPOT);
0078   assert(PCIe >= kEndPoint0);
0079   assert(PCIe <= kEndPoint1);
0080   assert(tagger >= kLVL1Tagger);
0081   assert(tagger <= kEnDatTagger);
0082 }