some bug fix?

This commit is contained in:
Ryan Tang 2022-01-06 19:58:39 -05:00
parent d2d7a66396
commit c13738e699
4 changed files with 22 additions and 15 deletions

1
.gitignore vendored
View File

@ -22,5 +22,6 @@ ti74pt7a
fsu_run_2021 fsu_run_2021
data data
Data Data
obsolete
test.cpp test.cpp

View File

@ -58,7 +58,9 @@ int main(int argn, char **argv){
Long64_t totnumEntry = tree->GetEntries(); 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"); printf(">>> Buidling Index using the timestamp\n");
tree->BuildIndex("e_t"); tree->BuildIndex("e_t");
@ -68,13 +70,12 @@ int main(int argn, char **argv){
ULong64_t time0; //time-0 for each event ULong64_t time0; //time-0 for each event
int timeDiff; int timeDiff;
TString outFileName = inFileName; TString outFileName = inFileName;
outFileName.Remove(inFileName.First("_raw")); outFileName.Remove(inFileName.First("_raw"));
outFileName.Append(".root"); outFileName.Append(".root");
if( argn >=4 ) outFileName = argv[3]; 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"); printf(">>> Create output tree\n");
TFile * saveFile = new TFile(outFileName, "recreate"); TFile * saveFile = new TFile(outFileName, "recreate");
@ -82,7 +83,7 @@ int main(int argn, char **argv){
TTree * newtree = new TTree("tree", "tree"); TTree * newtree = new TTree("tree", "tree");
Int_t multi = 0; /// this is total multipicilty for all detectors 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 ; Int_t eventID = 0 ;
newtree->Branch("evID", &eventID, "event_ID/l"); newtree->Branch("evID", &eventID, "event_ID/l");
@ -93,9 +94,9 @@ int main(int argn, char **argv){
int id[MAXMULTI]; int id[MAXMULTI];
double e[MAXMULTI]; double e[MAXMULTI];
ULong64_t e_t[MAXMULTI]; ULong64_t e_t[MAXMULTI];
newtree->Branch("id", id, "id[multipiclity]/I" ); newtree->Branch("id", id, "id[multi]/I" );
newtree->Branch("e", e, "e[multipiclity]/D" ); newtree->Branch("e", e, "e[multi]/D" );
newtree->Branch("e_t", e_t, "e_timestamp[multipiclity]/l"); newtree->Branch("e_t", e_t, "e_timestamp[multi]/l");
printf("================== Start processing....\n"); printf("================== Start processing....\n");
Float_t Frac = 0.1; ///Progress bar Float_t Frac = 0.1; ///Progress bar
@ -117,9 +118,9 @@ int main(int argn, char **argv){
entry = index[entry]; entry = index[entry];
b_ID->GetEntry(entry); b_ID->GetEntry(entry, 0);
b_energy->GetEntry(entry); b_energy->GetEntry(entry, 0);
b_energy_timestamp->GetEntry(entry); b_energy_timestamp->GetEntry(entry, 0);
if( time0 == 0) { if( time0 == 0) {
time0 = energy_t; time0 = energy_t;
@ -127,7 +128,6 @@ int main(int argn, char **argv){
} }
timeDiff = (int) (energy_t - time0); timeDiff = (int) (energy_t - time0);
if( timeDiff < timeWindow ) { if( timeDiff < timeWindow ) {
id[multi] = detID; id[multi] = detID;

View File

@ -4,7 +4,7 @@ CC=g++
#all: xia2root xia2ev2_nopart pixie2root scan evt2root evt2hist #all: xia2root xia2ev2_nopart pixie2root scan evt2root evt2hist
#all: xia2root to2root MergeEVT evt2hist pxi-time-order ev22txt EventBuilder #all: xia2root to2root MergeEVT evt2hist pxi-time-order ev22txt EventBuilder
#all: xia2root to2root MergeEVT 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 #this is FSU evt to root
xia2root: ../armory/xia2root.cpp xia2root: ../armory/xia2root.cpp

View File

@ -6,12 +6,14 @@ DATA_DIR=data
TIMEWINDOW=100 TIMEWINDOW=100
if [ $# -eq 0 ] || [ $1 == "-help" ]; then 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 " Run Folder = the name of run folder"
echo " Merge = 1/0/-1 || 1 = merge, 0 = not merge, -1 = force merge " 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 " Analysis = 1/0/-1 || "
echo "" echo ""
ls -l --color $DATA_DIR/
exit 1 exit 1
fi; fi;
@ -35,7 +37,7 @@ NC='\033[0m'
if [ -f $DATA_DIR/$RunFolder/*.evt ]; then if [ -f $DATA_DIR/$RunFolder/*.evt ]; then
echo -e "found evt files." echo -e "found evt files."
else else
echo -e "cannot found any evt files. Abort." echo -e "cannot found any evt files in $DATA_DIR/$RunFolder/. Abort."
exit exit
fi fi
@ -105,6 +107,10 @@ if [ ${isAnalysis} -eq 1 ]; then
root -l "process_run.c(\"${RunFolder}.root\")" root -l "process_run.c(\"${RunFolder}.root\")"
fi fi
if [ ${isAnalysis} -eq 0 ]; then
echo -e "$YELLOW skipped by user $NC"
fi
if [ ${isAnalysis} -eq -1 ]; then if [ ${isAnalysis} -eq -1 ]; then
echo -e "$YELLOW forced by user $NC" echo -e "$YELLOW forced by user $NC"
root -l "process_run.c(\"${RunFolder}.root\")" root -l "process_run.c(\"${RunFolder}.root\")"