Skip to content

Commit

Permalink
Directory with scripts for processing at CERN added
Browse files Browse the repository at this point in the history
  • Loading branch information
nigmatkulov committed Apr 5, 2024
1 parent 9bd54ab commit 5f8da87
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 2 deletions.
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@
*.DS_Store

# build directory
build/*
build/*

# processing
processing/input/*
processing/output/*
processing/log/*
processin/voms_proxy.txt
3 changes: 2 additions & 1 deletion jetAna.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ int main(int argc, char const *argv[]) {
TString pfBranchName{};
TString oFileName{};
TString JECFileName;
TString path2JEC = "/Users/gnigmat/work/cms/soft/jetAnalysis";
//TString path2JEC = "/Users/gnigmat/work/cms/soft/jetAnalysis";
TString path2JEC = "../";
if ( isPbPb ) {
inFileName = "../../../data/HiForestAOD_PbPb_sim.list";
//inFileName = "../../../data/HiForestAOD_PbPb_exp.list";
Expand Down
21 changes: 21 additions & 0 deletions processing/run_jetAna.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

# Load CMS environment
source ${HOME}/setup_cmsenv.sh

# Add path to the PDF sets

# Where the executable and the library are stored
EXEC_PATH=${HOME}/soft/jetAnalysis/processing
cd $EXEC_PATH

input_file_list=$1
output_file_name=$2

echo -e "Input file list: ${input_file_list}"
echo -e "Output file name: ${output_file_name}"

# Run jetAna
../build/jetAna ${input_file_list} ${output_file_name}

echo -e "Data processing of thes ${input_file_list} is finished"
36 changes: 36 additions & 0 deletions processing/split_input_2_sublists.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Check if the correct number of arguments is provided
if [ $# -ne 2 ]; then
echo "Usage: $0 <input_file> <N>"
exit 1
fi

input_file="$1" # Input file name
N="$2" # Number of entries for each sublist

# Check if the input file exists
if [ ! -f "$input_file" ]; then
echo "Input file '$input_file' not found."
exit 1
fi

# Count the total number of lines in the input file
total_lines=$(wc -l < "$input_file")

# Calculate the number of sublists needed
num_sublists=$((total_lines / N))
if [ $((total_lines % N)) -ne 0 ]; then
((num_sublists++))
fi

# Create sublists
for ((i = 0; i < num_sublists; i++)); do
start=$((i * N + 1)) # Calculate start line number for current sublist
end=$((start + N - 1)) # Calculate end line number for current sublist
sublist_file="inputfile_$((i+1)).list" # Name of sublist file
sed -n "${start},${end}p" "$input_file" > "$PWD/input/$sublist_file" # Extract sublist
done

echo $num_sublists

42 changes: 42 additions & 0 deletions processing/submit_jetAna.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

# Set path to CMSSW
source $HOME/setup_cmsenv.sh

# Initial parameters to run
EXEC_PATH=${HOME}/soft/jetAnalysis/processing
cd $EXEC_PATH

files_per_job=2
#input_file_list=$HOME/filelists/pythiaHydjet2018_miniAODforest.txt
input_file_list=$HOME/filelists/test_list.txt

echo -e "Splitting input file list: ${input_file_list}"
n_sublists=$(./split_input_2_sublists.sh ${input_file_list} ${files_per_job})
echo -e "Input file list is splitted into ${n_sublists}"

for ((jobId = 1; jobId <= $n_sublists; jobId++)); do
cat <<EOF >condor/sub/job_jetAna_$jobId.sub
universe = vanilla
executable = run_jetAna.sh
+JobFlavour = "longlunch"
getenv = True
requirements =((OpSysAndVer =?= "AlmaLinux9") && (CERNEnvironment =?= "qa"))
RequestCpus = 1
transfer_input_files = voms_proxy.txt
environment = "X509_USER_PROXY=voms_proxy.txt"
arguments = input/inputfile_$jobId.list output/jetAna/oJetAna_$jobId.root
output = condor/log/jetAna.${jobId}.out
error = condor/log/jetAna.${jobId}.err
log = condor/log/jetAna.${jobId}.log
queue
EOF

condor_submit condor/sub/job_jetAna_$jobId.sub
done

0 comments on commit 5f8da87

Please sign in to comment.