snapshot during 64Ni+7Li run

This commit is contained in:
Tim Gray 2022-03-10 13:59:06 -05:00
parent 088a9200f5
commit 06915c8a51
8 changed files with 278 additions and 120 deletions

View File

@ -12,14 +12,18 @@
//############################################ User setting
int rawEnergyRange[2] = {0, 6000}; // in ch
int energyRange[3] = {1, 50, 6000}; // keV {resol, min, max}
int rawEnergyRange[2] = {0, 12000}; // in ch
int energyRange[3] = {1, 30, 800}; // keV {resol, min, max}
double BGO_threshold = 0; // in ch
int pidMaxRange[3] = {500, 300, 1800}; //nBin, tail, and peak
TString e_corr = "correction_e.dat";
TString cutFileName = "proton209Cut.root";
TString cutFileName1 = "protonCut.root";
//TString cutFileName1 = "alphaCut.root";
//TString cutFileName1 = "LiCut.root";
bool save_ev2 = false;
@ -30,16 +34,25 @@ bool save_ev2 = false;
TH2F * heVID;
TH1F * he[NCRYSTAL];
TH2F * hgg[NCRYSTAL][NCRYSTAL];
//TH2F * hgg[NCRYSTAL][NCRYSTAL];
TH2F * hcoin;
TH2F * hcrystalBGO;
TH2F * hgg;
TH1F * hTDiff;
TH2F * hPID;
TH2F * hPID209;
TH2F * hPID219;
TH2F * hPID[NGAGG];
TH2F * hPID_A[NGAGG];
TH2F * hPID_B[NGAGG];
TH2F * hGAGGVID;
///----- after gamma gate
TH2F * hPID_A_g[NGAGG];
///----- after calibration and BGO veto
TH2F * heCalVID;
@ -54,8 +67,10 @@ TH2F * heCalVID_g;
TH1F * hg_g[NCLOVER];
///============= cut
TCutG * cut;
TCutG * cut1;
//############################################ BEGIN
void Analyzer::Begin(TTree * tree){
@ -77,8 +92,8 @@ void Analyzer::Begin(TTree * tree){
hTDiff = new TH1F("hTDiff", "data time different within an event; tick [10 ns]", 110, 0, 110);
heVID->SetNdivisions(-409, "X");
heCalVID->SetNdivisions(-409, "X");
heVID->SetNdivisions(-410, "X");
heCalVID->SetNdivisions(-410, "X");
for( int i = 0; i < NCRYSTAL; i ++){
he[i] = new TH1F( Form("he%02d", i), Form("e -%02d", i), rawEnergyRange[1] - rawEnergyRange[0], rawEnergyRange[0], rawEnergyRange[1]);
@ -91,18 +106,25 @@ void Analyzer::Begin(TTree * tree){
hg_g[i] = new TH1F(Form("hg_g%02d", i), Form("Clover-%02d (added-back) particle", i), (energyRange[2] - energyRange[1])/energyRange[0], energyRange[1], energyRange[2]);
}
hPID = new TH2F("hPID", "PID; tail; peak ", 400, -20, 300, 400, -50, 1200);
hPID209 = new TH2F("hPID209", "PID detID = 209; tail; peak ", 400, -20, 300, 400, -50, 1200);
hPID219 = new TH2F("hPID219", "PID detID = 219; tail; peak ", 400, -20, 300, 400, -50, 1200);
hgg = new TH2F("hgg", "Gamma - Gamma", (energyRange[2] - energyRange[1])/energyRange[0], energyRange[1], energyRange[2], (energyRange[2] - energyRange[1])/energyRange[0], energyRange[1], energyRange[2]);
for( int i = 0; i < NGAGG; i++){
hPID[i] = new TH2F(Form("hPID%02d", i), Form("PID-%2d; tail; peak ", i), pidMaxRange[0], -20, pidMaxRange[1], pidMaxRange[0], -50, pidMaxRange[2]);
hPID_A[i] = new TH2F(Form("hPID_A%02d",i), Form("PID_A detID = %2d; tail; peak ", i) , pidMaxRange[0], -20, pidMaxRange[1], pidMaxRange[0], -50, pidMaxRange[2]);
hPID_B[i] = new TH2F(Form("hPID_B%02d",i), Form("PID_B detID = %2d; tail; peak ", i) , pidMaxRange[0], -20, pidMaxRange[1], pidMaxRange[0], -50, pidMaxRange[2]);
hPID_A_g[i] = new TH2F(Form("hPID_A_g%02d",i), Form("PID_A detID = %2d (gated); tail; peak ", i) , pidMaxRange[0], -20, pidMaxRange[1], pidMaxRange[0], -50, pidMaxRange[2]);
}
hGAGGVID = new TH2F("hGAGGVID", "GAGG V ID", 80, 0, 80, 400, -50, 2000);
/**
for( int i = 0; i < NCRYSTAL; i++){
for( int j = i+1; j < NCRYSTAL; j++){
//hgg[i][j] = new TH2F(Form("hgg%02d%02d", i, j), Form("e%02d vs e%02d; e%02d; e%02d", i, j, i, j),
// (rawEnergyRange[1] - rawEnergyRange[0])/2, rawEnergyRange[0], rawEnergyRange[1],
// (rawEnergyRange[1] - rawEnergyRange[0])/2, rawEnergyRange[0], rawEnergyRange[1]);
}
}
}*/
hcoin = new TH2F("hcoin", "detector coin.; det ID; det ID", NCRYSTAL, 0, NCRYSTAL, NCRYSTAL, 0 , NCRYSTAL);
@ -115,18 +137,24 @@ void Analyzer::Begin(TTree * tree){
eCorr = LoadCorrectionParameters(e_corr);
if( cutFileName != ""){
if( cutFileName1 != ""){
printf("======================== Load cuts.\n");
TFile * cutFile = new TFile(cutFileName);
cut = (TCutG *) cutFile->Get("protonCut");
printf(" %s is loaded.\n", cut->GetName());
TFile * cutFile1 = new TFile(cutFileName1);
cut1 = (TCutG *) cutFile1->Get("CUTG");
printf(" %s is loaded.\n", cut1->GetName());
}
saveEV2 = save_ev2;
}
void Analyzer::PID_calculation(int ID){
}
//############################################ PROCESS
Bool_t Analyzer::Process(Long64_t entry){
@ -148,6 +176,7 @@ Bool_t Analyzer::Process(Long64_t entry){
b_multiCry->GetEntry(entry);
b_detID->GetEntry(entry);
b_qdc->GetEntry(entry);
b_pileup->GetEntry(entry);
if( multi == 0 ) return kTRUE;
@ -156,46 +185,66 @@ Bool_t Analyzer::Process(Long64_t entry){
///printf("---------------------------- %d \n", multi);
double bgC[2]={0}, peakC[2]={0}, tailC[2] = {0};
int count = 0 ;
double bg[NGAGG][2]={0}, peak[NGAGG][2]={0}, tail[NGAGG][2] = {0};
int count[NGAGG] = {0} ;
///=========== make the particle gate
for( int i = 0; i < multi ; i ++){
if( e_t[i] - e_t[0] > 20 ) continue;
if( pileup[i] == 1 ) continue;
if( e[i] < 100 ) continue;
int id = detID[i];
if( id < 200 || id >= 300 ) continue;
id = id - 200;
if( id == 209 ) {
double bg = (qdc[i][0] + qdc[i][1])/60.;
double peak = qdc[i][3]/20. - bg;
double tail = qdc[i][5]/55. - bg;
hPID209->Fill( tail, peak);
}
if( id == 219 ) {
double bg = (qdc[i][0] + qdc[i][1])/60.;
double peak = qdc[i][3]/20. - bg;
double tail = qdc[i][5]/55. - bg;
hPID219->Fill( tail, peak);
hGAGGVID->Fill(id, e[i]);
// GAGG_A
if( (0 <= id && id < 50) ) {
bg[id][0] = (qdc[i][0] + qdc[i][1])/60.;
peak[id][0] = qdc[i][3]/20. - bg[id][0];
tail[id][0] = qdc[i][5]/55. - bg[id][0];
hPID_A[id]->Fill( tail[id][0], peak[id][0]);
count[id] ++;
}
if( count < 2 && (id == 209 || id == 219 )){
bgC[count] = (qdc[i][0] + qdc[i][1])/60.;
peakC[count] = qdc[i][3]/20. - bgC[count];
tailC[count] = qdc[i][5]/55. - bgC[count];
count++;
// GAGG_B
if( 50 <= id ) {
id = id - 50;
bg[id][1] = (qdc[i][0] + qdc[i][1])/60.;
peak[id][1] = qdc[i][3]/20. - bg[id][1];
tail[id][1] = qdc[i][5]/55. - bg[id][1];
hPID_B[id]->Fill( tail[id][1], peak[id][1]);
count[id]++;
}
}
///#########################################################
///================ coincident gate between proton and gamma
double tail = (tailC[0]+tailC[1])/2.;
double peak = (peakC[0]+peakC[1])/2.;
hPID->Fill( tail, peak);
///printf("======================\n");
for ( int i = 0 ; i < NGAGG ; i++){
if( count[i] == 2 ){
double tailAvg = (tail[i][0]+tail[i][1])/2.;
double peakAvg = (peak[i][0]+peak[i][1])/2.;
hPID[i]->Fill( tailAvg, peakAvg);
}
}
///=========== Looping data for the event
for( int i = 0; i < multi ; i ++){
if( pileup[i] == 1 ) continue;
int id = detID[i];
///printf("%d %f %llu\n", id, e[i], e_t[i]);
@ -218,10 +267,13 @@ Bool_t Analyzer::Process(Long64_t entry){
}
if( 200 < id && id < 300){ /// GAGG
continue;
}
//======== TDiff veto
//if( !(e_t[i] - e_t[0] < 20 || e_t[i] - e_t[0] > 35) ) continue;
if( e_t[i] - e_t[0] > 20 ) continue;
if ( i > 0 ) hTDiff->Fill( e_t[i] - e_t[0]);
@ -236,13 +288,13 @@ Bool_t Analyzer::Process(Long64_t entry){
}
}
}
if( dropflag ) return kTRUE;
if( dropflag ) continue;
if( 0<= id && id < NCRYSTAL ) {
if( e_corr == "" ){
eCal[id] = e[i];
}else{
///========= apply correction
///========= apply energy correction
int order = (int) eCorr[id].size();
eCal[id] = 0;
for( int k = 0; k < order ; k++){
@ -250,7 +302,7 @@ Bool_t Analyzer::Process(Long64_t entry){
}
}
heCalVID->Fill( id, eCal[id]);
if( id != 30 ) heCalVID->Fill( id, eCal[id]);
heCal[id]->Fill(eCal[id]);
for ( int j = i + 1; j < multi; j++){
@ -261,16 +313,16 @@ Bool_t Analyzer::Process(Long64_t entry){
///========== add back and remove cross talk
int cloverID = id /4;
if( eCal[id] > 100 ) gamma[cloverID] += eCal[id];
if( eCal[id] > energyRange[1]/4. ) gamma[cloverID] += eCal[id];
///====== particle coincidet
if( cut->IsInside(tail, peak) ){
heCal_g[id]->Fill(eCal[id]);
heCalVID_g->Fill(id, eCal[id]);
}
}
for( int i = 0; i < NCLOVER; i++){
for( int j = 0; j < NCLOVER; j++){
if( gamma[i] > 0 && gamma[j] > 0 && i != j ) hgg->Fill( gamma[i], gamma[j]);
}
}
for( int i = 0 ; i < NCLOVER; i++){
@ -278,8 +330,17 @@ Bool_t Analyzer::Process(Long64_t entry){
hg[i]->Fill(gamma[i]);
if( cut->IsInside(tail, peak) ) hg_g[i]->Fill(gamma[i]);
for( int gi = 0; gi < NGAGG ; gi ++){
if( cut1->IsInside(tail[gi][0], peak[gi][0]) ) {
hg_g[i]->Fill(gamma[i]);
}
}
}
if( abs(gamma[i] - 1052 ) < 8 ){
for( int i = 0; i < NGAGG ; i ++){
hPID_A_g[i]->Fill( tail[i][0], peak[i][0]);
}
}
}
@ -297,27 +358,70 @@ void Analyzer::Terminate(){
printf("============================== finishing.\n");
gROOT->cd();
int canvasXY[2] = {1200 , 1200} ;// x, y
int canvasDiv[2] = {2,2};
int canvasXY[2] = {1600 , 800} ;// x, y
int canvasDiv[2] = {4,2};
TCanvas *cCanvas = new TCanvas("cCanvas", "" ,canvasXY[0],canvasXY[1]);
cCanvas->Modified(); cCanvas->Update();
cCanvas->cd(); cCanvas->Divide(canvasDiv[0],canvasDiv[1]);
gStyle->SetOptStat("neiou");
cCanvas->cd(1);
cCanvas->cd(1)->SetLogz(1);
int padID = 0;
//========================= canvas 1
padID++;
cCanvas->cd(padID);
cCanvas->cd(padID)->SetLogz(0);
heCalVID->Draw("colz");
cCanvas->cd(2);
cCanvas->cd(2)->SetLogz(1);
hPID->Draw("colz");
cut->Draw("same");
//========================= canvas 2
padID++;
cCanvas->cd(padID);
cCanvas->cd(padID)->SetLogz(1);
hGAGGVID->Draw("colz");
cCanvas->cd(3);
cCanvas->cd(3)->SetLogz(1);
heCalVID_g->Draw("colz");
//========================= canvas 3
padID++;
cCanvas->cd(padID);
cCanvas->cd(padID)->SetLogz(0);
hTDiff->Draw();
//========================= canvas 3
padID++;
cCanvas->cd(padID);
cCanvas->cd(padID)->SetLogz(0);
hg[6]->Draw();
//========================= canvas 5
padID++;
cCanvas->cd(padID);
cCanvas->cd(padID)->SetLogz(1);
//heCalVID->Draw("colz");
hPID[9]->Draw("colz");
//========================= canvas 6
padID++;
cCanvas->cd(padID);
cCanvas->cd(padID)->SetLogz(1);
hPID_A[9]->Draw("colz");
cut1->Draw("same");
//========================= canvas 7
padID++;
cCanvas->cd(padID);
cCanvas->cd(padID)->SetLogz(1);
hPID_B[9]->Draw("colz");
//========================= canvas 8
padID++;
cCanvas->cd(padID);
cCanvas->cd(padID)->SetLogz(1);
//hPID_A_g[9]->Draw("colz");
hg_g[6]->Draw();
/*
//========================= canvas 1
cCanvas->cd(4);
cCanvas->cd(4)->SetLogy(1);
//gROOT->ProcessLine(".x script.C");
@ -345,6 +449,7 @@ void Analyzer::Terminate(){
h0_g->Draw("same");
hg[0]->Draw("same");
/**/
printf("=============== loaded AutoFit.C, try showFitMethos()\n");
gROOT->ProcessLine(".L armory/AutoFit.C");
printf("=============== Analyzer Utility\n");

View File

@ -38,6 +38,7 @@ public :
Int_t multi;
Int_t multiCry;
Int_t multiGagg;
Bool_t pileup[MAX_MULTI];
// List of branches
TBranch *b_event_ID; //!
@ -49,6 +50,7 @@ public :
TBranch *b_multi; //!
TBranch *b_multiCry; //!
TBranch *b_multiGagg; //!
TBranch *b_pileup; //!
Analyzer(TTree * /*tree*/ =0) : fChain(0) { totnumEntry = 0;
Frac = 0.1;
@ -89,6 +91,9 @@ public :
double eCal[NCRYSTAL];
double gamma[NCLOVER]; // added-back energy
void PID_calculation(int ID);
};
#endif
@ -118,6 +123,7 @@ void Analyzer::Init(TTree *tree)
fChain->SetBranchAddress("multi", &multi, &b_multi);
fChain->SetBranchAddress("multiCry", &multiCry, &b_multiCry);
fChain->SetBranchAddress("multiGagg", &multiGagg, &b_multiGagg);
fChain->SetBranchAddress("pileup", pileup, &b_pileup);
TString option = GetOption();
if ( option != "" ) outEV2Name = option;

View File

@ -49,6 +49,7 @@ class evtReader{
~evtReader();
void OpenFile(TString inFileName);
void CloseFile();
void UpdateFileSize();
bool IsEndOfFile();
@ -124,6 +125,17 @@ void evtReader::OpenFile(TString inFileName){
}
};
void evtReader::CloseFile(){
fclose(inFile);
isOpened = false;
data->Clear();
inFileSize = 0;
inFilePos = 0;
nBlock = 0;
blockID = -1;
endOfFile = false;
};
void evtReader::UpdateFileSize(){
if( inFile == NULL ) return;
fseek(inFile, 0L, SEEK_END);

View File

@ -84,6 +84,7 @@ int main(int argc, char **argv) {
int id[MAX_ID] = {0};
double e[MAX_ID] = {TMath::QuietNaN()};
unsigned long long e_t[MAX_ID] = {0};
bool pileup[MAX_ID] = {0};
int qdc[MAX_ID][8] = {0};
int multiCry = 0 ; /// this is total multiplicity for all crystal
int runID = 0; // date-run-fileID, Dec15-02-001 = 1502001
@ -95,6 +96,7 @@ int main(int argc, char **argv) {
tree->Branch("detID", id, "detID[multi]/I");
tree->Branch("e", e, "e[multi]/D");
tree->Branch("e_t", e_t, "e_timestamp[multi]/l");
tree->Branch("pileup", pileup, "pileup[multi]/O");
tree->Branch("qdc", qdc, "qdc[multi][8]/I");
tree->Branch("multiCry", &multiCry, "multiplicity_crystal/I");
tree->Branch("multiGagg", &multiGagg, "multiplicity_GAGG/I");
@ -134,6 +136,8 @@ int main(int argc, char **argv) {
etime = data->time;
tdif = 0;
multi = 0;
multiCry = 0;
multiGagg = 0;
}else {
tdif = data->time - etime;
}
@ -162,6 +166,7 @@ int main(int argc, char **argv) {
id[multi] = mapping[haha];
e[multi] = data->energy;
e_t[multi] = data->time;
pileup[multi] = data->pileup;
for( int i = 0; i < 8; i++) qdc[multi][i] = data->QDCsum[i];
multi++ ;
if( id[multi] < 100 ) multiCry ++;
@ -173,7 +178,8 @@ int main(int argc, char **argv) {
id[multi] = mapping[haha];
e[multi] = data->energy;
e_t[multi] = data->time;
for( int i = 0; i < 8; i++) qdc[multi-1][i] = data->QDCsum[i];
pileup[multi] = data->pileup;
for( int i = 0; i < 8; i++) qdc[multi][i] = data->QDCsum[i];
multi++ ;
if( id[multi] < 100 ) multiCry ++;
if( id[multi] >= 200 ) multiGagg ++;
@ -192,21 +198,24 @@ int main(int argc, char **argv) {
evt->PrintStatus(1);
printf("\n\n\n");
printf(" total number of event built : %llu\n", evID);
printf(" total number of Gamma - GAGG coincdient : %d (%.3f %%)\n", countGP, countGP*1.0/evID);
//printf(" total number of Gamma - GAGG coincdient : %d (%.3f %%)\n", countGP, countGP*1.0/evID);
outRootFile->cd();
tree->Write();
totalDataSize += evt->GetFileSize()/1024./1024./1024.;
totalDataSize += (evt->GetFileSize())/1024./1024./1024.;
double rootFileSize = outRootFile->GetSize()/1024./1024./1024. ; // in GB
printf(" ----------- root file size : %.3f GB\n", rootFileSize);
printf(" ---------- total read size : %.3f GB\n", totalDataSize);
printf(" ----------- reduction rate : %.3f %%\n", rootFileSize*100./totalDataSize);
evt->CloseFile();
/*
if( rootFileSize > 3.0 ) {
break;
}
}*/
///try to open a new root file when file size > 2 GB
/*if( rootFileSize > 2.0 ) {
@ -242,7 +251,7 @@ int main(int argc, char **argv) {
printf("\n\n\n==================== finished.\r\n");
printf(" number of Gamma - GAGG coincdient : %d\n", countGP);
//printf(" number of Gamma - GAGG coincdient : %d\n", countGP);
return 0;
}

15
batch_evt.to.fsu.100 Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
DIR=$1
evtList=$(ls ${DIR}/*.evt)
echo "############### list of evt files"
for a in ${evtList} ; do
echo ${a}
done
for a in ${evtList} ; do
echo -e "\033[1;31m============================\033[m"
./armory/pxi-fsu-time-order ${a} 100
done

View File

@ -11,10 +11,10 @@ SaveFile=$1
DIR=$(pwd)
TIMEWINDOW=100
DATA_DIR=/home/ryan/XIAEventBuilder/data/data1/202112_16O_clarion2/XIAEventBuilder/
DATA_DIR=data/data/Mar10-04
fileList=$(\ls ${DATA_DIR}/Dec*/*/*.evt.to)
numFile=$(\ls -1 ${DATA_DIR}/Dec*/*/*.evt.to | wc -l)
fileList=$(\ls $DIR/${DATA_DIR}/*.evt.to.fsu.100)
numFile=$(\ls -1 $DIR/${DATA_DIR}/*.evt.to.fsu.100 | wc -l)
echo "##############################################"
echo "number of files : "$numFile

View File

@ -18,6 +18,10 @@
0.0874480331 0.1290573470
0.3928400202 0.1479762423
0.2514077943 0.1707848626
0.0 1.0
0.0 1.0
0.0 1.0
0.0 1.0
0.1375653253 0.1509230900
0.1447086122 0.1531835401
0.1784763570 0.1519575184
@ -34,4 +38,7 @@
0.2951614679 0.1481891679
0.2229254902 0.1551385739
0.0663532207 0.0800650041
0.0 1.0
0.0 1.0
0.0 1.0
0.0 1.0

View File

@ -1,7 +1,8 @@
/************************************
Clover : 0 - 99
BGO : 100 - 199
Other : 200 - 299
GAGG : 200 - 299
ZERO DEGREE : 300 - 399
* *********************************/
#ifndef MAPPING
@ -9,24 +10,27 @@ Other : 200 - 299
//==================== mapping
#define NCLOVER 9
#define NCLOVER 10
#define NCRYSTAL NCLOVER*4
#define NBGO NCLOVER
#define NOTHER 52
#define NGAGG 26
#define NZERO 2
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
int mapping[128] ={ 0, 1, 2, 3, 100, 4, 5, 6, 7, 101, 8, 9, 10, 11, 102, -1, //mod-0
12, 13, 14, 15, 103, 16, 17, 18, 19, 104, 20, 21, 22, 23, 105, -1, //mod-1
24, 25, 26, 27, 106, 28, 29, 30, 31, 107, 32, 33, 34, 35, 108, -1, //mod-2
36, 37, 38, 39, 109, 40, 41, 42, 43, 110, 300, 301, 200, 201, 202, 203,
204, 205, 206, 207, 208, 209, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259,
210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, // Ring 4A
260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, // Ring 4B
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
//200- 209 GAGG 2A
//210- 225 GAGG 4A
//250- 259 GAGG 2B
//260- 275 GAGG 4B
// 0 1 2 3 4 5 6 7 8 9
int mapping[130] ={ 0, 1, 2, 3, 100, 4, 5, 6, 7, 101, // 0
8, 9, 10, 11, 102, -1, 12, 13, 14, 15, // 10
103, 16, 17, 18, 19, 104, -1, -1, -1, -1, // 20
-1, -1, 20, 21, 22, 23, 105, 24, 25, 26, // 30
27, 106, 28, 29, 30, 31, 107, -1, -1, -1, // 40
-1, -1, -1, 32, 33, 34, 35, 108, -1, -1, // 50
200, 201, 202, 203, 204, 205, 206, 207, 208, 209, // 60
210, 211, 212, 213, 214, 215, 216, 217, 218, 219, // 70
220, 221, 222, 223, 224, 225, 226, 227, 228, 229, // 80
230, 231, 232, 233, 234, 235, 236, 237, 238, 239, // 90
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, // 100
250, 251, -1, -1, -1, -1, -1, -1, -1, -1, // 110
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // 120
#endif