ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
packet_cdevringnopol.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file packet_cdevringnopol.cc
1 #include <packet_cdevringnopol.h>
2 
4  : Packet_w4 (data)
5 {
6  ps = 0;
7  hasfilldata = 0;
8  decoded = 0; // only decode once...
9 }
10 
11 
12 int *Packet_cdevringnopol::decode ( int *nwout)
13 {
14  if (decoded) {
15  *nwout = 0;
16  return 0;
17  }
18 
19  decoded = 1;
20  hasfilldata = 1;
21 
22  int *k;
23  k = (int *) findPacketDataStart(packet);
24  if (k == 0)
25  {
26  ps = 0;
27  *nwout = 0;
28  return 0;
29  }
30 
31  if ( getHitFormat() == IDCDEVRINGNOPOL)
32  {
33  ps = ( struct cdevRingNoPolData *) k;
34 
35  }
36 
37 
38 
39  *nwout = 0;
40  return 0;
41 }
42 
43 int Packet_cdevringnopol::iValue(const int ich, const char *what)
44 {
45  int i;
46  decode (&i);
47 
48  if ( strcmp(what, "ringState") == 0 ) {
49  if (ich >=0 && ich < 256) {
50  return ps->m_ringState[ich] ;
51  }
52  }
53 
54  if ( strcmp(what, "ionSpecies") == 0 ) {
55  if (ich>=0 && ich<1024) {
56  return ps->m_ionSpecies[ich] ;
57  }
58  }
59 
60  if ( strcmp(what, "stoneType") == 0 ) return ps->m_stoneType ;
61 
62 
63  if ( strcmp(what, "timeOfFillStart") == 0 ) return ps->m_timeOfFillStart;
64  if ( strcmp(what, "timeOfLuminosityStart") == 0 ) return ps->m_timeOfLuminosityStart;
65 
66  if (hasfilldata )
67  {
68  if ( strcmp(what, "fillNumber") == 0 ) return ps->m_fillNumber;
69  if ( strcmp(what, "datavalidMask") == 0 ) return ps->m_datavalidMask;
70 
71  }
72 
73 
74 
75 
76  std::cout << "packet_cdevringnopol::iValue error unknown datum: " << what << std::endl;
77  return 0;
78 
79 }
80 
81 
82 double Packet_cdevringnopol::dValue(const int channel,const char *what)
83 {
84  int i;
85  decode (&i);
86 
87  if ( strcmp(what, "beamEnergy") == 0 ) return ps->m_beamEnergy;
88  if ( strcmp(what, "gamma") == 0 ) return ps->m_gamma;
89  if ( strcmp(what, "momentumSpread") == 0 ) return ps->m_momentumSpread;
90  if ( strcmp(what, "synchrotronTune") == 0 ) return ps->m_synchrotronTune;
91  if ( strcmp(what, "chromaticityVertical") == 0 ) return ps->m_chromaticityVertical;
92  if ( strcmp(what, "chromaticityHorizontal") == 0 ) return ps->m_chromaticityHorizontal;
93  if ( strcmp(what, "emittanceVertical") == 0 ) return ps->m_emittanceVertical;
94  if ( strcmp(what, "emittanceHorizontal") == 0 ) return ps->m_emittanceHorizontal;
95  if ( strcmp(what, "betaIPMHorizontal") == 0 ) return ps->m_betaIPMHorizontal;
96  if ( strcmp(what, "betaIPMVertical") == 0 ) return ps->m_betaIPMVertical;
97 
98  std::cout << "packet_cdevringnopol::dValue error unknown datum: " << what << std::endl;
99  return 0;
100 }
101 
102 
103 
105 {
106  int i;
107  decode (&i);
108 
109  this->identify(os);
110 
111  os << "m_ringState " << ps->m_ringState << std::endl;
112  os << "m_ionSpecies " << ps->m_ionSpecies << std::endl;
113  os << "m_beamEnergy " << ps->m_beamEnergy << std::endl;
114  os << "m_gamma " << ps->m_gamma << std::endl;
115  os << "m_stoneType " << ps->m_stoneType << std::endl;
116  os << "m_momentumSpread " << ps->m_momentumSpread << std::endl;
117  os << "m_chromaticityVertical " << ps->m_chromaticityVertical << std::endl;
118  os << "m_chromaticityHorizontal " << ps->m_chromaticityHorizontal << std::endl;
119  os << "m_emittanceVertical " << ps->m_emittanceVertical << std::endl;
120 
121 
122  if (hasfilldata)
123  {
124  os << "fillNumber " << iValue(i,"fillNumber") << std::endl;
125  os << "datavalidMask " << iValue(i,"datavalidMask") << std::endl;
126 
127  }
128 
129 
130 
131 }
132