00001 #include "BsmdRawData.h"
00002
00003
00004 #include <TArrayC.h>
00005 #include <TArrayS.h>
00006 #include <TObjArray.h>
00007
00008 ClassImp(BsmdRawData)
00009
00010
00011
00012
00013
00014 BsmdRawData :: BsmdRawData() {
00015 used=new TArrayS ;
00016 caps=new TArrayC ;
00017 head=new TArrayS ;
00018 data=new TArrayS ;
00019 clear();
00020 }
00021
00022
00023
00024
00025 BsmdRawData :: ~BsmdRawData() {
00026 delete caps;
00027 delete used;
00028 delete head;
00029 delete data;
00030 }
00031
00032
00033
00034
00035
00036 void BsmdRawData :: clear() {
00037 caps->Reset();
00038 used->Reset();
00039 head->Reset();
00040 data->Reset();
00041 nBlock=0;
00042 }
00043
00044
00045
00046 int BsmdRawData ::headSize() const{
00047 return nBlock>0 ? head->GetSize()/ nBlock: 0;
00048 }
00049
00050
00051
00052 int BsmdRawData ::dataBlockSize() const{
00053 return nBlock>0 ? data->GetSize()/ nBlock: 0;
00054 }
00055
00056
00057
00058 void BsmdRawData :: print(int k, FILE *fd) const{
00059 fprintf(fd,"BsmdRawData:: print() \n");
00060 fprintf(fd,"used %.0f blocks\n", used->GetSum());
00061
00062 unsigned char *capsA=(unsigned char*)caps->GetArray();
00063 unsigned short *usedA=(unsigned short *)used->GetArray();
00064 int i;
00065 for(i=0;i<used->GetSize();i++) {
00066 if(!usedA[i]) continue;
00067 printf("i=%d used=%d caps=%d\n",i,usedA[i],capsA[i]);
00068 }
00069
00070 int hSize=headSize();
00071 int bSize=dataBlockSize();
00072 fprintf(fd,"No. of nonzero blocks %d, size: heder=%d, dataBlock=%d\n", nBlock,hSize,bSize);
00073 if(nBlock<=0) return;
00074
00075 if(k<=0) return;
00076
00077 unsigned short *headA=(unsigned short *)head->GetArray();
00078 unsigned short *dataA=(unsigned short *)data->GetArray();
00079 int ib;
00080
00081 for(ib=0;ib<nBlock;ib++) {
00082 int j;
00083 printf("\n======\nSMD BANK=%d header size=%d\n",ib,hSize);
00084 for(j = 0;j<hSize;j++) {
00085 if(j%16==0) printf("\n");
00086 printf("0x%04x ",headA[ib*hSize+j]);
00087 }
00088 printf("\n");
00089 if(k<=1) continue;
00090
00091 printf("\n======\nSMD BANK=%d data size=%d\n",ib,bSize);
00092 for(j = 0;j<bSize;j++) {
00093 if(j%16==0) printf("\n");
00094 printf("0x%04x ",dataA[ib*bSize+j]);
00095 }
00096 printf("\n");
00097 }
00098
00099
00100
00101
00102 }
00103
00104