CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/EventFilter/CSCTFRawToDigi/src/CSCSP_SPblock.h

Go to the documentation of this file.
00001 #ifndef CSCSP_SPblock_h
00002 #define CSCSP_SPblock_h
00003 #include <vector>
00004 
00005 #include "EventFilter/CSCTFRawToDigi/src/CSCSP_MEblock.h"
00006 #include "EventFilter/CSCTFRawToDigi/src/CSCSP_MBblock.h"
00007 
00008 class CSCSP_SPblock {
00009 private:
00011         unsigned phi_        : 5; // azimuth coordinate
00012         unsigned sign_       : 1; // deltaPhi sign bit, part of the PT LUT address
00013         unsigned front_rear  : 1; // front/rear bit
00014         unsigned charge_     : 1; // muon charge bit
00015         unsigned eta_        : 5; // pseudo rapidity, eta[4:1] is a part of the PT LUT address
00016         unsigned halo_       : 1; // halo bit
00017         unsigned se          : 1; // synchronization error: OR of 15 SM bits for all LCTs and similar bits for 2 MB Stubs, passed to the MS
00018         unsigned zero_1      : 1; // format specific
00020         unsigned deltaPhi12_ : 8; // difference in phi between station 1 and 2, part of the PT LUT address
00021         unsigned deltaPhi23_ : 4; // difference in phi between station 2 and 3, part of the PT LUT address
00022         unsigned zero_2      : 1; // format specific
00023         unsigned bxn0_       : 1; // OR of BX0 signals received with ME LCTs and MB stubs, passed to the MS
00024         unsigned bc0_        : 1; // OR of BC0 signals received with ME LCTs and MB stubs, passed to the MS
00025         unsigned zero_3      : 1; // format specific
00027         unsigned me1_id      : 3; // track stubs used to build up the track
00028         unsigned me2_id      : 2; // ...
00029         unsigned me3_id      : 2; // ...
00030         unsigned me4_id      : 2; // ...
00031         unsigned mb_id       : 3; // ...
00032         unsigned ms_id       : 3; // Muon Sorter Winner bit positional code
00033         unsigned zero_4      : 1; // format specific
00035         unsigned me1_tbin    : 3; // time bins of the above track stubs used to build up a track
00036         unsigned me2_tbin    : 3; // ...
00037         unsigned me3_tbin    : 3; // ...
00038         unsigned me4_tbin    : 3; // ...
00039         unsigned mb_tbin     : 3; //
00040         unsigned zero_5      : 1; // format specific
00041 
00042         // LCTs and MB stub, that formed this track should be easily accessible through the track interface
00043         //  Hence we keep copies of the data here and let top-level unpacking set these data
00044         friend class CSCSPEvent;
00045         CSCSP_MEblock lct_[4]; // LCTs from four stations
00046         CSCSP_MBblock dt_;     // MB stub
00047         // LCTs and stub were used (=true) in this record
00048         bool lctFilled[4], dtFilled;
00049 
00050         // Other data members logically belong to SP Block record,
00051         //  but physically are located in Data Block Header, which implementation is:
00052         friend class CSCSPRecord;
00053         friend class CSCTFPacker;
00054         unsigned int tbin_; // time bin, that this SP block belongs to
00055         unsigned int mode_; // stations, that this track crossed (they gave LCTs to build it)
00056         unsigned int id_;   // track number (1, 2, or 3)
00057 
00058 public:
00059         bool check(void) const throw() { return zero_1!=0||zero_2!=0||zero_3!=0||zero_4!=0||zero_5!=0; }
00060 
00061         unsigned int phi   (void) const throw() { return phi_;    }
00062         unsigned int sign  (void) const throw() { return sign_;   }
00063         unsigned int f_r   (void) const throw() { return front_rear; };
00064         unsigned int charge(void) const throw() { return charge_; }
00065         unsigned int eta   (void) const throw() { return eta_;    }
00066         unsigned int halo  (void) const throw() { return halo_;   }
00067         unsigned int syncErr(void)const throw() { return se;      }
00068 
00069         unsigned int deltaPhi12(void) const throw() { return deltaPhi12_; }
00070         unsigned int deltaPhi23(void) const throw() { return deltaPhi23_; }
00071         unsigned int bx0       (void) const throw() { return bxn0_;   }
00072         unsigned int bc0       (void) const throw() { return bc0_;    }
00073 
00074         unsigned int ME1_id(void) const throw() { return me1_id; }
00075         unsigned int ME2_id(void) const throw() { return me2_id; }
00076         unsigned int ME3_id(void) const throw() { return me3_id; }
00077         unsigned int ME4_id(void) const throw() { return me4_id; }
00078         unsigned int MB_id (void) const throw() { return mb_id;  }
00079         unsigned int MS_id (void) const throw() { return ms_id;  }
00080 
00081         unsigned int ME1_tbin(void) const throw() { return me1_tbin; }
00082         unsigned int ME2_tbin(void) const throw() { return me2_tbin; }
00083         unsigned int ME3_tbin(void) const throw() { return me3_tbin; }
00084         unsigned int ME4_tbin(void) const throw() { return me4_tbin; }
00085         unsigned int MB_tbin (void) const throw() { return mb_tbin;  }
00086 
00087         unsigned int tbin(void) const throw() { return tbin_; }
00088         unsigned int id  (void) const throw() { return id_;   }
00089 
00090         // vector may have up to 4 elements (one per station)
00091         std::vector<CSCSP_MEblock> LCTs(void) const throw() {
00092                 std::vector<CSCSP_MEblock> result;
00093                 for(int station=0; station<4; station++)
00094                         if(lctFilled[station]) result.push_back(lct_[station]);
00095                 return result;
00096         }
00097 
00098         // vector either empty or has one element
00099         std::vector<CSCSP_MBblock> dtStub(void) const throw() {
00100                 std::vector<CSCSP_MBblock> result;
00101                 if(dtFilled) result.push_back(dt_);
00102                 return result;
00103         }
00104 
00105         unsigned int ptLUTaddress(void) const throw() { return (sign_<<20) | (mode_<<16) | ((eta_&0x1E)<<11) | (deltaPhi23_<<8) | deltaPhi12_; }
00106         unsigned int mode        (void) const throw() { return mode_; }
00107 
00108         bool unpack(const unsigned short *&buf) throw() { memcpy((void*)this,buf,4*sizeof(short)); buf+=4; return check(); }
00109 
00110         CSCSP_SPblock(void){}
00111 };
00112 
00113 #endif