File indexing completed on 2025-08-03 08:20:50
0001 #include <packet_cdevbuckets.h>
0002
0003 Packet_cdevbuckets::Packet_cdevbuckets(PACKET_ptr data)
0004 : Packet_w4 (data)
0005 {
0006 ps = 0;
0007 decoded = 0;
0008 }
0009
0010 int *Packet_cdevbuckets::decode ( int *nwout)
0011 {
0012 if (decoded) {
0013 *nwout = 0;
0014 return 0;
0015 }
0016
0017 decoded = 1;
0018
0019 int *k;
0020 k = (int *) findPacketDataStart(packet);
0021 if (k == 0)
0022 {
0023 ps = 0;
0024 *nwout = 0;
0025 return 0;
0026 }
0027
0028 if ( getHitFormat() == IDCDEVBUCKETS)
0029 {
0030 ps = ( struct cdevBucketsData *) k;
0031 }
0032
0033
0034
0035 *nwout = 0;
0036 return 0;
0037 }
0038
0039 int Packet_cdevbuckets::iValue(const int ich, const char *what)
0040 {
0041 int i;
0042 decode (&i);
0043
0044
0045 if ( strcmp(what, "intendedFillPattern") == 0 ) {
0046 if (ich >= 0 && ich < 360 ) {
0047 return ps->m_intendedFillPattern[ich];
0048 }
0049 }
0050
0051 if ( strcmp(what, "measuredFillPattern") == 0 ) {
0052 if (ich >= 0 && ich < 360 ) {
0053 return ps->m_measuredFillPattern[ich];
0054 }
0055 }
0056
0057 if ( strcmp(what, "polarizationFillPattern") == 0 ) {
0058 if (ich >= 0 && ich < 360 ) {
0059 return ps->m_polarizationFillPattern[ich];
0060 }
0061 }
0062
0063
0064
0065
0066
0067
0068
0069
0070 std::cout << "packet_cdevbuckets::iValue error unknown datum: " << what << std::endl;
0071 return 0;
0072
0073 }
0074
0075
0076 double Packet_cdevbuckets::dValue(const int channel,const char *what)
0077 {
0078 int i;
0079 decode (&i);
0080
0081 if ( strcmp(what, "bunchLength") == 0 ) return ps->m_bunchLength;
0082 if ( strcmp(what, "fillPatternThreshold") == 0 ) return ps->m_fillPatternThreshold;
0083 if ( strcmp(what, "bunchOneRelativePhase") == 0 ) return ps->m_bunchOneRelativePhase;
0084
0085 std::cout << "packet_cdevbuckets::dValue error unknown datum: " << what << std::endl;
0086 return 0;
0087 }
0088
0089
0090
0091 void Packet_cdevbuckets::dump ( OSTREAM& os)
0092 {
0093 int i;
0094 decode (&i);
0095
0096 this->identify(os);
0097
0098 os << "m_bunchLength " << ps->m_bunchLength << std::endl;
0099 os << "m_fillPatternThreshol " << ps->m_fillPatternThreshold << std::endl;
0100 os << "m_bunchOneRelativePhase " << ps->m_bunchOneRelativePhase << std::endl;
0101
0102 os << "index " <<" intendedFillPattern " << " measuredFillPattern "<< " polarizationFillPattern " << std::endl;
0103 for (i = 0 ; i < 360 ;i++)
0104 {
0105 os << std::setw(3) <<i << std::setw(3)<< "|" << std::setw(10) << iValue(i,"intendedFillPattern")<< std::setw( 20)<< iValue(i,"measuredFillPattern")<< std::setw( 23)<<iValue(i,"polarizationFillPattern");
0106 os << std::endl;
0107 }
0108 os << std::endl;
0109
0110 }
0111