File indexing completed on 2025-08-03 08:20:40
0001 #include <packet_cdevringnopol.h>
0002
0003 Packet_cdevringnopol::Packet_cdevringnopol(PACKET_ptr data)
0004 : Packet_w4 (data)
0005 {
0006 ps = 0;
0007 hasfilldata = 0;
0008 decoded = 0;
0009 }
0010
0011
0012 int *Packet_cdevringnopol::decode ( int *nwout)
0013 {
0014 if (decoded) {
0015 *nwout = 0;
0016 return 0;
0017 }
0018
0019 decoded = 1;
0020 hasfilldata = 1;
0021
0022 int *k;
0023 k = (int *) findPacketDataStart(packet);
0024 if (k == 0)
0025 {
0026 ps = 0;
0027 *nwout = 0;
0028 return 0;
0029 }
0030
0031 if ( getHitFormat() == IDCDEVRINGNOPOL)
0032 {
0033 ps = ( struct cdevRingNoPolData *) k;
0034
0035 }
0036
0037
0038
0039 *nwout = 0;
0040 return 0;
0041 }
0042
0043 int Packet_cdevringnopol::iValue(const int ich, const char *what)
0044 {
0045 int i;
0046 decode (&i);
0047
0048 if ( strcmp(what, "ringState") == 0 ) {
0049 if (ich >=0 && ich < 256) {
0050 return ps->m_ringState[ich] ;
0051 }
0052 }
0053
0054 if ( strcmp(what, "ionSpecies") == 0 ) {
0055 if (ich>=0 && ich<1024) {
0056 return ps->m_ionSpecies[ich] ;
0057 }
0058 }
0059
0060 if ( strcmp(what, "stoneType") == 0 ) return ps->m_stoneType ;
0061
0062
0063 if ( strcmp(what, "timeOfFillStart") == 0 ) return ps->m_timeOfFillStart;
0064 if ( strcmp(what, "timeOfLuminosityStart") == 0 ) return ps->m_timeOfLuminosityStart;
0065
0066 if (hasfilldata )
0067 {
0068 if ( strcmp(what, "fillNumber") == 0 ) return ps->m_fillNumber;
0069 if ( strcmp(what, "datavalidMask") == 0 ) return ps->m_datavalidMask;
0070
0071 }
0072
0073
0074
0075
0076 std::cout << "packet_cdevringnopol::iValue error unknown datum: " << what << std::endl;
0077 return 0;
0078
0079 }
0080
0081
0082 double Packet_cdevringnopol::dValue(const int channel,const char *what)
0083 {
0084 int i;
0085 decode (&i);
0086
0087 if ( strcmp(what, "beamEnergy") == 0 ) return ps->m_beamEnergy;
0088 if ( strcmp(what, "gamma") == 0 ) return ps->m_gamma;
0089 if ( strcmp(what, "momentumSpread") == 0 ) return ps->m_momentumSpread;
0090 if ( strcmp(what, "synchrotronTune") == 0 ) return ps->m_synchrotronTune;
0091 if ( strcmp(what, "chromaticityVertical") == 0 ) return ps->m_chromaticityVertical;
0092 if ( strcmp(what, "chromaticityHorizontal") == 0 ) return ps->m_chromaticityHorizontal;
0093 if ( strcmp(what, "emittanceVertical") == 0 ) return ps->m_emittanceVertical;
0094 if ( strcmp(what, "emittanceHorizontal") == 0 ) return ps->m_emittanceHorizontal;
0095 if ( strcmp(what, "betaIPMHorizontal") == 0 ) return ps->m_betaIPMHorizontal;
0096 if ( strcmp(what, "betaIPMVertical") == 0 ) return ps->m_betaIPMVertical;
0097
0098 std::cout << "packet_cdevringnopol::dValue error unknown datum: " << what << std::endl;
0099 return 0;
0100 }
0101
0102
0103
0104 void Packet_cdevringnopol::dump ( OSTREAM& os)
0105 {
0106 int i;
0107 decode (&i);
0108
0109 this->identify(os);
0110
0111 os << "m_ringState " << ps->m_ringState << std::endl;
0112 os << "m_ionSpecies " << ps->m_ionSpecies << std::endl;
0113 os << "m_beamEnergy " << ps->m_beamEnergy << std::endl;
0114 os << "m_gamma " << ps->m_gamma << std::endl;
0115 os << "m_stoneType " << ps->m_stoneType << std::endl;
0116 os << "m_momentumSpread " << ps->m_momentumSpread << std::endl;
0117 os << "m_chromaticityVertical " << ps->m_chromaticityVertical << std::endl;
0118 os << "m_chromaticityHorizontal " << ps->m_chromaticityHorizontal << std::endl;
0119 os << "m_emittanceVertical " << ps->m_emittanceVertical << std::endl;
0120
0121
0122 if (hasfilldata)
0123 {
0124 os << "fillNumber " << iValue(i,"fillNumber") << std::endl;
0125 os << "datavalidMask " << iValue(i,"datavalidMask") << std::endl;
0126
0127 }
0128
0129
0130
0131 }
0132