CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/EventFilter/CSCTFRawToDigi/src/CSCSP_MEblock.h

Go to the documentation of this file.
00001 #ifndef CSCSP_MEblock_h
00002 #define CSCSP_MEblock_h
00003 
00004 class CSCSP_MEblock {
00005 private:
00007         unsigned clct_pattern_number : 4; // higher pattern number - straighter high-momentum tracks with more layers hit, also encodes half/di-strip indication
00008         unsigned quality_            : 4; // the more hits the higher LCT Quality
00009         unsigned wire_group_id       : 7; // radial position of the pattern within the chamber (0-111)
00010         unsigned zero_1              : 1; // format specific
00012         unsigned clct_pattern_id     : 8; // azimuthal position ot the pattern at the third (key) layer: (0-159 for half-strips 0-39 for di-strips)
00013         unsigned csc_id              : 4; // chamber # (1-9)
00014         unsigned left_right          : 1; // L/R - track is heading towards lower/higher strip number
00015         unsigned bx0_                : 1; // BX counter least significant bit
00016         unsigned bc0_                : 1; // BC Zero flag marks that next BXN = 0
00017         unsigned zero_2              : 1; // format specific
00019         unsigned me_bxn              : 12;// LCT arrival time picked from a local 12-bit BX Counter, that runs at link timing
00020         unsigned receiver_status_er1 : 1; // receiver status for the frame 1 (see below)
00021         unsigned receiver_status_dv1 : 1; // receiver status for the frame 1 (see below)
00022         unsigned aligment_fifo_full  : 1; // Alignment FIFO Full Flag, should be 0, if AF has been initialized successfully by L1Reset
00023         unsigned zero_3              : 1; // format specific
00025         unsigned link_id             : 2; // Link number (1-3)         [reported by MPC on every L1 Reset]
00026         unsigned mpc_id              : 6; // MPC Crate number (0-63)   [reported by MPC on every L1 Reset]
00027         unsigned err_prop_cnt        : 4; // accumulates the "Receive Error Propagation" occurrences since last L1Reset
00028         unsigned receiver_status_er2 : 1; // receiver status for the frame 2 (see below)
00029         unsigned receiver_status_dv2 : 1; // receiver status for the frame 2 (see below)
00030         unsigned aligment_fifo_empty : 1; // Alignment FIFO Empty Flag, should be 0, if AF has been initialized successfully by L1Reset
00031         unsigned zero_4              : 1; // format specific
00032 
00033         // Optical Receiver Status options:
00034         // {receiver_status_dv, receiver_status_er} = {Receive Data Valid, Receive Error}
00035         // {0,0} - Receive Idle Character;
00036         // {0,1} - Receive Carrier Extend;
00037         // {1,0} - Receive Normal Data Character <- expect to have;
00038         // {1,1} - Receive Error Propagation;
00039 
00040         // Other data members logically belong to ME Block record,
00041         //  but physically are located in Data Block Header, which implementation is:
00042         friend class CSCSPRecord;
00043         friend class CSCTFPacker;
00044         // Let this class set following data memebers:
00045         unsigned int tbin_;           // time bin, that this ME block belongs to in global SP record
00046         unsigned int valid_pattern;   // LCT valid bit
00047         unsigned int sync_error;      // LCT synchronization error bit
00048         unsigned int sync_modified;   // LCT modified synchronization error bit
00049         unsigned int alignment_fifo;  // AF error
00050         unsigned int bxBit;           // monitors the ALCT/TMB/MPC timing
00051         unsigned int spInput_;        // Input SP link, this LCT come through [1..15] (as SP sees it)
00052 
00053 public:
00054         bool check(void) const throw() { return zero_1!=0||zero_2!=0||zero_3!=0||zero_4!=0; }
00055 
00056         unsigned int quality(void) const throw() { return quality_; }
00057         unsigned int BXN    (void) const throw() { return me_bxn;   }
00058         unsigned int bx0    (void) const throw() { return bx0_;     }
00059         unsigned int bc0    (void) const throw() { return bc0_;     }
00060 
00061         unsigned int spInput(void) const throw() { return spInput_; }
00062         unsigned int link   (void) const throw() { return link_id;  }
00063         unsigned int mpc    (void) const throw() { return mpc_id;   }
00064         unsigned int csc    (void) const throw() { return csc_id;   }
00065 
00066         unsigned int l_r    (void) const throw() { return left_right;        }
00067         unsigned int wireGroup(void) const throw() { return wire_group_id;   }
00068         unsigned int strip  (void) const throw() { return clct_pattern_id;      }
00069         unsigned int pattern(void) const throw() { return clct_pattern_number;  }
00070 
00071         enum AF { EMPTY=1, FULL=2 };
00072         unsigned int aligment_fifo(void) const throw() { return (aligment_fifo_full<<1)|aligment_fifo_empty; }
00073 
00074         enum RS { IDLE_CHARs=0, CARRIER_EXTEND=1, NORMAL_DATA=2, ERROR_PROP=3 };
00075         unsigned int receiver_status_frame1(void) const throw() { return (receiver_status_dv1<<1)|receiver_status_er1; }
00076         unsigned int receiver_status_frame2(void) const throw() { return (receiver_status_dv2<<1)|receiver_status_er2; }
00077 
00078         unsigned int errCnt(void) const throw() { return err_prop_cnt; }
00079 
00080         unsigned int tbin(void) const throw() { return tbin_;         }
00081         unsigned int vp  (void) const throw() { return valid_pattern; }
00082         unsigned int se  (void) const throw() { return sync_error;    }
00083         unsigned int sm  (void) const throw() { return sync_modified; }
00084         unsigned int af  (void) const throw() { return alignment_fifo;}
00085         unsigned int timingError(void) const throw() { return bxBit; }
00086 
00087         bool unpack(const unsigned short *&buf) throw() { memcpy((void*)this,buf,4*sizeof(short)); buf+=4; return check(); }
00088 
00089         CSCSP_MEblock(void){}
00090 };
00091 
00092 #endif