added Process_Download and Procee_Sort
This commit is contained in:
parent
c7623f2c45
commit
781363a13b
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,5 +1,4 @@
|
||||||
working/Logs
|
working/Logs
|
||||||
working/Settings
|
|
||||||
|
|
||||||
EventBuilder
|
EventBuilder
|
||||||
*.root
|
*.root
|
||||||
|
|
15
.vscode/c_cpp_properties.json
vendored
15
.vscode/c_cpp_properties.json
vendored
|
@ -1,5 +1,20 @@
|
||||||
{
|
{
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Mac",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**",
|
||||||
|
"/Applications/root-6.28.00/include/**"
|
||||||
|
],
|
||||||
|
"defines": [],
|
||||||
|
"macFrameworkPath": [
|
||||||
|
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
|
||||||
|
],
|
||||||
|
"compilerPath": "/usr/bin/g++",
|
||||||
|
"cStandard": "c17",
|
||||||
|
"cppStandard": "c++17",
|
||||||
|
"intelliSenseMode": "macos-gcc-arm64"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Linux",
|
"name": "Linux",
|
||||||
"includePath": [
|
"includePath": [
|
||||||
|
|
38
SOLARIS.sh
38
SOLARIS.sh
|
@ -1,4 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
#========== this script define the SOLARISANADIR as global env.
|
#========== this script define the SOLARISANADIR as global env.
|
||||||
|
|
||||||
unset SOLARISANADIR
|
unset SOLARISANADIR
|
||||||
|
@ -8,18 +8,8 @@ PCName=$(uname -n)
|
||||||
if [ $(uname -n) == "solaris-daq" ]; then
|
if [ $(uname -n) == "solaris-daq" ]; then
|
||||||
SOLARISANADIR=~/Analysis
|
SOLARISANADIR=~/Analysis
|
||||||
else
|
else
|
||||||
if [ $(pwd) == $HOME ]; then
|
ABSPATH=$(realpath ${SOURCE})
|
||||||
SOLARISANADIR=$(dirname ${SOURCE})
|
SOLARISANADIR=$(dirname ${ABSPATH})
|
||||||
|
|
||||||
if [[ ${SOLARISANADIR} == *"$HOME"* ]]; then
|
|
||||||
dummpy=0
|
|
||||||
else
|
|
||||||
SOLARISANADIR=${HOME}/$SOLARISANADIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
SOLARISANADIR=$(pwd)
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export SOLARISANADIR
|
export SOLARISANADIR
|
||||||
|
@ -33,4 +23,26 @@ echo "####### add ${SOLARISANADIR}/armory into PATH"
|
||||||
|
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
|
echo "####### Define BASH Alias / Functions for SOLARIS"
|
||||||
|
|
||||||
alias 2Working='cd ${SOLARISANADIR}/working'
|
alias 2Working='cd ${SOLARISANADIR}/working'
|
||||||
|
alias ShowRunTimeStamp='cat $SOLARISANADIR/data_raw/data/RunTimeStamp.dat'
|
||||||
|
|
||||||
|
function ShowRunSize {
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
echo 'Please set run number '
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
source $SOLARISANADIR/working/expName.sh
|
||||||
|
RUN=$1
|
||||||
|
if [ ${RUN} = "latest" ]; then
|
||||||
|
RUN=${runID}
|
||||||
|
fi
|
||||||
|
runLen=${#RUN}
|
||||||
|
if [ ${runLen} -eq 1 ]; then
|
||||||
|
RUN="00"${RUN}
|
||||||
|
elif [ ${runLen} -eq 2 ]; then
|
||||||
|
RUN="0"${RUN}
|
||||||
|
fi
|
||||||
|
du -hc $SOLARISANADIR/data_raw/data/${expName}_${RUN}_*.sol
|
||||||
|
}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
/home/solaris/SOLARIS_QT6_DAQ/Event.h
|
|
217
armory/Event.h
Normal file
217
armory/Event.h
Normal file
|
@ -0,0 +1,217 @@
|
||||||
|
#ifndef EVENT_H
|
||||||
|
#define EVENT_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#define MaxTraceLenght 8100
|
||||||
|
|
||||||
|
class Event {
|
||||||
|
public:
|
||||||
|
|
||||||
|
unsigned short dataType;
|
||||||
|
|
||||||
|
///============= for dpp-pha
|
||||||
|
uint8_t channel; // 6 bit
|
||||||
|
uint16_t energy; // 16 bit
|
||||||
|
uint64_t timestamp; // 48 bit
|
||||||
|
uint16_t fine_timestamp; // 16 bit
|
||||||
|
uint16_t flags_low_priority; // 12 bit
|
||||||
|
uint16_t flags_high_priority; // 8 bit
|
||||||
|
size_t traceLenght; // 64 bit
|
||||||
|
uint8_t downSampling; // 8 bit
|
||||||
|
bool board_fail;
|
||||||
|
bool flush;
|
||||||
|
uint8_t analog_probes_type[2]; // 3 bit
|
||||||
|
uint8_t digital_probes_type[4]; // 4 bit
|
||||||
|
int32_t * analog_probes[2]; // 18 bit
|
||||||
|
uint8_t * digital_probes[4]; // 1 bit
|
||||||
|
uint16_t trigger_threashold; // 16 bit
|
||||||
|
size_t event_size; // 64 bit
|
||||||
|
uint32_t aggCounter; // 32 bit
|
||||||
|
|
||||||
|
///============= for raw
|
||||||
|
uint8_t * data;
|
||||||
|
size_t dataSize; /// number of byte of the data, size/8 = word [64 bits]
|
||||||
|
uint32_t n_events;
|
||||||
|
|
||||||
|
bool isTraceAllZero;
|
||||||
|
|
||||||
|
Event(){
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
~Event(){
|
||||||
|
ClearMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Init(){
|
||||||
|
channel = 0;
|
||||||
|
energy = 0;
|
||||||
|
timestamp = 0;
|
||||||
|
fine_timestamp = 0;
|
||||||
|
downSampling = 0;
|
||||||
|
board_fail = false;
|
||||||
|
flush = false;
|
||||||
|
flags_low_priority = 0;
|
||||||
|
flags_high_priority = 0;
|
||||||
|
trigger_threashold = 0;
|
||||||
|
event_size = 0;
|
||||||
|
aggCounter = 0;
|
||||||
|
analog_probes[0] = NULL;
|
||||||
|
analog_probes[1] = NULL;
|
||||||
|
digital_probes[0] = NULL;
|
||||||
|
digital_probes[1] = NULL;
|
||||||
|
digital_probes[2] = NULL;
|
||||||
|
digital_probes[3] = NULL;
|
||||||
|
|
||||||
|
analog_probes_type[0] = 0xFF;
|
||||||
|
analog_probes_type[1] = 0xFF;
|
||||||
|
digital_probes_type[0] = 0xFF;
|
||||||
|
digital_probes_type[1] = 0xFF;
|
||||||
|
digital_probes_type[2] = 0xFF;
|
||||||
|
digital_probes_type[3] = 0xFF;
|
||||||
|
data = NULL;
|
||||||
|
|
||||||
|
isTraceAllZero = true; // indicate trace are all zero
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearMemory(){
|
||||||
|
if( data != NULL ) delete data;
|
||||||
|
|
||||||
|
if( analog_probes[0] != NULL) delete analog_probes[0];
|
||||||
|
if( analog_probes[1] != NULL) delete analog_probes[1];
|
||||||
|
|
||||||
|
if( digital_probes[0] != NULL) delete digital_probes[0];
|
||||||
|
if( digital_probes[1] != NULL) delete digital_probes[1];
|
||||||
|
if( digital_probes[2] != NULL) delete digital_probes[2];
|
||||||
|
if( digital_probes[3] != NULL) delete digital_probes[3];
|
||||||
|
|
||||||
|
isTraceAllZero = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetDataType(unsigned int type){
|
||||||
|
dataType = type;
|
||||||
|
ClearMemory();
|
||||||
|
|
||||||
|
if( dataType == 0xF){
|
||||||
|
data = new uint8_t[20*1024*1024];
|
||||||
|
}else{
|
||||||
|
analog_probes[0] = new int32_t[MaxTraceLenght];
|
||||||
|
analog_probes[1] = new int32_t[MaxTraceLenght];
|
||||||
|
|
||||||
|
digital_probes[0] = new uint8_t[MaxTraceLenght];
|
||||||
|
digital_probes[1] = new uint8_t[MaxTraceLenght];
|
||||||
|
digital_probes[2] = new uint8_t[MaxTraceLenght];
|
||||||
|
digital_probes[3] = new uint8_t[MaxTraceLenght];
|
||||||
|
|
||||||
|
isTraceAllZero = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClearTrace(){
|
||||||
|
if( isTraceAllZero ) return; // no need to clear again
|
||||||
|
|
||||||
|
for( int i = 0; i < MaxTraceLenght; i++){
|
||||||
|
analog_probes[0][i] = 0;
|
||||||
|
analog_probes[1][i] = 0;
|
||||||
|
|
||||||
|
digital_probes[0][i] = 0;
|
||||||
|
digital_probes[1][i] = 0;
|
||||||
|
digital_probes[2][i] = 0;
|
||||||
|
digital_probes[3][i] = 0;
|
||||||
|
}
|
||||||
|
isTraceAllZero = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrintEnergyTimeStamp(){
|
||||||
|
printf("ch: %2d, energy: %u, timestamp: %llu ch, traceLenght: %lu\n", channel, energy, timestamp, traceLenght);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AnaProbeType(uint8_t probeType){
|
||||||
|
switch(probeType){
|
||||||
|
case 0: return "ADC";
|
||||||
|
case 1: return "Time filter";
|
||||||
|
case 2: return "Energy filter";
|
||||||
|
default : return "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string DigiProbeType(uint8_t probeType){
|
||||||
|
switch(probeType){
|
||||||
|
case 0: return "Trigger";
|
||||||
|
case 1: return "Time filter armed";
|
||||||
|
case 2: return "Re-trigger guard";
|
||||||
|
case 3: return "Energy filter baseline freeze";
|
||||||
|
case 4: return "Energy filter peaking";
|
||||||
|
case 5: return "Energy filter peaking ready";
|
||||||
|
case 6: return "Energy filter pile-up guard";
|
||||||
|
case 7: return "Event pile-up";
|
||||||
|
case 8: return "ADC saturation";
|
||||||
|
case 9: return "ADC saturation protection";
|
||||||
|
case 10: return "Post-saturation event";
|
||||||
|
case 11: return "Energy filter saturation";
|
||||||
|
case 12: return "Signal inhibit";
|
||||||
|
default : return "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string HighPriority(uint16_t prio){
|
||||||
|
std::string output;
|
||||||
|
|
||||||
|
bool pileup = prio & 0x1;
|
||||||
|
//bool pileupGuard = (prio >> 1) & 0x1;
|
||||||
|
//bool eventSaturated = (prio >> 2) & 0x1;
|
||||||
|
//bool postSatEvent = (prio >> 3) & 0x1;
|
||||||
|
//bool trapSatEvent = (prio >> 4) & 0x1;
|
||||||
|
//bool SCA_Event = (prio >> 5) & 0x1;
|
||||||
|
|
||||||
|
output = std::string("Pile-up: ") + (pileup ? "Yes" : "No");
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO LowPriority
|
||||||
|
|
||||||
|
void PrintAll(){
|
||||||
|
printf("============= Type : %u\n", dataType);
|
||||||
|
printf("ch : %2d (0x%02X), fail: %d, flush: %d\n", channel, channel, board_fail, flush);
|
||||||
|
printf("energy: %u, timestamp: %llu, fine_timestamp: %u \n", energy, timestamp, fine_timestamp);
|
||||||
|
printf("flag (high): 0x%02X, (low): 0x%03X, traceLength: %lu\n", flags_high_priority, flags_low_priority, traceLenght);
|
||||||
|
printf("Agg counter : %u, trigger Thr.: %u, downSampling: %u \n", aggCounter, trigger_threashold, downSampling);
|
||||||
|
printf("AnaProbe Type: %s(%u), %s(%u)\n", AnaProbeType(analog_probes_type[0]).c_str(), analog_probes_type[0],
|
||||||
|
AnaProbeType(analog_probes_type[1]).c_str(), analog_probes_type[1]);
|
||||||
|
printf("DigProbe Type: %s(%u), %s(%u), %s(%u), %s(%u)\n", DigiProbeType(digital_probes_type[0]).c_str(), digital_probes_type[0],
|
||||||
|
DigiProbeType(digital_probes_type[1]).c_str(), digital_probes_type[1],
|
||||||
|
DigiProbeType(digital_probes_type[2]).c_str(), digital_probes_type[2],
|
||||||
|
DigiProbeType(digital_probes_type[3]).c_str(), digital_probes_type[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrintTrace(unsigned short ID){
|
||||||
|
for(unsigned short i = 0; i < (unsigned short)traceLenght; i++){
|
||||||
|
if( ID == 0 ) printf("%4d| %6d\n", i, analog_probes[0][i]);
|
||||||
|
if( ID == 1 ) printf("%4d| %6d\n", i, analog_probes[1][i]);
|
||||||
|
if( ID == 2 ) printf("%4d| %u\n", i, digital_probes[0][i]);
|
||||||
|
if( ID == 3 ) printf("%4d| %u\n", i, digital_probes[1][i]);
|
||||||
|
if( ID == 4 ) printf("%4d| %u\n", i, digital_probes[2][i]);
|
||||||
|
if( ID == 5 ) printf("%4d| %u\n", i, digital_probes[3][i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrintAllTrace(){
|
||||||
|
for(unsigned short i = 0; i < (unsigned short)traceLenght; i++){
|
||||||
|
printf("%4d| %6d %6d %1d %1d %1d %1d\n", i, analog_probes[0][i],
|
||||||
|
analog_probes[1][i],
|
||||||
|
digital_probes[0][i],
|
||||||
|
digital_probes[1][i],
|
||||||
|
digital_probes[2][i],
|
||||||
|
digital_probes[3][i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -89,6 +89,10 @@ int main(int argc, char ** argv){
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for( int i = 0; i < argc; i++){
|
||||||
|
// printf("%d | %s\n", i, argv[i]);
|
||||||
|
// }
|
||||||
|
|
||||||
TString outFileName = argv[1];
|
TString outFileName = argv[1];
|
||||||
int timeWindow = atoi(argv[2]);
|
int timeWindow = atoi(argv[2]);
|
||||||
const bool saveTrace = atoi(argv[3]);
|
const bool saveTrace = atoi(argv[3]);
|
||||||
|
|
|
@ -87,11 +87,13 @@ void GeneralSort::Terminate(){
|
||||||
DecodeOption();
|
DecodeOption();
|
||||||
|
|
||||||
if( !isParallel){
|
if( !isParallel){
|
||||||
|
printf("%s::SaveTree %p, %p\n", __func__, saveFile, newTree);
|
||||||
saveFile->cd();
|
saveFile->cd();
|
||||||
newTree->Write();
|
newTree->Write();
|
||||||
saveFile->Close();
|
saveFile->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("=======================================================\n");
|
||||||
//get entries
|
//get entries
|
||||||
saveFile = TFile::Open(saveFileName);
|
saveFile = TFile::Open(saveFileName);
|
||||||
if( saveFile->IsOpen() ){
|
if( saveFile->IsOpen() ){
|
||||||
|
@ -115,6 +117,7 @@ void GeneralSort::Begin(TTree * tree){
|
||||||
|
|
||||||
PrintMapping(mapping, detTypeName, detMaxID);
|
PrintMapping(mapping, detTypeName, detMaxID);
|
||||||
|
|
||||||
|
tree->GetEntriesFast();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +131,7 @@ void GeneralSort::SlaveTerminate(){
|
||||||
printf("%s\n", __func__);
|
printf("%s\n", __func__);
|
||||||
|
|
||||||
if( isParallel){
|
if( isParallel){
|
||||||
|
printf("%s::SaveTree\n", __func__);
|
||||||
saveFile->cd();
|
saveFile->cd();
|
||||||
newTree->Write();
|
newTree->Write();
|
||||||
fOutput->Add(proofFile);
|
fOutput->Add(proofFile);
|
||||||
|
|
|
@ -255,6 +255,7 @@ void GeneralSort::Init(TTree *tree){
|
||||||
printf(" ++++++++ no Trace.\n");
|
printf(" ++++++++ no Trace.\n");
|
||||||
isTraceExist = false;
|
isTraceExist = false;
|
||||||
}else{
|
}else{
|
||||||
|
printf(" ++++++++ Found Trace.\n");
|
||||||
isTraceExist = true;
|
isTraceExist = true;
|
||||||
fChain->SetBranchAddress("tl", tl, &b_tl);
|
fChain->SetBranchAddress("tl", tl, &b_tl);
|
||||||
fChain->SetBranchAddress("trace", trace, &b_trace);
|
fChain->SetBranchAddress("trace", trace, &b_trace);
|
||||||
|
|
|
@ -6,6 +6,11 @@
|
||||||
#
|
#
|
||||||
##############################################
|
##############################################
|
||||||
|
|
||||||
|
if [ ! -z $RED ]; then
|
||||||
|
echo "Process_BasicConfig already loaded."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
RED='\033[1;31m'
|
RED='\033[1;31m'
|
||||||
YELLOW='\033[1;33m'
|
YELLOW='\033[1;33m'
|
||||||
ORANGE='\033[0;33m'
|
ORANGE='\033[0;33m'
|
||||||
|
|
87
armory/Process_Download
Executable file
87
armory/Process_Download
Executable file
|
@ -0,0 +1,87 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ $# -eq 0 ] || [ $1 == "-help" ]; then
|
||||||
|
echo "$./process_Download [RunNum]"
|
||||||
|
echo " RunNum = run number"
|
||||||
|
echo " * if RunNum = all, sync all"
|
||||||
|
exit 1
|
||||||
|
fi;
|
||||||
|
RUN=$1
|
||||||
|
|
||||||
|
source $SOLARISANADIR/armory/Process_BasicConfig
|
||||||
|
source $SOLARISANADIR/working/expName.sh
|
||||||
|
|
||||||
|
MacRawDataPath=$rawDataPathParent/$expName/
|
||||||
|
IP=solarisdaq # defined at ~/.ssh/config
|
||||||
|
USR=solaris
|
||||||
|
|
||||||
|
if [ ${RUN} == "all" ]; then
|
||||||
|
|
||||||
|
if [ ${PCID} -eq 2 ]; then
|
||||||
|
#============ Get the raw data
|
||||||
|
rsync -avuht --progress $USR@$IP:$rawDataPath/$expName_* $MacRawDataPath/data/.
|
||||||
|
|
||||||
|
echo -e "$YELLOW======== rsync RunTimeStamp.dat $NC"
|
||||||
|
rsync -avuht --progress $USR@$IP:$rawDataPath/$RunTimeStamp* $MacRawDataPath/data/.
|
||||||
|
|
||||||
|
echo -e "$YELLOW======== rsync expName.sh $NC"
|
||||||
|
rsync -avuht --progress $USR@$IP:Analysis/working/expName.sh $SOLARISANADIR/working/.
|
||||||
|
|
||||||
|
echo -e "$YELLOW=============================================$NC"
|
||||||
|
tail -10 $MacRawDataPath/data/RunTimeStamp.dat
|
||||||
|
echo -e "$YELLOW=============================================$NC"
|
||||||
|
else
|
||||||
|
echo -e "$RED############### Only in SOLARIS MAC can donwload data. skip.$NC"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#just in case people put %03d as RUN
|
||||||
|
if [ "${RUN:0:2}" == "00" ]; then
|
||||||
|
RUN=${RUN:2:1}
|
||||||
|
elif [ "${RUN:0:1}" == "0" ]; then
|
||||||
|
RUN=${RUN:1:2}
|
||||||
|
else
|
||||||
|
RUN=$(printf '%d' $RUN)
|
||||||
|
fi
|
||||||
|
RUN=$(printf '%03d' ${RUN})
|
||||||
|
|
||||||
|
echo $RUN
|
||||||
|
|
||||||
|
#######################################
|
||||||
|
#################### Download raw data
|
||||||
|
echo -e "${RED}######################### Download raw data: run ${RUN}${NC}"
|
||||||
|
if [ ${PCID} -eq 2 ]; then
|
||||||
|
#============ Get the raw data
|
||||||
|
echo -e "================= RUN $RUN: Get the raw data `date`"
|
||||||
|
|
||||||
|
rsync -avuht --progress $USR@$IP:$rawDataPath/$expName_$RUN* $MacRawDataPath/data/.
|
||||||
|
|
||||||
|
echo -e "$YELLOW======== rsync RunTimeStamp.dat $NC"
|
||||||
|
rsync -avuht --progress $USR@$IP:$rawDataPath/$RunTimeStamp* $MacRawDataPath/data/.
|
||||||
|
|
||||||
|
echo -e "$YELLOW======== rsync expName.sh $NC"
|
||||||
|
rsync -avuht --progress $USR@$IP:Analysis/working/expName.sh $SOLARISANADIR/working/.
|
||||||
|
|
||||||
|
echo -e "$YELLOW=============================================$NC"
|
||||||
|
tail -10 $MacRawDataPath/data/RunTimeStamp.dat
|
||||||
|
echo -e "$YELLOW=============================================$NC"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo -e "$RED############### Only in SOLARIS MAC can donwload data. skip.$NC"
|
||||||
|
fi
|
||||||
|
|
||||||
|
count=`ls -1 $SOLARISANADIR/data_raw/${expName}_${RUN}_*.sol 2>/dev/null | wc -l`
|
||||||
|
echo -e "========== Number of Files : ${count}${NC}"
|
||||||
|
if [ ${count} -eq 0 ]; then
|
||||||
|
echo "============================================"
|
||||||
|
echo "==== RAW Files of RUN-${RUN} not found! "
|
||||||
|
echo "============================================"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo -e "${YELLOW}"
|
||||||
|
du -hc $SOLARISANADIR/data_raw/${expName}_${RUN}_*.sol
|
||||||
|
echo -e "$NC============================================="
|
||||||
|
|
||||||
|
fi
|
49
armory/Process_EventBuilder
Normal file → Executable file
49
armory/Process_EventBuilder
Normal file → Executable file
|
@ -1,12 +1,35 @@
|
||||||
################################################ EventBuilder
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z $SOLARISANADIR ]; then
|
||||||
|
echo "###### env variable SOLARISANADIR not defined. Abort. Please run the SOLARIS.sh."
|
||||||
|
echo "better add \"source <path_to_SOLARIS.sh>\" into .bashrc"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -ne 3 ] || [ $1 == "-help" ]; then
|
||||||
|
echo "$ Process_EventBuilder [RunNum] [EventBuild] [timeWin]"
|
||||||
|
echo " RunNum = run number"
|
||||||
|
echo " EventBld = 2/1/0/-1/-2 || 2 = with Trace"
|
||||||
|
echo " timeWin = number of tick for an event "
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi;
|
||||||
|
|
||||||
RUN=$1
|
RUN=$1
|
||||||
EventBld=$2
|
EventBld=$2
|
||||||
|
timeWin=$3
|
||||||
|
|
||||||
rawDataPath=${SOLARISANADIR}/data_raw
|
source ${SOLARISANADIR}/armory/Process_BasicConfig
|
||||||
rootDataPath=${SOLARISANADIR}/root_data
|
source ${SOLARISANADIR}/working/expName.sh
|
||||||
|
|
||||||
rawDataPattern="${rawDataPath}/${expName}_${RUN}_"
|
runNum=${RUN#0} #remove zero
|
||||||
rootDataName="${rootDataPath}/run${RUN}.root"
|
RUN=$(printf '%03d' $runNum) ##add back the zero
|
||||||
|
|
||||||
|
rawDataPath=$SOLARISANADIR/data_raw
|
||||||
|
rootDataPath=$SOLARISANADIR/root_data
|
||||||
|
|
||||||
|
rawDataPattern="$rawDataPath/${expName}_${RUN}_*.sol"
|
||||||
|
rootDataName="$rootDataPath/run$RUN.root"
|
||||||
|
|
||||||
dir=$(pwd)
|
dir=$(pwd)
|
||||||
cd ${SOLARISANADIR}/armory
|
cd ${SOLARISANADIR}/armory
|
||||||
|
@ -17,7 +40,7 @@ cd ${dir}
|
||||||
isRawDataExist=`ls -1 ${rawDataPattern}* 2>/dev/null | wc -l`
|
isRawDataExist=`ls -1 ${rawDataPattern}* 2>/dev/null | wc -l`
|
||||||
|
|
||||||
if [ ! $isRawDataExist -gt 0 ]; then
|
if [ ! $isRawDataExist -gt 0 ]; then
|
||||||
echo -e "${LRED}################# Run Data not exist. Abort ${NC}"
|
echo -e "${LRED}################# Run Data $rawDataPattern not exist. Abort. ${NC}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -32,13 +55,13 @@ echo -e "${CYAN} ============== total file size : ${totSize}${NC}"
|
||||||
if [ ${Arch} == "Linux" ]; then
|
if [ ${Arch} == "Linux" ]; then
|
||||||
rawDataTime=`stat -c "%Z" ${rawDataPattern}* | sort -rn | head -1`
|
rawDataTime=`stat -c "%Z" ${rawDataPattern}* | sort -rn | head -1`
|
||||||
else
|
else
|
||||||
rawDataTime=`stat -f "%Sm" -t "%Y%m%d%H%M%S" ${rawDataPattern}* | sort -rn | head -1`
|
rawDataTime=`stat -f "%Sm" -t "%Y%m%d%H%M%S" $rawDataPattern | sort -rn | head -1`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#==== check if root data exist
|
#==== check if root data exist
|
||||||
isRootDataExist=`ls -1 $rootDataName 2>/dev/null | wc -l`
|
isRootDataExist=`ls -1 $rootDataName 2>/dev/null | wc -l`
|
||||||
|
|
||||||
#==== if merged data exist, check timeStamp
|
#==== if root data exist, check timeStamp
|
||||||
if [ ${isRootDataExist} -gt 0 ]; then
|
if [ ${isRootDataExist} -gt 0 ]; then
|
||||||
if [ ${Arch} == "Linux" ]; then
|
if [ ${Arch} == "Linux" ]; then
|
||||||
rootDataTime=`stat -c "%Z" $rootDataName | sort -rn | head -1`
|
rootDataTime=`stat -c "%Z" $rootDataName | sort -rn | head -1`
|
||||||
|
@ -60,14 +83,14 @@ elif [ ${EventBld} -ge 1 ]; then
|
||||||
|
|
||||||
echo -e "${LRED}>>>>>>>>>>>>>>>>>>>>> Event Building $(date) ${NC}"
|
echo -e "${LRED}>>>>>>>>>>>>>>>>>>>>> Event Building $(date) ${NC}"
|
||||||
if [ ${EventBld} -eq 1 ]; then
|
if [ ${EventBld} -eq 1 ]; then
|
||||||
EventBuilder $rootDataName ${timeWin} 0 `ls -1 ${rawDataPattern}*`
|
EventBuilder $rootDataName ${timeWin} 0 $rawDataPattern
|
||||||
elif [ ${EventBld} -eq 2 ]; then
|
elif [ ${EventBld} -eq 2 ]; then
|
||||||
EventBuilder $rootDataName ${timeWin} 1 `ls -1 ${rawDataPattern}*`
|
EventBuilder $rootDataName ${timeWin} 1 $rawDataPattern
|
||||||
fi
|
fi
|
||||||
echo -e "${LRED}<<<<<<<<<<<<<<<< Done Event Building $(date) ${NC}"
|
echo -e "${LRED}<<<<<<<<<<<<<<<< Done Event Building $(date) ${NC}"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo -e "${GREEN}Merged data are newer than raw data. No need to merged again.${NC}"
|
echo -e "${GREEN} root data are newer than raw data. No need to merged again.${NC}"
|
||||||
echo -e "${GREEN}You can Force merging using option -${EventBld}, ${ORANGE} see ./process_run.sh -help${NC}"
|
echo -e "${GREEN}You can Force merging using option -${EventBld}, ${ORANGE} see ./process_run.sh -help${NC}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -75,9 +98,9 @@ else
|
||||||
|
|
||||||
echo -e "${LRED}>>>>>>>>>>>>>>> Force Event Building $(date) ${NC}"
|
echo -e "${LRED}>>>>>>>>>>>>>>> Force Event Building $(date) ${NC}"
|
||||||
if [ ${EventBld} -eq -1 ]; then
|
if [ ${EventBld} -eq -1 ]; then
|
||||||
EventBuilder $rootDataName ${timeWin} 0 `ls -1 ${rawDataPattern}*`
|
EventBuilder $rootDataName ${timeWin} 0 $rawDataPattern
|
||||||
elif [ ${EventBld} -eq -2 ]; then
|
elif [ ${EventBld} -eq -2 ]; then
|
||||||
EventBuilder $rootDataName ${timeWin} 1 `ls -1 ${rawDataPattern}*`
|
EventBuilder $rootDataName ${timeWin} 1 $rawDataPattern
|
||||||
fi
|
fi
|
||||||
echo -e "${LRED}<<<<<<<<<<<<<<<< Done Event Building $(date) ${NC}"
|
echo -e "${LRED}<<<<<<<<<<<<<<<< Done Event Building $(date) ${NC}"
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
######## default time window = 100 tick
|
||||||
|
timeWin=100
|
||||||
|
|
||||||
if [ -z $SOLARISANADIR ]; then
|
if [ -z $SOLARISANADIR ]; then
|
||||||
echo "###### env variable SOLARISANADIR not defined. Abort. Please run the SOLARIS.sh."
|
echo "###### env variable SOLARISANADIR not defined. Abort. Please run the SOLARIS.sh."
|
||||||
echo "better add \"source <path_to_SOLARIS.sh>\" into .bashrc"
|
echo "better add \"source <path_to_SOLARIS.sh>\" into .bashrc"
|
||||||
|
@ -8,10 +11,11 @@ fi
|
||||||
|
|
||||||
|
|
||||||
if [ $# -eq 0 ] || [ $1 == "-help" ]; then
|
if [ $# -eq 0 ] || [ $1 == "-help" ]; then
|
||||||
echo "$ Proess_Run [RunNum] [EventBuild] [GeneralSort] [Monitor]"
|
echo "$ Process_Run [RunNum] [EventBuild] [GeneralSort] [TraceMethod] [Monitor]"
|
||||||
echo " RunNum = run number / \"lastRun\" "
|
echo " RunNum = run number / \"lastRun\" "
|
||||||
echo " EventBld = 2/1/0/-1/-2 || 2 = with Trace"
|
echo " EventBld = 2/1/0/-1/-2 || 2 = with Trace"
|
||||||
echo " GeneralSort = n/0/-n || n = number of worker"
|
echo " GeneralSort = n/0/-n || n = number of worker"
|
||||||
|
echo " TraceMethod = -1/0/1/2 || -1 no trace, 0 save trace, 1 fit, 2 trapezoid"
|
||||||
echo " Monitors = 2/1/0 || 1 = single run, 2 = using the list in ChainMonitors.C"
|
echo " Monitors = 2/1/0 || 1 = single run, 2 = using the list in ChainMonitors.C"
|
||||||
echo " 10 = single run and post to websrv, 20 = list runs and post to websrv"
|
echo " 10 = single run and post to websrv, 20 = list runs and post to websrv"
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -25,11 +29,13 @@ RUN=$1
|
||||||
runNum=$1
|
runNum=$1
|
||||||
EventBld=0
|
EventBld=0
|
||||||
nWorker=1
|
nWorker=1
|
||||||
|
TraceMethod=0
|
||||||
isMonitor=0
|
isMonitor=0
|
||||||
|
|
||||||
if [ $# -ge 2 ]; then EventBld=$2; fi
|
if [ $# -ge 2 ]; then EventBld=$2; fi
|
||||||
if [ $# -ge 3 ]; then nWorker=$3; fi
|
if [ $# -ge 3 ]; then nWorker=$3; fi
|
||||||
if [ $# -ge 4 ]; then isMonitor=$4; fi
|
if [ $# -ge 4 ]; then TraceMethod=$3; fi
|
||||||
|
if [ $# -ge 5 ]; then isMonitor=$5; fi
|
||||||
|
|
||||||
timeWin=100000
|
timeWin=100000
|
||||||
|
|
||||||
|
@ -40,41 +46,22 @@ if [ "$RUN" == "lastRun" ]; then
|
||||||
RUN=$runID
|
RUN=$runID
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#padding
|
RUN=${RUN%0} #remove zero
|
||||||
if [ "${RUN:0:1}" == "0" ]; then
|
RUN=$(printf '%03d' $RUN) ##add back the zero
|
||||||
RUN=${RUN:1:2}
|
|
||||||
else
|
|
||||||
RUN=$(printf '%d' $RUN)
|
|
||||||
fi
|
|
||||||
RUN=$(printf '%03d' ${RUN})
|
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
if [ ${PCID} -eq 1 ]; then
|
if [ ${PCID} -eq 1 ]; then
|
||||||
source Process_EventBuilder $RUN ${EventBld}
|
source Process_EventBuilder $RUN $EventBld $timeWin
|
||||||
fi
|
|
||||||
|
else
|
||||||
|
source Process_Download $RUN
|
||||||
|
|
||||||
|
source Process_EventBuilder $RUN $EventBld
|
||||||
|
|
||||||
if [ ${PCID} -eq 2 ]; then
|
|
||||||
## Dwonlaod Data
|
|
||||||
echo "Downlaod data"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#################################### GeneralSort
|
#################################### GeneralSort
|
||||||
|
|
||||||
if [ ${nWorker} -eq 0 ]; then
|
|
||||||
|
|
||||||
echo -e "${LRED}>>>>>>>>>>>>>>>>>>>>> GeneralSort Skipped by user. ${NC}"
|
|
||||||
|
|
||||||
else
|
|
||||||
source $ROOTSYS/bin/thisroot.sh
|
|
||||||
|
|
||||||
mkdir ~/.proof/working
|
|
||||||
cp ${SOLARISANADIR}/working/Mapping.h ~/.proof/working/.
|
|
||||||
mkdir ~/.proof/armory
|
|
||||||
cp ${SOLARISANADIR}/armory/AnalysisLib.h ~/.proof/armory/.
|
|
||||||
|
|
||||||
root -l -q -b "${SOLARISANADIR}/armory/GeneralSortAgent.C($runNum, ${nWorker}, 0)"
|
|
||||||
|
|
||||||
fi
|
|
||||||
#################################### Monitor
|
#################################### Monitor
|
||||||
|
|
||||||
|
|
||||||
|
|
92
armory/Process_Sort
Executable file
92
armory/Process_Sort
Executable file
|
@ -0,0 +1,92 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z $SOLARISANADIR ]; then
|
||||||
|
echo "###### env variable SOLARISANADIR not defined. Abort. Please run the SOLARIS.sh."
|
||||||
|
echo "better add \"source <path_to_SOLARIS.sh>\" into .bashrc"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -eq 0 ] || [ $1 == "-help" ]; then
|
||||||
|
echo "$ Process_Sort [RunNum] [GeneralSort] [TraceMethod]"
|
||||||
|
echo " RunNum = run number"
|
||||||
|
echo " GeneralSort = n/0/-n || n = number of worker"
|
||||||
|
echo " TraceMethod = -1/0/1/2 || -1 no trace, 0 save trace, 1 fit, 2 trapezoid"
|
||||||
|
echo ""
|
||||||
|
exit 1
|
||||||
|
fi;
|
||||||
|
|
||||||
|
RUN=$1
|
||||||
|
nWorker=$2
|
||||||
|
TraceMethod=$3
|
||||||
|
|
||||||
|
source $SOLARISANADIR/armory/Process_BasicConfig
|
||||||
|
source $SOLARISANADIR/working/expName.sh
|
||||||
|
|
||||||
|
runNum=${RUN#0} #remove zero
|
||||||
|
RUN=$(printf '%03d' $runNum) ##add back the zero
|
||||||
|
|
||||||
|
if [ ${nWorker} -eq 0 ]; then
|
||||||
|
echo -e "${LRED}>>>>>>>>>>>>>>>>>>>>> GeneralSort Skipped by user. ${NC}"
|
||||||
|
else
|
||||||
|
source $ROOTSYS/bin/thisroot.sh
|
||||||
|
|
||||||
|
#--------- Check is runXXX.root exist
|
||||||
|
rootDataPath=$SOLARISANADIR/root_data
|
||||||
|
rootDataName="$rootDataPath/run$RUN.root"
|
||||||
|
isRootDataExist=`ls -1 $rootDataName 2>/dev/null | wc -l`
|
||||||
|
|
||||||
|
#==== if root data exist, check timeStamp
|
||||||
|
if [ $isRootDataExist -gt 0 ]; then
|
||||||
|
if [ ${Arch} == "Linux" ]; then
|
||||||
|
rootDataTime=`stat -c "%Z" $rootDataName | sort -rn | head -1`
|
||||||
|
else
|
||||||
|
rootDataTime=`stat -f "%Sm" -t "%Y%m%d%H%M%S" $rootDataName | sort -rn | head -1`
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
rootDataTime=0
|
||||||
|
echo -e "$LRED ################# run$RUN.root does not exist. Abort. $NC"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#-------- check gen_root timestamp
|
||||||
|
genRootDataName="$rootDataPath/gen_run$RUN.root"
|
||||||
|
isGenRootDataExist=`ls -1 $genRootDataName 2>/dev/null | wc -l`
|
||||||
|
|
||||||
|
#----- if gen_runXXX.data exist, check timeStamp
|
||||||
|
if [ $isGenRootDataExist -gt 0 ]; then
|
||||||
|
if [ ${Arch} == "Linux" ]; then
|
||||||
|
genRootDataTime=`stat -c "%Z" $genRootDataName | sort -rn | head -1`
|
||||||
|
else
|
||||||
|
genRootDataTime=`stat -f "%Sm" -t "%Y%m%d%H%M%S" $genRootDataName | sort -rn | head -1`
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
genRootDataTime=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p ~/.proof/working
|
||||||
|
cp ${SOLARISANADIR}/working/Mapping.h ~/.proof/working/.
|
||||||
|
mkdir -p ~/.proof/armory
|
||||||
|
cp ${SOLARISANADIR}/armory/AnalysisLib.h ~/.proof/armory/.
|
||||||
|
|
||||||
|
if [ $nWorker -le -1 ]; then
|
||||||
|
echo -e "${LRED}>>>>>>>>>>>>>>> Force GeneralSort $(date) ${NC}"
|
||||||
|
root -l -q -b "$SOLARISANADIR/armory/GeneralSortAgent.C($runNum, $nWorker, $TraceMethod)"
|
||||||
|
echo -e "${LRED}<<<<<<<<<<<<<<<< Done GeneralSort $(date) ${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $nWorker -ge 1 ]; then
|
||||||
|
|
||||||
|
if [ $rootDataTime -ge $genRootDataTime ]; then
|
||||||
|
|
||||||
|
echo -e "${LRED}>>>>>>>>>>>>>>>>>>>>> Event Building $(date) ${NC}"
|
||||||
|
root -l -q -b "$SOLARISANADIR/armory/GeneralSortAgent.C($runNum, $nWorker, $TraceMethod)"
|
||||||
|
echo -e "${LRED}<<<<<<<<<<<<<<<< Done Event Building $(date) ${NC}"
|
||||||
|
|
||||||
|
else
|
||||||
|
echo -e "${GREEN}gen_run$RUN.root is newer than run$RUN.root. No need to GeneralSort again.${NC}"
|
||||||
|
echo -e "${GREEN}You can Force GeneralSort using option -${nWorker}, ${ORANGE} see Process_Run -help${NC}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
|
@ -1,6 +1,6 @@
|
||||||
expName=Master
|
expName=Master
|
||||||
rawDataPath=/mnt/data0/Master
|
rawDataPath=/mnt/data0/Master
|
||||||
rootDataPath=/mnt/data1/Master
|
rootDataPath=/mnt/data1/Master
|
||||||
runID=21
|
runID=5
|
||||||
elogID=59
|
elogID=9
|
||||||
#------------end of file.
|
#------------end of file.
|
Loading…
Reference in New Issue
Block a user