Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • nica_modules/mpd_scheduler
1 result
Show changes
Commits on Source (5)
File moved
File moved
<job>
<macro name="~/bmnroot/macro/raw/BmnWriteRawInfo.C"/>
<file exp_input="period=5" output="/dataBMN/bmndata1/run5/root/bmn_${file_name:~4}_digi.root"/>
<file exp_input="period=6" output="/dataBMN/bmndata1/run6/root/bmn_${file_name:~4}_digi.root"/>
<run mode="global" count="1" config="~/bmnroot/build/config.sh"/>
</job>
<job>
<macro name="~/bmnroot/macro/raw/BmnWriteRawInfo.C" add_args="&quot;&quot;,false"/>
<file input="/dataBMN/bmndata1/run6/raw/*.data" output=""/>
<run mode="global" count="1" config="~/bmnroot/build/config.sh"/>
</job>
......@@ -7,6 +7,9 @@
# request Bourne again shell as shell for job
#$ -S /bin/bash
# SLURM params
#SBATCH --ignore-pbs
# TORQUE params
#PBS -j oe
#PBS -d .
......@@ -42,7 +45,7 @@ else
fi
arr=(${line// / })
comm="root -b -q \"$macro("
comm="root -b -q '$macro("
counter=1
for i in "${arr[@]}"
do
......@@ -53,7 +56,7 @@ do
comm=$comm$i
let counter=$counter+1
done
comm="$comm)\""
comm="$comm)'"
eval $comm
......
......@@ -56,8 +56,9 @@ string int_to_hex_string(int int_number);
int hex_string_to_int(string hex_string);
// is string an integer number?
bool is_string_number(const string& s);
// extract first number in string (result number has string type)
string find_first_number(string const & str);
// extract first positive number or last positive number in string (result number has string type)
string find_first_number(string const & str); string find_first_double_number(string const & str);
string find_last_number(string const & str); string find_last_double_number(string const & str);
// convert array of chars to the new lowercase array
char* convert_pchar_to_lowercase_new(char* input_char_array);
// replace string 's' by string 'd' in text
......@@ -342,6 +343,46 @@ string find_first_number(string const & str)
return string();
}
string find_last_number(string const & str)
{
size_t const n = str.find_last_of("0123456789");
if (n != string::npos)
{
string temp = str.substr(0, n+1);
size_t const m = temp.find_last_not_of("0123456789");
if (m != string::npos) return temp.substr(m+1, n-m);
return temp;
}
return string();
}
string find_first_double_number(string const & str)
{
size_t const n = str.find_first_of("0123456789");
if (n != string::npos)
{
size_t const m = str.find_first_not_of("0123456789,.", n);
return str.substr(n, m != string::npos ? m-n : m);
}
return string();
}
string find_last_double_number(string const & str)
{
size_t const n = str.find_last_of("0123456789");
if (n != string::npos)
{
string temp = str.substr(0, n+1);
size_t const m = temp.find_last_not_of("0123456789,.");
if (m != string::npos) return temp.substr(m+1, n-m);
return temp;
}
return string();
}
// convert array of chars to the new lowercase array
char* convert_pchar_to_lowercase_new(char* input_char_array)
{
......
......@@ -267,17 +267,17 @@ void* SubThreadProcessFile(void* thread_parameter)
int lenSUB = 100+macro_name.length()+inFile.length()+outFile.length()+sConfig.length()+add_args.length();
char* pcSUB = new char[lenSUB];
sprintf (pcSUB, "%sroot -b -q \"%s(", sConfig.c_str(), macro_name.c_str());
sprintf (pcSUB, "%sroot -b -q '%s(", sConfig.c_str(), macro_name.c_str());
bool isFirst = true;
if (inFile != "")
{
sprintf(pcSUB, "%s\\\"%s\\\"", pcSUB, inFile.c_str());
sprintf(pcSUB, "%s\"%s\"", pcSUB, inFile.c_str());
isFirst = false;
}
if (!isFirst) sprintf(pcSUB, "%s, ", pcSUB);
else isFirst = false;
sprintf(pcSUB, "%s\\\"%s\\\"", pcSUB, outFile.c_str());
sprintf(pcSUB, "%s\"%s\"", pcSUB, outFile.c_str());
if (!isFirst) sprintf(pcSUB, "%s, ", pcSUB);
else isFirst = false;
......@@ -290,13 +290,14 @@ void* SubThreadProcessFile(void* thread_parameter)
if (add_args != ""){
if (!isFirst) sprintf(pcSUB, "%s, ", pcSUB);
else isFirst = false;
sprintf(pcSUB, "%s\\\"%s\\\"", pcSUB, add_args.c_str());
//sprintf(pcSUB, "%s\"%s\"", pcSUB, add_args.c_str());
sprintf(pcSUB, "%s%s", pcSUB, add_args.c_str());
}
if (logs != "")
sprintf (pcSUB, "%s)\" > %s_%d_%d 2>&1", pcSUB, logs.c_str(), counter, counter2);
sprintf (pcSUB, "%s)' > %s_%d_%d 2>&1", pcSUB, logs.c_str(), counter, counter2);
else
//sprintf (pcSUB, "%s)\" > /dev/null 2>&1", pcSUB);
sprintf (pcSUB, "%s)\"", pcSUB);
sprintf (pcSUB, "%s)'", pcSUB);
// write and execute temporary bash file
ofstream myfile;
......@@ -410,7 +411,7 @@ void* ThreadProcessFile(void* thread_parameter)
string exe_dir = get_app_dir_linux();
string UNIONc_path = exe_dir + "union.C";
char* pcSUB = new char[44+sUnion.length()+sConfig.length()+UNIONc_path.length()+logs.length()];
sprintf (pcSUB, "%sroot -b -q \"%s(\\\"%s\\\", %d)\"", sConfig.c_str(), UNIONc_path.c_str(),
sprintf (pcSUB, "%sroot -b -q '%s(\"%s\", %d)'", sConfig.c_str(), UNIONc_path.c_str(),
sUnion.c_str(), thread_par->iMerge);
if (logs != "")
......@@ -443,17 +444,17 @@ void* ThreadProcessFile(void* thread_parameter)
int lenSUB = 100+macro_name.length()+inFile.length()+outFile.length()+sConfig.length()+add_args.length();
char* pcSUB = new char[lenSUB];
sprintf (pcSUB, "%sroot -b -q \"%s(", sConfig.c_str(), macro_name.c_str());
sprintf (pcSUB, "%sroot -b -q '%s(", sConfig.c_str(), macro_name.c_str());
bool isFirst = true;
if (inFile != "")
{
sprintf(pcSUB, "%s\\\"%s\\\"", pcSUB, inFile.c_str());
sprintf(pcSUB, "%s\"%s\"", pcSUB, inFile.c_str());
isFirst = false;
}
if (outFile != ""){
if (!isFirst) sprintf(pcSUB, "%s, ", pcSUB);
else isFirst = false;
sprintf(pcSUB, "%s\\\"%s\\\"", pcSUB, outFile.c_str());
sprintf(pcSUB, "%s\"%s\"", pcSUB, outFile.c_str());
}
if (start_event != NULL)
{
......@@ -470,17 +471,18 @@ void* ThreadProcessFile(void* thread_parameter)
if (add_args != ""){
if (!isFirst) sprintf(pcSUB, "%s, ", pcSUB);
else isFirst = false;
sprintf(pcSUB, "%s\\\"%s\\\"", pcSUB, add_args.c_str());
//printf(pcSUB, "%s\"%s\"", pcSUB, add_args.c_str());
sprintf(pcSUB, "%s%s", pcSUB, add_args.c_str());
}
if (logs != ""){
//if (counter == 0)
// sprintf (pcSUB, "%s)\" >> %s 2>&1", pcSUB, logs.c_str());
//else
sprintf (pcSUB, "%s)\" > %s_%d 2>&1", pcSUB, logs.c_str(), counter);
sprintf (pcSUB, "%s)' > %s_%d 2>&1", pcSUB, logs.c_str(), counter);
}
else
//sprintf (pcSUB, "%s)\" > /dev/null 2>&1", pcSUB);
sprintf (pcSUB, "%s)\"", pcSUB);
sprintf (pcSUB, "%s)'", pcSUB);
// write and execute temporary bash file
ofstream myfile;
......@@ -1132,16 +1134,16 @@ int main(int argc, char** argv){
int event_per_proc = (*cur_count_event+j)/proc_count;
if (event_per_proc != 0){
fwrite("\\\"", 2, sizeof(char), pFile);
fwrite("\"", 1, sizeof(char), pFile);
fwrite(filePar->strFileIn.c_str(), filePar->strFileIn.length(), sizeof(char), pFile);
fwrite("\\\"", 2, sizeof(char), pFile);
fwrite("\"", 1, sizeof(char), pFile);
if (sOutFile != ""){
sOutFile = GenerateOutputFilePath(sOutFile, counter);
fwrite(" \\\"", 3, sizeof(char), pFile);
fwrite(" \"", 2, sizeof(char), pFile);
fwrite(sOutFile.c_str(), sOutFile.length(), sizeof(char), pFile);
fwrite("\\\"", 2, sizeof(char), pFile);
fwrite("\"", 1, sizeof(char), pFile);
}
fwrite(" ", 1, sizeof(char), pFile);
......@@ -1152,9 +1154,10 @@ int main(int argc, char** argv){
fwrite(strInt.c_str(), strInt.length(), sizeof(char), pFile);
if (add_args != NULL){
fwrite(" \\\"", 3, sizeof(char), pFile);
//fwrite(" \"", 2, sizeof(char), pFile);
fwrite(" ", 1, sizeof(char), pFile);
fwrite(add_args, strlen(add_args), sizeof(char), pFile);
fwrite("\\\"", 2, sizeof(char), pFile);
//fwrite("\"", 1, sizeof(char), pFile);
}
fwrite("\n", 1, sizeof(char), pFile);
......@@ -1174,14 +1177,14 @@ int main(int argc, char** argv){
}
}//if (i_parallel_mode > 1)
else{// i_parallel_mode <= 1
fwrite("\\\"", 2, sizeof(char), pFile);
fwrite("\"", 1, sizeof(char), pFile);
fwrite(filePar->strFileIn.c_str(), filePar->strFileIn.length(), sizeof(char), pFile);
fwrite("\\\"", 2, sizeof(char), pFile);
fwrite("\"", 1, sizeof(char), pFile);
if (filePar->strFileOut != ""){
fwrite(" \\\"", 3, sizeof(char), pFile);
fwrite(" \"", 2, sizeof(char), pFile);
fwrite(filePar->strFileOut.c_str(), filePar->strFileOut.length(), sizeof(char), pFile);
fwrite("\\\"", 2, sizeof(char), pFile);
fwrite("\"", 1, sizeof(char), pFile);
}
if (cur_start_event != NULL){
......@@ -1194,9 +1197,10 @@ int main(int argc, char** argv){
}
if (add_args != NULL){
fwrite(" \\\"", 3, sizeof(char), pFile);
//fwrite(" \"", 2, sizeof(char), pFile);
fwrite(" ", 1, sizeof(char), pFile);
fwrite(add_args, strlen(add_args), sizeof(char), pFile);
fwrite("\\\"", 2, sizeof(char), pFile);
//fwrite("\"", 1, sizeof(char), pFile);
}
fwrite("\n", 1, sizeof(char), pFile);
......@@ -2215,16 +2219,16 @@ void ParseDatabaseParameters(string input, TString& strConnection, TString& sql,
if (isMinField)
{
sql += TString::Format("field_current >= %d", iField);
sql += TString::Format("field_voltage >= %d", iField);
if (isMaxField)
sql += TString::Format(" AND field_current <= %d", iMaxField);
sql += TString::Format(" AND field_voltage <= %d", iMaxField);
}
else
{
if (isMaxField)
sql += TString::Format("field_current <= %d", iMaxField);
sql += TString::Format("field_voltage <= %d", iMaxField);
else
sql += TString::Format("field_current = %d", iField);
sql += TString::Format("field_voltage = %d", iField);
}
}
// if file size selection
......