00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 #include <string.h>
00078 #include <iostream>
00079
00080 #include "EventFilter/CSCTFRawToDigi/src/CSCTFTBSPData.h"
00081
00082
00083
00084
00085
00086
00087
00088
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
00093
00094
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
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
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 }