CoMPASS_BinReader/test.C

80 lines
1.8 KiB
C++
Raw Normal View History

2022-12-01 12:50:48 -05:00
/**************************************
*
* root script for using the BinReader.h
*
*
***************************************/
#include "BinReader.h"
2024-07-18 19:02:22 -04:00
#include "TH1.h"
#include "TStyle.h"
#include "TCanvas.h"
2022-12-01 12:50:48 -05:00
#define NChannel 16
TH1I * hBoard;
TH1I * hChannel;
TH1I * he[NChannel];
2024-07-18 19:02:22 -04:00
// 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");
2022-12-01 12:50:48 -05:00
void test(){
2024-07-18 19:02:22 -04:00
// reader->ReadBlock();
// reader->data.Print();
2022-12-01 12:50:48 -05:00
2024-07-18 19:02:22 -04:00
reader->ScanNumHit();
2022-12-01 12:50:48 -05:00
2024-07-18 19:02:22 -04:00
printf("################## Number of data Block : %llu \n", reader->GetNumHit());
unsigned int count = 0;
do{
2022-12-01 12:50:48 -05:00
reader->ReadBlock();
2024-07-18 19:02:22 -04:00
reader->data.Print();
count ++;
}while( !reader->IsEndOfFile() );
printf(">>>>>>>>>>>>>>. count : %ld\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);
2022-12-01 12:50:48 -05:00
2024-07-18 19:02:22 -04:00
// if( i < 10 ) reader->data.Print();
2022-12-01 12:50:48 -05:00
2024-07-18 19:02:22 -04:00
// if( i % 5000000 == 0 ) {
// printf("------- %d \n", i);
// reader->data.Print();
// }
// }
2022-12-01 12:50:48 -05:00
2024-07-18 19:02:22 -04:00
// gStyle->SetOptStat("neiou");
2022-12-01 12:50:48 -05:00
2024-07-18 19:02:22 -04:00
// TCanvas * haha = new TCanvas("haha", "haha", 4*400, 5*400);
// haha->Divide(4,5);
2022-12-01 12:50:48 -05:00
2024-07-18 19:02:22 -04:00
// haha->cd(1); hBoard->Draw();
// haha->cd(2); hChannel->Draw();
2022-12-01 12:50:48 -05:00
2024-07-18 19:02:22 -04:00
// for( int i = 0; i < 16; i++){
// haha->cd(i+5);
// he[i]->Draw();
// }
2022-12-01 12:50:48 -05:00
}