Warning, /analysis/Jet-Study/README.org is written in an unsupported language. File is not indexed.
0001 * Generate run list
0002 #+begin_src bash
0003 CreateDstList.pl --build ana462 --cdb 2024p010_v001 DST_JET_run2pp --printruns
0004 #+end_src
0005
0006 * Generate runs with magnetic field on:
0007 #+begin_src bash
0008 psql -h sphnxdaqdbreplica daq -c "select runnumber from magnet_info where magnet_on = 'true' and runnumber >= 47289;" -At
0009 #+end_src
0010
0011 * Generate runs with MBD N&S>=1 enabled:
0012 #+begin_src bash
0013 psql -h sphnxdaqdbreplica daq -c "select runnumber from gl1_scaledown where scaledown10 != -1 and runnumber >= 47289;" -At
0014 #+end_src
0015
0016 * Generate runs with MBD Jet 8 GeV + MBD NS >= 1 enabled:
0017 #+begin_src bash
0018 psql -h sphnxdaqdbreplica daq -c "select runnumber from gl1_scaledown where scaledown17 != -1 and runnumber >= 47289;" -At
0019 #+end_src
0020
0021 * Generate Trigger Name List
0022 #+begin_src bash
0023 psql -h sphnxdaqdbreplica daq -c "select distinct index,triggername from gl1_triggernames where runnumber >= 46038 and runnumber_last <= 54074 order by index;" -At
0024 #+end_src
0025
0026 * Generate run list where specific triggers are enabled
0027 #+begin_src bash
0028 psql -h sphnxdaqdbreplica daq -c 'select runnumber from gl1_scaledown where runnumber > 46619 and <scaledownXY> != -1 order by runnumber;' -At > runs-trigger-XY.list
0029 #+end_src
0030
0031 Example: Ensure that MBD NS >= 1 and Jet 8, 10, and 12 GeV trigger are enabled
0032 #+begin_src bash
0033 psql -h sphnxdaqdbreplica daq -c 'select runnumber from gl1_scaledown where runnumber > 46619 and scaledown10 != -1 and scaledown21 != -1 and scaledown22 != -1 and scaledown23 != -1 order by runnumber;' -At > runs-trigger.list
0034 #+end_src
0035
0036 * Generate dst list from run list
0037 #+begin_src bash
0038 CreateDstList.pl --build ana450 --cdb 2024p009 DST_JET_run2pp --list <list>
0039 #+end_src
0040
0041 * Generate list of runs that contain bad tower maps
0042 #+begin_src bash
0043 find /cvmfs/sphenix.sdcc.bnl.gov/calibrations/sphnxpro/cdb/CEMC_BadTowerMap -name "*p0*" | cut -d '-' -f2 | cut -d c -f1 | sort | uniq > files/runs-hot-maps.list
0044 #+end_src
0045
0046 * Access the good run database
0047 #+begin_src bash
0048 psql Production -h sphnxproddbmaster.sdcc.bnl.gov -U argouser
0049 #+end_src
0050
0051 * Access the File Catalog
0052 #+begin_src bash
0053 psql FileCatalog
0054 #+end_src
0055
0056 * Fun4All Quick Tests
0057
0058 ** After editing Makefile.am
0059 Jet Validation:
0060 #+begin_src bash
0061 rm -rf build && mkdir build && cd build && ../src/autogen.sh --prefix=$MYINSTALL && cd .. && make install -j8 --directory build && rm -f bin/Fun4All_JetValv2 && make && ./bin/Fun4All_JetValv2 DST_JET_run2pp_ana462_2024p010_v001-00051576-00022.root DST_JETCALO_run2pp_ana462_2024p010_v001-00051576-00022.root test.root 3000 2>/dev/null
0062 #+end_src
0063
0064 #+begin_src bash
0065 rm -rf build && mkdir build && cd build && ../src/autogen.sh --prefix=$MYINSTALL && cd .. && make install -j8 --directory build && root -b -l -q 'macros/Fun4All_JetValv2.C("DST_JET_run2pp_ana462_2024p010_v001-00051576-00022.root","DST_JETCALO_run2pp_ana462_2024p010_v001-00051576-00022.root","test.root", 3000)'
0066 #+end_src
0067
0068 ** After editing .cc or .h
0069 Jet Validation:
0070 #+begin_src bash
0071 make install -j8 --directory build && rm -f bin/Fun4All_JetValv2 && make && ./bin/Fun4All_JetValv2 DST_JET_run2pp_ana462_2024p010_v001-00051576-00022.root DST_JETCALO_run2pp_ana462_2024p010_v001-00051576-00022.root test.root 3000 2>/dev/null
0072 #+end_src
0073
0074 #+begin_src bash
0075 make install -j8 --directory build && root -b -l -q 'macros/Fun4All_JetValv2.C("DST_JET_run2pp_ana462_2024p010_v001-00051576-00022.root","DST_JETCALO_run2pp_ana462_2024p010_v001-00051576-00022.root","test.root", 3000)'
0076 #+end_src
0077
0078 ** Build joclJetBackgroundCutModule
0079 #+begin_src bash
0080 rm -rf build-joclJetBackgroundCutModule && mkdir build-joclJetBackgroundCutModule && cd build-joclJetBackgroundCutModule && ../joclJetBackgroundCutModule/autogen.sh --prefix=$MYINSTALL && cd .. && make install -j8 --directory build-joclJetBackgroundCutModule
0081 #+end_src
0082
0083 * Condor Tips
0084
0085 ** Allocate more memory to an idle job
0086 #+begin_src bash
0087 condor_hold -all && condor_qedit <job id> RequestMemory <Memory (MB)> && condor_release -all
0088 #+end_src
0089
0090 * Post Condor Run Notes
0091
0092 ** Check if any jobs failed due to bad input and list the specific segments:
0093 #+begin_src bash
0094 rg "No Root Tree T" */stdout | rg -o "DST.*root" | tee bad-segments.list && cat bad-segments.list | cut -d "-" -f2 | uniq | sort | awk '{x=$0+0;print x}' > runs-with-bad-segments.list
0095 #+end_src
0096 Note: Must be in the general condor directory for the "*/stdout" to work.
0097
0098 ** Get list of jobs to resubmit in the event that they are held. Convert
0099 First get the list of process numbers of the jobs that are held:
0100 #+begin_src bash
0101 condor_q | rg anarde | cut -d "." -f2 | cut -d " " -f1 > temp.list
0102 #+end_src
0103
0104 Use the process numbers from the temp.list above to convert into line numbers from the ~jobs.list~ file and extract that subset.
0105 #+begin_src bash
0106 while read line_num; do
0107 head -n "$((line_num + 1))" "jobs.list" | tail -n 1 >> jobs-resubmit.list
0108 done < "temp.list"
0109 #+end_src
0110
0111 * Bash Tips
0112
0113 ** Remove Leading Zeros
0114 #+begin_src bash
0115 echo 01234 | awk '{x=$0+0;print x}'
0116 #+end_src
0117
0118 ** Loop over output of a command
0119 Example with `ls` command.
0120 #+begin_src bash
0121 ls | while read file; do
0122 echo "file: $file"
0123 done
0124 #+end_src
0125
0126 ** Get the basenames from a list of file paths of files
0127 #+begin_src bash
0128 awk -F'/' '{print $NF}' <list-file>
0129 #+end_src
0130
0131 ** Get the sum of numbers in a file
0132 Note there must be one number per line.
0133 #+begin_src bash
0134 awk '{ sum += $1 } END { print sum }' <file>
0135 #+end_src
0136
0137 * PSQL Tips
0138 ** Load the contents of a file into a temporary table with psql:
0139 #+begin_src psql
0140 create temp table tmp_runs (id int);
0141 \copy tmp_runs (id) from '<path/to/file>' WITH (FORMAT csv);
0142 #+end_src
0143
0144 ** Access ana build info
0145 #+begin_src bash
0146 psql phnxbld
0147 #+end_src
0148
0149 Example:
0150 #+begin_src bash
0151 psql phnxbld -c "select * from buildtags where date > '2025-01-01 00:00:00' and build like 'ana%' and reponame = 'sPHENIX-Collaboration/coresoftware.git' order by date;"
0152 #+end_src
0153
0154 * Misc Tips
0155
0156 ** Get list of DSTs where there is unknown in the trigger name
0157 Note: To be run from within ~/gpfs02/sphenix/user/anarde/jets/jets~ directory
0158 Note: Job ID (Process number) = job list (submission) line numbers - 1. Ex: line 1 is job id 0 and so on.
0159 #+begin_src bash
0160 rg "unknown0" stdout/ | cut -d "." -f1 | cut -d"-" -f2 | while read line_num; do head -n "$((line_num + 1))" "highPtJets-dsts.list" | tail -n 1 >> unknown-trigger-dsts.list; done
0161 #+end_src