CoMPASS_BinReader/test.C
2024-09-03 13:41:36 -04:00

83 lines
1.9 KiB
C

/**************************************
*
* root script for using the BinReader.h
*
*
***************************************/
#include "BinReader.h"
#include "TH1.h"
#include "TStyle.h"
#include "TCanvas.h"
#define NChannel 16
TH1I * hBoard;
TH1I * hChannel;
TH1I * he[NChannel];
// BinReader * reader = new BinReader("/home/ryan/ExpData/fsu_testing/testing_014_single.bin");
// BinReader * reader = new BinReader("data/run_123/UNFILTERED/Data_CH9@V1725S_19555_run_123.BIN");
BinReader * reader = new BinReader("run_268/CH0@V1725_324_Data_run_268.bin");
void test(){
// reader->ReadBlock();
// reader->data.Print();
reader->ScanNumHit();
printf("################## Number of data Block : %llu \n", reader->GetNumHit());
unsigned int count = 0;
do{
reader->ReadBlock();
reader->data.Print();
count ++;
// if( count > 10 ) break;
}while( !reader->IsEndOfFile() );
printf(">>>>>>>>>>>>>>. count : %u\n", count);
reader->PrintStatus(1);
printf("\n\n\n");
// hBoard = new TH1I ("hBoard", "BoardID", 100, 0, 10);
// hChannel = new TH1I ("hChannel", "Channel", NChannel, 0, NChannel);
// for( int i = 0 ; i < NChannel ; i++){
// he[i] = new TH1I(Form("he%0d", i), Form("he%0d", i), 500, 0, 10000);
// }
// for( int i = 0; i < reader->GetNumberOfBlock(); i++){
// reader->ReadBlock();
// hBoard->Fill( reader->data.BoardID );
// unsigned short ch = reader->data.Channel;
// hChannel->Fill( ch);
// he[ch]->Fill( reader->data.Energy);
// if( i < 10 ) reader->data.Print();
// if( i % 5000000 == 0 ) {
// printf("------- %d \n", i);
// reader->data.Print();
// }
// }
// gStyle->SetOptStat("neiou");
// TCanvas * haha = new TCanvas("haha", "haha", 4*400, 5*400);
// haha->Divide(4,5);
// haha->cd(1); hBoard->Draw();
// haha->cd(2); hChannel->Draw();
// for( int i = 0; i < 16; i++){
// haha->cd(i+5);
// he[i]->Draw();
// }
}