tested in Clarion2-DAQ

This commit is contained in:
Tim Gray 2021-12-16 10:30:38 -05:00
parent 853367b84c
commit 923dc4626f
4 changed files with 76 additions and 20 deletions

View File

@ -11,9 +11,10 @@
//############################################ User setting
int rawEnergyRange[2] = {100, 2000};
int rawEnergyRange[2] = {100, 6000}; // in ch
int energyRange[2] = {100, 2000}; // keV
double BGO_threshold = 100;
double BGO_threshold = 100; // in ch
//############################################ end of user setting
@ -27,6 +28,8 @@ TStopwatch StpWatch;
TH2F * heVID;
TH1F * he[NCLOVER];
TH1F * h1, * h2;
TH2F * hgg[NCLOVER][NCLOVER];
TH2F * hcoin;
@ -43,6 +46,10 @@ void Analyzer::Begin(TTree * tree){
NumEntries = tree->GetEntries();
printf("======================== histogram declaration\n");
h1 = new TH1F("h1", "h1", 1900, 100, 2000);
h2 = new TH1F("h2", "h2 BGO gated", 1900, 100, 2000);
heVID = new TH2F("heVID", "e vs ID; det ID; e [ch]", NCLOVER, 0, NCLOVER, rawEnergyRange[1] - rawEnergyRange[0], rawEnergyRange[0], rawEnergyRange[1]);
heCalVID = new TH2F("heCalVID", Form("eCal vs ID (BGO veto > %.1f); det ID; e [ch]", BGO_threshold), NCLOVER, 0, NCLOVER, rawEnergyRange[1] - rawEnergyRange[0], rawEnergyRange[0], rawEnergyRange[1]);
for( int i = 0; i < NCLOVER; i ++){
@ -82,13 +89,14 @@ Bool_t Analyzer::Process(Long64_t entry){
b_energy->GetEntry(entry);
b_time->GetEntry(entry);
b_pileup->GetEntry(entry);
//b_pileup->GetEntry(entry);
b_bgo->GetEntry(entry);
b_other->GetEntry(entry);
b_multiplicity->GetEntry(entry);
//b_other->GetEntry(entry);
//b_multiplicity->GetEntry(entry);
if( multi == 0 ) return kTRUE;
///=========== Looping Crystals
for( int detID = 0; detID < NCLOVER ; detID ++){
//======== baics gate when no energy or pileup
@ -97,7 +105,26 @@ Bool_t Analyzer::Process(Long64_t entry){
//======== Fill raw data
heVID->Fill( detID, e[detID]);
he[detID]->Fill(e[detID]);
if( 8 == detID ) {
h1->Fill( e[detID]*0.307484 - 0.505163 );
heCal[detID]->Fill( e[detID]*0.307484 - 0.505163 );
}
if( 9 == detID ) {
h1->Fill( e[detID]*0.308628 + 0.672629 );
heCal[detID]->Fill( e[detID]*0.308628 + 0.672629 );
}
if( 10 == detID ) {
h1->Fill( e[detID]*0.308445 + 0.238095 );
heCal[detID]->Fill( e[detID]*0.308445 + 0.238095 );
}
if( 11 == detID ) {
h1->Fill( e[detID]*0.312665 + 0.359117 );
heCal[detID]->Fill( e[detID]*0.312665 + 0.359117 );
}
for( int detJ = detID +1; detJ < NCLOVER; detJ++) {
if( TMath::IsNaN(e[detJ])) continue;
@ -112,12 +139,21 @@ Bool_t Analyzer::Process(Long64_t entry){
return kTRUE;
}
}
if( 8 == detID ) h2->Fill( e[detID]*0.307484 - 0.505163 );
if( 9 == detID ) h2->Fill( e[detID]*0.308628 + 0.672629 );
if( 10 == detID ) h2->Fill( e[detID]*0.308445 + 0.238095 );
if( 11 == detID ) h2->Fill( e[detID]*0.312665 + 0.359117 );
//========= apply correction
double eCal = e[detID];
heCalVID->Fill( detID, eCal);
heCal[detID]->Fill(eCal);
//heCal[detID]->Fill(eCal);
for( int detJ = detID +1; detJ < NCLOVER; detJ++) {
if( TMath::IsNaN(e[detJ])) continue;
@ -151,16 +187,22 @@ void Analyzer::Terminate(){
heCalVID->Draw("colz");
cCanvas->cd(3);
cCanvas->cd(3)->SetLogz(1);
hcoin->Draw("colz");
//cCanvas->cd(3)->SetLogz(1);
//hcoin->Draw("colz");
h1->Draw("");
heCal[8]->SetLineColor(2);heCal[8]->Draw("same");
heCal[9]->SetLineColor(4);heCal[9]->Draw("same");
heCal[10]->SetLineColor(6);heCal[10]->Draw("same");
heCal[11]->SetLineColor(7);heCal[11]->Draw("same");
cCanvas->cd(4);
cCanvas->cd(4)->SetLogz(1);
hcoinBGO->Draw("colz");
//cCanvas->cd(4)->SetLogz(1);
//hcoinBGO->Draw("colz");
h2->Draw("");
printf("=============== Analyzer Utility\n");
gROOT->ProcessLine(".L Analyzer_Utilt.c");
gROOT->ProcessLine("listDraws()");
//gROOT->ProcessLine("listDraws()");
printf("=============== loaded AutoFit.C\n");
gROOT->ProcessLine(".L AutoFit.C");

View File

@ -10,7 +10,7 @@ void listDraws(void) {
int nCanvas=0;
void newCanvas(int sizeX = 800, int sizeY = 600, int posX = 0, int posY = 0){
TString name; name.Form("cNewCanvas%d | %s", nCanvas, canvasTitle.Data());
TString name; name.Form("cNewCanvas%d", nCanvas);
TCanvas * cNewCanvas = new TCanvas(name, name, posX, posY, sizeX, sizeY);
nCanvas++;
cNewCanvas->cd();
@ -75,7 +75,7 @@ void drawGG(){
cGG->Clear();cGG->Divide(NCLOVER, NCLOVER);
for( int i = 0; i < NCLOVER; i ++){
for( int j = i+; j < NCLOVER; j ++){
for( int j = i+1; j < NCLOVER; j ++){
cGG->cd( NCLOVER * i + j +1 );
hgg[i][j]->Draw("colz");
}

13
ChainAnalysis.C Normal file
View File

@ -0,0 +1,13 @@
#include "TChain.h"
void ChainAnalysis(){
TChain * chain = new TChain("tree");
chain->Add("Dec15-07-00[0-9].root");
chain->GetListOfFiles()->Print();
chain->Process("Analyzer.C+");
}

View File

@ -18,7 +18,7 @@ EventBuild=1
if [ $# -gt 2 ]; then EventBuild=$3; fi
DIR=$(pwd)
DATA_DIR=fsu_run_2021
RED='\033[1;31m'
YELLOW='\033[1;33m'
@ -28,11 +28,13 @@ BLUE='\033[0;34m'
Cyan='\033[0;36m'
NC='\033[0m'
cd $RunFolder
#cd $RunFolder
#ls -lhtr *.evt
cd $DATA_DIR/$RunFolder
fileList=$(ls *.evt)
numFile=$(ls -lhtr *.evt | wc -l)
count=0
cd $DIR
for a in $fileList
do
@ -44,13 +46,13 @@ do
#............ check if *.to file exist, if yes, check timestamp, if timestamp is eariler, sort time
if [ $TimeSort -eq 1 ]; then
evtDateTime=`stat -c "%Z" $a | sort -rn | head -1`
evtDateTime=`stat -c "%Z" $DATA_DIR/$RunFolder/$a | sort -rn | head -1`
istoExist=`ls -1 $a.to | wc -l`
if [ ${istoExist} -gt 0 ]; then
echo "found $a.to"
toDateTime=`stat -c "%Z" $a.to | sort -rn | head -1`
if [ ${evtDateTime} -ge ${toDateTime} ]; then
$DIR/pxi-time-order $a
$DIR/$DATA_DIR/pxi-time-order $a
else
echo "$a.to is generated after $a. skip."
fi
@ -59,7 +61,7 @@ do
echo "skipped time sort by user."
else
echo "force Time sort"
$DIR/pxi-time-order $a
$DATA_DIR/pxi-time-order $DATA_DIR/$RunFolder/$a
fi
@ -74,7 +76,7 @@ do
echo "found $rootFile"
rootDateTime=`stat -c "%Z" $rootFile | sort -rn | head -1`
if [ ${toDateTime} -ge ${rootDateTime} ]; then
$DIR/pixie2root $a.to
$DATA_DIR/pixie2root $a.to
else
echo "$rootFile is generated after $a.to skip."
fi
@ -90,5 +92,4 @@ done
fileList=$(ls *.root)
cd $DIR