Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-03 08:20:50

0001 #ifndef __PACKET_A_H__
0002 #define __PACKET_A_H__
0003 
0004 
0005 #include "packet.h"
0006 #include "packetPublic.h"
0007 #include "packetConstants.h"
0008 #include "packetRoutines.h"
0009 #include "decoding_routines.h"
0010 
0011 const char *get_mnemonic (const int structure,const int format);
0012 const char *get_type_mnemonic (const int id);
0013 
0014 /** in order to keep the top-level Packet class
0015     fully implementation-independent, we put 
0016     this Packet\_A class in, from which all current implementations
0017     derive.
0018 */
0019 
0020 #ifndef __CINT__
0021 class WINDOWSEXPORT Packet_A : public Packet
0022 #else
0023 class  Packet_A : public Packet
0024 #endif
0025 {
0026 
0027 public:
0028 
0029   Packet_A(PACKET_ptr packet_ptr);
0030   Packet_A();
0031   ~Packet_A();
0032 
0033   // access to envelope information 
0034   int   getLength() const;
0035   //  int   getType() const;
0036   //  int   getDecoding() const;
0037 
0038   // some more header fields which are not yet implemented, marked "//*"
0039   //* int   gethdrVersion() const; // Version of header definition                    
0040   //* int   getHdrLength() const;     // inclusive of alignment data 
0041   int   getStatus() const { return 0;};
0042   int   getErrorLength() const;    // Length of error block in Dwords
0043   int   getDebugLength() const;// Length of debug block in Dwords
0044 
0045   int   getIdentifier() const; // Identifier
0046   //* int   getEndianism() const;  // Big/little endian indicator
0047   int   getPadding() const;    // number of padding units
0048 
0049   int   getStructure() const;  // Structure of packet
0050   //* int   getWordSize() const;   // "Word" size used to store packet data
0051   //* int   getAddrLength() const; // number of bytes used for channel address
0052   //* int   getHitLength() const;  // Length of a single "hit" in bytes
0053 
0054   int   getHitFormat() const;  // Format of a single hit
0055   //* int   getNumEntries() const; // Number of "objects" stored in packet
0056 
0057   int   getDataLength() const;  // Format of a single hit
0058 
0059 
0060   // debugging-type information 
0061 
0062 
0063   void  identify( OSTREAM& =COUT) const;
0064   void  fullIdentify( OSTREAM& =COUT) const;
0065 
0066   void  dumpErrorBlock ( OSTREAM& =COUT ) ;
0067   void  dumpDebugBlock ( OSTREAM& =COUT ) ;
0068 
0069   int   setIdentifier(const int newid);
0070 
0071   // getting decoded values
0072   int    iValue(const int);
0073   int    iValue(const int,const char *);
0074   int    iValue(const int,const int);
0075   int    iValue(const int, const int, const char *){return 0;};
0076   int    iValue(const int channel, const int iy, const int iz) {return 0;};
0077   int    iValue(const int channel, const int iy, const int iz, const char *what) {return 0;};
0078 
0079   float  rValue(const int);
0080   float  rValue(const int,const char *);
0081   float  rValue(const int,const int);
0082 
0083   int    getArraylength(const char *);
0084   int    fillIntArray (int [], const int, int *,const char * what="");
0085   int    fillFloatArray (float [], const int, int *,const char * what="");
0086   int*   getIntArray (int *,const char * what="");
0087   float* getFloatArray (int *,const char *what="");
0088 
0089   // pointer or data based handling
0090   virtual int is_pointer_type() const;
0091   virtual int convert();
0092 
0093   int getCheckSumStatus() const;
0094 
0095   int copyMe(int dest [],  const int maxlength) const;
0096 
0097   int setInternalParameter ( const int p1=0, const int p2=0, const char *what = "") {return 0;};
0098 
0099  protected:
0100 
0101   //  PACKETHDR_ptr packetHdr;
0102 
0103   int    standardIntArray (int [], const int, int *,const char * what="");
0104 
0105   PACKET_ptr packet;  // storage for the packet
0106 
0107 
0108   int is_data_type;  // 0 is pointer based --  1 is data based
0109 
0110   int data1_length;
0111   int data2_length;
0112   int data3_length;
0113   int data4_length;
0114   int data5_length;
0115   int data6_length;
0116   int data7_length;
0117   int data8_length;
0118   int data9_length;
0119   int data10_length;
0120 
0121   int *decoded_data1;
0122   int *decoded_data2;
0123   int *decoded_data3;
0124   int *decoded_data4;
0125   int *decoded_data5;
0126   int *decoded_data6;
0127   int *decoded_data7;
0128   int *decoded_data8;
0129   int *decoded_data9;
0130   int *decoded_data10;
0131 
0132   virtual int *decode(int *) =0;
0133 
0134 #ifdef LVL2_WINNT
0135   static void fix_endianess ( LONGLONG *x);
0136 #else
0137   static void fix_endianess ( long long *x);
0138 #endif
0139 
0140   static void fix_endianess ( double *x);
0141   static void fix_endianess ( char *str, const int length);
0142 
0143 };
0144 
0145 
0146 
0147 struct cdevIrData
0148 {
0149       char m_irState[256];
0150       double m_tripletTrimCurrents[12];
0151       double m_irVacuum;
0152       double m_estBeamSizeYellowVert;
0153       double m_estBeamSizeYellowHorz;
0154       double m_estBeamSizeBlueVert;
0155       double m_estBeamSizeBlueHorz;
0156       double m_estimatedLuminosity;
0157       double m_betaStarYellowHorz;
0158       double m_betaStarBlueHorz;
0159       double m_betaStarYellowVert;
0160       double m_betaStarBlueVert;
0161       double m_polarPerBunchYellowX[360];
0162       double m_polarPerBunchYellowY[360];
0163       double m_polarPerBunchYellowZ[360];
0164       double m_polarPerBunchBlueX[360];
0165       double m_polarPerBunchBlueY[360];
0166       double m_polarPerBunchBlueZ[360];
0167       int m_avgOrbitDXBpmYellowHorzOdd;
0168       int m_avgOrbitDXBpmYellowHorzEven;
0169       int m_avgOrbitDXBpmYellowVertOdd;
0170       int m_avgOrbitDXBpmYellowVertEven;
0171       int m_avgOrbitDXBpmBlueHorzOdd;
0172       int m_avgOrbitDXBpmBlueHorzEven;
0173       int m_avgOrbitDXBpmBlueVertOdd;
0174       int m_avgOrbitDXBpmBlueVertEven;
0175       int m_experimentVertexX[100];
0176       int m_experimentVertexY[100];
0177       int m_experimentVertexZ[100];
0178       int m_vertexStartTime;
0179       int m_vertexEndTime;
0180       unsigned int m_datavalidMask; 
0181 
0182 };
0183 
0184 struct cdevRingData
0185 {
0186 
0187   char   m_ringState[256]; // ejd91801
0188   char   m_ionSpecies[1024] ;
0189   double m_beamEnergy ;
0190   double m_gamma;
0191   int   m_stoneType;
0192   double m_momentumSpread;
0193   double m_bunchLength;
0194   int    m_intendedFillPattern[360];
0195   int    m_measuredFillPattern[360];
0196   double m_bunchOneRelativePhase;
0197   double m_synchrotronTune;
0198   double m_chromaticityVertical;
0199   double m_chromaticityHorizontal;
0200   int    m_polarizationFillPattern[360];
0201   int    m_timeOfFillStart;
0202   int    m_timeOfLuminosityStart;
0203   double m_emittanceVertical;
0204   double m_emittanceHorizontal;
0205   double m_betaIPMHorizontal;
0206   double m_betaIPMVertical;
0207   int    m_measuredPolarizationUp[360];
0208   int    m_measuredPolarizationDown[360];
0209   int    m_fillNumber;
0210   unsigned int m_datavalidMask;    // bit mask for data validity
0211   
0212 };
0213 
0214 
0215 
0216 struct cdevRingNoPolData
0217 {
0218 
0219   char   m_ringState[256]; // ejd91801
0220   char   m_ionSpecies[1024] ;
0221   double m_beamEnergy ;
0222   double m_gamma;
0223   int   m_stoneType;
0224   double m_momentumSpread;
0225   double m_synchrotronTune;
0226   double m_chromaticityVertical;
0227   double m_chromaticityHorizontal;
0228   int    m_timeOfFillStart;
0229   int    m_timeOfLuminosityStart;
0230   double m_emittanceVertical;
0231   double m_emittanceHorizontal;
0232   double m_betaIPMHorizontal;
0233   double m_betaIPMVertical;
0234   int    m_fillNumber;
0235   unsigned int m_datavalidMask;    // bit mask for data validity
0236   
0237 };
0238 
0239 struct cdevBucketsData
0240 {
0241   double m_bunchLength;
0242   double m_bunchOneRelativePhase;
0243   double m_fillPatternThreshold;
0244   int    m_intendedFillPattern[360];
0245   int    m_measuredFillPattern[360];
0246   int    m_polarizationFillPattern[360];
0247   unsigned int m_datavalidMask;    // bit mask for data validity
0248 };
0249 
0250 struct cdevRingPolData
0251 {
0252   char   m_ringState[256]; // ejd91801
0253   char   m_ionSpecies[1024] ;
0254   double m_beamEnergy ;
0255   double m_gamma;
0256   int   m_stoneType;
0257   double m_momentumSpread;
0258   double m_bunchLength;
0259   int    m_intendedFillPattern[360];
0260   int    m_measuredFillPattern[360];
0261   double m_bunchOneRelativePhase;
0262   double m_synchrotronTune;
0263   double m_chromaticityVertical;
0264   double m_chromaticityHorizontal;
0265   int    m_polarizationFillPattern[360];
0266   int    m_timeOfFillStart;
0267   int    m_timeOfLuminosityStart;
0268   double m_emittanceVertical;
0269   double m_emittanceHorizontal;
0270   double m_betaIPMHorizontal;
0271   double m_betaIPMVertical;
0272   int    m_measuredPolarizationUp[360];
0273   int    m_measuredPolarization[360];
0274   unsigned int m_datavalidMask;    // bit mask for data validity
0275 };
0276  
0277 struct cdevWCMData
0278 {
0279   int     cdevCaptureTimeStamp;
0280   //int dummy; //? 
0281   double  beamcurrent;
0282   float  bunchcurrent[360];
0283 
0284 };
0285 
0286 struct cdevDvmData
0287 {
0288   double beamCurrent;
0289   double beamLifeTime;
0290 };
0291 
0292 struct cdevBPMData
0293 {
0294   long    avgOrbTimeStamp;
0295   float  avgOrbPosition;
0296   float  avgOrbVariance;
0297   float  avgOrbStat;
0298   long   datavalidMask;
0299 };
0300 
0301 struct cdevMadchData
0302 {
0303   int   cdevCaptureTimeStamp; //ejd 4/30/03 long to int
0304   double current;
0305 };
0306 
0307 struct cdevWCMHistory
0308 {
0309   int counts;
0310   struct cdevWCMData reading[1];
0311 
0312 };
0313 
0314 struct cdevSISData
0315 {
0316 
0317   int countRate;
0318   int totalCount;
0319 
0320 };
0321 
0322 struct cdevPolTargetData
0323 {
0324   int positionEncLinear;
0325   int positionEncRot;
0326 };
0327 
0328 struct cdevPolarimeterData
0329 {
0330   
0331   int   m_cdevCaptureTimeStamp;
0332   double runIdS;    // FILL.XXX --- where XXX is the run number 
0333   int startTimeS;   // Unix time
0334   int stopTimeS;    // Unix time
0335   char daqVersionS[80];
0336   char cutIdS[80];
0337   char targetIdS[80];   // "Horz.tagret3" or "Vert.target6" etc.
0338   int encoderPositionS[2];
0339   int statusS;  // bit pattern if <0 data is not usable
0340   char statusStringS[80];
0341   int totalCountsS;
0342   int upCountsS;
0343   int downCountsS;
0344   int unpolCountsS;
0345   int countsUpLeftS[360];
0346   int countsLeftS[360];
0347   int countsDownLeftS[360];
0348   int countsDownRightS[360];
0349   int countsRightS[360];
0350   int countsUpRightS[360];
0351   float avgAsymXS;
0352   float avgAsymX45S;
0353   float avgAsymX90S;    
0354   float avgAsymYS;
0355   float avgAsymErrorXS;
0356   float avgAsymErrorX45S;
0357   float avgAsymErrorX90S;
0358   float avgAsymErrorYS;
0359   float bunchAsymXS[360];
0360   float bunchAsymYS[360];
0361   float bunchAsymErrorXS[360];
0362   float bunchAsymErrorYS[360];
0363   float beamEnergyS;    // the same as ringSpec.color:beamEnergyM just for reference
0364   float analyzingPowerS;
0365   float analyzingPowerErrorS;
0366   int numberEventsS;    // provided by MCR before measurement
0367   int maxTimeS; 
0368   float polarizationM;
0369 };
0370 
0371 
0372 
0373 struct cdevPolarimeterZData
0374 {
0375   
0376   int   m_cdevCaptureTimeStamp;
0377   double runIdS;    // FILL.XXX --- where XXX is the run number 
0378   int startTimeS;   // Unix time
0379   int stopTimeS;    // Unix time
0380   char daqVersionS[80];
0381   char cutIdS[80];
0382   char targetIdS[80];   // "Horz.tagret3" or "Vert.target6" etc.
0383   int encoderPositionS[2];
0384   int statusS;  // bit pattern if <0 data is not usable
0385   char statusStringS[80];
0386   int totalCountsS;
0387   int upCountsS;
0388   int downCountsS;
0389   int unpolCountsS;
0390   int countsUpLeftS[360];
0391   int countsLeftS[360];
0392   int countsDownLeftS[360];
0393   int countsDownRightS[360];
0394   int countsRightS[360];
0395   int countsUpRightS[360];
0396   float avgAsymXS;
0397   float avgAsymX45S;
0398   float avgAsymX90S;    
0399   float avgAsymYS;
0400   float avgAsymErrorXS;
0401   float avgAsymErrorX45S;
0402   float avgAsymErrorX90S;
0403   float avgAsymErrorYS;
0404   float bunchAsymXS[360];
0405   float bunchAsymYS[360];
0406   float bunchAsymErrorXS[360];
0407   float bunchAsymErrorYS[360];
0408   float beamEnergyS;    // the same as ringSpec.color:beamEnergyM just for reference
0409   float analyzingPowerS;
0410   float analyzingPowerErrorS;
0411   int numberEventsS;    // provided by MCR before measurement
0412   int maxTimeS; 
0413   float polarizationM;
0414 };
0415 #endif /* __PACKET_A_H__ */
0416 
0417