From c13738e699396c3e041d311eceb7de91fb1a3f81 Mon Sep 17 00:00:00 2001 From: "Ryan@WorkStation" Date: Thu, 6 Jan 2022 19:58:39 -0500 Subject: [PATCH] some bug fix? --- .gitignore | 1 + armory/EventBuilder.cpp | 22 +++++++++++----------- armory/makefile | 2 +- process_run | 12 +++++++++--- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 6e6afe6..e561c56 100644 --- a/.gitignore +++ b/.gitignore @@ -22,5 +22,6 @@ ti74pt7a fsu_run_2021 data Data +obsolete test.cpp diff --git a/armory/EventBuilder.cpp b/armory/EventBuilder.cpp index 96add19..af121af 100644 --- a/armory/EventBuilder.cpp +++ b/armory/EventBuilder.cpp @@ -58,7 +58,9 @@ int main(int argn, char **argv){ Long64_t totnumEntry = tree->GetEntries(); - printf( "total Entry : %lld \n", totnumEntry); + printf(" total Entry : %lld \n", totnumEntry); + + printf(" event Build window: %d tick = %d nsec \n", timeWindow, timeWindow * 10); printf(">>> Buidling Index using the timestamp\n"); tree->BuildIndex("e_t"); @@ -67,14 +69,13 @@ int main(int argn, char **argv){ ULong64_t time0; //time-0 for each event int timeDiff; - TString outFileName = inFileName; outFileName.Remove(inFileName.First("_raw")); outFileName.Append(".root"); if( argn >=4 ) outFileName = argv[3]; - printf(">>> out File name : %s\n", outFileName.Data()); + printf(">>> out File name : \033[1,31m%s\033[m\n", outFileName.Data()); printf(">>> Create output tree\n"); TFile * saveFile = new TFile(outFileName, "recreate"); @@ -82,7 +83,7 @@ int main(int argn, char **argv){ TTree * newtree = new TTree("tree", "tree"); Int_t multi = 0; /// this is total multipicilty for all detectors - newtree->Branch("multi", &multi, "multipiclity/I"); + newtree->Branch("multi", &multi, "multi/I"); Int_t eventID = 0 ; newtree->Branch("evID", &eventID, "event_ID/l"); @@ -93,9 +94,9 @@ int main(int argn, char **argv){ int id[MAXMULTI]; double e[MAXMULTI]; ULong64_t e_t[MAXMULTI]; - newtree->Branch("id", id, "id[multipiclity]/I" ); - newtree->Branch("e", e, "e[multipiclity]/D" ); - newtree->Branch("e_t", e_t, "e_timestamp[multipiclity]/l"); + newtree->Branch("id", id, "id[multi]/I" ); + newtree->Branch("e", e, "e[multi]/D" ); + newtree->Branch("e_t", e_t, "e_timestamp[multi]/l"); printf("================== Start processing....\n"); Float_t Frac = 0.1; ///Progress bar @@ -117,9 +118,9 @@ int main(int argn, char **argv){ entry = index[entry]; - b_ID->GetEntry(entry); - b_energy->GetEntry(entry); - b_energy_timestamp->GetEntry(entry); + b_ID->GetEntry(entry, 0); + b_energy->GetEntry(entry, 0); + b_energy_timestamp->GetEntry(entry, 0); if( time0 == 0) { time0 = energy_t; @@ -127,7 +128,6 @@ int main(int argn, char **argv){ } timeDiff = (int) (energy_t - time0); - if( timeDiff < timeWindow ) { id[multi] = detID; diff --git a/armory/makefile b/armory/makefile index c66592e..bba2edb 100644 --- a/armory/makefile +++ b/armory/makefile @@ -4,7 +4,7 @@ CC=g++ #all: xia2root xia2ev2_nopart pixie2root scan evt2root evt2hist #all: xia2root to2root MergeEVT evt2hist pxi-time-order ev22txt EventBuilder #all: xia2root to2root MergeEVT pxi-time-order ev22txt EventBuilder -all: to2root MergeEVT ev22txt EventBuilder pxi-time-order EventBuilder2 +all: to2root MergeEVT ev22txt EventBuilder pxi-time-order #this is FSU evt to root xia2root: ../armory/xia2root.cpp diff --git a/process_run b/process_run index c21d138..6869df8 100755 --- a/process_run +++ b/process_run @@ -6,12 +6,14 @@ DATA_DIR=data TIMEWINDOW=100 if [ $# -eq 0 ] || [ $1 == "-help" ]; then - echo "$./process_run [Run Folder] [Merge] [isBuildEvents] [Analysis]" + echo "$./process_run [Run Folder] [Merge] [BuildEvents] [Analysis]" echo " Run Folder = the name of run folder" echo " Merge = 1/0/-1 || 1 = merge, 0 = not merge, -1 = force merge " - echo " isBuildEvents = 1/0/-1 || " + echo " BuildEvents = 1/0/-1 || " echo " Analysis = 1/0/-1 || " echo "" + + ls -l --color $DATA_DIR/ exit 1 fi; @@ -35,7 +37,7 @@ NC='\033[0m' if [ -f $DATA_DIR/$RunFolder/*.evt ]; then echo -e "found evt files." else - echo -e "cannot found any evt files. Abort." + echo -e "cannot found any evt files in $DATA_DIR/$RunFolder/. Abort." exit fi @@ -105,6 +107,10 @@ if [ ${isAnalysis} -eq 1 ]; then root -l "process_run.c(\"${RunFolder}.root\")" fi +if [ ${isAnalysis} -eq 0 ]; then + echo -e "$YELLOW skipped by user $NC" +fi + if [ ${isAnalysis} -eq -1 ]; then echo -e "$YELLOW forced by user $NC" root -l "process_run.c(\"${RunFolder}.root\")"