CMS 3D CMS Logo

CSCTFTBSPHeader.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:     CSCTFTBRawFormat
00004 // Module:      CSCTFTBSPHeader
00005 // 
00006 // Description: SP Event Data class
00007 //
00008 // Implementation:
00009 //     <Notes on implementation>
00010 //
00011 // Author:      Lindsey Gray
00012 // Created:     13.1.2005
00013 //
00014 // $Id: CSCTFTBSPHeader.cc,v 1.1 2007/04/26 23:39:19 kkotov Exp $
00015 //
00016 // Revision History
00017 // $Log: CSCTFTBSPHeader.cc,v $
00018 // Revision 1.1  2007/04/26 23:39:19  kkotov
00019 //
00020 // Moved old TB data format to a separate folder, attempted to unpack status digi
00021 //
00022 // Revision 1.2  2006/06/22 14:46:05  lgray
00023 // Forced commit of all code
00024 //
00025 // Revision 1.1  2006/06/22 00:34:18  lgray
00026 // Moved all data format classes here. Removed old Packages from nightly
00027 //
00028 // Revision 1.1  2006/02/22 23:16:42  lgray
00029 // First commit of test beam data format from UF
00030 //
00031 // Revision 1.1  2005/02/14 21:01:32  lgray
00032 // First Commit from UF
00033 //
00034 // Revision 1.10  2004/05/28 00:24:58  tfcvs
00035 // DEA: a working version of code for 4 chambers!
00036 //
00037 // Revision 1.9  2004/05/18 21:53:42  tfcvs
00038 // DEA: some print out
00039 //
00040 // Revision 1.8  2004/05/18 15:00:25  tfcvs
00041 // DEA: close to new SP data format
00042 //
00043 // Revision 1.7  2004/05/18 11:37:46  tfcvs
00044 // DEA: touch base
00045 //
00046 // Revision 1.6  2004/05/18 09:45:07  tfcvs
00047 // DEA: touch base
00048 //
00049 // Revision 1.5  2004/05/18 08:00:34  tfcvs
00050 // DEA: touch base
00051 //
00052 // Revision 1.4  2004/05/16 07:43:49  tfcvs
00053 // DEA: TB2003 version working with new software
00054 //
00055 // Revision 1.3  2003/09/19 20:22:55  tfcvs
00056 // latest
00057 //
00058 // Revision 1.2  2003/08/27 22:08:59  tfcvs
00059 // Added pretty-print  -Rick
00060 //
00061 // Revision 1.1  2003/05/25 10:13:02  tfcvs
00062 // first working version -DEA
00063 //
00064 // Revision 1.7  2003/05/22 17:27:20  tfcvs
00065 // HS - Some more minor changes
00066 //
00067 // Revision 1.6  2003/05/20 22:13:06  tfcvs
00068 // HS - Added Darin's changes
00069 //
00070 // Revision 1.5  2003/05/19 23:23:12  tfcvs
00071 // HS - Commit after some changes
00072 //
00073 // Revision 1.3  2003/05/19 15:47:18  tfcvs
00074 // HS - Some cleanup
00075 //
00076 // Revision 1.2  2003/05/15 23:58:40  tfcvs
00077 // HS - Some cosmetics
00078 //
00079 // 
00080 //
00081 
00082 // System include files
00083 
00084 // Package include files
00085 #include "EventFilter/CSCTFRawToDigi/src/CSCTFTBSPHeader.h"
00086 
00087 // External package include files
00088 // #include "CSCEventData.h"
00089 
00090 // STL classes
00091 
00092 // Constants, enums and typedefs
00093 
00094 // CVS-based strings (Id and Tag with which file was checked out)
00095 static const char* const kIdString  = "$Id: CSCTFTBSPHeader.cc,v 1.1 2007/04/26 23:39:19 kkotov Exp $";
00096 static const char* const kTagString = "$Name: V02-15-07 $";
00097 
00098 // Static data member definitions
00099 
00100 // Constructors and destructor
00101 CSCTFTBSPHeader::CSCTFTBSPHeader()
00102 {}
00103 
00104 CSCTFTBSPHeader::CSCTFTBSPHeader(const CSCTFTBSPHeader &parent)
00105 {
00106   memcpy(this,&parent,size()*sizeof(unsigned short));
00107 }
00108 
00109 CSCTFTBSPHeader::~CSCTFTBSPHeader()
00110 {
00111 }
00112 
00113 CSCTFTBSPHeader CSCTFTBSPHeader::operator=(const CSCTFTBSPHeader & parent)
00114 {
00115   memcpy(this,&parent,size()*sizeof(unsigned short));
00116   return *this;
00117 }
00118 
00119 // Member Functions
00120 
00122 unsigned int CSCTFTBSPHeader::getSEBit(unsigned int frontFPGA, unsigned int link) 
00123 const  
00124 {
00125   frontFPGA =  (frontFPGA >5 || frontFPGA < 1) ? 1 : frontFPGA;
00126   link =  (link >3 || link < 1) ? 1 : link;
00127   unsigned shift = ( (frontFPGA-1)*3 + (link-1) );
00128   return (synch_err_ & (1<<shift)) >> shift;
00129 }
00130 
00132 unsigned int CSCTFTBSPHeader::getTrackMode(unsigned int trk) const
00133 {
00134   switch(trk)
00135     {
00136     case 1:
00137       return mode1_;
00138       break;
00139     case 2:
00140       return mode2_;
00141       break;
00142     case 3:
00143       return mode3_;
00144       break;
00145     default:
00146       return mode1_;
00147       break;
00148     }
00149 }
00150 
00152 unsigned int CSCTFTBSPHeader::getVPDTBit(unsigned int link) const  
00153 {
00154   switch(link)
00155     {
00156     case 1:
00157       return MB1A_flag_;
00158       break;
00159     case 2:
00160       return MB1D_flag_;
00161       break;
00162     default:
00163       return MB1A_flag_;
00164       break;
00165     }
00166 }
00167 
00168 
00169 std::ostream & operator<<(std::ostream & stream, const CSCTFTBSPHeader & bx) 
00170 {
00171   if(bx.synchError()||bx.getTrackMode(1)||bx.getTrackMode(2)
00172      ||bx.getTrackMode(3)||bx.getVPDTBit(1) || bx.getVPDTBit(2))
00173     {
00174       stream <<"\tSP Header Data:"<< std::endl;
00175       stream <<"\t Synch Error Bits   : "<< std::hex << bx.synchError()<< std::dec <<std::endl;
00176       if(bx.getTrackMode(1)||bx.getTrackMode(2)||bx.getTrackMode(3))
00177         {
00178           stream <<"\t Track Modes:\n";
00179           if(bx.getTrackMode(1)) stream<<"\t\tTrack 1: "<< bx.getTrackMode(1)<< "\n";
00180           if(bx.getTrackMode(2)) stream<<"\t\tTrack 2: "<< bx.getTrackMode(2)<< "\n";
00181           if(bx.getTrackMode(3)) stream<<"\t\tTrack 3: "<< bx.getTrackMode(3)<< "\n";
00182         }
00183       if(bx.getVPDTBit(1) || bx.getVPDTBit(2))
00184         {
00185           stream <<"\t DT Valid Patterns:\n";
00186           if(bx.getVPDTBit(1)) stream <<"\t\tValid DT pattern in link 1!\n";
00187           if(bx.getVPDTBit(2)) stream <<"\t\tValid DT pattern in link 2!\n";
00188         }
00189     }
00190   return stream;
00191 }
00192 

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