59 lines
1.3 KiB
C
59 lines
1.3 KiB
C
/**************************************
|
|
*
|
|
* root script for using the BinReader.h
|
|
*
|
|
*
|
|
***************************************/
|
|
|
|
#include "BinReader.h"
|
|
|
|
#define NChannel 16
|
|
|
|
TH1I * hBoard;
|
|
TH1I * hChannel;
|
|
TH1I * he[NChannel];
|
|
|
|
BinReader * reader = new BinReader("DataR_run_pulser_3.BIN");
|
|
|
|
void test(){
|
|
|
|
reader->ScanNumberOfBlock();
|
|
|
|
printf("################## Number of data Block : %llu \n", reader->GetNumberOfBlock());
|
|
|
|
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();
|
|
}
|
|
|
|
}
|