added skip event in to2root

This commit is contained in:
Ryan Tang 2022-01-07 14:46:32 -05:00
parent 044ad47bd8
commit bd453a99e0
3 changed files with 257 additions and 114 deletions

View File

@ -34,6 +34,8 @@ TH2F * hcoin;
TH2F * hcrystalBGO; TH2F * hcrystalBGO;
TH1F * hTDiff;
///----- after calibration and BGO veto ///----- after calibration and BGO veto
TH2F * heCalVID; TH2F * heCalVID;
TH1F * heCal[NCRYSTAL]; TH1F * heCal[NCRYSTAL];
@ -58,6 +60,8 @@ void Analyzer::Begin(TTree * tree){
heVID = new TH2F("heVID", "e vs ID; det ID; e [ch]", NCRYSTAL, 0, NCRYSTAL, rawEnergyRange[1] - rawEnergyRange[0], rawEnergyRange[0], rawEnergyRange[1]); heVID = new TH2F("heVID", "e vs ID; det ID; e [ch]", NCRYSTAL, 0, NCRYSTAL, rawEnergyRange[1] - rawEnergyRange[0], rawEnergyRange[0], rawEnergyRange[1]);
heCalVID = new TH2F("heCalVID", Form("eCal vs ID (BGO veto > %.1f); det ID; Energy [keV]", BGO_threshold), NCRYSTAL, 0, NCRYSTAL, (energyRange[2] - energyRange[1])/energyRange[0], energyRange[1], energyRange[2]); heCalVID = new TH2F("heCalVID", Form("eCal vs ID (BGO veto > %.1f); det ID; Energy [keV]", BGO_threshold), NCRYSTAL, 0, NCRYSTAL, (energyRange[2] - energyRange[1])/energyRange[0], energyRange[1], energyRange[2]);
hTDiff = new TH1F("hTDiff", "data time different within an event; tick [10 ns]", 110, 0, 110);
heVID->SetNdivisions(-409, "X"); heVID->SetNdivisions(-409, "X");
heCalVID->SetNdivisions(-409, "X"); heCalVID->SetNdivisions(-409, "X");
@ -113,32 +117,39 @@ Bool_t Analyzer::Process(Long64_t entry){
for( int i = 0; i < NCRYSTAL; i++) eCal[i] = TMath::QuietNaN(); for( int i = 0; i < NCRYSTAL; i++) eCal[i] = TMath::QuietNaN();
///printf("---------------------------- %d \n", multi);
///=========== Looping data for the event ///=========== Looping data for the event
for( int i = 0; i < multi ; i ++){ for( int i = 0; i < multi ; i ++){
int id = detID[i];
///printf("%d %f %llu\n", id, e[i], e_t[i]);
//======== Fill raw data //======== Fill raw data
if( detID[i] < 100 ){ /// gamma data if( 0 <= id && id < NCRYSTAL ){ /// gamma data
heVID->Fill( detID[i], e[i]); heVID->Fill( id, e[i]);
he[detID[i]]->Fill(e[i]); he[id]->Fill(e[i]);
for ( int j = i + 1; j < multi; j++){ for ( int j = i + 1; j < multi; j++){
if( 100 <= detID[j] && detID[j] < 200 ) hcrystalBGO->Fill(detID[i], detID[j]-100); /// crystal - BGO coincident if( 100 <= detID[j] && detID[j] < 200 ) hcrystalBGO->Fill(id, detID[j]-100); /// crystal - BGO coincident
if( detID[j] < 100 ) hcoin->Fill(detID[i], detID[j]); /// crystal-crystal coincident if( detID[j] < 100 ) hcoin->Fill(id, detID[j]); /// crystal-crystal coincident
} }
} }
if ( 100 < detID[i] && detID[i] < 200 ){ /// BGO data if ( 100 < id && id < 200 ){ /// BGO data
} }
if ( i > 0 ) hTDiff->Fill( e_t[i] - e_t[0]);
//======== BGO veto //======== BGO veto
bool dropflag = false; bool dropflag = false;
if( detID[i] < 100 && multi > 1) { if( id < NCRYSTAL && multi > 1) {
for( int j = i + 1; j < multi; j++){ for( int j = i + 1; j < multi; j++){
if( detID[j] > 100 && (detID[j]-100)*4 < detID[i] && detID[i] < (detID[j]-100 +1)*4) { if( detID[j] >= 100 && (detID[j]-100)*4 <= id && id < (detID[j]-100 +1)*4) {
dropflag = true; dropflag = true;
break; break;
} }
@ -146,27 +157,28 @@ Bool_t Analyzer::Process(Long64_t entry){
} }
if( dropflag ) return kTRUE; if( dropflag ) return kTRUE;
//========= apply correction
//int order = (int) eCorr[detID].size(); if( 0<= id && id < NCRYSTAL ) {
//for( int i = 0; i < order ; i++){
// eCal[detID] += eCorr[detID][i] * TMath::Power(e[detID], i);
//}
if( detID[i] < 100 ) {
if( e_corr == "" ){ if( e_corr == "" ){
eCal[detID[i]] = e[i]; eCal[id] = e[i];
}else{ }else{
eCal[detID[i]] = eCorr[detID[i]][0] + eCorr[detID[i]][1] * e[i]; ///========= apply correction
int order = (int) eCorr[id].size();
eCal[id] = 0;
for( int k = 0; k < order ; k++){
eCal[id] += eCorr[id][k] * TMath::Power(e[i], k);
}
} }
heCalVID->Fill( detID[i], eCal[detID[i]]); heCalVID->Fill( id, eCal[id]);
heCal[detID[i]]->Fill(eCal[detID[i]]); heCal[id]->Fill(eCal[id]);
for ( int j = i + 1; j < multi; j++){ for ( int j = i + 1; j < multi; j++){
if( 100 <= detID[j] && detID[j] < 200 ) hcrystalBGO_G->Fill(detID[i], detID[j]-100); /// crystal - BGO coincident if( 100 <= detID[j] && detID[j] < 200 ) hcrystalBGO_G->Fill(id, detID[j]-100); /// crystal - BGO coincident
} }
} }
} }

View File

@ -31,8 +31,6 @@
#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.
#define MAXMULTI 100
#include "../mapping.h" #include "../mapping.h"
///////////////////// /////////////////////
@ -80,38 +78,49 @@ int main(int argc, char **argv) {
printf("=====================================\n"); printf("=====================================\n");
// Check that the corrent number of arguments were provided. // Check that the corrent number of arguments were provided.
if (argc != 2 && argc != 3 ) { if (argc != 2 && argc != 3 && argc != 4 && argc != 5) {
printf("Incorrect number of arguments:\n"); printf("Incorrect number of arguments:\n");
printf("%s [*.to File] [timeWindow] \n", argv[0]); printf("%s [*.to File] <timeWindow> <fraction> <saveFile>\n", argv[0]);
printf(" timeWindow : number of tick, 1 tick = 10 ns. default = 100 \n"); printf(" timeWindow : number of tick, 1 tick = 10 ns. default = 100 \n");
printf(" fraction : 0 to 100, default 100, last fraction of evt.to to root \n");
printf(" e.g. 10, last 10%% of the evt.to to root \n");
printf(" saveFile : default is replace evt.to with root \n");
return 1; return 1;
} }
//CERN ROOT things //CERN ROOT things
TString inFileName = argv[1]; TString inFileName = argv[1];
TString outFileName = inFileName;
int timeWindow = 100; int timeWindow = 100;
if( argc >= 3 ) timeWindow = atoi(argv[2]); if( argc >= 3 ) timeWindow = atoi(argv[2]);
int frac = 100;
if( argc >= 4 ) frac = abs(atoi(argv[3]));
TString outFileName = inFileName;
outFileName.Remove(inFileName.First('.')); outFileName.Remove(inFileName.First('.'));
outFileName.Append(".root"); outFileName.Append(".root");
int pos = inFileName.Last('/');
outFileName.Remove(0, pos+1);
if( argc >= 5) outFileName = argv[4];
printf(" in file : %s \n", inFileName.Data()); printf(" in file : %s \n", inFileName.Data());
printf(" our file : %s \n", outFileName.Data()); printf(" our file : \033[1;31m%s\033[m\n", outFileName.Data());
printf(" max number of detector channal: %d \n", MAX_ID); printf(" max number of detector channal: %d \n", MAX_ID);
printf(" Skipping the frist \033[0;34m %d %% \033[m of data \n", 100 - frac);
printf("------------------------ Event building time window : %d tics = %d nsec \n", timeWindow, timeWindow*10); printf("------------------------ Event building time window : %d tics = %d nsec \n", timeWindow, timeWindow*10);
TFile * outRootFile = new TFile(outFileName, "recreate"); TFile * outRootFile = new TFile(outFileName, "recreate");
outRootFile->cd(); outRootFile->cd();
TTree * tree = new TTree("tree", "tree"); TTree * tree = new TTree("tree", "tree");
unsigned long long evID = 0; unsigned long long evID = 0;
int multi = 0; int multi = 0;
int id[MAXMULTI] = {0}; int id[MAX_ID] = {0};
double e[MAXMULTI] = {TMath::QuietNaN()}; double e[MAX_ID] = {TMath::QuietNaN()};
unsigned long long e_t[MAXMULTI] = {0}; unsigned long long e_t[MAX_ID] = {0};
Int_t multiCry = 0 ; /// this is total multiplicity for all crystal Int_t multiCry = 0 ; /// this is total multiplicity for all crystal
//unsigned short pileup[MAXMULTI]; //unsigned short pileup[MAXMULTI];
@ -144,7 +153,7 @@ int main(int argc, char **argv) {
///////////////////// /////////////////////
// MAIN WHILE LOOP // // MAIN WHILE LOOP //
///////////////////// /////////////////////
while (1) { //main while loop while (!feof(fpr)) { //main while loop
///////////////////////////////// /////////////////////////////////
// UNPACK DATA AND EVENT BUILD // // UNPACK DATA AND EVENT BUILD //
@ -152,18 +161,24 @@ int main(int argc, char **argv) {
long long int etime = -1; long long int etime = -1;
long long int tdif = -1; long long int tdif = -1;
int sevtmult=0;
while (1) { //get subevents and event build for one "event" while (1) { //get subevents and event build for one "event"
if (fread(sub, sizeof(int)*HEADER_LENGTH, 1, fpr) != 1) break; if (fread(sub, sizeof(int)*HEADER_LENGTH, 1, fpr) != 1) break;
fprpos = ftell(fpr);
if ( fprpos < fprsize * ( 1. - frac/100.) ) {
//printf("%ld / %ld \n", fprpos, fprsize);
data.elen = (sub[0] & 0x7FFE0000) >> 17;
fseek(fpr, sizeof(int)*(data.elen - HEADER_LENGTH), SEEK_CUR);
continue;
}
data.chn = sub[0] & 0xF; /// channel in digitizer data.chn = sub[0] & 0xF; /// channel in digitizer
data.sln = (sub[0] & 0xF0) >> 4; /// digitizer ID data.sln = (sub[0] & 0xF0) >> 4; /// digitizer ID
data.crn = (sub[0] & 0xF00) >> 8; /// crate data.crn = (sub[0] & 0xF00) >> 8; /// crate
data.id = data.crn*MAX_BOARDS_PER_CRATE*MAX_CHANNELS_PER_BOARD + (data.sln-BOARD_START)*MAX_CHANNELS_PER_BOARD + data.chn; data.id = data.crn*MAX_BOARDS_PER_CRATE*MAX_CHANNELS_PER_BOARD + (data.sln-BOARD_START)*MAX_CHANNELS_PER_BOARD + data.chn;
data.hlen = (sub[0] & 0x1F000) >> 12; data.hlen = (sub[0] & 0x1F000) >> 12;
data.elen = (sub[0] & 0x7FFE0000) >> 17; data.elen = (sub[0] & 0x7FFE0000) >> 17;
data.fcode = (sub[0] & 0x80000000) >> 31; data.fcode = (sub[0] & 0x80000000) >> 31;
data.time = ( (long long int)(sub[2] & 0xFFFF) << 32) + sub[1]; data.time = ( (long long int)(sub[2] & 0xFFFF) << 32) + sub[1];
data.ctime = (sub[2] & 0x7FFF0000) >> 16; data.ctime = (sub[2] & 0x7FFF0000) >> 16;
@ -175,11 +190,11 @@ int main(int argc, char **argv) {
tempf = (float)data.e/RAWE_REBIN_FACTOR;// + RAND; tempf = (float)data.e/RAWE_REBIN_FACTOR;// + RAND;
data.e = (int)tempf; data.e = (int)tempf;
//Set reference time for event building //Set reference time for event building
if (etime == -1) { if (etime == -1) {
etime = data.time; etime = data.time;
tdif = 0; tdif = 0;
multi = 0; multi = 0;
}else { }else {
tdif = data.time - etime; tdif = data.time - etime;
@ -204,11 +219,11 @@ int main(int argc, char **argv) {
pileUpCount++; pileUpCount++;
} }
//more data than just the header; read entire sub event, first rewind, then read data.elen //more data than just the header; read entire sub event, first rewind, then read data.elen
fseek(fpr, -sizeof(int)*HEADER_LENGTH, SEEK_CUR); fseek(fpr, -sizeof(int)*HEADER_LENGTH, SEEK_CUR);
//if (fread(sub, sizeof(int)*dataBlock[sevtmult].elen, 1, fpr) != 1) break; //if (fread(sub, sizeof(int)*dataBlock[sevtmult].elen, 1, fpr) != 1) break;
if (fread(sub, sizeof(int)*data.elen, 1, fpr) != 1) break; if (fread(sub, sizeof(int)*data.elen, 1, fpr) != 1) break;
/** /**
//trace //trace
@ -268,7 +283,6 @@ int main(int argc, char **argv) {
printf("Total dataBlock: \x1B[32m%llu \x1B[31m(%d%% pileup)\x1B[0m\nTotal Events: \x1B[32m%llu (%.1f <mult>)\x1B[0m\nPercent Complete: \x1B[32m%ld%% of %.3f GB\x1B[0m\nTime used:%3.0f min %5.2f sec\033[3A\r", printf("Total dataBlock: \x1B[32m%llu \x1B[31m(%d%% pileup)\x1B[0m\nTotal Events: \x1B[32m%llu (%.1f <mult>)\x1B[0m\nPercent Complete: \x1B[32m%ld%% of %.3f GB\x1B[0m\nTime used:%3.0f min %5.2f sec\033[3A\r",
dataCount, (int)((100*pileUpCount)/dataCount), evID+1, (float)dataCount/((float)evID+1), (100*fprpos/fprsize), tempf, TMath::Floor(time/60.), time - TMath::Floor(time/60.)*60.); dataCount, (int)((100*pileUpCount)/dataCount), evID+1, (float)dataCount/((float)evID+1), (100*fprpos/fprsize), tempf, TMath::Floor(time/60.), time - TMath::Floor(time/60.)*60.);
} }
outRootFile->cd(); outRootFile->cd();
tree->Fill(); tree->Fill();

View File

@ -1,22 +1,32 @@
#!/bin/bash #!/bin/bash
DIR=$(pwd) DIR=$(pwd)
DATA_DIR=data
TIMEWINDOW=100 TIMEWINDOW=100
Method=1 #1 : evt -> evt.to -> root , 2 : evt -> _raw.root -> root
if [ $Method -eq 1 ]; then
DATA_DIR=.
else
DATA_DIR=data
fi
if [ $# -eq 0 ] || [ $1 == "-help" ]; then if [ $# -eq 0 ] || [ $1 == "-help" ]; then
echo "$./process_run [Run Folder] [Merge] [BuildEvents] [Analysis]" echo "$./process_run [RunFile] [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 " BuildEvents = 1/0/-1 || " echo " BuildEvents = 1/0/-1 || if |x| > 1, take last x %, e.g. 10, last 10 %"
echo " Analysis = 1/0/-1 || " echo " Analysis = 1/0/-1 || "
echo "" echo ""
ls -l --color $DATA_DIR/ if [ $Method -eq 1 ]; then
ls -l --color $DATA_DIR/
fi
exit 1 exit 1
fi; fi;
RunFile=$1
RunFolder=$1 RunFolder=$1
isMerge=1 isMerge=1
@ -34,85 +44,192 @@ BLUE='\033[0;34m'
Cyan='\033[0;36m' Cyan='\033[0;36m'
NC='\033[0m' NC='\033[0m'
if [ -f $DATA_DIR/$RunFolder/*.evt ]; then ################################### method 1 evt -> evt.to -> root
echo -e "found evt files." if [ $Method -eq 1 ]; then
else
echo -e "cannot found any evt files in $DATA_DIR/$RunFolder/. Abort."
exit
fi
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Merge evt files to ${RunFolder}_raw.root $NC"
if [ $isMerge -eq 1 ]; then
# check is ${RunFolder}"_raw.root" exist
if [ -f ${RunFolder}_raw.root ]; then #_raw.root exist
#check evt DateTime
evtDateTime=`stat -c "%Z" $DATA_DIR/$RunFolder/*.evt | sort -rn | head -1`
rawRootDateTime=`stat -c "%Z" ${RunFolder}"_raw.root" | sort -rn | head -1`
if [ $evtDateTime -gt $rawRootDateTime ]; then #if evt file is newer
./armory/MergeEVT ${RunFolder}"_raw.root" `ls ${DATA_DIR}/${RunFolder}/*.evt`
else
echo "there is no newer evt files"
fi
if [ -f $RunFile ]; then
echo -e "found evt files. "${RunFile}
else else
echo -e "!!!!! cannot found evt files ${RunFile}. Abort."
./armory/MergeEVT ${RunFolder}"_raw.root" `ls ${DATA_DIR}/${RunFolder}/*.evt` exit
fi fi
fi
pos=`expr index "${RunFile}" /`
if [ $isMerge -eq 0 ]; then temp=${RunFile:pos}
echo -e "$YELLOW skipped by user $NC" pos=`expr index "${temp}" /`
fi toFile=${temp:pos}".to"
pos=`expr index "${toFile}" .`
if [ $isMerge -eq -1 ]; then rootFile=${toFile:0:pos}"root"
echo -e "$YELLOW forced by user $NC"
./armory/MergeEVT ${RunFolder}"_raw.root" `ls ${DATA_DIR}/${RunFolder}/*.evt` #echo ${RunFile}
fi #echo ${toFile}
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Merge finished$NC" #echo ${rootFile}
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Time sort evt to evt.to $NC"
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Build Events$NC" if [ $isMerge -eq 1 ]; then
if [ ${isBuildEvents} -eq 1 ]; then if [ -f ${toFile} ]; then #_raw.root exist
#check evt DateTime
if [ -f ${RunFolder}.root ]; then # root exist evtDateTime=`stat -c "%Z" ${RunFile} | sort -rn | head -1`
rawRootDateTime=`stat -c "%Z" ${RunFolder}"_raw.root" | sort -rn | head -1` toDateTime=`stat -c "%Z" ${toFile} | sort -rn | head -1`
rootDateTime=`stat -c "%Z" ${RunFolder}".root" | sort -rn | head -1` if [ $evtDateTime -gt $toDateTime ]; then #if evt file is newer
./armory/pxi-time-order ${RunFile}
if [ ${rawRootDateTime} -gt ${rootDateTime} ]; then echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Time sort finished$NC"
./armory/EventBuilder ${RunFolder}"_raw.root" $TIMEWINDOW else
echo "there is no newer evt files"
fi
else else
echo -e "${RunFolder}.root is up-to-date." ./armory/pxi-time-order ${RunFile}
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Time sort finished$NC"
fi fi
fi
if [ $isMerge -eq 0 ]; then
echo -e "$YELLOW skipped by user $NC"
fi
if [ $isMerge -eq -1 ]; then
echo -e "$YELLOW forced by user $NC"
./armory/pxi-time-order ${RunFile}
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Time sort finished$NC"
fi
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Build Events $NC"
if [ ${isBuildEvents} -ge 1 ]; then
if [ -f ${rootFolder} ]; then # root exist
toDateTime=`stat -c "%Z" ${toFolder} | sort -rn | head -1`
rootDateTime=`stat -c "%Z" ${rootFolder} | sort -rn | head -1`
if [ ${toDateTime} -gt ${rootDateTime} ]; then
if [ ${isBuildEvents} -gt 1 ]; then
./armory/to2root ${toFile} $TIMEWINDOW ${isBuildEvents}
else
./armory/to2root ${toFile} $TIMEWINDOW
fi
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Build Events finsihed.$NC"
else
echo -e "${rootFile} is up-to-date."
fi
else
./armory/to2root ${toFile} $TIMEWINDOW
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Build Events finsihed.$NC"
fi
fi
if [ ${isBuildEvents} -eq 0 ]; then
echo -e "$YELLOW skipped by user $NC"
fi
if [ ${isBuildEvents} -le -1 ]; then
echo -e "$YELLOW forced by user $NC"
if [ ${isBuildEvents} -lt 1 ]; then
./armory/to2root ${toFile} $TIMEWINDOW ${isBuildEvents}
else
./armory/to2root ${toFile} $TIMEWINDOW
fi
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Build Events finsihed.$NC"
fi
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Analysis $NC"
if [ ${isAnalysis} -eq 1 ]; then
root -l "process_run.c(\"${rootFile}\")"
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(\"${rootFile}\")"
fi
fi
################################### method 2 evt -> _raw.root -> root
if [ $Method -eq 2 ]; then
if [ -f $DATA_DIR/$RunFolder/*.evt ]; then
echo -e "found evt files."
else else
./armory/EventBuilder ${RunFolder}"_raw.root" $TIMEWINDOW echo -e "cannot found any evt files in $DATA_DIR/$RunFolder/. Abort."
fi exit
fi
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Merge evt files to ${RunFolder}_raw.root $NC"
if [ $isMerge -eq 1 ]; then
# check is ${RunFolder}"_raw.root" exist
if [ -f ${RunFolder}_raw.root ]; then #_raw.root exist
#check evt DateTime
evtDateTime=`stat -c "%Z" $DATA_DIR/$RunFolder/*.evt | sort -rn | head -1`
rawRootDateTime=`stat -c "%Z" ${RunFolder}"_raw.root" | sort -rn | head -1`
if [ $evtDateTime -gt $rawRootDateTime ]; then #if evt file is newer
./armory/MergeEVT ${RunFolder}"_raw.root" `ls ${DATA_DIR}/${RunFolder}/*.evt`
else
echo "there is no newer evt files"
fi
else
./armory/MergeEVT ${RunFolder}"_raw.root" `ls ${DATA_DIR}/${RunFolder}/*.evt`
fi
fi
if [ $isMerge -eq 0 ]; then
echo -e "$YELLOW skipped by user $NC"
fi
if [ $isMerge -eq -1 ]; then
echo -e "$YELLOW forced by user $NC"
./armory/MergeEVT ${RunFolder}"_raw.root" `ls ${DATA_DIR}/${RunFolder}/*.evt`
fi
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Merge finished$NC"
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Build Events$NC"
if [ ${isBuildEvents} -eq 1 ]; then
if [ -f ${RunFolder}.root ]; then # root exist
rawRootDateTime=`stat -c "%Z" ${RunFolder}"_raw.root" | sort -rn | head -1`
rootDateTime=`stat -c "%Z" ${RunFolder}".root" | sort -rn | head -1`
if [ ${rawRootDateTime} -gt ${rootDateTime} ]; then
./armory/EventBuilder ${RunFolder}"_raw.root" $TIMEWINDOW
else
echo -e "${RunFolder}.root is up-to-date."
fi
else
./armory/EventBuilder ${RunFolder}"_raw.root" $TIMEWINDOW
fi
fi
if [ ${isBuildEvents} -eq 0 ]; then
echo -e "$YELLOW skipped by user $NC"
fi
if [ ${isBuildEvents} -eq -1 ]; then
echo -e "$YELLOW forced by user $NC"
./armory/EventBuilder ${RunFolder}"_raw.root" $TIMEWINDOW
fi
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Build Events finsihed.$NC"
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Analysis $NC"
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\")"
fi
fi fi
if [ ${isBuildEvents} -eq 0 ]; then
echo -e "$YELLOW skipped by user $NC"
fi
if [ ${isBuildEvents} -eq -1 ]; then
echo -e "$YELLOW forced by user $NC"
./armory/EventBuilder ${RunFolder}"_raw.root" $TIMEWINDOW
fi
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Build Events finsihed.$NC"
echo -e "$RED>>> `date` >>>>>>>>>>>>>>>>>>>>>>> Analysis $NC"
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\")"
fi