FEDRA emulsion software from the OPERA Collaboration
rwdread.cpp File Reference
#include <iostream>
#include "libDataConversion.h"
Include dependency graph for rwdread.cpp:

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)
9 {
10  unsigned int vid(0),tside(0),tid(0);
11 
12  if (argc < 2)
13  {
14  cout<< "usage: rwdread <input file (.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<< " rwdread <input file (.rwd)> > output.txt"<<endl;
17  return 0;
18  };
19  char* rwdname = argv[1];
20  if (argc >2) vid = atoi(argv[2]);
21  if (argc >3) tside = atoi(argv[3]);
22  if (argc >4) tid = atoi(argv[4]);
23 
24  if (tside>(unsigned int)1) { cout <<"Track side can be 0 or 1"<<endl ; return false ;}
25 
26  IO_VS_Fragment2 *pFrag = 0;
27 
28  if (ReadFragment((void**)&pFrag, (char*)rwdname) != 1) return false;
29 
30  cout<<"-----------------------------------------------------------------------\n";
31  cout<<"IO_VS_Fragment2" << endl;
32  cout<<" |-- t_Hdr Hdr"<<endl;
33  cout<<" |\t |-- IO_Header Type"<<endl;
34  cout<<" |\t |\t |-- BYTE InfoType = " << pFrag->Hdr.Type.InfoType <<endl;
35  cout<<" |\t |\t |-- WORD HeaderFormat = " << pFrag->Hdr.Type.HeaderFormat <<endl;
36  cout<<" |\t |-- Identifier ID"<<endl;
37  cout<<" |\t \t |-- DWORD Part[0] = " << pFrag->Hdr.ID.Part[0] <<endl;
38  cout<<" |\t \t |-- DWORD Part[1] = " << pFrag->Hdr.ID.Part[1] <<endl;
39  cout<<" |\t \t |-- DWORD Part[2] = " << pFrag->Hdr.ID.Part[2] <<endl;
40  cout<<" |\t \t |-- DWORD Part[3] = " << pFrag->Hdr.ID.Part[3] <<endl;
41 
42  VS_Fragment2* fr(& pFrag->Fragment) ;
43 
44  cout<<" |-- VS_Fragment2 Fragment"<<endl;
45  cout<<" |\t |-- int Index = " << fr->Index <<endl;
46  cout<<" |\t |-- int StartView = " << fr->StartView <<endl;
47  cout<<" |\t |-- int CountOfViews = " << fr->CountOfViews <<endl;
48  cout<<" |\t |-- int FitCorrectionDataSize = " << fr->FitCorrectionDataSize <<endl;
49  cout<<" |\t |-- int CodingMode = " << fr->CodingMode <<endl;
50 
51  if (vid>=(unsigned int)fr->CountOfViews ) { cout <<"View ID out of range!"<<endl ; return false ;}
52 
53  VS_View2* vw(& pFrag->Fragment.pViews[vid]) ;
54 
55  cout<<" |\t |-- VS_View2 *pViews" << endl;
56  cout<<" |\t \t |-- int TileX = " << vw->TileX <<endl;
57  cout<<" |\t \t |-- int TileY = " << vw->TileY <<endl;
58  cout<<" |\t \t |-- float X[0] = " << vw->X[0] <<endl;
59  cout<<" |\t \t |-- float Y[0] = " << vw->Y[0] <<endl;
60  cout<<" |\t \t |-- float X[1] = " << vw->X[1] <<endl;
61  cout<<" |\t \t |-- float Y[1] = " << vw->Y[1] <<endl;
62  cout<<" |\t \t |-- float MapX[0] = " << vw->MapX[0] <<endl;
63  cout<<" |\t \t |-- float MapY[0] = " << vw->MapY[0] <<endl;
64  cout<<" |\t \t |-- float MapX[1] = " << vw->MapX[1] <<endl;
65  cout<<" |\t \t |-- float MapY[1] = " << vw->MapY[1] <<endl;
66  cout<<" |\t \t |-- float ImageMat[0][0][0] = "<< vw->ImageMat[0][0][0] <<endl;
67  cout<<" |\t \t |-- float ImageMat[0][0][1] = "<< vw->ImageMat[0][0][1] <<endl;
68  cout<<" |\t \t |-- float ImageMat[0][1][0] = "<< vw->ImageMat[0][1][0] <<endl;
69  cout<<" |\t \t |-- float ImageMat[0][1][1] = "<< vw->ImageMat[0][1][1] <<endl;
70  cout<<" |\t \t |-- float ImageMat[1][0][0] = "<< vw->ImageMat[1][0][0] <<endl;
71  cout<<" |\t \t |-- float ImageMat[1][0][1] = "<< vw->ImageMat[1][0][1] <<endl;
72  cout<<" |\t \t |-- float ImageMat[1][1][0] = "<< vw->ImageMat[1][1][0] <<endl;
73  cout<<" |\t \t |-- float ImageMat[1][1][1] = "<< vw->ImageMat[1][1][1] <<endl;
74  cout<<" |\t \t |-- t_RelevantZs2 RelevantZs" <<endl;
75  cout<<" |\t \t | |-- float TopExt = " << vw->RelevantZs.TopExt <<endl;
76  cout<<" |\t \t | |-- float TopInt = " << vw->RelevantZs.TopInt <<endl;
77  cout<<" |\t \t | |-- float BottomInt = " << vw->RelevantZs.BottomInt <<endl;
78  cout<<" |\t \t | |-- float BottomExt = " << vw->RelevantZs.BottomExt <<endl;
79 
80  for(int j=0;j<2;j++)
81  {
82  cout<<" |\t \t |-- t_Layers2 Layers["<<j<<"]" <<endl;
83  cout<<" |\t \t | |-- int Count = " << vw->Layers[j].Count <<endl;
84  cout<<" |\t \t | |-- t_LayerInfo* pLayerInfo" <<endl;
85  cout<<" |\t \t | |-- int Clusters #### see below " <<endl;
86  cout<<" |\t \t | |-- float Z #### see below "<<endl;
87  }
88 
89  cout<<" |\t \t |-- unsigned char Status[0] = " << vw->Status[0] <<endl;
90  cout<<" |\t \t |-- unsigned char Status[1] = " << vw->Status[1] <<endl;
91  cout<<" |\t \t |-- int TCount[0] = " << vw->TCount[0] <<endl;
92  cout<<" |\t \t |-- int TCount[1] = " << vw->TCount[1] <<endl;
93 
94  if ( tid>=(unsigned int) vw->TCount[tside] ) { cout <<"track ID out of range!"<<endl ; return false ;}
95 
96  Track2* tr(& vw->pTracks[tside][tid]) ;
97  cout<<" |\t \t |-- Track2 *pTracks["<<tside<<"]" <<endl;
98  cout<<" |\t \t |-- Field = " << tr->Field << endl;
99  cout<<" |\t \t |-- int AreaSum = " << tr->AreaSum << endl;
100  cout<<" |\t \t |-- int Grains = " << tr->Grains << endl;
101  cout<<" |\t \t |-- Grain *pGrains"<<endl;
102  cout<<" |\t \t | |-- short Area #### see below "<< endl;
103  cout<<" |\t \t | |-- float X #### see below "<< endl;
104  cout<<" |\t \t | |-- float Y #### see below "<< endl;
105  cout<<" |\t \t | |-- float Z #### see below "<< endl;
106 
107  cout<<" |\t \t |-- BYTE *pCorrection = " <</* tr->pCorrection <<*/endl;
108  cout<<" |\t \t |-- TVector Intercept" <<endl;
109  cout<<" |\t \t | |-- float X = " << tr->Intercept.X <<endl;
110  cout<<" |\t \t | |-- float Y = " << tr->Intercept.Y <<endl;
111  cout<<" |\t \t | |-- float Z = " << tr->Intercept.Z <<endl;
112  cout<<" |\t \t |-- TVector Slope" <<endl;
113  cout<<" |\t \t | |-- float X = " << tr->Slope.X <<endl;
114  cout<<" |\t \t | |-- float Y = " << tr->Slope.Y <<endl;
115  cout<<" |\t \t | |-- float Z = " << tr->Slope.Z <<endl;
116  cout<<" |\t \t |-- float Sigma = " << tr->Sigma <<endl;
117  cout<<" |\t \t |-- float FirstZ = " << tr->FirstZ <<endl;
118  cout<<" |\t \t |-- float LastZ = " << tr->LastZ <<endl;
119  cout<<" |\t \t |-- boolean Valid = " << tr->Valid << endl;
120  cout<<" |-- unsigned char Reserved[256] = " ;
121  for(int i=0;i<256;i++) cout << pFrag->Reserved[i] ; cout<<endl;
122  cout<<"-----------------------------------------------------------------------\n"<<endl;
123 
124  cout<<"\t##### clusters[0] Z[0]\t clusters[1] Z[1]" <<endl;
125  for(int i=0;i< max(vw->Layers[0].Count,vw->Layers[1].Count);i++)
126  {
127  cout<<"\t\t " ;
128  if (i < vw->Layers[0].Count)
129  cout << vw->Layers[0].pLayerInfo[i].Clusters <<"\t"
130  << vw->Layers[0].pLayerInfo[i].Z ;
131  else cout <<"\t\t";
132  cout <<"\t";
133  if (i < vw->Layers[1].Count)
134  cout << vw->Layers[1].pLayerInfo[i].Clusters <<"\t"
135  << vw->Layers[1].pLayerInfo[i].Z << endl;
136  else cout << endl;
137  }
138 
139  cout<<"\n\t ##### area X Y Z" <<endl;
140  if (tr->pGrains)
141  {
142  for(int i=0;i<(int) tr->Grains;i++)
143  cout<<"\t\t "
144  << tr->pGrains[i].Area <<" "<<
145  tr->pGrains[i].X <<" "<<
146  tr->pGrains[i].Y <<" "<<
147  tr->pGrains[i].Z << endl ;
148  } else {
149  cout<<"\t CORRUPTED DATA: null pointer to Grain *pGrains !" << endl;
150  }
151 
152  FreeMemory((void**)pFrag);
153  //delete pFrag; // WINDOWS VISTA CRASH
154 
155  return 0;
156  }
TTree * tr
Definition: Shower_E_FromShowerRoot.C:5
int max
Definition: check_shower.C:41
int FreeMemory(void **ppData)
Definition: dataIO.cpp:67
int ReadFragment(void **ppData, char *name)
Definition: dataIO.cpp:89
int Layers
Definition: hwinit.C:65
UInt_t Count
Definition: tlg2pattern.C:102
BYTE InfoType
Definition: id.h:14
Definition: vscan_ds.h:106
IO_Header Type
Definition: vscan_ds.h:112
struct IO_VS_Fragment2::@32 Hdr
Definition: Track2.h:18
Definition: vscan_ds.h:50
Definition: VSRawData.h:35