CMS 3D CMS Logo

CSCTFTBSPData.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // //
00003 // Package:     CSCTFTBRawFormat
00004 // Module:      CSCTFTBSPData
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: CSCTFTBSPData.cc,v 1.1 2007/04/26 23:39:19 kkotov Exp $
00015 //
00016 // Revision History
00017 // $Log: CSCTFTBSPData.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.5  2005/06/22 22:03:27  lgray
00032 // update
00033 //
00034 // Revision 1.4  2005/05/13 08:29:59  lgray
00035 // Another bug fix.
00036 //
00037 // Revision 1.3  2005/05/10 21:57:22  lgray
00038 // Bugfixes, stability issues fixed
00039 //
00040 // Revision 1.2  2005/03/03 18:14:49  lgray
00041 // Added ability to pack data back into raw form. Added test program for this as well.
00042 //
00043 // Revision 1.1  2005/02/14 21:01:32  lgray
00044 // First Commit from UF
00045 //
00046 // Revision 1.21  2004/10/12 00:09:07  tfcvs
00047 // DEA: update to Ntuple
00048 //
00049 // Revision 1.20  2004/06/13 12:06:14  tfcvs
00050 // DEA: closer to having beam dat ain sim
00051 //
00052 // Revision 1.19  2004/06/09 10:04:52  tfcvs
00053 // DEA
00054 //
00055 // Revision 1.18  2004/06/07 22:37:23  tfcvs
00056 // DEA
00057 //
00058 // Revision 1.17  2004/05/21 10:17:27  tfcvs
00059 // DEA: changes to analysis
00060 //
00061 // Revision 1.16  2004/05/18 22:25:54  tfcvs
00062 // DEA: change in location of Pt LUT
00063 //
00064 // Revision 1.15  2004/05/18 21:53:42  tfcvs
00065 // DEA: some print out
00066 //
00067 // Revision 1.14  2004/05/18 15:00:25  tfcvs
00068 // DEA: close to new SP data format
00069 //
00070 // Revision 1.13  2004/05/18 08:00:34  tfcvs
00071 // DEA: touch base
00072 //
00073 // 
00074 //
00075 
00076 // System include files
00077 #include <string.h> // memcpy
00078 #include <iostream>
00079 // Package include files
00080 #include "EventFilter/CSCTFRawToDigi/src/CSCTFTBSPData.h"
00081 
00082 // External package include files
00083 
00084 // STL classes
00085 
00086 // Constants, enums and typedefs
00087 
00088 // CVS-based strings (Id and Tag with which file was checked out)
00089 static const char* const kIdString  = "$Id: CSCTFTBSPData.cc,v 1.1 2007/04/26 23:39:19 kkotov Exp $";
00090 static const char* const kTagString = "$Name: V02-15-07 $";
00091 
00092 // Static data member definitions
00093 
00094 // Constructors and destructor
00095 CSCTFTBSPData::CSCTFTBSPData():
00096   zero1_(0),
00097   zero2_(0),
00098   zero3_(0),
00099   pt_data_(NULL),
00100   mymode_(0),
00101   mylink_(0)
00102 {}
00103 
00104 CSCTFTBSPData::~CSCTFTBSPData()
00105 {  
00106   if(pt_data_)
00107     {
00108       delete pt_data_;
00109       pt_data_ = NULL;
00110     }  
00111 }
00112 
00113 CSCTFTBSPData::CSCTFTBSPData(const CSCTFTBSPData & parent)
00114 {
00115   this->pt_data_ = NULL;
00116   if(&parent)
00117     {      
00118       memcpy(this,&parent,sizeof(CSCTFTBSPData));   
00119     }
00120   if(parent.pt_data_)
00121     { 
00122       pt_data_ = new CSCTFTBPTData();
00123       memcpy(pt_data_,parent.pt_data_,CSCTFTBPTData::size()*sizeof(short)); 
00124     }
00125 }
00126 
00127 CSCTFTBSPData::CSCTFTBSPData(unsigned short * buf, bool ptflag,
00128                              unsigned themode_,unsigned link_)
00129 {
00130   pt_data_ = NULL;
00131   unpackData(buf, ptflag);  
00132   mymode_ = themode_;
00133   mylink_ = link_;
00134 }
00135 
00136 CSCTFTBSPData CSCTFTBSPData::operator=(const CSCTFTBSPData & parent)
00137 {  
00138   if(this == &parent) return *this;
00139   memcpy(this,&parent,sizeof(CSCTFTBSPData));
00140   if(parent.pt_data_)
00141     {      
00142       memcpy(pt_data_,parent.pt_data_,CSCTFTBPTData::size()*sizeof(short));
00143     }
00144   return *this;
00145 }
00146 
00147 int CSCTFTBSPData::unpackData(unsigned short *buf,bool ptflag)
00148 {  
00149   memcpy(this,buf,size()*sizeof(short));
00150   if (ptflag) 
00151     {      
00152       pt_data_ = new CSCTFTBPTData();
00153       memcpy(pt_data_,buf+size(),CSCTFTBPTData::size()*sizeof(short));
00154     }
00155   return 0;
00156 }
00157 
00158 /*
00159 BitVector CSCTFTBSPData::packVector() const
00160 {
00161   BitVector result;
00162   BitVector spdata(reinterpret_cast<const unsigned*>(this),size()*sizeof(short)*8);
00163   result.assign(result.nBits(),spdata.nBits(),spdata);
00164 
00165   if(pt_data_)
00166     {
00167       BitVector pt(reinterpret_cast<const unsigned*>(pt_data_),size()*sizeof(short)*8);
00168       result.assign(result.nBits(),pt.nBits(),pt);
00169     }
00170   return result;
00171 }
00172 */
00173 
00174 std::ostream & operator<<(std::ostream & stream, const CSCTFTBSPData & spData) 
00175 {
00176   stream << "\t Track Data:\n";
00177   if(spData.pt_data_)
00178     {
00179       stream <<*(spData.pt_data_);
00180     }
00181   return stream;
00182 }

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