9{
10 unsigned int vid(0),tside(0),tid(0);
11
12 if (argc < 3)
13 {
14 cout<< "usage: rwdcomp <input file1 (.rwd)> <input file2 (.rwd)> [view id] [track side] [track id]"<<endl;
15 cout<< endl << " use the operator> to save the output in a text file: "<<endl ;
16 cout<< " rwdcomp <input file1 (.rwd)> <input file2 (.rwd)> > output.txt"<<endl;
17 return 0;
18 };
19 char* rwdname1 = argv[1];
20 char* rwdname2 = argv[2];
21 if (argc >3) vid = atoi(argv[3]);
22 if (argc >4) tside = atoi(argv[4]);
23 if (argc >5) tid = atoi(argv[5]);
24
25 if (tside>(unsigned int)1) { cout <<"Track side can be 0 or 1"<<endl ; return false ;}
26
29
30 if (
ReadFragment((
void**)&pFrag1, (
char*)rwdname1) != 1)
return false;
31 if (
ReadFragment((
void**)&pFrag2, (
char*)rwdname2) != 1)
return false;
32
33 cout<<"-----------------------------------------------------------------------\n";
34 cout<<"IO_VS_Fragment2" << endl;
35 cout<<" |-- t_Hdr Hdr"<<endl;
36 cout<<" |\t |-- IO_Header Type"<<endl;
37 cout<<" |\t |\t |-- BYTE InfoType = "
38 << memcmp(&pFrag1->Hdr.Type.InfoType , &pFrag2->Hdr.Type.InfoType ,sizeof(pFrag1->Hdr.Type.InfoType) ) <<endl;
39 cout<<" |\t |\t |-- WORD HeaderFormat = "
40 << memcmp(&pFrag1->Hdr.Type.HeaderFormat , &pFrag2->Hdr.Type.HeaderFormat ,sizeof(pFrag1->Hdr.Type.HeaderFormat) ) <<endl;
41 cout<<" |\t |-- Identifier ID"<<endl;
42 cout<<" |\t \t |-- DWORD Part[0] = " << memcmp(&pFrag1->Hdr.ID.Part[0] , &pFrag2->Hdr.ID.Part[0] ,sizeof(pFrag1->Hdr.ID.Part[0])) <<endl;
43 cout<<" |\t \t |-- DWORD Part[1] = " << memcmp(&pFrag1->Hdr.ID.Part[1] , &pFrag2->Hdr.ID.Part[1] ,sizeof(pFrag1->Hdr.ID.Part[1])) <<endl;
44 cout<<" |\t \t |-- DWORD Part[2] = " << memcmp(&pFrag1->Hdr.ID.Part[2] , &pFrag2->Hdr.ID.Part[2] ,sizeof(pFrag1->Hdr.ID.Part[2])) <<endl;
45 cout<<" |\t \t |-- DWORD Part[3] = " << memcmp(&pFrag1->Hdr.ID.Part[3] , &pFrag2->Hdr.ID.Part[3] ,sizeof(pFrag1->Hdr.ID.Part[3])) <<endl;
46
47 VS_Fragment2* fr1(& pFrag1->Fragment),*fr2(& pFrag2->Fragment) ;
48
49 cout<<" |-- VS_Fragment2 Fragment"<<endl;
50 cout<<" |\t |-- int Index = " << memcmp(&fr1->Index , &fr2->Index ,sizeof(fr1->Index ) ) <<endl;
51 cout<<" |\t |-- int StartView = " << memcmp(&fr1->StartView , &fr2->StartView ,sizeof(fr1->StartView ) ) <<endl;
52 cout<<" |\t |-- int CountOfViews = " << memcmp(&fr1->CountOfViews , &fr2->CountOfViews ,sizeof(fr1->CountOfViews) ) <<endl;
53 cout<<" |\t |-- int FitCorrectionDataSize = " << memcmp(&fr1->FitCorrectionDataSize , &fr2->FitCorrectionDataSize ,sizeof(fr1->FitCorrectionDataSize)) <<endl;
54 cout<<" |\t |-- int CodingMode = " << memcmp(&fr1->CodingMode , &fr2->CodingMode ,sizeof(fr1->CodingMode) ) <<endl;
55
56 if (vid>=(unsigned int)fr1->CountOfViews ) { cout <<"View ID out of range!"<<endl ; return false ;}
57
58 VS_View2* vw1(& pFrag1->Fragment.pViews[vid]),* vw2(& pFrag2->Fragment.pViews[vid]) ;
59
60 cout<<" |\t |-- VS_View2 *pViews" << endl;
61 cout<<" |\t \t |-- int TileX = " << memcmp(&vw1->TileX , &vw2->TileX ,sizeof(vw1->TileX) ) <<endl;
62 cout<<" |\t \t |-- int TileY = " << memcmp(&vw1->TileY , &vw2->TileY ,sizeof(vw1->TileY) ) <<endl;
63 cout<<" |\t \t |-- float X[0] = " << memcmp(&vw1->X[0] , &vw2->X[0] ,sizeof(vw1->X[0] ) ) <<endl;
64 cout<<" |\t \t |-- float Y[0] = " << memcmp(&vw1->Y[0] , &vw2->Y[0] ,sizeof(vw1->Y[0] ) ) <<endl;
65 cout<<" |\t \t |-- float X[1] = " << memcmp(&vw1->X[1] , &vw2->X[1] ,sizeof(vw1->X[1] ) ) <<endl;
66 cout<<" |\t \t |-- float Y[1] = " << memcmp(&vw1->Y[1] , &vw2->Y[1] ,sizeof(vw1->Y[1] ) ) <<endl;
67 cout<<" |\t \t |-- float MapX[0] = " << memcmp(&vw1->MapX[0] , &vw2->MapX[0] ,sizeof(vw1->MapX[0]) ) <<endl;
68 cout<<" |\t \t |-- float MapY[0] = " << memcmp(&vw1->MapY[0] , &vw2->MapY[0] ,sizeof(vw1->MapY[0]) ) <<endl;
69 cout<<" |\t \t |-- float MapX[1] = " << memcmp(&vw1->MapX[1] , &vw2->MapX[1] ,sizeof(vw1->MapX[1]) ) <<endl;
70 cout<<" |\t \t |-- float MapY[1] = " << memcmp(&vw1->MapY[1] , &vw2->MapY[1] ,sizeof(vw1->MapY[1]) ) <<endl;
71 cout<<" |\t \t |-- float ImageMat[0][0][0] = "<< memcmp(&vw1->ImageMat[0][0][0] , &vw2->ImageMat[0][0][0] ,sizeof(vw1->ImageMat[0][0][0]) ) <<endl;
72 cout<<" |\t \t |-- float ImageMat[0][0][1] = "<< memcmp(&vw1->ImageMat[0][0][0] , &vw2->ImageMat[0][0][0] ,sizeof(vw1->ImageMat[0][0][0]) ) <<endl;
73 cout<<" |\t \t |-- float ImageMat[0][1][0] = "<< memcmp(&vw1->ImageMat[0][1][0] , &vw2->ImageMat[0][1][0] ,sizeof(vw1->ImageMat[0][1][0]) ) <<endl;
74 cout<<" |\t \t |-- float ImageMat[0][1][1] = "<< memcmp(&vw1->ImageMat[0][1][1] , &vw2->ImageMat[0][1][1] ,sizeof(vw1->ImageMat[0][1][1]) ) <<endl;
75 cout<<" |\t \t |-- float ImageMat[1][0][0] = "<< memcmp(&vw1->ImageMat[1][0][0] , &vw2->ImageMat[1][0][0] ,sizeof(vw1->ImageMat[1][0][0]) ) <<endl;
76 cout<<" |\t \t |-- float ImageMat[1][1][0] = "<< memcmp(&vw1->ImageMat[1][1][0] , &vw2->ImageMat[1][1][0] ,sizeof(vw1->ImageMat[1][1][0]) ) <<endl;
77 cout<<" |\t \t |-- float ImageMat[1][0][1] = "<< memcmp(&vw1->ImageMat[1][0][1] , &vw2->ImageMat[1][0][1] ,sizeof(vw1->ImageMat[1][0][1]) ) <<endl;
78 cout<<" |\t \t |-- float ImageMat[1][1][0] = "<< memcmp(&vw1->ImageMat[1][1][0] , &vw2->ImageMat[1][1][0] ,sizeof(vw1->ImageMat[1][1][0]) ) <<endl;
79 cout<<" |\t \t |-- float ImageMat[1][1][1] = "<< memcmp(&vw1->ImageMat[1][1][1] , &vw2->ImageMat[1][1][1] ,sizeof(vw1->ImageMat[1][1][1]) ) <<endl;
80 cout<<" |\t \t |-- t_RelevantZs2 RelevantZs" <<endl;
81 cout<<" |\t \t | |-- float TopExt = " << memcmp(&vw1->RelevantZs.TopExt , &vw2->RelevantZs.TopExt ,sizeof(vw1->RelevantZs.TopExt ) ) <<endl;
82 cout<<" |\t \t | |-- float TopInt = " << memcmp(&vw1->RelevantZs.TopInt , &vw2->RelevantZs.TopInt ,sizeof(vw1->RelevantZs.TopInt ) ) <<endl;
83 cout<<" |\t \t | |-- float BottomInt = " << memcmp(&vw1->RelevantZs.BottomInt , &vw2->RelevantZs.BottomInt ,sizeof(vw1->RelevantZs.BottomInt) ) <<endl;
84 cout<<" |\t \t | |-- float BottomExt = " << memcmp(&vw1->RelevantZs.BottomExt , &vw2->RelevantZs.BottomExt ,sizeof(vw1->RelevantZs.BottomExt) ) <<endl;
85
86 for(int j=0;j<2;j++)
87 {
88 cout<<" |\t \t |-- t_Layers2 Layers["<<j<<"]" <<endl;
89 cout<<" |\t \t | |-- int Count = " << memcmp(&vw1->Layers[j].Count , &vw2->Layers[j].Count ,sizeof(vw1->Layers[j].Count) ) <<endl;
90 cout<<" |\t \t | |-- t_LayerInfo* pLayerInfo" <<endl;
91 cout<<" |\t \t | |-- int Clusters #### see below " <<endl;
92 cout<<" |\t \t | |-- float Z #### see below "<<endl;
93 }
94
95 cout<<" |\t \t |-- unsigned char Status[0] = " << memcmp(&vw1->Status[0] , &vw2->Status[0] ,sizeof(vw1->Status[0]) ) <<endl;
96 cout<<" |\t \t |-- unsigned char Status[1] = " << memcmp(&vw1->Status[1] , &vw2->Status[1] ,sizeof(vw1->Status[1]) ) <<endl;
97 cout<<" |\t \t |-- int TCount[0] = " << memcmp(&vw1->TCount[0] , &vw2->TCount[0] ,sizeof(vw1->TCount[0]) ) <<endl;
98 cout<<" |\t \t |-- int TCount[1] = " << memcmp(&vw1->TCount[1] , &vw2->TCount[1] ,sizeof(vw1->TCount[1]) ) <<endl;
99
100 if (tid>=(unsigned int)pFrag1->Fragment.pViews[vid].TCount[tside] ) { cout <<"track ID out of range!"<<endl ; return false ;}
101
102 Track2* tr1(& pFrag1->Fragment.pViews[vid].pTracks[tside][tid]),* tr2(& pFrag2->Fragment.pViews[vid].pTracks[tside][tid]) ;
103 cout<<" |\t \t |-- Track2 *pTracks["<<tside<<"]" <<endl;
104 cout<<" |\t \t |-- Field = " << memcmp(&tr1->Field , &tr2->Field ,sizeof(tr1->Field ) ) << endl;
105 cout<<" |\t \t |-- int AreaSum = " << memcmp(&tr1->AreaSum , &tr2->AreaSum ,sizeof(tr1->AreaSum) ) << endl;
106 cout<<" |\t \t |-- int Grains = " << memcmp(&tr1->Grains , &tr2->Grains ,sizeof(tr1->Grains ) ) << endl;
107 cout<<" |\t \t |-- Grain *pGrains"<<endl;
108 cout<<" |\t \t | |-- short Area #### see below "<< endl;
109 cout<<" |\t \t | |-- float X #### see below "<< endl;
110 cout<<" |\t \t | |-- float Y #### see below "<< endl;
111 cout<<" |\t \t | |-- float Z #### see below "<< endl;
112
113 cout<<" |\t \t |-- BYTE *pCorrection = " << memcmp(&tr1->pCorrection , &tr2->pCorrection ,sizeof(tr1->pCorrection) ) <<endl;
114 cout<<" |\t \t |-- TVector Intercept" <<endl;
115 cout<<" |\t \t | |-- float X = " << memcmp(&tr1->Intercept.X , &tr2->Intercept.X ,sizeof(tr1->Intercept.X) ) <<endl;
116 cout<<" |\t \t | |-- float Y = " << memcmp(&tr1->Intercept.Y , &tr2->Intercept.Y ,sizeof(tr1->Intercept.Y) ) <<endl;
117 cout<<" |\t \t | |-- float Z = " << memcmp(&tr1->Intercept.Z , &tr2->Intercept.Z ,sizeof(tr1->Intercept.Z) ) <<endl;
118 cout<<" |\t \t |-- TVector Slope" <<endl;
119 cout<<" |\t \t | |-- float X = " << memcmp(&tr1->Slope.X , &tr2->Slope.X ,sizeof(tr1->Slope.X) ) <<endl;
120 cout<<" |\t \t | |-- float Y = " << memcmp(&tr1->Slope.Y , &tr2->Slope.Y ,sizeof(tr1->Slope.Y) ) <<endl;
121 cout<<" |\t \t | |-- float Z = " << memcmp(&tr1->Slope.Z , &tr2->Slope.Z ,sizeof(tr1->Slope.Z) ) <<endl;
122 cout<<" |\t \t |-- float Sigma = " << memcmp(&tr1->Sigma , &tr2->Sigma ,sizeof(tr1->Sigma ) )<<endl;
123 cout<<" |\t \t |-- float FirstZ = " << memcmp(&tr1->FirstZ , &tr2->FirstZ ,sizeof(tr1->FirstZ ) )<<endl;
124 cout<<" |\t \t |-- float LastZ = " << memcmp(&tr1->LastZ , &tr2->LastZ ,sizeof(tr1->LastZ ) )<<endl;
125 cout<<" |\t \t |-- boolean Valid = " << memcmp(&tr1->Valid , &tr2->Valid ,sizeof(tr1->Valid ) )<< endl;
126 cout<<" |-- unsigned char Reserved[256] = " ;
127 for(int i=0;i<256;i++) cout << memcmp(& pFrag1->Reserved[i] , &pFrag2->Reserved[i] , sizeof(pFrag1->Reserved[i]) ) ; cout<<endl;
128 cout<<"-----------------------------------------------------------------------\n"<<endl;
129
130 cout<<"\t\t\t##### clusters[0] Z[0]\t clusters[1] Z[1]" <<endl;
131 for(
int i=0;i<
max(vw1->Layers[0].Count,vw1->Layers[1].Count);i++)
132 {
133 cout<<"\t\t\t\t " ;
135 cout << memcmp(&vw1->Layers[0].pLayerInfo[i].Clusters , &vw2->Layers[0].pLayerInfo[i].Clusters ,sizeof(vw1->Layers[0].pLayerInfo[i].Clusters) )
136 <<"\t" << memcmp(&vw1->Layers[0].pLayerInfo[i].Z , &vw2->Layers[0].pLayerInfo[i].Z ,sizeof(vw1->Layers[0].pLayerInfo[i].Z ) ) ;
137 else cout <<"\t\t\t";
138 cout <<"\t";
140 cout << memcmp(&vw1->Layers[1].pLayerInfo[i].Clusters , &vw2->Layers[1].pLayerInfo[i].Clusters ,sizeof(vw1->Layers[1].pLayerInfo[i].Clusters) )
141 <<"\t"<< memcmp(&vw1->Layers[1].pLayerInfo[i].Z , &vw2->Layers[1].pLayerInfo[i].Z ,sizeof(vw1->Layers[1].pLayerInfo[i].Z ) ) <<endl;
142 else cout << endl;
143 }
144 cout<<"\n\t\t\t ##### area X Y Z" <<endl;
145 for(int i=0;i<(int) tr1->Grains;i++)
146 {
147 tr1->pGrains[i].Area = tr2->pGrains[i].Area = 25 ;
148 cout<<"\t\t\t\t\t "
149 << memcmp(&tr1->pGrains[i].Area , &tr2->pGrains[i].Area , sizeof(tr1->pGrains[i].Area)) <<" "<<
150 memcmp(&tr1->pGrains[i].X , &tr2->pGrains[i].X , sizeof(tr1->pGrains[i].X) ) <<" "<<
151 memcmp(&tr1->pGrains[i].Y , &tr2->pGrains[i].Y , sizeof(tr1->pGrains[i].Y) ) <<" "<<
152 memcmp(&tr1->pGrains[i].Z , &tr2->pGrains[i].Z , sizeof(tr1->pGrains[i].Z) ) << endl ;
153 }
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171 int nlayers = 0;
172 int ntracks = 0;
173 int ngrains = 0;
174 int nviews = pFrag1->Fragment.CountOfViews;
175 for (int i = 0; i < nviews; i++)
176 {
177 nlayers += pFrag1->Fragment.pViews[i].Layers[0].Count
178 + pFrag1->Fragment.pViews[i].Layers[1].Count;
179 ntracks += pFrag1->Fragment.pViews[i].TCount[0]
180 + pFrag1->Fragment.pViews[i].TCount[1];
181 for (int j = 0; j < 2; j++)
182 for (int k = 0; k < pFrag1->Fragment.pViews[i].TCount[j]; k++)
183 ngrains += pFrag1->Fragment.pViews[i].pTracks[j][k].Grains ;
184 };
185
186 int HdrSize = sizeof(pFrag1->Hdr);
187 int FragSize = sizeof(pFrag1->Fragment.Index)
188 + sizeof(pFrag1->Fragment.StartView)
189 + sizeof(pFrag1->Fragment.CountOfViews)
190 + sizeof(pFrag1->Fragment.FitCorrectionDataSize)
191 + sizeof(pFrag1->Fragment.CodingMode)
192 + sizeof(pFrag1->Reserved) ;
193 VS_View2* pView = & pFrag1->Fragment.pViews[0] ;
194 int ViewSize =
sizeof(pView->
TileX)
195 +
sizeof(pView->
TileY)
196 +
sizeof(pView->
X[0])
197 +
sizeof(pView->
X[1])
198 +
sizeof(pView->
Y[0])
199 +
sizeof(pView->
Y[1])
200 +
sizeof(pView->
MapX[0])
201 +
sizeof(pView->
MapX[1])
202 +
sizeof(pView->
MapY[0])
203 +
sizeof(pView->
MapY[1])
204 + 2*2*2*
sizeof(pView->
ImageMat[0][0][0])
210 + 2*
sizeof(pView->
Status[0])
211 + 2*
sizeof(pView->
TCount[0]) ;
212 ViewSize *= nviews;
213
215 int LayInfSize =
sizeof(pLayInf->
Clusters)
216 +
sizeof(pLayInf->
Z) ;
217 LayInfSize *= nlayers;
218
220 int TrackSize =
sizeof(
t->AreaSum)
222 +
sizeof(
t->Intercept.X)
223 +
sizeof(
t->Intercept.Y)
224 +
sizeof(
t->Intercept.Z)
231
232 ;
233 TrackSize *= ntracks;
234
235 int GrainSize =
sizeof(
Grain) ;
236 GrainSize *= ngrains ;
237
238 int TotalSize = 0;
239 printf("\t\tstart \t end \t bytes\n");
240 printf("Header Size: %7X %7X %9d\n", TotalSize,TotalSize-1+HdrSize, HdrSize) ; TotalSize += HdrSize;
241 printf("Frag Size: %7X %7X %9d\n", TotalSize,TotalSize-1+FragSize, FragSize) ; TotalSize += FragSize;
242 printf("Views Size: %7X %7X %9d\t| %7d views * %4d B \n", TotalSize,TotalSize-1+ViewSize, ViewSize, nviews, ViewSize/nviews) ; TotalSize += ViewSize;
243 printf("LayInf Size: %7X %7X %9d\t| %7d layers * %4d B \n", TotalSize,TotalSize-1+LayInfSize,LayInfSize,nlayers,LayInfSize/nlayers); TotalSize += LayInfSize;
244 printf("Tracks Size: %7X %7X %9d\t| %7d tracks * %4d B \n", TotalSize,TotalSize-1+TrackSize, TrackSize,ntracks, TrackSize/ntracks); TotalSize += TrackSize;
245 printf("Grain Size: %7X %7X %9d\t| %7d grain * %4d B \n", TotalSize,TotalSize-1+GrainSize, GrainSize,ngrains, GrainSize/ngrains); TotalSize += GrainSize;
246
247 printf(" \t\t -------\n");
248 printf("Total Size: \t\t %8d bytes\n\n\n",TotalSize);
249
250 cout << "Grain::Area is unsigned short (2 BYTES) but in the Grain structure it takes 4 BYTES both in memory and in file" << endl;
251 cout << "size of Grain::Area + Grain::X + Grain::Y + Grain::Z = " <<
252 sizeof(
t->pGrains[0].Area) +
sizeof(
t->pGrains[0].X) +
sizeof(
t->pGrains[0].Y) +
sizeof(
t->pGrains[0].Z) << endl;
253 cout <<
"size of Grain structure = " <<
sizeof(
Grain)<< endl;
254
256 delete pFrag1 ;
257 delete pFrag2 ;
258
259 return 0;
260 }
int FreeMemory(void **ppData)
Definition: dataIO.cpp:67
int ReadFragment(void **ppData, char *name)
Definition: dataIO.cpp:89
int Layers
Definition: hwinit.C:65
TTree * t
Definition: check_shower.C:4
int max
Definition: check_shower.C:41
UInt_t Count
Definition: tlg2couples.C:101
Definition: vscan_ds.h:106
Definition: vscan_ds.h:50
Definition: VSRawData.h:48
int Clusters
Definition: VSRawData.h:49
float Z
Definition: VSRawData.h:50
int Count
Definition: VSRawData.h:54
struct t_LayerInfo * pLayerInfo
Definition: VSRawData.h:55
float TopInt
Definition: VSRawData.h:43
float TopExt
Definition: VSRawData.h:42
float BottomExt
Definition: VSRawData.h:45
float BottomInt
Definition: VSRawData.h:44
Definition: VSRawData.h:35
float Y[2]
Definition: VSRawData.h:37
float MapX[2]
Definition: VSRawData.h:38
Track2 * pTracks[2]
Definition: VSRawData.h:59
float X[2]
Definition: VSRawData.h:37
float MapY[2]
Definition: VSRawData.h:38
float ImageMat[2][2][2]
Definition: VSRawData.h:39
int TCount[2]
Definition: VSRawData.h:58
int TileY
Definition: VSRawData.h:36
struct VS_View2::t_Layers2 Layers[2]
unsigned char Status[2]
Definition: VSRawData.h:57
struct VS_View2::t_RelevantZs2 RelevantZs
int TileX
Definition: VSRawData.h:36