CMS 3D CMS Logo

HcalHTRData.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 #ifndef HcalHTRData_H
00003 #define HcalHTRData_H
00004 
00016 class HcalHTRData {
00017  public:
00018   static const int CHANNELS_PER_SPIGOT        ;// = 24;
00019   static const int MAXIMUM_SAMPLES_PER_CHANNEL;// = 20;
00020   
00021   HcalHTRData();
00022   ~HcalHTRData() { if (m_ownData!=0) delete [] m_ownData; }
00023   HcalHTRData(int version_to_create);
00024   HcalHTRData(const unsigned short* data, int length);
00025   HcalHTRData(const HcalHTRData&);
00026   
00027   HcalHTRData& operator=(const HcalHTRData&);
00028   void allocate(int version_to_create=0);
00029   void adoptData(const unsigned short* data, int length);
00030   
00032   inline int getFormatVersion() const { return m_formatVersion; }
00033   
00035   inline const unsigned short* getRawData() const { return m_rawConst; }
00036   
00038   inline const int getRawLength() const { return m_rawLength; }
00039   
00043   bool check() const;
00044   
00052   void dataPointers(const unsigned short** daq_first,
00053                     const unsigned short** daq_last,
00054                     const unsigned short** tp_first,
00055                     const unsigned short** tp_last);
00056   
00057   
00065   void unpack(unsigned char* daq_lengths, unsigned short* daq_samples,
00066               unsigned char* tp_lengths, unsigned short* tp_samples) const;
00067   
00075   bool unpackHistogram(int fiber, int fiberchan, int capid, unsigned
00076                        short* histogram) const;
00077   
00084   void pack(unsigned char* daq_lengths, unsigned short* daq_samples,
00085             unsigned char* tp_lengths, unsigned short* tp_samples, bool
00086             do_capid=false);
00088   void packHeaderTrailer(int L1Anumber, int bcn, int submodule, int
00089                          orbitn, int pipeline, int ndd, int nps, int firmwareRev=0);
00090   
00092   inline unsigned int getL1ANumber() const { 
00093     return (m_rawConst[0]&0xFF)+(m_rawConst[1]<<8); 
00094   }
00096   inline unsigned int getBunchNumber() const { 
00097     return (m_rawConst[4]&0xFFF); 
00098   }
00100   unsigned int getOrbitNumber() const;
00102   unsigned int getSubmodule() const;
00104   // get the htr slot
00105   unsigned int htrSlot() const;
00107   // get the htr top/bottom (1=top/0=bottom)
00108   unsigned int htrTopBottom() const;
00110   // get the readout VME crate number
00111   unsigned int readoutVMECrateId() const;
00113   bool isCalibrationStream() const;
00115   bool isUnsuppressed() const;
00117   bool wasMarkAndPassZS(int fiber, int fiberchan) const;
00118   
00120   bool isPatternRAMEvent() const;
00123   bool isHistogramEvent() const;
00126   void getHistogramFibers(int& a, int& b) const;
00128   unsigned int getPipelineLength() const;
00130   unsigned int getFirmwareRevision() const;
00132   int getFirmwareFlavor() const;
00134   inline unsigned int getErrorsWord() const { 
00135     return m_rawConst[2]&0xFFFF; }
00137   int getNPrecisionWords() const;
00139   int getNDD() const;
00142   int getNTP() const;
00144   int getNPS() const;
00145 
00147   inline unsigned int getDLLunlock() const { 
00148     return (m_rawConst[5]>>1)&0x3; }
00149 
00151   inline unsigned int getTTCready() const { 
00152     return m_rawConst[5]&0x1; }
00153 
00155   inline unsigned int getFib1OrbMsgBCN() const {
00156   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-12]&0xFFF);
00157 }
00158   inline unsigned int getFib2OrbMsgBCN() const {
00159   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-11]&0xFFF);
00160 }
00161 
00162   inline unsigned int getFib3OrbMsgBCN() const {
00163   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-10]&0xFFF);
00164 }
00165 
00166   inline unsigned int getFib4OrbMsgBCN() const {
00167   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-9]&0xFFF);
00168 }
00169 
00170   inline unsigned int getFib5OrbMsgBCN() const {
00171   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-8]&0xFFF);
00172 }
00173 
00174   inline unsigned int getFib6OrbMsgBCN() const {
00175   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-7]&0xFFF);
00176 }
00177 
00178   inline unsigned int getFib7OrbMsgBCN() const {
00179   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-6]&0xFFF);
00180 }
00181 
00182   inline unsigned int getFib8OrbMsgBCN() const {
00183   return (m_formatVersion==-1)?(0):(m_rawConst[m_rawLength-5]&0xFFF);
00184 }
00185 
00186 
00187 
00189   inline unsigned int getExtHdr1() const { 
00190     return (m_rawConst[0]);}
00191   inline unsigned int getExtHdr2() const { 
00192     return (m_rawConst[1]); }
00193   inline unsigned int getExtHdr3() const { 
00194     return (m_rawConst[2]);} 
00195   inline unsigned int getExtHdr4() const { 
00196     return (m_rawConst[3]); }
00197   inline unsigned int getExtHdr5() const { 
00198     return (m_rawConst[4]);} 
00199   inline unsigned int getExtHdr6() const { 
00200     return (m_rawConst[5]);} 
00201   inline unsigned int getExtHdr7() const { 
00202     return (m_rawConst[6]);} 
00203   inline unsigned int getExtHdr8() const { 
00204     return (m_rawConst[7]);}  
00205 
00206   /* unsigned int getFib1OrbMsgBCN() const;
00207   unsigned int getFib2OrbMsgBCN() const;
00208   unsigned int getFib3OrbMsgBCN() const;
00209   unsigned int getFib4OrbMsgBCN() const;
00210   unsigned int getFib5OrbMsgBCN() const;
00211   unsigned int getFib6OrbMsgBCN() const;
00212   unsigned int getFib7OrbMsgBCN() const;
00213   unsigned int getFib8OrbMsgBCN() const;
00214   */
00215 
00218   bool wasHistogramError(int ifiber) const;
00219   
00220 protected:
00221   void determineSectionLengths(int& tpWords, int& daqWords, int&
00222                                headerWords, int& trailerWords) const;
00223   void determineStaticLengths(int& headerWords, int& trailerWords) const;
00224   int m_formatVersion;
00225   int m_rawLength;
00226   const unsigned short* m_rawConst;
00227   unsigned short* m_ownData;
00228 };
00229 
00230 #endif
00231 

Generated on Tue Jun 9 17:34:41 2009 for CMSSW by  doxygen 1.5.4