many things
This commit is contained in:
parent
0acff94f90
commit
853367b84c
|
@ -1,11 +1,22 @@
|
||||||
void listDraws(void) {
|
void listDraws(void) {
|
||||||
printf("------------------- List of Plots -------------------\n");
|
printf("------------------- List of Plots -------------------\n");
|
||||||
printf(" rawID() - Raw e vs ID\n");
|
printf(" newCanvas() - Create a new Canvas\n");
|
||||||
|
printf("-----------------------------------------------------\n");
|
||||||
|
printf(" rawEvID() - Raw e vs ID\n");
|
||||||
printf(" drawE() - Raw e for all %d detectors\n", NCLOVER);
|
printf(" drawE() - Raw e for all %d detectors\n", NCLOVER);
|
||||||
|
printf(" drawGG() - Gamma - Gamma Coincident for all %d detectors\n", NCLOVER);
|
||||||
printf("-----------------------------------------------------\n");
|
printf("-----------------------------------------------------\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void rawID(){
|
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());
|
||||||
|
TCanvas * cNewCanvas = new TCanvas(name, name, posX, posY, sizeX, sizeY);
|
||||||
|
nCanvas++;
|
||||||
|
cNewCanvas->cd();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rawEvID(){
|
||||||
TCanvas * cRawID = (TCanvas *) gROOT->FindObjectAny("cRawID");
|
TCanvas * cRawID = (TCanvas *) gROOT->FindObjectAny("cRawID");
|
||||||
if( cRawID == NULL ) cRawID = new TCanvas("cRawID", "raw ID", 1000, 800);
|
if( cRawID == NULL ) cRawID = new TCanvas("cRawID", "raw ID", 1000, 800);
|
||||||
cRawID->cd(1)->SetGrid();
|
cRawID->cd(1)->SetGrid();
|
||||||
|
@ -14,10 +25,13 @@ void rawID(){
|
||||||
|
|
||||||
void drawE(bool isLogy = false, bool cali = false){
|
void drawE(bool isLogy = false, bool cali = false){
|
||||||
|
|
||||||
int numCol = NCLOVER / 4;
|
int nCrystal = 4;
|
||||||
|
int numCol = NCLOVER / nCrystal;
|
||||||
|
|
||||||
|
int size = 300;
|
||||||
|
|
||||||
TCanvas *cRawE = (TCanvas *) gROOT->FindObjectAny("cRawE");
|
TCanvas *cRawE = (TCanvas *) gROOT->FindObjectAny("cRawE");
|
||||||
if( cRawE == NULL ) cRawE = new TCanvas("cRawE", cali ? "Cal e" : "Raw e", 1200, 800);
|
if( cRawE == NULL ) cRawE = new TCanvas("cRawE", cali ? "Cal e" : "Raw e", size * numCol, size * nCrystal);
|
||||||
cRawE->Clear();cRawE->Divide(numCol, 4);
|
cRawE->Clear();cRawE->Divide(numCol, 4);
|
||||||
|
|
||||||
//cRawE->SetRightMargin(0);
|
//cRawE->SetRightMargin(0);
|
||||||
|
@ -27,7 +41,7 @@ void drawE(bool isLogy = false, bool cali = false){
|
||||||
//cRawE->SetTicks(1,1);
|
//cRawE->SetTicks(1,1);
|
||||||
//cRawE->SetBorderMode(1);
|
//cRawE->SetBorderMode(1);
|
||||||
|
|
||||||
for (Int_t i = 0; i < 4; i++) {
|
for (Int_t i = 0; i < nCrystal; i++) {
|
||||||
for( Int_t j = 0; j < numCol; j++){
|
for( Int_t j = 0; j < numCol; j++){
|
||||||
int canvasID = numCol * i + j + 1;
|
int canvasID = numCol * i + j + 1;
|
||||||
cRawE->cd(canvasID);
|
cRawE->cd(canvasID);
|
||||||
|
@ -38,7 +52,7 @@ void drawE(bool isLogy = false, bool cali = false){
|
||||||
//cRawE->cd(canvasID)->SetBottomMargin(0);
|
//cRawE->cd(canvasID)->SetBottomMargin(0);
|
||||||
//cRawE->cd(canvasID)->SetBorderMode(1);
|
//cRawE->cd(canvasID)->SetBorderMode(1);
|
||||||
if( isLogy ) cRawE->cd(canvasID)->SetLogy();
|
if( isLogy ) cRawE->cd(canvasID)->SetLogy();
|
||||||
int hID = 4*j+ i;
|
int hID = nCrystal*j+ i;
|
||||||
if( cali ) {
|
if( cali ) {
|
||||||
heCal[hID]->Draw("");
|
heCal[hID]->Draw("");
|
||||||
}else{
|
}else{
|
||||||
|
@ -48,3 +62,23 @@ void drawE(bool isLogy = false, bool cali = false){
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drawGG(){
|
||||||
|
|
||||||
|
int nCrystal = 4;
|
||||||
|
int numCol = NCLOVER / nCrystal;
|
||||||
|
|
||||||
|
int size = 300;
|
||||||
|
|
||||||
|
TCanvas *cGG = (TCanvas *) gROOT->FindObjectAny("cGG");
|
||||||
|
if( cGG == NULL ) cGG = new TCanvas("cGG", "Gamma - Gamma Coin.", size * NCLOVER, size * NCLOVER);
|
||||||
|
cGG->Clear();cGG->Divide(NCLOVER, NCLOVER);
|
||||||
|
|
||||||
|
for( int i = 0; i < NCLOVER; i ++){
|
||||||
|
for( int j = i+; j < NCLOVER; j ++){
|
||||||
|
cGG->cd( NCLOVER * i + j +1 );
|
||||||
|
hgg[i][j]->Draw("colz");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ void ShowFitMethod(){
|
||||||
printf("------- Mouse click Fit : \n");
|
printf("------- Mouse click Fit : \n");
|
||||||
printf(" clickFitNGaussPol() - fit n-Gauss + pol-n BG \n");
|
printf(" clickFitNGaussPol() - fit n-Gauss + pol-n BG \n");
|
||||||
printf(" clickFitNGaussPolSub() - Fit Pol-n BG, subtract, fit n-Gauss\n");
|
printf(" clickFitNGaussPolSub() - Fit Pol-n BG, subtract, fit n-Gauss\n");
|
||||||
printf(" SaveFitPara() - Save the initial guess parameters.\n");
|
printf(" saveFitPara() - Save the initial guess parameters.\n");
|
||||||
printf("---------------------------------------------------------\n");
|
printf("---------------------------------------------------------\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1934,7 +1934,7 @@ void Clicked() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SaveFitPara(TString fileName = "AutoFit_para.txt"){
|
void saveFitPara(TString fileName = "AutoFit_para.txt"){
|
||||||
printf("Save to : %s \n", fileName.Data());
|
printf("Save to : %s \n", fileName.Data());
|
||||||
FILE * file_out;
|
FILE * file_out;
|
||||||
file_out = fopen (fileName.Data(), "w+");
|
file_out = fopen (fileName.Data(), "w+");
|
||||||
|
|
|
@ -9,7 +9,9 @@ Other : 200 - 299
|
||||||
|
|
||||||
#define NCLOVER 36
|
#define NCLOVER 36
|
||||||
#define NBGO 9
|
#define NBGO 9
|
||||||
#define NOTHER 62
|
#define NOTHER 52
|
||||||
|
|
||||||
|
#define EVENT_BUILD_TIME 109 // 100 = 1 micro-second ; should be < L + G ~ 5.04 us (note 0.08 us scale factor in set file)
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9
|
// 0 1 2 3 4 5 6 7 8 9
|
||||||
int map[130] = { 0, 1, 2, 3, 100, 4, 5, 6, 7, 101, // 0
|
int map[130] = { 0, 1, 2, 3, 100, 4, 5, 6, 7, 101, // 0
|
||||||
|
@ -23,6 +25,6 @@ int map[130] = { 0, 1, 2, 3, 100, 4, 5, 6, 7, 101, // 0
|
||||||
220, 221, 222, 223, 224, 225, 226, 227, 228, 229, // 80
|
220, 221, 222, 223, 224, 225, 226, 227, 228, 229, // 80
|
||||||
230, 231, 232, 233, 234, 235, 236, 237, 238, 239, // 90
|
230, 231, 232, 233, 234, 235, 236, 237, 238, 239, // 90
|
||||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, // 100
|
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, // 100
|
||||||
250, 251, 252, 253, 254, 255, 256, 257, 258, 259, // 110
|
250, 251, -1, -1, -1, -1, -1, -1, -1, -1, // 110
|
||||||
260, 261, -1, -1, -1, -1, -1, -1, -1, -1}; // 120
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // 120
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,9 @@
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
|
/* */
|
||||||
|
/* Modified by Ryan From */
|
||||||
|
/* */
|
||||||
/* PXI SCAN CODE -- J.M. Allmond (ORNL) -- July 2016 */
|
/* PXI SCAN CODE -- J.M. Allmond (ORNL) -- July 2016 */
|
||||||
/* */
|
/* */
|
||||||
/* !unpak data from Pixie-16 digitizers, event build, */
|
|
||||||
/* !and create detctors and user defined spectra */
|
|
||||||
/* */
|
|
||||||
/* gcc -o pxi-scan pxi-scan.c */
|
|
||||||
/* ./pxi-scan -op datafile calibrationfile mapfile */
|
|
||||||
/* */
|
|
||||||
/* ..... calibration file optional */
|
|
||||||
/* ..... map file optional */
|
|
||||||
/* ..... u for update spectra */
|
|
||||||
/* ..... o for overwrite spectra */
|
|
||||||
/* ..... p for print realtime stats */
|
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -25,14 +17,7 @@
|
||||||
#include "TMath.h"
|
#include "TMath.h"
|
||||||
#include "TBenchmark.h"
|
#include "TBenchmark.h"
|
||||||
|
|
||||||
#define PRINT_CAL 1
|
|
||||||
#define PRINT_MAP 1
|
|
||||||
|
|
||||||
#define RAND ((float) rand() / ((unsigned int) RAND_MAX + 1)) // random number in interval (0,1)
|
#define RAND ((float) rand() / ((unsigned int) RAND_MAX + 1)) // random number in interval (0,1)
|
||||||
#define TRUE 1
|
|
||||||
#define FALSE 0
|
|
||||||
|
|
||||||
#define LINE_LENGTH 120
|
|
||||||
|
|
||||||
#define MAX_CRATES 2
|
#define MAX_CRATES 2
|
||||||
#define MAX_BOARDS_PER_CRATE 13
|
#define MAX_BOARDS_PER_CRATE 13
|
||||||
|
@ -44,8 +29,6 @@
|
||||||
#define HEADER_LENGTH 4 //unit = words with 4 bytes per word
|
#define HEADER_LENGTH 4 //unit = words with 4 bytes per word
|
||||||
#define MAX_SUB_LENGTH 2016 //unit = words with 4 bytes per word ; 2004 --> 40 micro-second trace + 4 word header
|
#define MAX_SUB_LENGTH 2016 //unit = words with 4 bytes per word ; 2004 --> 40 micro-second trace + 4 word header
|
||||||
|
|
||||||
#define EVENT_BUILD_TIME 109 // 100 = 1 micro-second ; should be < L + G ~ 5.04 us (note 0.08 us scale factor in set file)
|
|
||||||
|
|
||||||
#define RAWE_REBIN_FACTOR 2.0 // Rebin 32k pixie16 spectra to something smaller to fit better into 8k.
|
#define RAWE_REBIN_FACTOR 2.0 // Rebin 32k pixie16 spectra to something smaller to fit better into 8k.
|
||||||
|
|
||||||
#include "mapping.h"
|
#include "mapping.h"
|
||||||
|
@ -83,6 +66,9 @@ int mult[1][4096]={0};
|
||||||
|
|
||||||
int tdifid[MAX_ID][8192]={0};
|
int tdifid[MAX_ID][8192]={0};
|
||||||
|
|
||||||
|
/****
|
||||||
|
int overwrite = 1;
|
||||||
|
|
||||||
///////////////////////
|
///////////////////////
|
||||||
// Write 2-byte data //
|
// Write 2-byte data //
|
||||||
///////////////////////
|
///////////////////////
|
||||||
|
@ -161,7 +147,7 @@ void write_data4(char *filename, int *data, int xdim, int ydim, int overwrite) {
|
||||||
fwrite(data, sizeof(int)*xdim, ydim, FP);
|
fwrite(data, sizeof(int)*xdim, ydim, FP);
|
||||||
fclose(FP);
|
fclose(FP);
|
||||||
}
|
}
|
||||||
|
******/
|
||||||
|
|
||||||
///////////////////////////////////
|
///////////////////////////////////
|
||||||
// START OF MAIN FUNCTION //
|
// START OF MAIN FUNCTION //
|
||||||
|
@ -170,21 +156,10 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
int i=0, j=0, k=0;
|
int i=0, j=0, k=0;
|
||||||
float tempf=0;
|
float tempf=0;
|
||||||
int max1=0, min1=0;
|
|
||||||
int max2=0, min2=0;
|
|
||||||
int maxid1=-1, minid1=-1;
|
|
||||||
int maxid2=-1, minid2=-1;
|
|
||||||
div_t e_div;
|
div_t e_div;
|
||||||
lldiv_t lle_div;
|
lldiv_t lle_div;
|
||||||
|
|
||||||
int overwrite = 1;
|
|
||||||
|
|
||||||
double etrace0,etrace1,btrace0,btrace1;
|
|
||||||
double ptrace0,ptrace1,ttrace0,ttrace1,tautrace0,tautrace1;
|
|
||||||
int dbcount = 0;
|
|
||||||
long long int strace[500];
|
|
||||||
memset(strace, 0, sizeof(strace));
|
|
||||||
|
|
||||||
//temp buffer for each sub event
|
//temp buffer for each sub event
|
||||||
unsigned int sub[MAX_SUB_LENGTH];
|
unsigned int sub[MAX_SUB_LENGTH];
|
||||||
memset(sub, 0, sizeof(sub));
|
memset(sub, 0, sizeof(sub));
|
||||||
|
@ -217,6 +192,7 @@ int main(int argc, char **argv) {
|
||||||
printf(" our file : %s \n", outFileName.Data());
|
printf(" our file : %s \n", outFileName.Data());
|
||||||
|
|
||||||
printf(" number of detector channal: %d \n", MAX_ID);
|
printf(" number of detector channal: %d \n", MAX_ID);
|
||||||
|
printf("------------------------ Event building time window : %d tics = %d nsec \n", EVENT_BUILD_TIME, EVENT_BUILD_TIME*10);
|
||||||
|
|
||||||
TFile * outRootFile = new TFile(outFileName, "recreate");
|
TFile * outRootFile = new TFile(outFileName, "recreate");
|
||||||
outRootFile->cd();
|
outRootFile->cd();
|
||||||
|
|
94
process_run
Executable file
94
process_run
Executable file
|
@ -0,0 +1,94 @@
|
||||||
|
#1/bin/bash
|
||||||
|
|
||||||
|
if [ $# -eq 0 ] || [ $1 == "-help" ]; then
|
||||||
|
echo "$./process_run [Run Folder] [Time Sort] [EventBuild] [Analysis]"
|
||||||
|
echo " Run Folder = the name of run folder"
|
||||||
|
echo " Time Sort = 1/0/-1 || 1 = sort, 0 = not sort, -1 = force sort "
|
||||||
|
echo " EventBuild = 1/0/-1 || "
|
||||||
|
echo " Analysis = 1/0/-1 || "
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi;
|
||||||
|
|
||||||
|
RunFolder=$1
|
||||||
|
|
||||||
|
TimeSort=1
|
||||||
|
if [ $# -gt 1 ]; then TimeSort=$2; fi
|
||||||
|
EventBuild=1
|
||||||
|
if [ $# -gt 2 ]; then EventBuild=$3; fi
|
||||||
|
|
||||||
|
DIR=$(pwd)
|
||||||
|
|
||||||
|
|
||||||
|
RED='\033[1;31m'
|
||||||
|
YELLOW='\033[1;33m'
|
||||||
|
ORANGE='\033[0;33m'
|
||||||
|
GREEN='\033[1;32m'
|
||||||
|
BLUE='\033[0;34m'
|
||||||
|
Cyan='\033[0;36m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
cd $RunFolder
|
||||||
|
#ls -lhtr *.evt
|
||||||
|
fileList=$(ls *.evt)
|
||||||
|
numFile=$(ls -lhtr *.evt | wc -l)
|
||||||
|
count=0
|
||||||
|
|
||||||
|
for a in $fileList
|
||||||
|
do
|
||||||
|
count=$((${count}+1))
|
||||||
|
echo -e "$YELLOW>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ["$count"/"$numFile"]"
|
||||||
|
echo -e $a
|
||||||
|
echo -e "------------------------------------------$NC"
|
||||||
|
|
||||||
|
#............ 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`
|
||||||
|
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
|
||||||
|
else
|
||||||
|
echo "$a.to is generated after $a. skip."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif [ $TimeSort -eq 0 ]; then
|
||||||
|
echo "skipped time sort by user."
|
||||||
|
else
|
||||||
|
echo "force Time sort"
|
||||||
|
$DIR/pxi-time-order $a
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#............ check if *.root file exist, if yes, check timestamp, if timestamp is eariler, built
|
||||||
|
|
||||||
|
if [ $EventBuild -eq 1 ]; then
|
||||||
|
len=`echo $a | wc -c`
|
||||||
|
len=$(($len-5))
|
||||||
|
rootFile=${a:0:$len}".root"
|
||||||
|
isRootExist=`ls -1 $rootFile | wc -l`
|
||||||
|
if [ ${isRootExist} -gt 0 ]; then
|
||||||
|
echo "found $rootFile"
|
||||||
|
rootDateTime=`stat -c "%Z" $rootFile | sort -rn | head -1`
|
||||||
|
if [ ${toDateTime} -ge ${rootDateTime} ]; then
|
||||||
|
$DIR/pixie2root $a.to
|
||||||
|
else
|
||||||
|
echo "$rootFile is generated after $a.to skip."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
elif [ $TimeSort -eq 0 ]; then
|
||||||
|
echo "skipped event build by user."
|
||||||
|
else
|
||||||
|
echo "force event build"
|
||||||
|
$DIR/pixie2root $a.to
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
fileList=$(ls *.root)
|
||||||
|
|
||||||
|
|
||||||
|
cd $DIR
|
Loading…
Reference in New Issue
Block a user