00001 #include <Riostream.h>
00002 #include "TFndSCCshowHistos.h"
00003
00004 TFndSCCshowHistos *myman;
00005
00006 void Init(){
00007 myman = new TFndSCCshowHistos();
00008 }
00009
00010 Int_t Open(TString path){
00011
00012 TString compl_pth = "";
00013 compl_pth.Form("%s/%s",gSystem->ExpandPathName("$FND_SCC_RAW"),path.Data());
00014 Int_t open_err = myman->OpenRawFile(compl_pth);
00015 cout << "open_err:" << open_err << endl;
00016 return open_err;
00017 }
00018
00019 Int_t Close(){
00020 Int_t close_err = myman->CloseRawFile();
00021 cout << "close_err:" << close_err << endl;
00022 return close_err;
00023 }
00024
00025 Int_t EventLoop(const Int_t &nevs){
00026
00027 Bool_t print_content = kFALSE;
00028
00029 Int_t ev = 0;
00030 while(1){
00031 if(nevs != -1 && ev >= nevs) break;
00032 ev++;
00033 Int_t exit_val = 0;
00034 UInt_t *event = myman->GetNextRawEvent(exit_val);
00035 if(!event) return -1;
00036
00037 if(print_content){
00038 for(UInt_t i=0;i < (event[0])/4 ;i++){
00039 cout << "event " << ev << "; exit_val: " << "; event[" << i << "]: " << event[i] << endl ;
00040 }
00041 }
00042 if( exit_val != 0) return -1;
00043
00044 myman->PrintAllInfo();
00045
00046 }
00047
00048 return 0;
00049 }
00050
00051 void ReadSccRaw(TString path="13_2_2007.scc.raw",Int_t n_events = 2){
00052
00053 Init();
00054
00055 if( Open(path) !=0 ) return;
00056
00057 if( EventLoop(n_events) !=0 ) return;
00058
00059 if( Close() !=0 ) return;
00060 }